Jump to content
GreenSock

erikb

change destination values?

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

With tweenlite, can I change the destination values of an existing tween?

Link to comment
Share on other sites

TweenMax has an updateTo() method for that, yes, but since TweenLite is intended to be a very streamlined "lightweight" core, it doesn't have that method. Frankly, it's not generally advisable to update values like that - usually if you're trying to update values after creation, there's probably an architectural problem in your code (not always of course). 

 

And beware that you can't updateTo() plugin-based values. It's a very tricky conundrum because you have to factor in all the possible scenarios, like what if the tween is part-way done and then you update the destination values - should the interpolation be from the original starting value or should it be adjusted to avoid any jumps? If there's an adjustment, what happens when you reverese() that tween - the starting values would shift. Should the duration be reset? What if the tween has already finished - should things just jump to the new values immediately? 

 

So usually it's better to just create a new tween instead.

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