Skip to content

API / WorldClock

Class: WorldClock

Defined in: animation/WorldClock.ts:35

Worldclock provides clock support for animations, advance time for each IAnimatable object added to the instance.

Constructors

Constructor

ts
new WorldClock(time: number): WorldClock;

Defined in: animation/WorldClock.ts:66

Creating a Worldclock instance. Typically, you do not need to create Worldclock instance. When multiple Worldclock instances are running at different speeds, can achieving some specific animation effects, such as bullet time.

Parameters

ParameterTypeDefault value
timenumber0.0

Returns

WorldClock

Properties

time

ts
time: number = 0.0;

Defined in: animation/WorldClock.ts:43

Current time. (In seconds)


timeScale

ts
timeScale: number = 1.0;

Defined in: animation/WorldClock.ts:54

The play speed, used to control animation speed-shift play. [0: Stop play, (0~1): Slow play, 1: Normal play, (1~N): Fast play]

Default

ts
1.0

Methods

add()

ts
add(value: IAnimatable): void;

Defined in: animation/WorldClock.ts:150

Add IAnimatable instance.

Parameters

ParameterTypeDescription
valueIAnimatableThe IAnimatable instance.

Returns

void


advanceTime()

ts
advanceTime(passedTime: number): void;

Defined in: animation/WorldClock.ts:79

Advance time for all IAnimatable instances.

Parameters

ParameterTypeDescription
passedTimenumberPassed time. [-1: Automatically calculates the time difference between the current frame and the previous frame, [0~N): Passed time] (In seconds)

Returns

void


clear()

ts
clear(): void;

Defined in: animation/WorldClock.ts:180

Clear all IAnimatable instances.

Returns

void


contains()

ts
contains(value: IAnimatable): boolean;

Defined in: animation/WorldClock.ts:137

Check whether contains a specific instance of IAnimatable.

Parameters

ParameterTypeDescription
valueIAnimatableThe IAnimatable instance.

Returns

boolean


remove()

ts
remove(value: IAnimatable): void;

Defined in: animation/WorldClock.ts:166

Removes a specified IAnimatable instance.

Parameters

ParameterTypeDescription
valueIAnimatableThe IAnimatable instance.

Returns

void

Released under the MIT License.