updata (dt: number) of common usage

/***
*dt 每帧刷新时经过的时间秒
***/
updata(dt:number):void
{

}

We want to achieve the effect of a body of revolution for 3 seconds, then our frame rate refresh in how to write code?

Because updata dt is the distance inside a second pass, we rate of 1 second is appropriate for the speed of the unit

private speed_sec:120;//3秒转1圈,折算为1秒转120度
/***
*dt 每帧刷新时经过的时间秒
***/
updata(dt:number):void
{
    //精准的移动
    this.node.rotation+=dt*this.speed_sec;
}

Guess you like

Origin www.cnblogs.com/naiking/p/12155495.html