Jump to content
Search Community

Does totalDuration() respect timeScale()?

Robert Wildling 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 just wanted to test the eventCallback('onComplete') of a timeline, which - to my understanding - should fire once the timeline has completed to play. The Pen shows, that, no matter what the timeScale is nor where it is placed, totalDuration will always be 5 seconds.

 

Why is that? What would I have to do to make GSAP respect the timeScale?

 

 

See the Pen yqwyJQ?editors=1111 by rowild (@rowild) on CodePen

Link to comment
Share on other sites

timeScale doesn't change the duration. It scales the time like so...

 

tl.totalDuration() / tl.timeScale()

 

 

But that's just at one level. If a child timeline has a timeScale of 0.5 and its parent has a timeScale of 0.5, then it's timeScale would be 0.25

 

0.5 * 0.5 = 0.25

 

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