Click the green flag, then the things that look like buttons. The question mark button explains what the buttons do.
I made this when I was learning about reflection and refraction in Physics class. I had a couple days with no immediate homework, so I figured this would be a fun way to spend them since it would help me get a more intuitive understanding of how light works. I hope it helps you too. This program lets you get away with more than real life does. For example, it can calculate indices of refraction below 1, and even below 0, which are both impossible. When you're adjusting θ1 with n1 > n2 and you see θ2 jump to NaN, that's because you've surpassed the critical angle of incidence for n1 and n2, meaning no light would actually be refracted in real life (it would all reflect off the boundary, following the gray arrow.) The calculations for how light behaves when it goes from one material to another are all summed up in Snell's Law of Refraction: n1*sin(θ1) = n2*sin(θ2), where n1 and n2 are the indices of refraction of the two materials and θ1 and θ2 are the angles the light rays make. This makes it super easy to find one of the variables if you know the other three, and makes simulating simplified light rays easier than you might expect. The hardest part about making this project was getting all the angle math correct, and getting Scratch to interpret the angles the way I wanted it to.