DevTools Logo

CSS Scroll-Driven Animations & Timeline Builder

CSS Scroll-Driven Animations & Timeline Builder

Generate animation-timeline, animation-range and keyframes, and test them in a live scroll box.

Runs in your browser
Try an example

Animation settings

Live scroll demo

Scroll this box: the bar at the top fills with scroll position.

The demo runs the generated CSS (without the fallback blocks) inside this box.

Generated CSS

scroll(block)
Progress bar: give .scroll-progress position: fixed (or sticky), a height and a background; the timeline only drives the scaleX animation.
Support (MDN / caniuse, reviewed 2026-11): Chrome and Edge 115+, Safari 26+. Firefox: behind a flag only at that review. Check caniuse before relying on it.
@keyframes scroll-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.scroll-progress {
  animation-name: scroll-progress;
  animation-duration: 1ms;
  animation-timing-function: linear;
  animation-fill-mode: both;
  animation-timeline: scroll(block);
  animation-range: 0% 100%;
  transform-origin: 0 50%;
}

/* Fallback: browsers without scroll-driven animations keep content visible/static. */
@supports not (animation-timeline: scroll()) {
  .scroll-progress { animation: none; opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-progress { animation: none; opacity: 1; transform: none; }
}

Examples

Reading-progress bar

Input
buildScrollDrivenCss({ type: "progress-bar", axis: "block", rangeStart: 0, rangeEnd: 100 })
Output
animation-timeline: scroll(block); animation-range: 0% 100%; @keyframes scroll-progress

The block-axis scroll timeline drives scaleX from 0 to 1 across the full scroll range with a static fallback.

Scroll reveal

Input
buildScrollDrivenCss({ type: "reveal", axis: "vertical", range: "entry", rangeStart: 0, rangeEnd: 50 })
Output
animation-timeline: view(vertical); animation-range: entry 0% cover 50%;

The element fades and rises as it enters the viewport, reaching full opacity halfway through its cover range.

About this tool

CSS Scroll Driven Animations emits timeline-bound animation CSS with buildScrollDrivenCss(options): choose a recipe (progress-bar, reveal, parallax, stagger), an axis (block, inline, vertical, horizontal), and a range to receive keyframes, a timeline block, the computed animationRange, and a full stylesheet that wires them together with duration, easing, and fill mode.

Timelines and ranges follow the spec split: progress-bar binds animation-timeline to scroll(axis) with a plain numeric range ("0% 100%"), while reveal/parallax/stagger bind to view(axis) with named ranges ("entry 0% cover 50%"). Percentages clamp to 0–100, unknown types/axes/ranges fall back to safe defaults, and the stagger recipe adds an --index-based 80 ms per-item delay.

Every output ships progressive enhancement: a @supports not (animation-timeline: scroll()) block freezes the animated selector to its resting state, so browsers without scroll-driven animations keep content visible and static instead of stuck at opacity 0 or scaleX 0.

How to use this tool

  1. Pick a recipe

    Use progress-bar for scroll progress (scroll timeline, scaleX keyframes), reveal for entrances, parallax for drift, or stagger for indexed cascades.

  2. Set axis and range

    Choose the scroll axis, then a numeric 0–100 window for progress bars or a named entry/entry-crossing/exit/contain range with cover percentages for view animations.

  3. Wire the timeline names

    Keep the generated scroll-timeline-name and timeline-scope custom properties, or override them via timelineName/scope — unsafe characters sanitize to dashes automatically.

Use cases

Adding reading progress

Drop the progress-bar recipe's fixed bar into long articles without any scroll listeners or JavaScript.

Revealing content on scroll

Fade-and-rise sections with the reveal recipe's named entry range instead of IntersectionObserver code.

Layering parallax and stagger

Drift hero layers with parallax and cascade cards with stagger's --index delay, all compositor-friendly.

Common mistakes

Mistake:Expecting animation on browsers without timeline support.

Fix:The @supports fallback intentionally renders content static and visible — treat scroll-driven motion as enhancement, not the only reveal path.

Mistake:Passing out-of-range percentages like -20 or 140.

Fix:Range endpoints clamp to 0–100, so a -20→140 window silently becomes 0% 100% — normalize inputs if the clamp surprises you.

Frequently asked questions

What does this tool do?

It emits scroll-driven animation CSS for the progress-bar, reveal, parallax, or stagger recipe — spec-correct scroll() timelines with numeric ranges for progress bars, view() timelines with named entry/cover ranges for the rest, plus a @supports fallback that keeps content visible where timelines are unsupported.

When do I get scroll() versus view()?

progress-bar binds to scroll(axis) with a plain percentage window like 0% 100%, while reveal, parallax, and stagger bind to view(axis) with named ranges like entry 0% cover 50%. The recipe you pick decides the timeline function.

Is my animation configuration uploaded or stored?

No. Recipe selection, range computation, and stylesheet assembly run fully client-side — nothing you enter is sent anywhere.

Why does my animation look static in some browsers?

Browsers without animation-timeline support hit the @supports not fallback, which intentionally freezes the element at its resting state (opacity 1, no transform). Treat scroll-driven motion as progressive enhancement rather than the only reveal path.

References & standards