Threejs animation

From bidewio/better-openclaw · View interactive version

Threejs animation is an AI agent skill from the GitHub repository bidewio/better-openclaw. Create, control, and optimize animations in Three.js — keyframes, skeletal rigs, morph targets, blending, procedural motion, and performance patterns for web 3D.

How to use this skill

Skill file

Three.js Animation Skill

When to use

Animation system overview

Quick recipe — Play glTF animation

import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
const loader = new GLTFLoader();
const clock = new THREE.Clock();
let mixer;

loader.load("model.glb", (gltf) => {
  scene.add(gltf.scene);
  mixer = new THREE.AnimationMixer(gltf.scene);
  const action = mixer.clipAction(gltf.animations[0]);
  action.play();
});

function animate() {
  requestAnimationFrame(animate);
  if (mixer) mixer.update(clock.getDelta());
  renderer.render(scene, camera);
}
animate();

Animation blending

const idleAction = mixer.clipAction(clips.idle);
const walkAction = mixer.clipAction(clips.walk);
idleAction.play();
// Crossfade to walk
walkAction.reset().setEffectiveTimeScale(1).setEffectiveWeight(1).fadeIn(0.5).play();
idleAction.fadeOut(0.5);

Morph targets

mesh.morphTargetInfluences[0] = Math.sin(time) * 0.5 + 0.5;

Procedural motion

// Orbit
object.position.x = Math.cos(time) * radius;
object.position.z = Math.sin(time) * radius;

// Bobbing
object.position.y = Math.sin(time * 2) * 0.1;

Performance tips

Tips for AI Agents

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.