Jump to content
Search Community

Fast forwarding the timeline

hirdesh gupta test
Moderator Tag

Recommended Posts

Hey Hirdesh and welcome to the GreenSock forums! 

 

What do you mean by "fast forward"? Do you mean change the timeScale of the animation so it runs faster? Do you mean make the timeline's playhead jump to 1 second in front of wherever it currently is? What if the timeline's playhead is at the end? Do you want it to always play from the new position or keep the current play/paused state? 

 

All of the above is very easy to do with GSAP, we could just use some clarity on what you're trying to accomplish :) 

Link to comment
Share on other sites

Thanks ! Zach for responding I mean to say that i want my playhead to jump relatively 1 seconds ahead from its current position and and play the timeline I have tried this tl.seek("+=1").play() but this doesn't work .

I have a timeline and repeating it i want that when i click a button than the timeline so jump 1seconds ahead from the current position and than resume the play.

Link to comment
Share on other sites

Since you have it repeating, I assume if the playhead is at the very end you'd want it to go to the 1 second mark of the animation. So I'd probably do something like this:

tl.play( gsap.utils.wrap(0, tl.duration(), tl.time() + 1) );

The same thing in two lines (for clarity):

const seekTime = gsap.utils.wrap(0, tl.duration(), tl.time() + 1);
tl.play( seekTime );

You can find more info about each of those methods in the docs but I'm happy to answer any questions that you have :) 

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