Menu

1 / 2

Staggering scroll-driven animations takes one animation-range-start line

DEV Community: css·Leo·about 1 hour ago
#4DNv85Ry
#devtocss#devto#dev#animation#scroll
Reading 0:00
15s threshold

I had both versions of this demo open side by side this morning. One is the original stagger effect with its custom CSS functions. The other is Lee Meyer's fork, which swaps the whole thing for one declaration. The staggered entrance is the same, with a lot less math.

Here's the news peg. In a CSS-Tricks article published November 16, Meyer responds to a Frontend Masters post by Ashutosh Biswas that staggers scroll-driven animations using what Biswas describes as "a huge formula and can look intimidating." Meyer argues that CSS already has a tool for the job, and that tool is animation-range-start .

Why animation-delay does nothing here

This is the part that trips people up. To stagger a list of time-based animations, you usually give each item a slightly larger animation-delay . Move the same animation onto a scroll timeline and that stops working.

Meyer cites MDN for the reason.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.