Is there a way to see what side is pointed near the camera? I can only
think of m very long if else statements to see what side it is
turning.. but it's pretty ugly..
I tried to fake it by just resetting the cube position, unfortunately
this causes about 1 frame clipping where the cube disappears.
switch (direction)
{
case 'left':
this.cube.cubeMaterials.front =
this.nextMaterial;
this.cube.cubeMaterials.left =
this.currentMaterial;
this.camera.distance = 400;
this.cube.rotationX = 90;
this.cube.rotationZ = 90;
this.cube.rotationY = 0;
this.cube.depth = this.x...@cubewidth;
this.cube.height = this.x...@cubeheight;
this.cube.width = this.x...@cubewidth;
Tweener.addTween(this.cube, {
time:this.x...@animationspeed,
rotationZ:(this.cube.rotationZ + 90), transition:'easeOutCubic' } );
break;
case 'top':
this.cube.cubeMaterials.front =
this.nextMaterial;
this.cube.cubeMaterials.top =
this.currentMaterial;
this.cube.cubeMaterials.left = null;
this.camera.distance = 250;
if (this.currentMaterial) {
this.currentMaterial.rotation =
90 * Math.PI / 180;
this.currentMaterial.repeat =
true;
}
this.cube.depth = this.x...@cubeheight;
this.cube.width = this.x...@cubewidth;
this.cube.rotationY = 180
this.cube.rotationX = 180;
this.cube.rotationZ = 0;
Tweener.addTween(this.cube, {
time:this.x...@animationspeed,
rotationX:(this.cube.rotationX + 90),
transition:'easeOutCubic' } );
break;
}