voxolith

Animator

Plays one entity's clips, from makeAnimator. Times are in seconds.

Defined in: engine/src/animation/animator.ts:8

Methods

clip()

clip(): string;

Defined in: engine/src/animation/animator.ts:23

Current clip id, or "" when the entity has no clips.

Returns

string


finished()

finished(): boolean;

Defined in: engine/src/animation/animator.ts:27

A non-looping clip has reached its end.

Returns

boolean


play()

play(id: string, opts?: object): void;

Defined in: engine/src/animation/animator.ts:14

Switch to a clip, crossfading over fade seconds (default 0.2). Playing the current clip again does nothing unless restart; speed (default 1) scales time and is set either way. Throws on an unknown clip id.

Parameters

ParameterType
idstring
opts?{ fade?: number; restart?: boolean; speed?: number; }
opts.fade?number
opts.restart?boolean
opts.speed?number

Returns

void


pose()

pose(): Pose;

Defined in: engine/src/animation/animator.ts:21

The current pose, crossfaded if a fade is under way. The object is reused by the next call, so pass it straight to poseMatrices or copy it.

Returns

Pose


time()

time(): number;

Defined in: engine/src/animation/animator.ts:25

Seconds into the current clip (wrapped for loops).

Returns

number


update()

update(dt: number): ClipEvent[];

Defined in: engine/src/animation/animator.ts:16

Advance; returns the events crossed since the last update.

Parameters

ParameterType
dtnumber

Returns

ClipEvent[]

On this page