Interface Optional
Animate on scroll with CSS
Drive scroll effects with CSS animation-timeline instead of scroll event listeners in JavaScript.
How to do it
Use animation-timeline: scroll() or view() with animation-range for scroll effects. Chrome and Safari 26 support it, and Firefox does not yet by default. Wrap it in @supports, animate only opacity or transform, and turn it off under prefers-reduced-motion: reduce.
Example
@supports (animation-timeline: scroll()) {
@media (prefers-reduced-motion: no-preference) {
.progress {
transform-origin: left;
animation: grow linear both;
animation-timeline: scroll();
animation-range: 0% 100%;
}
}
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}
How to check
A grep of the scripts finds no scroll event listener used for visual effects.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers website playbook: https://agentwranglers.se/playbook/website/interface/scroll-driven-animations.