Under the bezel — collision & feel
01
AABB + minimum penetration
The ball's 3px radius is expanded into a box, tested against each live brick cell (50×20). The axis with the smaller overlap decides the bounce face — flip dy for top/bottom, dx for left/right — then the ball is pushed clear of the cell so it never re-enters.
02
One hit per frame
Every candidate collision is scored by depth; only the closest is resolved. No brick clusters, no tunnelling, no stuck ball.
03
Constant magnitude
Velocity is renormalised to 3.44px/frame after every bounce.
04
Paddle angle control
Offset from paddle centre maps to a ±60° exit vector, so edge hits skim and dead-centre hits stack vertically. Paddle sides are solid too.
05
Fixed 60Hz timestep
Rendered with requestAnimationFrame, simulated on a 16.67ms accumulator — identical physics on 60Hz and 120Hz panels. Static brick and backdrop layers are baked to offscreen canvases and only repainted when the field changes.
06
Touch native
touchstart / move / end map the finger to canvas space, clamped to 0–340px.