Skip to content
All projects

Refraction Calculator

An interactive Snell's law playground — drag the incident ray and watch refraction, critical angles and total internal reflection happen live.

p5.js physics

Built with: p5.js · JavaScript

Snell’s law on paper: n₁ sin θ₁ = n₂ sin θ₂. Snell’s law in this app: grab the light ray with your mouse and bend it through different media.

Highlights

  • Drag the incident ray and read the refracted angle in real time
  • Change the refractive indices of both media
  • Push past the critical angle and watch total internal reflection kick in