
Threejs Animation
Implement and debug Three.js motion—procedural loops, GLTF clips, morph targets, and blended actions—in a web 3D scene.
Overview
Threejs Animation is an agent skill for the Build phase that guides Three.js keyframe, skeletal, morph, and procedural animation using clips, mixers, and actions.
Install
npx skills add https://github.com/cloudai-x/threejs-skills --skill threejs-animationWhat is this skill?
- Procedural animation quick start with Clock delta and requestAnimationFrame render loop
- AnimationClip, AnimationMixer, and AnimationAction playback model
- NumberKeyframeTrack and VectorKeyframeTrack for custom keyframe paths
- GLTF skeletal animation and morph-target blending patterns
- Reference snippets for opacity, position, and material property tracks
- Three-component animation model: AnimationClip, AnimationMixer, AnimationAction
Adoption & trust: 6.3k installs on skills.sh; 2.3k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your Three.js scene is static or GLTF animations fail to play because clips, mixers, or track paths are wired incorrectly.
Who is it for?
Indie devs shipping WebGL product demos, mini-games, or interactive landing pages with Three.js in Claude Code or Cursor.
Skip if: Projects using only CSS or 2D canvas motion with no Three.js scene graph.
When should I use this skill?
Use when animating objects, playing GLTF animations, creating procedural motion, or blending animations.
What do I get? / Deliverables
You get working animation loops and asset-driven playback with correct Clock timing, clip tracks, and mixer/action control in the render loop.
- Runnable animate loop with Clock-based updates
- Configured clips, mixers, and actions for target objects or rigs
Recommended Skills
Journey fit
How it compares
Skill reference for Three.js’s animation API—not a full game engine substitute or a Blender-to-web auto-pipeline.
Common Questions / FAQ
Who is threejs-animation for?
Frontend-focused solo builders and small teams animating Three.js objects and GLTF assets inside agent-assisted coding sessions.
When should I use threejs-animation?
Use it in Build while implementing procedural motion, playing GLTF animations, blending actions, or authoring keyframe tracks on meshes and materials.
Is threejs-animation safe to install?
Check the Security Audits panel on this Prism page and the cloudai-x/threejs-skills source before trusting it in automated agent runs.
SKILL.md
READMESKILL.md - Threejs Animation
# Three.js Animation ## Quick Start ```javascript import * as THREE from "three"; // Simple procedural animation const clock = new THREE.Clock(); function animate() { const delta = clock.getDelta(); const elapsed = clock.getElapsedTime(); mesh.rotation.y += delta; mesh.position.y = Math.sin(elapsed) * 0.5; requestAnimationFrame(animate); renderer.render(scene, camera); } animate(); ``` ## Animation System Overview Three.js animation system has three main components: 1. **AnimationClip** - Container for keyframe data 2. **AnimationMixer** - Plays animations on a root object 3. **AnimationAction** - Controls playback of a clip ## AnimationClip Stores keyframe animation data. ```javascript // Create animation clip const times = [0, 1, 2]; // Keyframe times (seconds) const values = [0, 1, 0]; // Values at each keyframe const track = new THREE.NumberKeyframeTrack( ".position[y]", // Property path times, values, ); const clip = new THREE.AnimationClip("bounce", 2, [track]); ``` ### KeyframeTrack Types ```javascript // Number track (single value) new THREE.NumberKeyframeTrack(".opacity", times, [1, 0]); new THREE.NumberKeyframeTrack(".material.opacity", times, [1, 0]); // Vector track (position, scale) new THREE.VectorKeyframeTrack(".position", times, [ 0, 0, 0, // t=0 1, 2, 0, // t=1 0, 0, 0, // t=2 ]); // Quaternion track (rotation) const q1 = new THREE.Quaternion().setFromEuler(new THREE.Euler(0, 0, 0)); const q2 = new THREE.Quaternion().setFromEuler(new THREE.Euler(0, Math.PI, 0)); new THREE.QuaternionKeyframeTrack( ".quaternion", [0, 1], [q1.x, q1.y, q1.z, q1.w, q2.x, q2.y, q2.z, q2.w], ); // Color track new THREE.ColorKeyframeTrack(".material.color", times, [ 1, 0, 0, // red 0, 1, 0, // green 0, 0, 1, // blue ]); // Boolean track new THREE.BooleanKeyframeTrack(".visible", [0, 0.5, 1], [true, false, true]); // String track (for morph targets) new THREE.StringKeyframeTrack( ".morphTargetInfluences[smile]", [0, 1], ["0", "1"], ); ``` ### Interpolation Modes ```javascript const track = new THREE.VectorKeyframeTrack(".position", times, values); // Interpolation track.setInterpolation(THREE.InterpolateLinear); // Default track.setInterpolation(THREE.InterpolateSmooth); // Cubic spline track.setInterpolation(THREE.InterpolateDiscrete); // Step function ``` ## AnimationMixer Plays animations on an object and its descendants. ```javascript const mixer = new THREE.AnimationMixer(model); // Create action from clip const action = mixer.clipAction(clip); action.play(); // Update in animation loop function animate() { const delta = clock.getDelta(); mixer.update(delta); // Required! requestAnimationFrame(animate); renderer.render(scene, camera); } ``` ### Mixer Events ```javascript mixer.addEventListener("finished", (e) => { console.log("Animation finished:", e.action.getClip().name); }); mixer.addEventListener("loop", (e) => { console.log("Animation looped:", e.action.getClip().name); }); ``` ## AnimationAction Controls playback of an animation clip. ```javascript const action = mixer.clipAction(clip); // Playback control action.play(); action.stop(); action.reset(); action.halt(fadeOutDuration); // Playback state action.isRunning(); action.isScheduled(); // Time control action.time = 0.5; // Current time action.timeScale = 1; // Playback speed (negative = reverse) action.paused = false; // Weight (for blending) action.weight = 1; // 0-1, contribution to final pose action.setEffectiveWeight(1); // Loop modes action.loop = THREE.LoopRepeat; // Default: loop forever action.loop = THREE.LoopOnce; // Play once and stop action.loop = THREE.LoopPingPong; // Alternate forward/backward actio