Skip to content
IndexRequest a UIAboutContact

Motion Path Follow

An element travelling along a curved path with easing, auto-rotation and speed controls.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Clean illustration of a small paper plane flying along a dashed curved loop path across an off-white sky, the plane rotated to follow the path direction at three positions with faint ghost copies behind it, dots marking evenly spaced time steps closer together at the start and wider in the middle to show easing, start and end markers, thin blue dashed path, flat vector style. Negative: gradients, clutter, text errors. Reduced motion: static illustration.

About this pattern

Definition

Moving an element along a curve instead of a straight line feels natural, like a leaf, a car or a paper plane. In CSS this is offset-path; in SVG you can read points from the path with getPointAtLength. Easing changes how progress along the path maps to time, and rotation can follow the path direction.

Purpose & UX principles

  • Compute progress t from 0 to 1, apply an easing function, then read the point at t times the path length.
  • For rotation, sample a point slightly ahead and use atan2 for the angle.
  • Keep path and element in the same coordinate space.
  • offset-path with offset-distance does this in CSS where supported.

Interaction states

  • Easing buttons, a Rotate with path switch and Play.

Motion specification

  • One trip takes 3 seconds.
  • Reduced motion: no autoplay; the Position slider moves it.

Responsive behaviour

  • Respect reduced motion by showing a static trail or letting people scrub.
  • Do not loop endlessly beside text people are trying to read.

Code

HTML
<div class="bx"><div class="pre" id="pre" role="group" aria-label="Easing"><button data-p="0" aria-pressed="true">Linear</button><button data-p="1" aria-pressed="false">Ease in-out</button><button data-p="2" aria-pressed="false">Overshoot</button></div><svg class="mp" viewBox="0 0 300 120" role="img" aria-label="A paper plane following a curved path"><path id="pa" d="M20 90 C60 10 110 10 140 60 S210 110 240 50 S280 20 284 30" fill="none" stroke="#9db8ff" stroke-width="2" stroke-dasharray="4 5"/><circle cx="20" cy="90" r="4" fill="#1f9d55"/><circle cx="284" cy="30" r="4" fill="#d94f3d"/><g id="pl"><path d="M-9 -6 L11 0 L-9 6 L-5 0Z" fill="#171717"/></g></svg><label class="rw">Position <b id="pv">0%</b><input id="ps" type="range" min="0" max="100" value="0"></label><div class="two"><label class="sw"><input id="ro" type="checkbox" checked> Rotate with path</label><button class="mini" id="go" type="button">Play</button></div></div>

Related patterns

Easing Comparison

↗
Easing ComparisonMotion & Transitions

Spring Follow

↗
Spring FollowMotion & Transitions

Route Path Draw on Map

↗
Route Path Draw on MapExplainers & Series