Thirty-two bricks,
zero libraries.
The whole cabinet is one HTML file. A single <canvas> holds every game pixel — bricks, paddle, ball, score, lives, and both end screens, including a canvas-drawn restart button with its own hit test.
Gridlayout
Bricks pack flush from y=48 — 8 columns × 50px, 4 rows × 20px. The render sprite is inset 2px so the eye reads 32 discrete blocks while the hitbox stays the exact grid cell.
Sweepmarch
Each physics tick is split into substeps capped at 1.5px. A ball moving 3.44px per frame can never tunnel a 20px brick, and no branch of the loop can skip a wall.
Sideresolution
Circle→AABB contact, then the shallowest penetration axis decides: flip dx for a side strike, flip dy for top or bottom. Only the deepest-overlapping brick resolves per substep, and velocity magnitude is never rewritten — only its signs.
Anglepaddle
Contact offset maps −1…+1 across the 60px face onto ±58°, plus a slice of live paddle velocity for slice shots. Dead-centre hits return a clean vertical, edge hits skim wide.
Budgetperf
A fixed 60Hz accumulator drives physics on any refresh rate; render runs once per animation frame. 32 bricks cost one drawImage each from a pre-rendered sprite. Backing store scales with devicePixelRatio, capped at 3×.
Inputdevices
Pointer capture and touchmove with preventDefault, so a drag never scrolls the page. Arrow keys ramp paddle velocity, tap launches, P pauses, R restarts. The keycaps above light up as you press them.