ワンクリックで
threejs
Three.js 基础能力:场景/相机/渲染器、坐标系、Object3D 层级与变换。用户需要搭建 3D 场景或理解基础概念时调用。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Three.js 基础能力:场景/相机/渲染器、坐标系、Object3D 层级与变换。用户需要搭建 3D 场景或理解基础概念时调用。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Weekly Focus Engineering analysis using ActivityWatch data. Use when analyzing app usage patterns, detecting context switching problems, identifying "death loops" (repetitive app switching), calculating focus scores, or creating weekly productivity reviews.
WCAG 2.2 AA conformance auditor. Systematically verifies success criteria through automated, interactive, and manual testing methods.
Implement features from spec documents (context/doc required)
PR review for bugs, security & quality (requires PR URL)
Brutally honest roasts of your code with fixes
Accessibility improvement planning support. Generates organizational maturity assessment, phased roadmap, KPI design, and stakeholder persuasion materials.
| name | Three.js基础 |
| description | Three.js 基础能力:场景/相机/渲染器、坐标系、Object3D 层级与变换。用户需要搭建 3D 场景或理解基础概念时调用。 |
import * as THREE from "three";
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(
75,
window.innerWidth / window.innerHeight,
0.1,
1000,
);
camera.position.set(0, 0, 5);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
document.body.appendChild(renderer.domElement);
const cube = new THREE.Mesh(
new THREE.BoxGeometry(1, 1, 1),
new THREE.MeshStandardMaterial({ color: 0x00ff00 }),
);
scene.add(cube);
scene.add(new THREE.AmbientLight(0xffffff, 0.5));
const dirLight = new THREE.DirectionalLight(0xffffff, 1);
dirLight.position.set(5, 5, 5);
scene.add(dirLight);
function animate() {
requestAnimationFrame(animate);
cube.rotation.y += 0.01;
renderer.render(scene, camera);
}
animate();
window.addEventListener("resize", () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
Scene:容器,持有所有可渲染对象/灯光/雾等Camera:决定视角与投影(透视/正交)WebGLRenderer:将场景+相机渲染到 <canvas>Object3D(如 Mesh、Group、Light)const group = new THREE.Group();
group.position.set(0, 1, 0);
scene.add(group);
const child = new THREE.Mesh(new THREE.BoxGeometry(), new THREE.MeshBasicMaterial());
child.position.set(2, 0, 0);
group.add(child);
position / rotation / scaleobject.updateMatrixWorld() 刷新世界矩阵AxesHelper、GridHelperTHREE.Clock 或 performance.now() 计算 deltaTime,让动画与帧率解耦const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const dt = clock.getDelta();
cube.rotation.y += dt;
renderer.render(scene, camera);
}
dispose()geometry.dispose();
material.dispose();
texture.dispose();
renderer.setPixelRatio(Math.min(devicePixelRatio, 2)) 通常更稳new Vector3()),尽量复用