blaze-2d
Version:
A fast and simple WebGL 2 2D game engine written in TypeScript
21 lines • 587 B
JavaScript
/**
* Stores variations of the delta time, the time between each frame/update.
*/
export default class TimeStep {
/**
* Creates an {@link TimeStep}.
*
* @param time The current time
* @param dt The current delta time
* @param lastDt The last delta time
*/
constructor(time, dt, lastDt) {
this.time = time;
this.dt = dt;
this.lastDt = lastDt;
this.dtRatio = lastDt === 0 ? 0 : dt / lastDt;
this.dtSquared = dt * dt;
this.inverseDt = dt === 0 ? 0 : 1 / dt;
}
}
//# sourceMappingURL=timestep.js.map