Przejdź do treści
Biblioteka skilli
Projektowanie i UX · Budowanie i kod

three

/three

Pomaga tworzyć deterministyczne sceny Three.js i warstwy WebGL, które reagują na zdarzenia hf-seek w HyperFrames.

Repozytorium
ralphy ↗
Licencja
Apache-2.0
Ostatnia zmiana repozytorium
04.11.2026

Ocena i bezpieczeństwo

95/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena10 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
3
Przestarzałość

Brak sygnałów. Repozytorium zmienione 04.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

Co robi i kiedy

Pomaga tworzyć deterministyczne sceny Three.js i warstwy WebGL, które reagują na zdarzenia hf-seek w HyperFrames.

Oryginalny opis (EN)

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.

Jak działa

  1. Contract
  2. Basic Pattern
  3. AnimationMixer Pattern
  4. Good Uses
  5. Avoid
  6. Validation
  7. Credits And References
Sekcje z nagłówków SKILL.md, w oryginale · 103 linii, 398 słów
Podgląd SKILL.md
---
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/three@0.181.2/+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

Wersje

RepozytoriumWynikLicencja
Ta strona · alecs5am/ralphy95Apache-2.0
contextgo/contextgo100Apache-2.0

Migawka bazy z 13.11.2026 · wersja paczki 6144de13aa54 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 1 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 95animejs
    Podaje wzorce adaptera Anime.js dla HyperFrames: animacje i osie czasu w kompozycjach, rejestrację w window.__hfAnime, deterministyczne sterowanie przez seek i przekładanie przykładów na HTML bezpieczny dla renderu.
  • 100animejs
    Opisuje adapter Anime.js w HyperFrames: pisanie animacji i timeline'ów w kompozycjach, rejestracja w window.__hfAnime, sterowanie przez seek oraz tłumaczenie przykładów na HTML odporny na render.
  • 95typegpu
    Podpowiada wzorce adaptera TypeGPU i WebGPU dla kompozycji HyperFrames: shadery WGSL, potoki obliczeń i efekty.
  • 100vybe-cinematic-3d
    Renderuje deterministyczne sceny 3D w Three.js i WebGL dla filmów HyperFrames, z kamerą i cząsteczkami.
  • 100css-animations
    Opisuje wzorce animacji CSS dla HyperFrames: keyframes, opóźnienia, animation-fill-mode i play-state, tak by ruch dało się deterministycznie przewijać w podglądzie i renderowaniu.
  • 100webgl-experience
    Tworzy pełnoekranowe doświadczenie WebGL lub WebGL2 w czasie rzeczywistym, z animowanymi shaderami, scenami 3D, wizualizacjami generatywnymi i polami cząstek z nakładką typograficzną, w jednym pliku index.html.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.