AS3旋转启动速度然后随着时间减慢

时间:2012-05-23 09:13:59

标签: actionscript-3 flash animation rotation

我得到了这个让我的对象连续旋转的代码

movieClip_2.addEventListener(Event.ENTER_FRAME, fl_RotateContinuously_2);

function fl_RotateContinuously_2(event:Event)
{
    movieClip_2.rotation += 100;

}

如何让这个物体在100秒到10秒之间减速5秒?

1 个答案:

答案 0 :(得分:0)

var fps:Number = stage.frameRate;
var step:int = 100;
var minStep:int = 10;
var time:Number = 5;
var increment:Number = (step - minStep) / (time * fps);

movieClip_2.addEventListener(Event.ENTER_FRAME, fl_RotateContinuously_2);

function fl_RotateContinuously_2(event:Event)
{
    movieClip_2.rotation += step;
    step -= increment;
    step = Math.max(minStep, step);
}