Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tweenlite: tweening multiple objects at once

I would like to know if I can get an error or some other problems when I try to tween several objects like this and using an onComplete-property:

TweenLite.to(restartBtn, .5, {alpha:0});
TweenLite.to(mainMenuBtn, .5, {alpha:0, onComplete:quitFadeIn});

What I want to do is fade out several objects at once and when they finished a special function gets called. Are there other possibilities when using tweenlite available or do I have to use timelinelite?

like image 666
drpelz Avatar asked Aug 18 '26 21:08

drpelz


1 Answers

Your sample code should work without any errors and if you're limited to TweenLite, this is a perfectly good method to use.

If you can use TweenMax which is the same as TweenLite, just with more features, you can use something like this to tween multiple items:

TweenMax.allTo([restartBtn, mainMenuBtn], .5, {alpha:0, onComplete:quitFadeIn});

and this would stagger the fades by .2 seconds

TweenMax.allTo([restartBtn, mainMenuBtn], .5, {alpha:0, onComplete:quitFadeIn}, -.2);
like image 69
crooksy88 Avatar answered Aug 21 '26 12:08

crooksy88



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!