Overview
Animation is mostly about what happens between keyframes. Linear interpolation moves at constant speed and changes direction abruptly at every key, which looks robotic. Curved interpolation passes smoothly through the keys. This lab samples a set of 3D keyframes and joins them with cubic Bézier segments whose smoothness you control with a tension value, then sends a marker along the result.
How it works
A cubic Bézier segment from point P0 to P3 is shaped by two control points, P1 and P2. The curve starts heading towards P1 and arrives from the direction of P2, but it does not pass through them. To build a smooth path through a sequence of keyframes, each segment's control points are derived from the neighbouring keyframes: the tangent at a key is parallel to the line between the previous and next keys (the Catmull-Rom construction), and it is scaled by the tension factor.
- Low tension shortens the tangents, so the path hugs the straight-line polyline with tight corners.
- High tension lengthens them, so the path swings wider and smoother, and can overshoot.
Because neighbouring segments share a tangent at each key, the path is continuous in both position and direction. Three.js's animation system uses the same family of ideas in its interpolants, and CubicBezierCurve3 and CatmullRomCurve3 expose them for paths.
Exploring the demo
Compare the dim polyline (the raw samples) with the bright interpolated curve. Drag tension from low to high and watch the corners round off, then start to bulge. Follow the moving marker: it passes through every keyframe without stopping or kinking.
Where this is used
Camera rails in cutscenes, enemy patrol routes, motion paths for UI, and smoothing noisy sensor or GPS data all use this interpolation. For moving the camera along a curve see the camera tour in the cathedral, for curve-driven geometry see splines, and for deforming a mesh along a path see the curve modifier.