我正在做一個Adobe空中交互式桌面項目,我正在嘗試補間一些旋轉。大多數情況下,它可以正常工作,但偶爾它會繞着旋轉方向旋轉一點。有沒有人有一個好的方法來防止補間Flash中的這個問題?將閃爍補間旋轉設置爲最短距離as3?
我的代碼片段:
var rotatePos:Number;
if (event.rotation > 180) { rotatePos = event.rotation - 360; } else { rotatePos = event.rotation; }
var rotateDifference:Number = Math.abs(Math.abs(rotatePos) - Math.abs(Number(rotationCurrent[tempCircleNumber])));
if (rotateDifference > 4 && rotateDifference < 60) {
rotateTheFiducial();
} else if (rotateDifference > 100) {
trace("too far, ignore : " + rotateDifference);
}
function rotateTheFiducial():void
{
try
{
var cardTweenRotation:Tween = new Tween(MovieClip(fiducialArray[tempCircleNumber]), "rotation", Regular.easeOut, Number(rotationCurrent[tempCircleNumber]), rotatePos, .2, true);
rotationCurrent[tempCircleNumber] = rotatePos;
}
catch (e:Error)
{
trace(fiducialId + " : Rotate Error : " + e);
}
}
是啊,我結束了與tweenlite – HeroicNate