threejs-animation
Agent skill fromCloudAI-X/threejs-skills
Keyframe, skeletal and morph-target animation, procedural motion and clip blending, on WebGL or with WebGPU and TSL. Use when animating objects, playing glTF animations, posing bones, driving morph targets, or mixing and crossfading clips.
How to install threejs-animation
install threejs-animation
# install the threejs-skills pack with the skills CLI
npx skills add CloudAI-X/threejs-skills# or add only this skill to Claude Code: copy the folder
skills/threejs-animation/
# into
~/.claude/skills/threejs-animation/ (all projects)
.claude/skills/threejs-animation/ (one project)
1# Three.js Animation23Targets three.js r186. Examples use WebGLRenderer; the WebGPU and TSL section uses WebGPURenderer.45## Quick Start67```javascript8import * as THREE from "three";910const renderer = new THREE.WebGLRenderer({ antialias: true });11renderer.setPixelRatio(window.devicePixelRatio);12renderer.setSize(window.innerWidth, window.innerHeight);13document.body.appendChild(renderer.domElement);1415const scene = new THREE.Scene();1617const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 100);18camera.position.set(0, 0.5, 3);1920const mesh = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1), new THREE.MeshNormalMaterial());21scene.add(mesh);2223const timer = new THREE.Timer();24timer.connect(document); // also keeps deltas small after the tab was hidden2526function animate() {27 timer.update(); // first thing each frame: fixes getDelta()/getElapsed() for this frame28 const delta = timer.getDelta();29 const elapsed = timer.getElapsed();3031 mesh.rotation.y += delta; // frame-rate-independent spin32 mesh.position.y = Math.sin(elapsed * 2) * 0.25; // bob on absolute time3334 renderer.render(scene, camera);35}3637renderer.setAnimationLoop(animate);38```3940## How the System Fits Together4142- **AnimationClip**: keyframe data — tracks of times and values, no playback state.43- **AnimationMixer**: plays clips on one root object and all its descendants.44- **AnimationAction**: playback control for one clip on one mixer.45…
Excerpt shown under the repository's MIT license.
