Skip to content

ViewTimers beta ​

Class of @v12-engine/client

ts
export declare class ViewTimers

Timers and tweens of a view, stepped by seconds as the frame runs: after and every call back, a tween drives a value over time with an Ease

Members ​

after ​

ts
after(seconds: number, run: () => void): number;

Runs run once, seconds from now. Returns its id, for cancel

cancel ​

ts
cancel(id: number): boolean;

Stops a timer or a tween. Whether it was still going

clear ​

ts
clear(): void;

Stops everything: the game is over

every ​

ts
every(seconds: number, run: () => void, times?: number): number;

Runs run every seconds: times times, or until cancelled

size ​

ts
get size(): number;

How many are going

tween ​

ts
tween(seconds: number, step: (t: number) => void, options?: {
        ease?: Ease;
        onEnd?: () => void;
    }): number;

Calls step every frame for seconds, with how far along it is, 0..1, through ease; with 1 at the end, then onEnd. For whatever moves or fades on the screen

update ​

ts
update(dt: number): void;

Moves time on by dt seconds: what is due goes off. The client calls it every frame