new Animation()
Animation represents a sequence of poses (keyframes) over time.
- Source
Classes
Methods
(static) fromJSON(data) → {Animation}
Create an Animation from JSON data.
Parameters:
| Name | Type | Description |
|---|---|---|
data | Object | JSON animation data. |
- Source
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:
| Name | Type | Description |
|---|---|---|
time | number | Time in seconds for this keyframe. |
pose | Pose | The pose at this keyframe. |
- Source
Returns:
This animation (for chaining).
- Type:
- Animation
getPoseAtTime(time) → {Pose}
Get the interpolated pose at a given time.
Parameters:
| Name | Type | Description |
|---|---|---|
time | number | Time in seconds. |
- Source
Returns:
Interpolated pose.
- Type:
- Pose