Jump to content
Search Community

Scrub not working on scrollTrigger

Stefano Monteiro test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

  • Solution

You just had some problems in your JS:

  1. You had an old helper function (not the one in the docs) that didn't have the "reversed" feature. I just copied the one from the docs below
  2. You weren't passing in a Boolean for reversed - you were passing in a string like "true" or "false" (which will always evaluate as true)
  3. You were calling .play() on the timeline which ALWAYS makes it go forward, thus your reversed timelines wouldn't play in reverse :) You should .resume() if you want to honor the previous playhead direction.

This one is corrected but NOT using scrub

See the Pen QWOvexM?editors=0010 by GreenSock (@GreenSock) on CodePen

 

You've got logic issues in your code if your desire is to scrub things. You cannot BOTH scrub AND independently pause()/resume() apart from the scroll position. Think of scrub like making the scrollbar into a scrubber/playhead on the timeline. And you can't have an infinitely-repeating timeline mapped to a finite scroll position. So I'm really not sure what behavior you're after here, but you can't logically have it work both ways. 

 

If you just want it to scrub, you've got to define an animation on the ScrollTrigger: 

See the Pen MWOmNPG?editors=0010 by GreenSock (@GreenSock) on CodePen

  • 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...