BREAKOUT

Canvas brick breaker · single file

Field 400×600
Grid 8×4 · 32 bricks
Vanilla JS · 0 deps
60 fps target
← → / A D steer Drag touch steer Space launch

32 bricks · +10 pts · 3 lives · max 320

01 · Collision

AABB with per-axis penetration depth. The closest brick wins the frame; positional push-out prevents re-hits.

02 · Physics

Fixed 60 Hz steps on a rAF accumulator. Constant magnitude 3.44 → 4 px/frame; paddle bounce angle up to 60°.

03 · Input

Mouse, touch and keys all map to one clamped paddle target (0–340 px). Non-passive touch handlers, no scroll hijack.

04 · Render

DPR-scaled backing store, pre-baked background, sprite-based glow for the ball. No shadowBlur in the hot path.