Skip to main content

Class: Clock

时钟对象,默认内部会使用 performance.now 否则会 回退到 Date.now().

const clock = new Clock();

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Clock(running?): Clock

Constructor

Parameters

NameTypeDefault valueDescription
runningbooleantrue时钟状态

Returns

Clock

Defined in

src/animation/Clock.ts:35

Properties

running

running: boolean

Defined in

src/animation/Clock.ts:29

Methods

start

start(): void

启动时钟

Returns

void

Defined in

src/animation/Clock.ts:42


stop

stop(): void

停止时钟

Returns

void

Defined in

src/animation/Clock.ts:52


reset

reset(): void

重置时钟状态

Returns

void

Defined in

src/animation/Clock.ts:61


getElapsedTime

getElapsedTime(): number

获取自时钟启动以来经过的秒数

Returns

number

Defined in

src/animation/Clock.ts:69


getDelta

getDelta(): number

计算时钟总启动时间,并将当前时间设置赋值到 lastTime

Returns

number

Defined in

src/animation/Clock.ts:77