jonkwheeler / ScrollScene

ScrollScene is an extra layer on top of ScrollMagic as well as using IntersectionObserver to achieve similar effects.
https://scrollscene.jonkwheeler.now.sh/
MIT License
136 stars 9 forks source link

Disable reverse ScrollObserver (IntersectionObserver) #25

Closed maartenvanhunsel closed 4 years ago

maartenvanhunsel commented 4 years ago

I would like to suggest to have an extra option, similar to scrollmagic. Disable reverse animation, so only animate once while scrolling down (not upwards).

jonkwheeler commented 4 years ago

I have this in my notes to do. Give me time on that. It's not that easy though without getting a bit gross with the code. The whole point of an IntersectionObserver is to fire an event when an element is intersecting the page view. To go against this means hacking up the IntersectionObserver. One way around this that could be possible is to set up your trigger elements to be super super long. You could have an element with absolute positioning and a length of like 100vh. An event will trigger on the way down, and stay that way since the element continues to be visible on the page.

I'll update this when I get some time.