Loading...
Loading...
Build 3D web apps with Three.js (WebGL/WebGPU). Use for 3D scenes, animations, custom shaders, PBR materials, VR/XR experiences, games, data visualizations, product configurators.
npx skill4agent add mrgoonie/claudekit-skills threejsreferences/00-fundamentals.mdreferences/01-getting-started.mdreferences/02-loaders.mdreferences/03-textures.mdreferences/04-cameras.mdreferences/05-lights.mdreferences/06-animations.mdreferences/07-math.mdreferences/18-geometry.mdreferences/11-materials.mdreferences/08-interaction.mdreferences/09-postprocessing.mdreferences/10-controls.mdreferences/11-materials-advanced.mdreferences/12-performance.mdreferences/13-node-materials.mdreferences/14-physics-vr.mdreferences/15-specialized-loaders.mdreferences/16-webgpu.mdreferences/17-shader.md// 1. Scene, Camera, Renderer
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
// 2. Add Objects
const geometry = new THREE.BoxGeometry();
const material = new THREE.MeshStandardMaterial({ color: 0x00ff00 });
const cube = new THREE.Mesh(geometry, material);
scene.add(cube);
// 3. Add Lights
const light = new THREE.DirectionalLight(0xffffff, 1);
light.position.set(5, 5, 5);
scene.add(light);
scene.add(new THREE.AmbientLight(0x404040));
// 4. Animation Loop
function animate() {
requestAnimationFrame(animate);
cube.rotation.x += 0.01;
cube.rotation.y += 0.01;
renderer.render(scene, camera);
}
animate();