Paths

CSS Motion Path Animation

An element travelling along a curved path.

Edit this in the studio

Opens with this animation loaded. Nothing is uploaded — the scene travels in the link.

animation.css
.travel-path {
  transform: translate3d(208px, 128px, 0);
  offset-path: path('M 0 0 Q 120 -160 240 0');
  offset-distance: 0%;
  offset-rotate: 0deg;
  width: 64px;
  height: 64px;
  background: #22d3ee;
  border-radius: 999px;
  animation: travel-path-anim 2400ms linear 0ms infinite both;
  will-change: transform, opacity;
}

@keyframes travel-path-anim {
  0% {
    offset-distance: 0%;
    offset-rotate: 0deg;
    animation-timing-function: ease-in-out;
  }
  100% {
    offset-distance: 100%;
    offset-rotate: 0deg;
  }
}

@media (prefers-reduced-motion: reduce) {
  .travel-path {
    animation: none;
    transition: none;
  }
}

Why it is built this way

offset-path moves an element along an arbitrary curve with one animated percentage — the kind of thing that used to need JavaScript stepping through coordinates every frame.

What it animates

1 property across 1 CSS declaration. The bar shows when each one is moving.

Distance
offset-distance
0 100
2 stopscompositor

What it costs to run

Offset-distance is handled by the compositor: no layout, no repaint, and the work can run off the main thread. This is the cheap end of CSS animation, which is why it stays smooth on a slow phone where other properties will not.

It runs for 2.40s across 2 keyframe stops, with every property moving over the same window.

One curve throughout: Ease In Out on a plain box. Keeping a single easing across every property is what makes a multi-property animation read as one movement rather than several things happening at once.

Accessibility

Nothing here hides content — offset-distance moves over 2.40s and the element is visible throughout. The exported prefers-reduced-motion guard still silences it, which matters most for the looping ones: motion that never stops is the kind that makes people feel unwell.

Related animations

offset-pathmotion pathcurvetravel