Rotate goal opening based on viewport aspect ratio

Featurekamo-internal
Shipped
April 30, 2026 at 1:48 AM UTC
Author
kamo
Commit
7cd97df

The goal frame now tilts by atan2(viewportH, viewportW) so its open right side aims toward the viewport diagonal — for 16:9 monitors the opening points ~29° south of east; for portrait it points closer to south. Reads the way users naturally throw heads from the bulk of the screen back toward the upper-left corner. Physics: goal collision now runs in goal-LOCAL coords. Each thrown head's center+velocity rotate into the local frame, the existing AABB collision against axis-aligned walls runs unchanged, then any push-out and velocity reflection rotates back to world space. The score zone check is also done in local coords so a head genuinely entering the (rotated) opening still scores. Visual: the SVG frame + entry-side glow live inside a rotation container; celebration overlays (GOAL!/MISS!) and the REMOVE caption sit outside the rotation so text stays readable. Miss-shake now oscillates around the base angle instead of zero. Goal angle is recomputed on viewport resize via a state setter, with a parallel ref so the throw RAF reads the latest value each frame without re-creating the callback.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing