Javascript Z索引垂直旋转木马类型脚本
我对phaser上的z索引优先级排序有问题。我已经创建了一个旋转垂直旋转木马,但我需要将下图所示的Javascript Z索引垂直旋转木马类型脚本,javascript,typescript,carousel,phaser-framework,Javascript,Typescript,Carousel,Phaser Framework,我对phaser上的z索引优先级排序有问题。我已经创建了一个旋转垂直旋转木马,但我需要将下图所示的中心图像作为最高优先级的z索引。交换(a,b)是交换z指数的。此代码位于更新函数中,该函数更新每一帧(因此中心图像会一直更改,但它需要始终位于所有其他图像的顶部) var r=0, n=此.itemCount, a=这个。symW/2, b=这一点symH/2; 对于(变量i=0;i=2*Math.PI) 此.currentAngle=0; 否则,该电流角-=0.01; 您能在顶部想要的物品上使用
中心图像
作为最高优先级的z索引。交换(a,b)
是交换z指数的。此代码位于更新函数中,该函数更新每一帧(因此中心图像会一直更改,但它需要始终位于所有其他图像的顶部)
var r=0,
n=此.itemCount,
a=这个。symW/2,
b=这一点symH/2;
对于(变量i=0;i=2*Math.PI)
此.currentAngle=0;
否则,该电流角-=0.01;
您能在顶部想要的物品上使用,而不是交换任何东西吗
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;