Javascript + CSS Scrolling Animations

How do you recommend to make vanilla javascript scrolling animations?

For example, the user scrolls down and at a certain offset, the animation will execute and cause the heading/paragraph to fade in or slide in or etcetera.

Should I be using an external library like animate.css? (But I find that it is sort of clunky and not customizable)

Thanks! :grin:

There are some pretty good scroll animation libraries (like AOS etc.).

For plain JS solutions I would (like I did in your other thread) suggest looking into the Intersection Observer API. Otherwise, you have to do scroll throttling to avoid performance issues from having an event listener fire on every scroll.