Files
esengine/source/src/Utils/SubpixelNumber.ts

27 lines
916 B
TypeScript
Raw Normal View History

2020-08-12 12:16:35 +08:00
module es {
/**
* 11update时添加到amount中
*/
export class SubpixelNumber {
public remainder: number;
/**
* amount递增余数intamount设置为当前值
* @param amount
*/
public update(amount: number){
this.remainder += amount;
let motion = Math.trunc(this.remainder);
this.remainder -= motion;
return motion;
}
/**
* 0
*
*/
public reset(){
this.remainder = 0;
}
}
}