Log in
README.md 31 lines · 1.0 KB

Rubik's Cube 3D

A 3D Rubik's Cube game built with TypeScript, Vite, and Three.js.

Run

npm install
npm run dev      # dev server at http://localhost:5173
npm run build    # type-check + production build to dist/

How to play

  • Drag a sticker to turn its layer (middle layers work too).
  • Drag the background to orbit the camera; scroll to zoom.
  • Keyboard: U D L R F B turn faces clockwise; hold Shift for counter-clockwise (standard cube notation).
  • Scramble starts a timed game with a move counter; solve the cube to stop the clock.
  • Reset returns the cube to the solved state.

Code layout

FileRole
src/cube.tsBuilds the 26 cubie meshes with sticker materials
src/rubiks.tsMove queue, animated 90Β° layer turns, scramble, solved detection
src/dragControls.tsRaycast-based drag-to-turn pointer input
src/scene.tsRenderer, camera, lights, resize handling
src/main.tsGame state (idle / scrambling / playing), HUD, keyboard input