The velocity of wave changes when wave move from one media into another media.
For light: The index of refraction is defined as , where
is the speed of light in vacuum, and
is the speed of light in media.
The following animation use many dogs running from one region into another region.
Due to the condition on the ground , dogy's speed is different when running from one region into another region.
It obeys Snell's Law .
You can use slider to change speed of running dogs and c1 to change it moving direction.