Jump to content
Search Community

progress NaN on tween's with duration 0

erikb 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

If you ask me it seems about right.

 

Keep in mind that .set() instances are zero duration instances so, something that actually lasts nothing can have a progress? Is it at the start or the end?  So to me is actually correct that it doesn't have a progress.

 

Of course the Yoda of GSAP, our beloved master @GreenSock will clarify this for us all why set tweens progress don't have :D

 

Happy Tweening!!

Link to comment
Share on other sites

Yeah, progress is basically a ratio of time / duration. So if the denominator is zero, you're gonna get NaN. 

 

You could tap into the ratio value and do something like this instead: 

 

console.log( t.duration() ? t.progress() : t.ratio );

 

So if the duration is zero, it'll just default to reporting the ratio. 

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