All files / ts/models frameTime.ts

100% Statements 9/9
100% Branches 2/2
100% Functions 5/5
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33            1x               4x     9x     13x     14x       27x 27x 27x 27x    
export interface IFrameTime {
    start: number;
    end: number;
    delta: number;
    fps: number;
}
export class FrameTime implements IFrameTime {
 
    private _start: number;
    private _end: number;
    private _delta: number;
    private _fps: number;
 
    public get start(): number {
        return this._start;
    }
    public get end(): number {
        return this._end;
    }
    public get delta(): number {
        return this._delta;
    }
    public get fps(): number {
        return this._fps;
    }
 
    public constructor(start: number, end: number) {
        this._start = start;
        this._end = end;
        this._delta = end - start;
        this._fps = this._delta > 0 ? 1 / (this._delta * 0.001) : 0;
    }
}