21 lines
488 B
TypeScript
21 lines
488 B
TypeScript
import { OnAnimationFrame } from './OnAnimationFrame';
|
|
export class AnimationFrameEvent
|
|
{
|
|
onAnimationFrame:OnAnimationFrame;
|
|
|
|
_timeMS:number = 0;
|
|
get timeMS(){ return this._timeMS; }
|
|
|
|
_lastTimeMS:number = 0;
|
|
get lastTimeMS(){ return this._lastTimeMS; }
|
|
|
|
_deltaTimeMS:number = 0;
|
|
get deltaTimeMS(){ return this._deltaTimeMS; }
|
|
|
|
update()
|
|
{
|
|
this._lastTimeMS = this._timeMS;
|
|
this._timeMS = Date.now();
|
|
this._deltaTimeMS = this._timeMS - this._lastTimeMS;
|
|
}
|
|
} |