Jump to content
Search Community

progress question about duration 0 tweens

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

Zero-duration tweens are an odd concept because they're not really tweens at all. And when the playhead lands directly on top of one, should that be interpreted as its "beginning" or "end" (there isn't really such a thing when there's no duration). See what I mean? We have done a lot of work to accommodate them, though, mostly by looking at the direction of the playhead as well as a few other factors, so they should behave in an intuitive way. 

 

I've never seen someone try what you're doing before, but I've added some code to resolve that in the next release. No problem. For now, you can simply check the tween's "ratio" instead (it'll be 1 at the end of a 0-duration tween, and 0 at the beginning). Keep in mind that the ratio is a number that's affected by the easing; it's not linear like progress is. 

  • Like 3
Link to comment
Share on other sites

Thanks!  I've many tweens where sometimes they have >0 durations, but sometimes they have to just jump to their destinations.  

 

I could check for duration before tweening and call set or to depending.  But it feels cleaner to just use duration 0.

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