Transform3D Showcase
Showcases the power of the Transform3D API with chainable operations, relative positioning, and smooth matrix-based interpolation using quaternion SLERP.
Overview
Section titled “Overview”The Transform3D class provides a mathematically correct way to compose 3D transformations using matrix operations and quaternions. This eliminates common issues like gimbal lock and provides smooth, natural interpolation paths.
Key Features
Section titled “Key Features”Chainable API
Section titled “Chainable API”Build complex transformations step-by-step:
const transform = Transform3D.identity() .translate(x, y, z) .rotateZ(Math.PI / 8) .scaleBy(1.5, 1.5, 1.5);Relative Positioning
Section titled “Relative Positioning”Create hierarchical transforms with proper composition:
// Satellites orbit around parentconst orbit = Transform3D.identity() .translate(x, y, z) .rotateY(angle);
// Apply to CSSelement.style.transform = orbit.toCSSMatrix3D();Smooth Interpolation
Section titled “Smooth Interpolation”Matrix-based interpolation with quaternion SLERP prevents gimbal lock:
const interpolated = interpolateTransform( from, to, progress, easing);Benefits:
- ✓ Natural rotation paths
- ✓ No gimbal lock artifacts
- ✓ Single matrix operation
- ✓ Proper transform composition
Transform Composition
Section titled “Transform Composition”Combine transforms hierarchically:
// Combine parent and childconst worldTransform = parent.multiply(child);
// Apply to pointsconst worldPos = transform.apply(localPos);
// Invert transformconst inverse = transform.inverse();Reference
Section titled “Reference”- Transform3D - Matrix-based transform class
- Scene3D - 3D scene with camera system
- Element3D - 3D positioned elements