2012-08-02 89 views
2

有這樣的代碼:我如何循環timelinemax動畫在這種情況下

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); 

如何循環這2個充斥着?當第二個動畫完成時,它的停止。是否可以在無限循環中運行一個接一個時間軸?

TNX

+1

注意jack的回答。他_wrote_ TweenLite et。所以他會知道 – 2012-08-02 21:51:48

回答

7

您可以時限內嵌套的時間表深深只要你想,那麼你可以簡單地添加你的兩個時間線的主時間線,有一個重複:-1(這意味着重複永遠)。在你現有的代碼下面加上這個:

var master:TimelineMax = new TimelineMax({repeat:-1}); 
master.append(timeline); 
master.append(timeline2); 
1

既然你可以計算出你將完成動畫的時候,你可以使用

delayedCall()

您還可以使用的onComplete VAR在TweenLite.to功能,請參閱在documentation

+0

tnx man.Please你可以寫同樣的例子,即時嘗試各種東西,但沒有結果。 – user642523 2012-08-02 14:47:06

+0

很想,但我目前沒有這類代碼的Flash項目。我現在更加關注iOS開發。嘗試在上次結束動畫中使用onComplete。它應該像發送onComplete參數一樣簡單。 – 2012-08-04 07:49:03

+0

也許這個帖子會有幫助[鏈接](http://forums.greensock.com/topic/1467-tweenlite-oncomplete-fires-function-immediately-solved/) – 2012-08-04 07:52:08