vector reflection (bounce) — live canvas animation example

motion & easing8+
trig, angles & vectors8-
collision detection11+
numbers in motion7+
geometry & shapes8+
generative showpieces13+
handy helpers7+
0 = freeze the wall

An incoming velocity vector (orange) hits an angled surface and leaves as a reflected vector (indigo). vecReflect uses the surface normal (green dashed), not the wall direction itself, to compute that ricochet. Rotate or freeze the wall and you can see the same incoming motion bounce to a different outgoing angle.