2015-04-03 28 views
0

我在排序相位器上的z-index優先順序時遇到問題。我已經創建了一個旋轉垂直旋轉木馬,但我需要將center image作爲最高優先級的z-index在下面的照片中看到。 swap(a,b)是交換z-索引的那個。此代碼位於更新每個幀的更新函數中(因此中心圖像始終在變化,但它必須始終位於所有其他圖像之上)。Z-Index垂直傳送帶打字稿

var r = 0, 
    n = this.itemCount, 
    a = this.symW/2, 
    b = this.symH/2; 
for (var i = 0; i < n; i++) { 
    t = 2 * Math.PI/n; 
    angle = i * t + this.currentAngle; 
    r = b/Math.tan(t/2); 
    pX = cX; 
    pX = Math.round(Math.cos(angle) * -r * 0.5); 
    pY = Math.round(Math.sin(angle) * r + cY); 
    //this.swap(this.symbols[i + 1], this.symbols[i]); 
    this.symbols[i].x = pX + 250; 
    this.symbols[i].y = pY - 150; 
} 
if (Math.abs(this.currentAngle) >= 2 * Math.PI) 
    this.currentAngle = 0; 
else this.currentAngle -= 0.01; 

enter image description here

回答

0

你能在你想在上面的,而不是任何東西交換的項目使用bringToTop()