Jump to content
Search Community

Can I add options to my tween that's tweening?

esset test
Moderator Tag

Recommended Posts

Can I add stuff to my tween that's already tweening?

 

Example: Let's say I have a movieclip called "Ball" and I'm tweening it from x: 0 to x: 500 in 5 seconds.

 

Can I somehow "add" on an autoAlpha: 0 after it's been tweening for 4 seconds so the last 1 second it'll autoAlpha to 0?

 

Hope it makes sense. Thank you :)

Link to comment
Share on other sites

Just create another tween for the autoAlpha part. You wouldn't want to add it to the original (partially finished) tween because the value would suddenly jump. For example, imagine a tween that's halfway done and then you add an autoAlpha to it and the object starts at alpha 1 and you're going to alpha 0. Putting it into the tween that's halfway done would cause the alpha to suddenly jump from 0 to 0.5 because the tween is supposed to be rendering at its halfway-done state. See what I mean? It'd be much better to just create another tween for the autoAlpha. If you're using TweenLite instead of TweenMax, remember that the default overwrite mode is ALL_IMMEDIATE, so you'd need to either set the default to AUTO (with OverwriteManager.init(2)) or set the overwrite special property to false, but I'd strongly recommend just setting the default overwrite mode to AUTO (2) because it's easier and you have less chance of creating conflicting tweens. http://www.greensock.com/overwritemanager/

 

If you're using TweenMax, it automatically sets the default mode to AUTO for you.

Link to comment
Share on other sites

So you mean I would do it like this?:

 

TweenMax.to(ball, 5, {x: 500});
TweenMax.to(ball, 1, {delay: 1, autoAlpha: 0});

 

... because I still want my ball to continue to x: 500.

 

Reason I can't do it with two tweens after another is because maybe my first tween has some easing applied to it. I don't want to interupt the easing for the entire tween.

 

Makes sense? :)

 

Thanks for the help

Link to comment
Share on other sites

So you mean I would do it like this?:

 

TweenMax.to(ball, 5, {x: 500});
TweenMax.to(ball, 1, {delay: 1, autoAlpha: 0});

 

... because I still want my ball to continue to x: 500.

Yep.

 

 

Reason I can't do it with two tweens after another is because maybe my first tween has some easing applied to it. I don't want to interupt the easing for the entire tween.

 

Makes sense? :)

No, that doesn't make sense to me. Why do you think that the 2nd tween would affect the easing on the 1st tween? (it wouldn't)

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