three — скилл для Claude Code: Three.js-сцены в HyperFrames
Держит Three.js-сцену в HyperFrames синхронной со временем ролика: адаптер шлёт hf-seek, а сцена рисует запрошенный кадр.
Apache-2.0 209 установок ★ 484 обновлён 2026-08-15
npx skills add boraoztunc/skills --skill three -a claude-codeЧто делает three
Скилл описывает подключение Three.js к HyperFrames через рантайм-адаптер three. Адаптер не владеет вашей сценой: он публикует время HyperFrames в window.__hfThreeTime и на каждый seek шлёт CustomEvent("hf-seek") с detail.time. Сцену, камеру, рендерер и материалы создавайте синхронно, где это возможно.
Движение считается от времени композиции, а не от системных часов. Для GLTF-клипов в примере вызывается mixer.setTime(time), несколько микшеров получают одно и то же значение. Модели, текстуры и HDRI грузятся до первого seek. Если оставить requestAnimationFrame источником движения, повторный рендер не совпадёт с первым: состояние сцены начнёт зависеть от того, сколько прошло реального времени.
После правок сцены проверка такая: npx hyperframes lint и npx hyperframes validate. В примере размер рендерера прибит к 1920×1080 и setPixelRatio(1), чтобы картинка не зависела от экрана, на котором её смотрят.
Какие задачи решает
- собрать 3D-сцену, которая повторяется кадр в кадр
- привязать вращение камеры и объектов к времени HyperFrames
- проиграть GLTF-клип на запрошенном времени через
mixer.setTime - убрать свободный animation loop из рендера видео
- прогнать lint и validate после правок сцены
Примеры запросов агенту
- Сделай Three.js-слой для HyperFrames: вращающийся икосаэдр, рендер строго по времени из
hf-seek - Переведи анимацию GLTF на
mixer.setTime(time)и убериrequestAnimationFrameиз рендера - Прогони
npx hyperframes validateпосле того, как поправишь камеру
Как установить three
1Через Skills CLI (Vercel)
npx skills add boraoztunc/skills --skill three -a claude-code2Вручную: положить файлы
~/.claude/skills/three/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/three/
1Через Skills CLI (Vercel)
npx skills add boraoztunc/skills --skill three -a codex2Вручную: положить файлы
.agents/skills/three/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add boraoztunc/skills --skill three -a cursor2Вручную: положить файлы
.cursor/skills/three/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install boraoztunc/skills three2Вручную: положить файлы
.github/skills/three/SKILL.md1Через Skills CLI (Vercel)
npx skills add boraoztunc/skills --skill three -a gemini-cli2Командой платформы
gemini skills install https://github.com/boraoztunc/skills --path threeВручную: положить файлы
.devin/skills/three/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add boraoztunc/skills --skill three -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о three
Как установить скилл three в Claude Code?
Выполните npx skills add boraoztunc/skills --skill three -a claude-code. Файл скилла окажется по пути ~/.claude/skills/three/SKILL.md.
Что делает скилл three?
Описывает шаблоны Three.js и WebGL для HyperFrames: рендер по времени композиции, обработку hf-seek, работу с AnimationMixer и шейдерами.
Почему нельзя рендерить из requestAnimationFrame?
Потому что тогда кадр зависит от прошедшего реального времени, и повторный рендер даст другую картинку. Время берётся из hf-seek, а не из часов.
Исходный текст
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