Keyboard: focus the canvas with Tab, then use the arrow keys to swing the ray.How to use: Drag the round handle at the end of the incoming ray
to change its angle. Two sliders set how optically dense each material is
(its refractive index). The dashed vertical line is the normal —
angles are always measured from it. Try the Water → Air preset and
drag the ray to a large angle.
Notice: n₁ sin θ₁ always equals n₂ sin θ₂ — that's Snell's law. And when light tries to go from dense to less dense at too steep an angle, it can't escape — it reflects back entirely. That's total internal reflection, and it's how fibre optic cables work.