Skip to content
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;
🚀

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: auto expects elements to point east (0 degrees). Add an angle offset like offset-rotate: auto 90deg; so it faces forward!
  • 2.The Legacy motion-path Property: Years ago, Chrome experimentally named this motion-path. The official W3C web standard was finalized as offset-path. Always use offset-path today.
Next Masterclass · Track 9 Engine Internals

Browser Rendering Pipeline: DOM + CSSOM to Pixels

Look under the browser hood: parse, construct Render Tree, calculate Layout, and rasterize Paint layers.

Continue to Concept 34