This is an interactive 3D web experience built with Three.js. It renders a simple cube, but with a powerful debug UI that lets you customize its properties in real-time.
This project serves as a fantastic starting point for learning how to integrate Three.js with debug tools like lil-gui and animation libraries like gsap.
A control panel (powered by lil-gui) allows you to modify the cube on the fly:
- Position: Change the cube's
XandYposition using sliders. - Visibility: Toggle the cube on and off with a checkbox.
- Wireframe: Switch between a solid and wireframe view.
- Color: Use a color picker to change the cube's material color instantly.
- Spin Animation: Trigger a full 360-degree
gsapanimation with the click of a button. - Subdivisions: Increase or decrease the cube's geometry subdivisions to see how it's constructed.
- Click + Drag: Rotate the camera around the cube (
OrbitControls). - Scroll Wheel: Zoom in and out.
- Double-Click: Enter or exit fullscreen mode.
- Press 'h': Show or hide the debug control panel.
To get this project running on your local machine, follow these simple steps.
-
Clone the repository:
git clone [https://github.com/your-username/your-repo-name.git](https://github.com/your-username/your-repo-name.git) cd your-repo-name -
Install dependencies: (Requires Node.js)
npm install
-
Run the local server: This command will start a local server, usually at
http://localhost:5173.npm run dev
-
Build for production: This command will create a
dist/directory with the optimized production files.npm run build