Jump to content
Search Community

Yoyo problems

tromezee test
Moderator Tag

Recommended Posts

Here is my problem :

 

I'm making three animations, all have yoyo parameter on true, when the first one is finished, i want to start the second, and the same way for the third one. At the end, i want to restart all the three animations in an unlimited loop,for example :

 

var timeline:TimelineMax = new TimelineMax({repeat:1, yoyo:true, repeatDelay:1.5});

var timeline2:TimelineMax = new TimelineMax({repeat:1, yoyo:true, repeatDelay:1.5});

 

 

timeline.insert(TweenMax.to(woman_caroussel, 1, {x:49, y:5}));

timeline.insertMultiple( TweenMax.allFrom([itstormName, CoName], 0.5, {autoAlpha:0}, 0.25), 0.6);

timeline.insertMultiple( TweenMax.allFrom(lettersArray, 1, {y:"-30", alpha:0, ease:Elastic.easeOut, onComplete:timeline2.play}, 0.04), 1.4);

timeline2.stop();

timeline2.insert(TweenMax.to(caroussel_man, 1, {x:49, y:5}), 5);

timeline2.insertMultiple( TweenMax.allTo([itstormName, CoName], 0.5, {autoAlpha:0}, 0.25), 5);

timeline.insertMultiple( TweenMax.allFrom(lettersArray2, 1, {y:"-30", alpha:0, ease:Elastic.easeOut, onComplete:timeline3.play}, 0.04), 1.4);

 

I'm getting crazy because only the first one works, it's like impossible to make the first one plays and reverse, after the second plays and reverse, and the third one plays and reverse, and go back at the beginning.

 

Thanks for your help

Link to comment
Share on other sites

You're putting the onComplete in the regular vars object of your allFrom()/allTo() methods which means that onComplete will be called at the end of EVERY TWEEN that the allFrom()/allTo() creates. For example, if your lettersArray has 20 letters, that onComplete will be called 20 times. If you want to call a function after ALL of those tweens complete, use the 5th parameter as indicated in the ASDocs.

 

Also keep in mind that you can nest TimelineMax instances inside other TimelineMax instances. So you could have a master TimelineMax into which you place your other TimelineMax instances.

 

var master:TimelineMax = new TimelineMax();
var tl1:TimelineMax = new TimelineMax({repeat:1, yoyo:true, repeatDelay:1.5});
var tl2:TimelineMax = new TimelineMax({repeat:1, yoyo:true, repeatDelay:1.5});

tl1.append( ...add tweens... );
tl2.append( ...add tweens... );

master.append(tl1);
master.append(tl2);

Link to comment
Share on other sites

Thanks a lot for your answer, now it's workink perfectly, i used to use "insert" function and after work with the delay to display all correctly, but with the "append" function all my animations are displaying smoothly without many delays, moreover i'm using now a main timeline to manage the others, and that's perfect ! Thank you again !

You've done a really good job with this api !

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