Jump to content
Search Community

ScrollSmoother Timeline Overwrite

pietM test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

Hi Everyone! 

 

I have a timeline that plays and reverses based on scroll direction. I also use a mouse enter/leave function to trigger/control the same timeline. When using ScrollSmoother the direction overrides the mouse enter/leave functions (the timeline won't play until the scroll is at rest, even when I trigger mouse enter/leave events).

My question: Can I overwrite the scroll control to prioritize the "mouse enter/leave" functions? 

 

Thanks, as always. 

 

See the Pen abKQPmO by evryali (@evryali) on CodePen

Link to comment
Share on other sites

  • Solution

Hi,

 

The issue is not really about overwritting, that's a completely different situation.

 

Basically what's happening here is that you have different event handlers battling for control to play/reverse the same GSAP instance, nothing more. A simple boolean and some conditional logic seems to solve the issue, in order to prevent ScrollTrigger's update callback  from controlling the instance:

See the Pen Yzvdpog by GreenSock (@GreenSock) on CodePen

 

Here you can read more about overwrite:

https://greensock.com/docs/v3/GSAP/Tween/vars

 

Let us know if you have more questions.

 

Happy Tweening!

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...