2015-06-29 59 views
0

我正在創建一個後端用於爲進度條設置動畫。將動畫播放到特定時間

// Default easing. 
TweenLite.defaultEase = Power0.easeNone; 

// Timeline. 
var tl = new TimelineLite({ 
    onUpdate : function() 
    { 
     console.log(progress.progress); 
    } 
}); 

// Initial state. 
var progress = { progress : 0 }; 

// Finalized state. 
tl.to(progress, 1, { progress : 100 }); 

// The length of the animation. 
tl.totalDuration(15); 

// Play. 
tl.play(); 

可正常工作,但有沒有辦法從當前播放頭動畫到一個特定?類似於tl.playTo(0.5)和之後的tl.playTo(0.2),將恢復到20%。

我知道seek,progressplay方法的可選變量,但他們只讓我指定起始位置,而不是結束位置。

我該如何實現這樣的行爲?

回答

1

如果我正確理解你的問題,這是我的建議。

能夠繪製的TimelineLiteprogress財產。例如:

TweenLite.to(tl, 1, {progress: .5, ease: Linear.easeNone});

而且,你見過tweenTo()tweenFromTo是在TimelineMax可用的,我知道你正在使用TimelineLite,但如果你知道他們的,我仍然不知道。

這有幫助嗎?

+0

是啊'tweenTo'是我在找的,謝謝! – jolt

相關問題