voxolith

makeAnimator()

A clip player for one rigged entity: the current clip, a crossfade from the previous one, and the clip events crossed since the last update. Pure and headless; one per animated instance, since it holds that instance's time.

function makeAnimator(entity: Entity, initial?: string): Animator;

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

Parameters

ParameterTypeDescription
entityEntityA rigged entity (rig and clips); without clips it stays at rest.
initial?stringClip to start on. Default the first clip.

Returns

Animator

The animator.

Example

const anim = makeAnimator(rat, "walk");
anim.play("run", { fade: 0.1 });
for (const e of anim.update(dt)) if (e.name === "step") footstep();
const matrices = poseMatrices(rat.rig!, anim.pose());

On this page