Skip to content
Skills Library
Programming · Building & coding

threejs-animation

/threejs-animation

Implement and debug Three.js motion with AnimationMixer, clips and actions, GLTF animation playback, skeletal rigs, morph targets, cross-fades, and frame-rate-independent procedural animation. Use when playing or blending model animations, driving bones or morphs, creating timeline motion, or fixing animation lifecycle and performance issues. Triggers on: Three.js animation, AnimationMixer, AnimationAction, AnimationClip, GLTF animation, skeletal animation, bones, morph targets, crossfade, procedural motion.

Repository
jeo-skills ↗
Licence
MIT
Last repository change
13.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
3
Scripts
0
HTML comments
0
URLs in SKILL.md
4
Deprecation

No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Implement and debug Three.js motion with AnimationMixer, clips and actions, GLTF animation playback, skeletal rigs, morph targets, cross-fades, and frame-rate-independent procedural animation. Use when playing or blending model animations, driving bones or morphs, creating timeline motion, or fixing animation lifecycle and performance issues. Triggers on: Three.js animation, AnimationMixer, AnimationAction, AnimationClip, GLTF animation, skeletal animation, bones, morph targets, crossfade, procedural motion.

Original author description

Implement and debug Three.js motion with AnimationMixer, clips and actions, GLTF animation playback, skeletal rigs, morph targets, cross-fades, and frame-rate-independent procedural animation. Use when playing or blending model animations, driving bones or morphs, creating timeline motion, or fixing animation lifecycle and performance issues. Triggers on: Three.js animation, AnimationMixer, AnimationAction, AnimationClip, GLTF animation, skeletal animation, bones, morph targets, crossfade, procedural motion.

How it works

  1. When to use this skill
  2. Instructions
  3. Examples
  4. Best practices
  5. References
Original SKILL.md headings · 119 lines, 623 words
SKILL.md preview
---
name: threejs-animation
description: >
  Implement and debug Three.js motion with AnimationMixer, clips and actions, GLTF
  animation playback, skeletal rigs, morph targets, cross-fades, and frame-rate-independent
  procedural animation. Use when playing or blending model animations, driving bones or
  morphs, creating timeline motion, or fixing animation lifecycle and performance issues.
  Triggers on: Three.js animation, AnimationMixer, AnimationAction, AnimationClip, GLTF
  animation, skeletal animation, bones, morph targets, crossfade, procedural motion.
allowed-tools: Bash Read Write Edit Glob Grep
license: MIT
metadata:
  tags: three.js, animation, animation-mixer, gltf, skeleton, morph-targets, webgl
  version: "1.0"
  source: https://github.com/CloudAI-X/threejs-skills/tree/main/skills/threejs-animation
---

# Three.js Animation

Use this skill for the animation implementation itself: clip selection, mixer ownership,
blending, skeleton/morph driving, and time-step correctness. Use `threejs-loaders` to
load the model and `web-game-development` when game-state or combat design—not the
animation API—is the primary problem.

## When to use this skill

- Play, pause, seek, loop, or blend `AnimationClip` data through `AnimationMixer`
- Attach GLTF clips to a loaded scene and clean mixers up with the model lifecycle
- Animate skeletal bones, morph target influences, or lightweight procedural movement
- Fix actions that do not play, snap during transitions, speed up with frame rate, or leak

## Instructions

### Step 1: Identify the animation owner and clock

1. Inspect the model's `gltf.animations`, root object, and current render-loop owner.
2. Create one mixer per animated root and advance it once per frame with elapsed **delta**
   time, not a fixed per-frame amount.
3. Preserve action references by semantic name; do not index an exported clip array
   blindly because asset revisions can reorder clips.

```js
const mixer = new THREE.AnimationMixer(gltf.scene);
const clips = new Map(gltf.animations.map((clip) => [clip.name, clip]));
const idle = mixer.clipAction(clips.get("Idle"));
idle.reset().fadeIn(0.2).play();

const clock = new THREE.Clock();
function update() {
  mixer.update(clock.getDelta());
  renderer.render(scene, camera);
  requestAnimationFrame(update);
}
update();
```

### Step 2: Transition actions without visual discontinuities

Set loop and clamp behavior deliberately, reset an incoming action before playing it,
and use cross-fades only when clips share a compatible pose/rig.

```js
function transition(from, to, duration = 0.2) {
  to.reset().setEffectiveWeight(1).setEffectiveTimeScale(1).play();
  from.crossFadeTo(to, duration, false);
}
```

For one-shot actions, listen for the mixer's `finished` event and transition back to a
known idle action. Remove listeners during feature teardown.

