The CSS scroll-driven animations module provides functionality that builds on top of the CSS animations module and Web Animations API. It allows you to animate property values based on a progression along a scroll-based timeline instead of the default time-based document timeline. This means that you can animate an element by scrolling a scrollable element, rather than just by the passing of time.
There are two types of scroll-based timelines:
When one of these two timelines is applied to an animated element, the animation progresses along that timeline instead of following the default time-based timeline.
It is possible to adjust the effective placement of the animation along the scroll progress and view progress timelines, i.e., you can define the position at which the animation starts and ends. This can be done in a couple of different ways:
You can find several tools and demos showing scroll-driven animations in action at Scroll-driven Animations tools and demos.
Set the timeline that will control the progress of an animation, and set its attachment range along that timeline:
Define named scroll progress timelines:
Define named view progress timelines:
Modify timeline scope:
CSS scroll-driven animations adds the ability to include <timeline-range-name>s in @keyframes blocks, to place keyframes at specific positions inside named timeline ranges.
Possible values of the animation-timeline property for defining anonymous scroll progress timelines and anonymous view progress timelines (i.e., implicitly defined by the browser rather than being explicitly named and defined using the scroll-timeline-* and view-timeline-* properties):
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_scroll-driven_animations