Animation

new Animation()

Animation represents a sequence of poses (keyframes) over time.

Classes

Animation

Methods

(static) fromJSON(data) → {Animation}

Create an Animation from JSON data.

Parameters:
NameTypeDescription
dataObject

JSON animation data.

Returns:
Type: 
Animation
Example
Animation.fromJSON({
  name: "walk",
  loop: true,
  frames: [
    { time: 0, limbs: { "LegL": { rotation: -0.3 } } },
    { time: 0.25, limbs: { "LegL": { rotation: 0.3 } } }
  ]
});

addKeyframe(time, pose) → {Animation}

Add a keyframe to the animation.

Parameters:
NameTypeDescription
timenumber

Time in seconds for this keyframe.

posePose

The pose at this keyframe.

Returns:

This animation (for chaining).

Type: 
Animation

getPoseAtTime(time) → {Pose}

Get the interpolated pose at a given time.

Parameters:
NameTypeDescription
timenumber

Time in seconds.

Returns:

Interpolated pose.

Type: 
Pose