### Step 3: Choose the narrowest animation mechanism

| Need | Default mechanism |
|---|---|
| Authored transform/property keys | `AnimationClip` + keyframe tracks |
| Imported character animation | `AnimationMixer` + `clipAction` |
| Per-frame idle motion or UI response | Delta-time procedural update |
| Facial expressions or mesh deformation | `morphTargetInfluences` |
| Runtime bone adjustment | Bone transform after mixer update |
| Layered additive pose | Additive clip only after validating reference pose |

Apply procedural bone offsets after `mixer.update(delta)` so the authored clip does not
overwrite them. Keep expensive IK, physics, or retargeting behind a measured budget.

### Step 4: Dispose animation state with the feature

Call `mixer.stopAllAction()` and `mixer.uncacheRoot(root)` when the animated root is
permanently removed. Do not uncache a root shared by another scene or instance.

### Step 5: Verify animation behavior

- Test at a low and high frame rate; duration and travel must remain consistent.
- Test transition interruption, one-shot completion, and rapid action changes.
- Confirm named clips exist and report a useful error when an expected asset export changes.
- Verify cleanup by mounting/unmounting the scene repeatedly without growing listeners or
  retained mixer actions.

## Examples

### Animate a morph target

```js
const face = gltf.scene.getObjectByName("Face");
face.morphTargetInfluences[0] = 0.75;
```

Validate that the mesh has morph targets and use a named index map from the asset rather
than a magic number when the export includes multiple expressions.

### Drive a simple procedural bob

```js
const elapsed = clock.getElapsedTime();
mesh.position.y = baseY + Math.sin(elapsed * 2) * 0.1;
```

Store `baseY` separately. Incremental position changes accumulate drift and make mixing
with authored animation difficult.

## Best practices

1. Update mixers exactly once per frame with `delta` seconds.
2. Prefer exported clips for authored movement; procedural offsets should be additive and
   localized.
3. Name clips at export time and validate names at load time.
4. Avoid cloning a rig or mixer without checking shared skeleton and material ownership.
5. Profile skinned meshes and morph targets on target hardware before multiplying them.

## References

- [Three.js Animation source coverage](https://github.com/CloudAI-X/threejs-skills/tree/main/skills/threejs-animation)
- [AnimationMixer documentation](https://threejs.org/docs/#api/en/animation/AnimationMixer)
- [Three.js manual: animation system](https://threejs.org/manual/#en/animation-system)
Files in this package (3)
  • SKILL.md 5 KB
  • SKILL.toon 1 KB
  • evals/evals.json 1 KB

Versions

RepositoryScoreLicence
This page · akillness/jeo-skills100MIT
cloudai-x/threejs-skills100MIT
emiliodominguez/threejs-skills100MIT
full-stack-skills/threejs-skills100Apache-2.0
kumaran-is/claude-code-onboarding100MIT
iart-ai/webgl-animation-skills100MIT
calesthio/OpenMontage95AGPL-3.0
fabioc-aloha/Alex_Skill_Mall95MIT
miaoge-ge/coding-agent-skills95MIT

Database snapshot: 13.11.2026 · package version 90ef9d5ae377 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100threejs-impl-animation
    Use when playing animations, crossfading between animation states, or loading skeletal animations from GLTF in Three.js. Prevents the common mistake of not calling mixer.update(delta) every frame, wrong crossfade setup, or missing Clock. Covers AnimationMixer, AnimationClip,…
  • 95three-dart-animation
    three_dart animation — AnimationMixer, AnimationClip, AnimationAction, keyframe tracks, procedural animation in Flutter. Use when animating 3D objects, playing GLTF animations, or blending animations in a Flutter three_dart scene.
  • 100threejs-animation-systems
    Use for Three.js AnimationMixer, clips, skeletal animation, blending and runtime animation lifecycle; not GLB export validation.
  • 90threejs-model-animate
    Playing a loaded model's animations in three.js or R3F: clips, crossfades, one-shots, root motion, Mixamo clips, morph targets and rigged copies. Use when wiring model animations; not for procedural motion (`threejs-animation`). Hands off to `threejs-model-fix`.
  • 100threejs-gltf-loading
    Load glTF/GLB models in three.js with GLTFLoader and play their skinned animations with AnimationMixer, including DRACO/Meshopt-compressed meshes and KTX2 textures. Use when importing 3D models into three.js — when the user mentions glTF, GLB, GLTFLoader, AnimationMixer,…
  • 91r3f-animation
    React Three Fiber animation - useFrame, useAnimations, spring physics, keyframes. Use when animating objects, playing GLTF animations, creating procedural motion, or implementing physics-based movement.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.