tiennm99 d19a9246d5 refactor: simplifier pass — collapse duplicate code paths
- animate-move: factored shared promise/Tween body into tweenPivot;
  animateMove builds the pivot from spec, snapAndAnimate accepts a
  caller-built pivot. 96 → 80 LOC, no behavior change.
- pointer-gesture: merged abortGesture / finishGesture / dispose busy
  release into a single idempotent endGesture; ownedBusy already
  encoded the per-gesture semantics. 205 → 190 LOC.
- App: dropped the redundant `solving` state; ControlsPanel derives
  it as `busy && !solveActive`. runSolveStep collapsed to a one-line
  delegate since the busy gate now lives in CubeView.
- CubeView: extracted cubejs lazy-load + parse into computeSolvePlan
  and dropped the dead bracket-undo guard.

41 tests still green; build clean. No deps, features, or behavior
changes. Refs: plans/reports/code-simplifier-260427-1848-rubik-pass.md
2026-04-27 18:54:17 +07:00

Rubik's 3x3 — Web Simulator

Interactive 3D Rubik's cube in the browser. Three.js rendering, drag-to-rotate face gestures, keyboard notation, scramble + timer + undo.

Live: https://tiennm99.github.io/rubik/

Stack

  • Three.js (WebGL rendering)
  • Svelte 5 with runes (UI shell)
  • Tween.js (move animation)
  • Vite (build)

Dev

npm install
npm run dev          # http://localhost:8080
npm run dev:codeserver  # behind code-server proxy (set CODESERVER_HOST in .env.local)
npm run build        # → ../dist

Controls

Input Action
Drag a sticker Rotate that face
Drag empty space Orbit camera
R L U D F B M E S Quarter-turn moves
Shift + letter Inverse (prime)
x y z Cube rotations
Space Scramble
Z Undo
Esc Reset

Project Layout

src/
  main.js
  app.css
  views/             Svelte components (UI)
  lib/
    core/            Pure JS — cube state, moves, scramble, parser
    render/          Three.js scene + cubie meshes + animation
    controls/        Pointer gesture + keyboard
plans/               Implementation plans + research reports
docs/                Project documentation
vite/                Per-environment Vite configs

License

Apache-2.0

S
Description
Interactive 3x3 Rubik's cube simulator in the browser — drag-to-rotate faces, scramble, timer, undo. Three.js + Svelte 5 + Vite.
Readme Apache-2.0
645 KiB
Languages
JavaScript 79.2%
Svelte 19.5%
CSS 0.7%
HTML 0.6%