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
| Parameter | Type |
|---|---|
id | string |
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
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
| Parameter | Type |
|---|---|
dt | number |
Returns
wound()
Remove the voxels within radius of a rest-space point and optionally paint a rim around the hole. Returns a new model (the input is not changed); keep it as the entity's rest model so the wound shows in every pose baked afterwards. A generator that layers its interior shows what is underneath,...
BakedPose
A cached pose of one variant: what was baked for a (variant, damage, clip, frame, heading) key.