Skip to content

Scroll-Driven Animations with animation-timeline

Pure CSS scroll-driven demo: reading progress bar with live percentage, fade-up cards, clip-path wipe and sliding text using scroll-timeline and view().

Also known as: scroll driven animations, animation-timeline scroll, reading progress bar, scroll reveal without javascript, view timeline animation

Scroll-Driven Animations with animation-timeline live demo

Open in new tab

Pure CSS code (HTML, CSS)

A demo of native CSS scroll-driven animations built without any JavaScript. Inside a scrollable panel, a reading progress bar fills up with a live percentage, cards fade up as they appear, an illustration opens with a clip-path wipe, outlined text slides sideways and steps glide in from both sides. Use the techniques for article pages, product stories and landing pages.

How it works

The root section.sd-demo wraps .sd-scroller, a fixed-height scroll container that declares a named timeline with scroll-timeline: --sd-scroll block. The sticky .sd-bar header inside it holds .sd-bar__progress, which runs the sd-grow keyframes on animation-timeline: --sd-scroll, so its scaleX matches the scroll position. .sd-bar__percent animates a registered @property --sd-pct integer from 0 to 100 on the same timeline and prints it with counter().

Every other effect uses animation-timeline: view(), which follows an element's own position in the scrollport. .sd-reveal cards run sd-rise during animation-range: entry 0% entry 90%. .sd-hero fades on exit, .sd-panel__art opens with the sd-wipe clip-path while .sd-sun rises, .sd-marquee__line slides across the full view range and .sd-step--left / .sd-step--right slide in from opposite sides. Keyframes only describe the start state, so without the animations every element simply sits in its final, readable position.

Customization

  • --sd-height on .sd-demo: height of the scroll panel.
  • --sd-accent and --sd-accent-2: the orange and teal used by the progress gradient, numbers, step borders and outlined text.
  • --sd-bg, --sd-surface and --sd-ink: page, card and text colors.
  • animation-range on .sd-reveal: try entry 20% cover 40% for a later, slower reveal.
  • translateY(60px) scale(0.94) in @keyframes sd-rise: the distance and size cards start from.
  • translateX(-45%) in @keyframes sd-slide: how far the outlined line travels.
  • To track the whole page instead of the panel, replace --sd-scroll with scroll(root) and remove the fixed height from .sd-scroller.

Use cases

  • Long articles: a reading progress bar fills with a live percentage as the visitor scrolls
  • Product story pages: cards fade up and an illustration opens with a clip-path wipe
  • Landing pages: outlined text slides sideways and steps glide in from the left and right
  • Front-end learning: a working demo of scroll-timeline and view() with no JavaScript
  • Modern browser projects: add scroll effects while older browsers keep a static layout

Accessibility

.sd-scroller has tabindex="0", role="region" and an aria-label, so keyboard users can focus it and scroll with the arrow keys; a visible outline marks the focus. Decorative parts (progress bar, percentage, illustration, marquee, hint) are aria-hidden. Under prefers-reduced-motion: reduce all reveal and slide effects are switched off; only the progress bar and percentage keep tracking the scroll, because they move with the user's own input.

Usage notes

Scroll-driven animations need a recent Chromium-based browser or Safari 26. The @supports (animation-timeline: view()) block keeps other browsers on a static layout and hides the progress elements.

Scroll-Driven Animations with animation-timeline at a glance

Framework
Pure CSS
Code
HTML, CSS
JavaScript
Not needed, CSS only
Dependencies
None
Layout
Responsive, works on mobile
Category
Scroll Animations
License
Free for personal and commercial use

Questions about this template

Can I use the Scroll-Driven Animations with animation-timeline code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

There is nothing to install. Paste the HTML where the component should appear and add the CSS to your stylesheet. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. It is built with HTML and CSS only, so there is no JavaScript to load.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

No dependencies. Pure HTML, CSS and JavaScript.

Scroll-Driven Animations with animation-timeline – Pure CSS scroll animations component screenshot
Scroll-Driven Animations with animation-timeline · Pure CSS Scroll Animations

More Scroll Animations

Horizontal Scroll Section – Bootstrap 5 scroll animations preview

Horizontal Scroll Section

Bootstrap 5 section that pins to the viewport and slides photo cards sideways as the page scrolls down, with a counter and progress bar.

Scroll Reveal Animations – Pure CSS scroll animations preview

Scroll Reveal Animations

Elements fade, slide, zoom or flip into view on scroll using IntersectionObserver and data-sr attributes, with stagger delays and reduced-motion support.

Reading Progress Bar – Tailwind CSS scroll animations preview

Reading Progress Bar

Sticky Tailwind CSS reading progress bar with a gradient fill, clickable chapter markers, current section label, minutes left and a circular back-to-top indicator.