Jump to content
Search Community

Timeline progress weird

Torben test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I'm just starting using this library for real so I'm asking a lot of questions these days  - thank you for answering.


Look at this Codepen and try to play it till the end. Then try and hit the "progress 0.5" button which sets the progress on the timelime to 0.5 and then read out the progress by hitting "get progress".

It reads out 0.66666. Why is that?


If you hit "progress 0.5" again and read out the progress it now says 0.5 as I would expect.

See the Pen texlC by anon (@anon) on CodePen

Link to comment
Share on other sites



Basically what's happening is that the progress() method is scrubbing the timeline's playhead from it's current position to the indicated value. The problem is that is running into the addPause() method between the current position and the one indicated in the progress() method.


Honestly I can't tell you if this is how is supposed to work or not, the behaviour you're expecting is the one I would expect as well. Looks like we're going to need The Big Kahuna himself in this one :D


Please stand by, thanks for your patience.

Link to comment
Share on other sites

Yeah, Rodrigo is correct - the pause(s) in your timeline are halting the playhead. I also agree that it's not the most intuitive behavior. I'll patch it in the next release. In the mean time, though, it's relatively easy to get the behavior you want by leveraging the time() or pause() method and its "suppressEvents" parameter (because the pause is basically an event/callback). So, for example: 

var progress = 0.5;
tl.pause(progress * tl.duration(), true); //jump to the appropriate time, and pause, suppressing events so that the pauses embedded in the timeline don't halt the playhead movement.

Here's an updated codepen: http://codepen.io/GreenSock/pen/4bcef0c8bbdf0f566bc09e672945b9fc/?editors=001

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