Skip to main content
skill CX Codex

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

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add boraoztunc/skills --skill three -a claude-code
Open on GitHub

What 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-seek time
  • Move the GLTF animation onto mixer.setTime(time) and drop the animation loop
  • Run npx hyperframes validate after you adjust the camera

How to install three

1Skills CLI (Vercel)

npx skills add boraoztunc/skills --skill three -a claude-code

2Manually: put the files in place

~/.claude/skills/three/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/three/

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

Similar skills

All skills for Game dev and 3D: Unity, Unreal, Godot, Blender →

From the same set22

The whole set →
hyperframes-cli hyperframes-cli controls the HyperFrames video pipeline through npx hyperframes, covering scaffolding, layout verification, studio preview, and final rendering. CX Codex +1 216installs lottie Teaches the agent to embed Lottie and dotLottie animations in HyperFrames so the composition timeline can be seeked to any frame. CX Codex +1 212installs waapi waapi instructs agents to write deterministic Web Animations API code for HyperFrames without relying on heavy external animation engines. CX Codex +1 211installs contribute-catalog The contribute-catalog skill guides a new HyperFrames block or component from an idea to an upstream catalog PR. Use it for captions, VFX, transitions, and lower thirds. CX Codex +1 211installs typegpu Skill for building GPU compositions with TypeGPU and WebGPU in HyperFrames: WGSL fragment shaders, compute pipelines, liquid glass effects, and particles on canvas. CX Codex +1 207installs linear-local-first-architecture linear-local-first-architecture tells the agent how to build a web app that answers instantly: workspace in IndexedDB, edits applied locally, sync queued in the background. CX Codex +1 201installs conductor-rewrite-performance conductor-rewrite-performance optimizes React performance in local-first Tauri desktop apps. Stops cascading re-renders on route changes and cleans up sluggish streaming lists. CX Codex +1 186installs minimal-zine-poster minimal-zine-poster turns a theme, phrase, object, or photo into a prompt for a sparse zine-style poster, then generates the image. Use it for essay or newsletter cover art. CX Codex +1 126installs

Project sponsors

Companies that keep this analytics open