If we use the example illustrated above shows that the first medium of air the light travels straight but when it hits the second medium of the glass it bends depending on which side hits the second medium first, it will bend left if the left side hits the second medium and slows down and refracts.
Not only the direction changes but separation of the waves decreases as the frequency of the waves does not change by its source but the shower speed must shorten the wavelength.
This is also interesting in sound because if the air above the earth is warmer than the surface, sound will bend back downwards towards the surface by refraction. refraction.
Refraction also amplifies sound sometimes over cool lakes in the morning. The water keeps the air cool near the water but as the sun comes up it heats the air higher up creating a thermal inversion. The speed of sound is faster in the warmer air and so bends some sound back towards you.
also see: Diffraction