HTML5 CANVASNO LIBRARIESVANILLA JS60 FPS FIXED-STEPAABBTOUCH · POINTER · KEYS

BREAKOUTCAB-01 · 32 BRICKS · 320 MAX

400×600FIELD8×4 @ 50×20GRIDPADDLE 60×10 @ y580CLAMP 0–340BALL r3 · |v|3.44DIAG LAUNCH
CAB-01 // BREAKOUT ATTRACT60 LOGIC/RENDER FPS · STEP 16.67ms
Breakout — your browser does not support canvas.
INSERT COIN COIN DOOR · PRESS START
000000
3
32
0
60
MOUSE◀ ▶DRAGPADDLE X — EASED ≤18px/STEP
SPACETAPLAUNCH / RESUME
PPAUSE · HOLD TO QUIT
RTAP RESTARTRESET 32 BRICKS

Paddle clamped to 0–340, so the wall lanes stay covered. Ball launch is (+2, −2.8) — diagonal, never straight up.

Build Log // CAB-01

Collision, separation and input are resolved in a fixed 60 Hz accumulator, so a phone at 30 Hz refresh and a desktop at 144 Hz get identical physics — only the render cadence differs.

COLLISION MODEL

Circle vs axis-aligned rect. ex = (w/2+r) − |cx−x|, ey = (h/2+r) − |cy−y|; the smaller overlap is the contact face, so ey < ex → flip dy, otherwise flip dx. Bricks are scanned by row (≤3 candidates) and the closest hit resolves — one per step.

DE-STALL GUARANTEE

Every hit separates the ball by r + 0.6 along the normal, so it cannot re-overlap. lastBrick blocks a second resolution against the same brick in one step. |dy| ≥ 1.09 kills the vertical death-loop; a 6 s stall re-angles the ball toward open brick.

MOBILE CONTRACT

  • touchstart / move / end
  • pointer fallback (mouse)
  • canvas = DPR × CSS box
  • aspect locked 2:3
  • bricks baked to sprites
  • works portrait + landscape