Creating Scroll-Based Animations in Full view()
css-tricks.com·1d
🎬CSS Animation
Preview
Report Post

The CSS animation-timeline property accepts a view() function which, in turn, returns a timeline of how much of an element is visible in the part of a scroll container that’s viewable (formally known as a scrollport). In other words, rather than letting an animation run a linear progression based on how much time has elapsed, view() runs animations based on the visibility of the animated element within a scrollport.

I like to equate it as the CSS version of JavaScript’s Intersection Observer. We can run an animation on an element as that element enters and exits the scrollport.

Here’s an example:

Pretty neat, right? Depending o…

Similar Posts

Loading similar posts...