A simple Three.js project for students to learn and experiment with 3D graphics.
- Make sure you have Node.js installed on your computer
- Open a terminal in this project folder
- Run these commands:
npm install npm start
- Open your browser and go to
http://localhost:5173
index.html- The main HTML filemain.js- Core Three.js setup (don't modify this)sketches/- Directory containing your 3D sketchesexample.js- Example sketch with a rotating cube
package.json- Project configuration and dependencies
- Create a new file in the
sketchesfolder (e.g.,mySketch.js) - Copy this template:
import * as THREE from 'three'; export function setup(scene, camera) { // Create your 3D objects here // Return any objects you want to animate return { /* your objects */ }; } export function update(objects) { // Animate your objects here }
- To use your sketch, modify the import in
main.js:import { setup, update } from './sketches/mySketch.js';
Try these simple changes in your sketch:
- Change colors: Modify the
colorvalue in materials - Change positions: Modify object positions using
position.set(x, y, z) - Add more objects: Create new geometries and add them to the scene
- Change animations: Modify the
updatefunction
- Three.js - For 3D graphics
- Vite - For development server and live reloading
Visualization of minimal surfaces with stacked contours

