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 using GSAP and ScrollScene #34

Closed Nyshhh closed 4 years ago

Nyshhh commented 4 years ago

Hey legend,

You've done an amazing job with this - thank you!!

Wondering if theres a way to disable gsap animation in reverse with scrollScene? ie play the animation only once when you scroll down so that it doesn't reset/reverse upon scrolling back up.

Cheers from down under, Nysh.

jonkwheeler commented 4 years ago

Using scrollScene? follow this example and pass reverse: false under scene.

Check the scene options: https://github.com/jonkwheeler/ScrollScene#scrollscene-options-uses-scrollmagic

const scrollScene = new ScrollScene({
  scene: {
    reverse: false,
  },
})

Alternatively, you could use scrollObserver and access the destroyImmediately option. Slightly different effect. It will fire the animation only once, but doesn't matter which direction you scroll.

https://github.com/jonkwheeler/ScrollScene#using-a-scene-once