# 3D Rubik's Cube — Complete Technical Build Prompt > **Goal**: Build a fully interactive, photorealistic 3D Rubik's Cube that runs entirely in a single HTML file in the browser with zero installation. The cube sits in a dark, moody, spotlight-lit environment. Users can drag faces to twist layers, drag elsewhere to orbit the camera, and use a frosted-glass floating control panel for moves, scramble, undo, reset, and speed control. Keyboard shortcuts are supported. Everything animates smoothly. --- ## 1. Tech Stack & Dependencies This project is a **single `index.html` file** with all CSS and JS inline. No build tools, no npm, no bundler. ### Libraries (loaded from CDN) | Library | Version | CDN URL | Purpose | |---------|---------|---------|---------| | Three.js | r162 | `https://cdnjs.cloudflare.com/ajax/libs/three.js/r162/three.min.js` | 3D rendering engine | | OrbitControls | r162 | `https://cdn.jsdelivr.net/npm/three@0.162.0/examples/js/controls/OrbitControls.js` | Camera orbiting (we will use this as a fallback/reference but implement custom drag logic) | > **Important**: We do NOT use React, Vue, or any framework. Pure vanilla JS + Three.js only. We do NOT use ES module imports (`import { Scene } from 'three'`) because OrbitControls via the non-module CDN path requires the global `THREE` namespace. Use the classic script tag approach. ### Browser Requirements - Any modern browser (Chrome, Firefox, Safari, Edge) from 2020+. - WebGL support required (virtually universal now). --- ## 2. File Structure **One single file:** ``` index.html ← Contains ALL HTML, CSS (in
RUBIK'S CUBE
R
R'
L
L'
U
U'
D
D'
F
F'
B
B'
M
M'
E
E'
S
S'
⟳ Scramble
↩ Undo
✕ Reset
Speed
Keys: R L U D F B (hold Shift for prime) · Space=Scramble · Ctrl+Z=Undo · Esc=Reset