2014-01-16 42 views
3

我對時間線精簡版中的多個補間進行排序,但我希望其中的幾個同時發生在不同的對象上。有沒有辦法做到這一點沒有onComplete函數。我現在的補間的順序是:時間軸精簡版 - 如何同時補間多個對象

tl.to($slideTitle, 0.3, {opacity: 0, left: -50 }) 
     .set($slideTitle, { css: { left: 50 } }) 
     .to($slideTitle,0.3, { opacity: 1, left: 0 }) 
     .to($slideDesc,0.3, {opacity: 0, left: -50 }) //Here is where I want a tween to happen to another item at the same time as I am animating $slideDesc 
     .set($slideDesc, { css: { left: 50 } }) 
     .to($slideDesc,0.3, {opacity: 1, left: 0, onComplete: function(){ 

     }}) 

所以中間還有,在同一時間作爲第一個動畫$ slideDesc,我想執行這個動畫:

.to($bodyCopy,0.3, {opacity: 0, left: -50, delay: .05 }) 

如何做到這一點?如果我在$ slideDesc之後的順序中插入它,它將在$ slideDesc完成後才執行。

回答

12

你有兩個選擇真:

  1. 創建一個標籤和參數設置位置的標籤都 項目
  2. 添加第二吐溫和抵消其負面相同 的$slideDesc

持續時間如此說明:

// Your code 
.addLabel('targetPoint') 
.to($slideDesc,0.3, {opacity: 0, left: -50 }, 'targetPoint') 
.to($bodyCopy,0.3, {opacity: 0, left: -50, delay: .05 }, 'targetPoint') 

OR

// Your code 
.to($slideDesc,0.3, {opacity: 0, left: -50 }) 
.to($bodyCopy,0.3, {opacity: 0, left: -50, delay: .05 }, '-=0.3')