three — Claude Code skill: Three.js scenes on HyperFrames time
Keeps a Three.js scene in HyperFrames tied to composition time: the adapter fires hf-seek and the scene draws the frame requested.
Apache-2.0 209 installs ★ 484 updated 2026-08-15
npx skills add boraoztunc/skills --skill three -a claude-codeWhat three does
This skill covers the three runtime adapter in HyperFrames. The adapter does not own your scene. It exposes composition time as window.__hfThreeTime and fires an hf-seek CustomEvent whose detail.time tells the scene which frame to draw. Build the scene, camera, renderer and materials synchronously where you can.
Animate from HyperFrames time, never from the clock. Clip playback goes through mixer.setTime(time); when several mixers exist, all of them take the same value. Models, textures and HDRIs load before seeking starts. Keep requestAnimationFrame as the driver of render-critical motion and repeat renders stop matching, because scene state then depends on how much real time elapsed.
Lint and validate after edits: npx hyperframes lint, then npx hyperframes validate. The sample pins the renderer to 1920×1080 with setPixelRatio(1), so output stays the same whatever display you view it on.
What it helps with
- render a 3D scene that repeats frame for frame
- drive camera motion from HyperFrames time
- seek a GLTF clip to an exact time with
mixer.setTime - strip a free-running animation loop out of video rendering
- lint and validate a Three.js composition after edits
Example prompts for the agent
- Build a Three.js layer for HyperFrames: rotating icosahedron, drawn strictly from
hf-seektime - Move the GLTF animation onto
mixer.setTime(time)and drop the animation loop - Run
npx hyperframes validateafter you adjust the camera
How to install three
1Skills CLI (Vercel)
npx skills add boraoztunc/skills --skill three -a claude-code2Manually: put the files in place
~/.claude/skills/three/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/three/
1Skills CLI (Vercel)
npx skills add boraoztunc/skills --skill three -a codex2Manually: put the files in place
.agents/skills/three/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add boraoztunc/skills --skill three -a cursor2Manually: put the files in place
.cursor/skills/three/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install boraoztunc/skills three2Manually: put the files in place
.github/skills/three/SKILL.md1Skills CLI (Vercel)
npx skills add boraoztunc/skills --skill three -a gemini-cli2Platform CLI
gemini skills install https://github.com/boraoztunc/skills --path threeManually: put the files in place
.devin/skills/three/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add boraoztunc/skills --skill three -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about three
How do I install the three skill in Claude Code?
Run npx skills add boraoztunc/skills --skill three -a claude-code. The skill lands at ~/.claude/skills/three/SKILL.md.
What does the three skill do?
It documents Three.js and WebGL adapter patterns for HyperFrames: drawing from composition time, handling hf-seek, and working with AnimationMixer and shader visuals.
Why does the skill warn against requestAnimationFrame?
Frames would depend on elapsed wall-clock time, so a second render of the same moment would differ. Time comes from hf-seek instead.
Source text
SKILL.md · Apache-2.0
---
name: three
description: Three.js and WebGL adapter patterns for HyperFrames. Use when creating deterministic Three.js scenes, WebGL canvas layers, AnimationMixer timelines, camera motion, shader-driven visuals, or canvas renders that respond to HyperFrames hf-seek events.
---
# Three.js for HyperFrames
HyperFrames supports Three.js through its `three` runtime adapter. The adapter does not own your scene. It publishes HyperFrames time and dispatches a seek event so your composition can render the exact frame.
## Contract
- Create the scene, camera, renderer, materials, and assets synchronously when possible.
- Render from HyperFrames time, not wall-clock time.
- Listen for the `hf-seek` event and render exactly that time.
- Load models, textures, and HDRIs before render-critical seeking. Do not fetch them at seek time.
- Avoid `requestAnimationFrame` or `renderer.setAnimationLoop` as the source of truth for render-critical motion.
The adapter sets `window.__hfThreeTime` and dispatches `new CustomEvent("hf-seek", { detail: { time } })` on each seek.
## Basic Pattern
```html
<canvas id="three-layer"></canvas>
<script type="module">
import * as THREE from "https://cdn.jsdelivr.net/npm/[email protected]/+esm";
const canvas = document.getElementById("three-layer");
const renderer = new THREE.WebGLRenderer({ canvas, alpha: true, antialias: true });
// Match these to your composition's frame size.
renderer.setSize(1920, 1080, false);
renderer.setPixelRatio(1);
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(35, 1920 / 1080, 0.1, 100);
camera.position.set(0, 0, 6);
const mesh = new THREE.Mesh(
new THREE.IcosahedronGeometry(1.4, 4),
new THREE.MeshStandardMaterial({ color: 0x64d2ff, roughness: 0.38 }),
);
scene.add(mesh);
scene.add(new THREE.HemisphereLight(0xffffff, 0x223344, 2));
function renderAt(time) {
mesh.rotation.y = time * 0.7;
mesh.rotation.x = Math.sin(time * 0.6) * 0.16;
renderer.render(scene, camera);
}
window.addEventListener("hf-seek", (event) => {
renderAt(event.detail.time);
});
renderAt(window.__hfThreeTime || 0);
</script>
```
```css
#three-layer {
width: 100%;
height: 100%;
display: block;
}
```
## AnimationMixer Pattern
For GLTF or authored clip animation, seek the mixer directly:
```js
function renderAt(time) {
mixer.setTime(time);
renderer.render(scene, camera);
}
```
If several mixers exist, seek all of them from the same `time`.
## Good Uses
- Deterministic 3D objects, product spins, particles with seeded data, and shader plates.
- Camera moves derived from `time`.
- GLTF animation clips when assets are local and loaded before validation completes.
## Avoid
- Using `Date.now()`, `performance.now()`, or clock deltas to update scene state.
- Leaving render-critical work inside a free-running animation loop.
- Loading remote models or textures at render time.
- Device-pixel-ratio dependent output. Pin renderer size and pixel ratio for video renders.
- Post-processing passes that depend on previous frame history unless you can reconstruct state from time.
## Validation
After editing a Three.js composition:
```bash
npx hyperframes lint
npx hyperframes validate
```
## Credits And References
- HyperFrames adapter source: `packages/core/src/runtime/adapters/three.ts`.
- Three.js `WebGLRenderer` docs: https://threejs.org/docs/pages/WebGLRenderer.html
- Three.js `AnimationMixer.setTime()` docs: https://threejs.org/docs/pages/AnimationMixer.html
© boraoztunc · Apache-2.0 · boraoztunc/skills