Shrinking Circle Escape
A ball bounces around inside a spinning ring. The ring has one open gap — bounce off
the solid arc, and every time a ball finds the gap and escapes, the ring shrinks a
notch and spawns fresh balls back at the center.
Balls: 0
Escapes: 0
Ring radius: 0
Start
Restart
Pause
Sound: On
How it works: every ball carries gravity and constant-speed velocity.
Each frame it moves, then we check its distance from the center against the ring's
radius. If it's past the boundary and its angle falls inside the (slowly rotating)
gap window, it's let through. Otherwise, we reflect its velocity across the radial
normal at the collision point — the standard "bounce off a curved wall" formula,
v' = v − 2(v·n)n — so it caroms off convincingly instead of just
reversing direction. Once a ball clears the boundary by a few radii it's marked
"escaped": it's removed, the ring shrinks by a fixed step (resetting to full size once
it gets too small), and a fresh batch of balls spawns from the center. The gap itself
keeps sweeping around the circle the whole time, so timing an escape is really about
the ball's angle lining up with a moving target.