Scroll-driven animations
A CSS animation normally runs on a clock. Scroll-driven animations tie it to a scroll position instead: animation-timeline: scroll() moves it along as a scroller scrolls, and view() moves it along as an element crosses the viewport. Reading-progress bars and fade-ins on scroll, which used to need a scroll listener or an IntersectionObserver, become a few declarations. Firefox was the last browser to ship it.
Delete: the script that moves an animation along with the scroll position.
/* a script updates --progress on every scroll */
.bar { transform: scaleX(var(--progress)); }
/* no script. The timeline goes after the shorthand,
which resets it to the default */
.bar {
animation: grow linear both;
animation-timeline: scroll(root);
}
@keyframes grow { from { transform: scaleX(0); } }Firefox’s summary score is 0.63, against 0.89 for Chrome, which seems like a Hold at first glance, but most of the tests Firefox fails use a JavaScript API that Firefox doesn’t support. That’s why the tests fail. The animation itself holds up. On the tests of the CSS properties, Firefox 159 passes 89 of 111, Chrome 157 passes 90, and Safari 27.2 passes 86.