Drag the playfield to steer · ← → on desktop
Drag the playfield to steer · ← → on desktop
No physics engine, no libraries. Explicit swept-axis collision resolution against a fixed 8×4 grid, driven by a fixed timestep.
ox, oy) picks the reflection axis; the previous frame position disambiguates corner hits.rel = (ballX - paddleCenter) / (paddleW/2) maps to ±60°, and the vector is re-normalized to a constant magnitude of 3.4 px/step — edges bite hard, the middle plays safe.requestAnimationFrame accumulates real delta time and consumes it in 16.67 ms ticks, so 120 Hz displays and throttled tabs see identical ball speed. Two substeps per tick prevent tunnelling through 20 px bricks.getBoundingClientRect() into the 400-unit logical space, clamped to 0–340, then smoothed toward the target so fast swipes don't jitter the paddle.