Share Posted January 29 Hey! I forgot how to find scroll direction in ScrollTrigger. onUpdate fires a lot of times. And I need only when the direction changes. I looked in the documentation and couldn't find Link to comment Share on other sites More sharing options...
Author Share Posted January 29 It seems to be possible to do this by storing the value in a variable and comparing it. Works great) Do you think several onUpdates will heavily load the user's computer? Does it make sense to do one check and pass it to the right components? Link to comment Share on other sites More sharing options...
Solution Solution Share Posted January 29 3 hours ago, Romanus said: It seems to be possible to do this by storing the value in a variable and comparing it. Works great) Do you think several onUpdates will heavily load the user's computer? Does it make sense to do one check and pass it to the right components? I wouldn't worry about it at all. It's cheap. ScrollTrigger.create({ ... onUpdate: self => { if (self.direction !== self.prevDirection) { console.log("toggled!"); self.prevDirection = self.direction; } } }); 2 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now