Back to Concepts
CSS UniverseTrack 8: Transitions & AnimationMotion Path (offset-path)
Transitions & Animation · Track 8 CapstoneCore Concept 33
CSS Motion Path (offset-path)
Move beyond straight linear translation. Lock HTML elements onto curved SVG vector trajectories using offset-path, throttle progress with offset-distance, and bank naturally into corners with offset-rotate: auto.
1. Mental Model: Roller Coaster Wheels Locked to Steel Rails
In classical CSS, if you wanted an airplane icon to fly in a semi-circle, you had to calculate intricate trigonometry in JavaScript or chain dozens of complex keyframes. With CSS Motion Path:
1. Lay the Steel Rail
offset-path: path(...) lays down the exact SVG vector spline rail.
2. Throttle Progress
offset-distance: 50% places the car exactly halfway along the track.
3. Auto Bank Turns
offset-rotate: auto rotates the nose of the plane along the curve's tangent.
2. The 3 Core Motion Path Properties
.rocket-ship {
/* Define any arbitrary SVG curve path */
offset-path: path('M 40 180 Q 200 20 360 180 T 680 180');
/* Steer from 0% (start) to 100% (end) */
offset-distance: 0%;
/* Keep head aligned to direction of travel */
offset-rotate: auto;
}
3. Interactive Studio: Live Roller Coaster Vector Flight
offset-distance Throttle25%
CSS Motion Path Code
offset-distance: 25%;
offset-rotate: auto;
offset-rotate: auto;
🚀
First-Year Student Traps: Motion Path
- 1.Initial Element Rotation Offset: If your rocket ship SVG icon naturally points upwards (north) by default,
offset-rotate: autoexpects elements to point east (0 degrees). Add an angle offset likeoffset-rotate: auto 90deg;so it faces forward! - 2.The Legacy
motion-pathProperty: Years ago, Chrome experimentally named thismotion-path. The official W3C web standard was finalized asoffset-path. Always useoffset-pathtoday.
Next Masterclass · Track 9 Engine Internals
Continue to Concept 34Browser Rendering Pipeline: DOM + CSSOM to Pixels
Look under the browser hood: parse, construct Render Tree, calculate Layout, and rasterize Paint layers.