threejs
/threejs
Pomaga budować i debugować interaktywne sceny 3D w Three.js: scena, kamera i renderer, światła, materiały, ładowanie GLTF, kontrolki i wydajność.
Ocena i bezpieczeństwo
- Pliki w paczce
- 5
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 26.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Pomaga budować i debugować interaktywne sceny 3D w Three.js: scena, kamera i renderer, światła, materiały, ładowanie GLTF, kontrolki i wydajność.
Oryginalny opis (EN)
Use when building or debugging interactive 3D scenes on the web with Three.js (scene/camera/renderer, lights/materials, GLTF loading, controls, performance). Helpful for designers shipping 3D UI moments.
Jak działa
- When to use
- Core mental model
- Key APIs/patterns
- Common pitfalls
- Quick recipes
- What to ask the user
Podgląd SKILL.md
---
name: threejs
description: Use when building or debugging interactive 3D scenes on the web with Three.js (scene/camera/renderer, lights/materials, GLTF loading, controls, performance). Helpful for designers shipping 3D UI moments.
---
# Three.js — WebGL 3D Scenes Skill
## When to use
- Real 3D: product spins, interactive hero scenes, shaders/material effects, 3D data viz
- You need full control beyond “background effects”
- You can budget time for asset pipeline + performance tuning
## Core mental model
- Create:
- `Scene` (root graph)
- `Camera` (Perspective/Orthographic)
- `Renderer` (`WebGLRenderer`)
- `Mesh` = `Geometry` + `Material`
- Lights (if using non-unlit materials)
- Render loop:
- `requestAnimationFrame(animate)`
- Update time-based animations, controls, mixers, then `renderer.render(scene, camera)`
## Key APIs/patterns
- Setup:
- `const renderer = new THREE.WebGLRenderer({ canvas, antialias, alpha })`
- `renderer.setSize(width, height, false)`
- `renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2))`
- Camera:
- `camera.aspect = width / height; camera.updateProjectionMatrix()`
- Scene graph:
- `scene.add(object)` / `object.position/rotation/scale`
- Loading assets:
- `GLTFLoader` (models), `TextureLoader` (images), `DRACOLoader` (compressed glTF)
- Controls (common):
- `OrbitControls` (debug/product), `PointerLockControls` (FPS), custom pointer handlers
- Cleanup (important in SPAs):
- `geometry.dispose()`, `material.dispose()`, `texture.dispose()`, `renderer.dispose()`
- Remove event listeners; cancel RAF.
## Common pitfalls
- Not handling resize → stretched/cropped rendering
- Too high devicePixelRatio → mobile GPU meltdown
- Leaking WebGL resources (not disposing) → crashes after route changes
- Loading huge textures/models → slow start; use compressed textures, Draco/KTX2, smaller maps
- Using too many lights/shadows → expensive; fake lighting with baked textures when possible
## Quick recipes
### 1) Minimal spinning cube
```js
import * as THREE from "three";
const canvas = document.querySelector("#c");
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: true });
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(45, 1, 0.1, 100);
camera.position.set(0, 0, 4);
const geom = new THREE.BoxGeometry(1, 1, 1);
const mat = new THREE.MeshStandardMaterial({ color: 0x7c3aed });
const mesh = new THREE.Mesh(geom, mat);
scene.add(mesh);
scene.add(new THREE.AmbientLight(0xffffff, 0.8));
const dir = new THREE.DirectionalLight(0xffffff, 0.8);
dir.position.set(2, 2, 2);
scene.add(dir);
function resize() {
const w = canvas.clientWidth;
const h = canvas.clientHeight;
renderer.setSize(w, h, false);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
camera.aspect = w / h;
camera.updateProjectionMatrix();
}
window.addEventListener("resize", resize);
resize();
function animate(t) {
mesh.rotation.y = t * 0.0006;
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
requestAnimationFrame(animate);
```
### 2) Respect reduced motion
- If `prefers-reduced-motion: reduce`, render a still frame (no RAF) or slow updates.
## What to ask the user
- Is this decorative (hero) or functional 3D (product viewer)?
- Target devices: mobile? older iPhones?
- Asset format availability (glTF, HDRI, textures) and file size constraints
- Accessibility/reduced motion requirements
Pliki w paczce (5)
- REFERENCES.md 1 KB
- SKILL.md 3 KB
- demo/PROMPT.md 2 KB
- demo/index.html 16 KB
- demo/preview.jpg 39 KB
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · MengTo/Skills | 100 | MIT |
| TerminalSkills/skills | 100 | Apache-2.0 |
| whoamnesia/astudio-motion | 100 | MIT |
| emiliodominguez/threejs-skills | 100 | MIT |
| Funnyhust/POC_Kaenx_Creator | 100 | GPL-3.0 |
| secondsky/claude-skills | 95 | MIT |
Identyczna treść występuje jeszcze w 2 innych folderach na GitHubie. Tu pokazujemy jedną, najlepiej ocenioną kopię.
Migawka bazy z 13.11.2026 · wersja paczki 8fb03a3d553f (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100threejs-fundamentals
Zbiera podstawy Three.js: scena, kamera, renderer, geometrie, materiały, światła, GLTF loader, OrbitControls, raycaster, pętla renderowania i obsługa zmiany rozmiaru, także bez Reacta. - 90threejs-3d
Buduje i optymalizuje sceny 3D w przeglądarce w Three.js, React Three Fiber lub WebGPU, z kamerami, materiałami i glTF. - 90threejs-guide
Podpowiada, jak pisać sceny 3D w czystym Three.js dla WebGL i WebGPU: materiały, oświetlenie, GLTF, shadery i wydajność. - 100threejs-gltf-loading
Ładuje modele glTF i GLB w three.js przez GLTFLoader i odtwarza animacje szkieletowe z AnimationMixer, w tym siatki DRACO i Meshopt oraz tekstury KTX2. - 100threejs-materials-lighting
Oświetla i cieniuje scenę three.js: dobiera materiały (MeshStandardMaterial PBR lub MeshBasicMaterial), dodaje światła, włącza mapy cieni i mapę środowiska IBL dla realistycznych odbić. - 100od-threejs
Tworzy elementy 3D i interaktywne doświadczenia w przeglądarce z Three.js: scenami, materiałami, kontrolerami i post-processingiem.