2

I have this code:

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.events.*;

var timeline:TimelineMax = new TimelineMax({yoyo:true,repeat:1});
var timeline2:TimelineMax = new TimelineMax({repeat:0,delay:12});

timeline.appendMultiple([ 
 TweenLite.from(crno_mc, .2, {x:-450,ease:Cubic.easeInOut}), 
 TweenLite.from(plavo_mc, .2, {x:-450,ease:Cubic.easeInOut}),
     TweenLite.from(network_mc, .6, {x:-450,ease:Cubic.easeInOut}),
 TweenLite.from(computers_mc, .6, {x:-450,ease:Cubic.easeInOut}), 
     TweenLite.from(odzaci_mc, .6, {x:-450,ease:Cubic.easeInOut}),
 TweenLite.from(adresa_mc, 1, {x:-350,ease:Cubic.easeInOut}),
 TweenLite.to(adresa_mc, 1, {x:50,ease:Cubic.easeInOut}),
 ], 1, TweenAlign.SEQUENCE, .3);


timeline2.appendMultiple([
   TweenLite.to(krediti_mc, .2, {x:10,ease:Cubic.easeInOut}), 
   TweenLite.to(dodva_mc, .3, {x:10,ease:Cubic.easeInOut}),
   TweenLite.to(nula_mc, 1, {x:10,ease:Bounce.easeOut}),
       TweenLite.to(tel_mc, .6, {x:10,ease:Cubic.easeInOut}),
   TweenLite.to(comp_mc, 1, {x:110,ease:Cubic.easeInOut}), 
], 1, TweenAlign.SEQUENCE, .5);

How to loop this 2 tweens? When second animation finish, its stop.Is it posible to run one timeline after another in infinite loop ?

Tnx

user642523
  • 151
  • 4
  • 16

2 Answers2

8

You can nest timelines within timelines as deeply as you want, so you could simply append both of your timelines to a master timeline that has a repeat:-1 (which means repeat forever). Add this below your existing code:

var master:TimelineMax = new TimelineMax({repeat:-1});
master.append(timeline);
master.append(timeline2);
Jack
  • 2,930
  • 17
  • 13
1

Since you can calculate the time that you would finish the animation, you can use

delayedCall ()

You can also use onComplete var on the TweenLite.to function, see the documentation

Shefy Gur-ary
  • 628
  • 8
  • 19
  • tnx man.Please can you write same example, im trying various stuff, but no results. – user642523 Aug 02 '12 at 14:47
  • Would love to, but Im currently don't have a flash project with this kind of code. I'm more into iOS development now. Try to use the onComplete in your last ending animation. It should be as simple as sending the name of the function as the onComplete parameter. – Shefy Gur-ary Aug 04 '12 at 07:49
  • Maybe this post would be helpful [link](http://forums.greensock.com/topic/1467-tweenlite-oncomplete-fires-function-immediately-solved/) – Shefy Gur-ary Aug 04 '12 at 07:52