一键导入
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()),尽量复用