Scroll-driven animation

A scroll-driven animation is tied to scroll position instead of time: scroll down and it plays forward, scroll up and it plays back.

CSS now supports it directly with animation-timeline: scroll() and view(), running off the main thread. Libraries like GSAP ScrollTrigger and Motion's scroll() do the same with more control.

It is different from an animation that simply starts when something scrolls into view; scroll-driven means the scroll bar is the playhead.

/* CSS */
.bar { animation: grow linear both; animation-timeline: scroll(); }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

See it live

Related terms