Monochromatic light passing through two parallel narrow slits to a screen forms a pattern of alternate light and dark stripes. The light stripes are brightest at those points on the screen where the distances to the two slits differs by a whole number of wavelengths, so the waves from the slits arrive at those points in sync: the waves add constructively. At points where the difference is half a wavelength, the waves are exactly out of phase, the waves have the same amplitude but opposite sign, and add destructively, leaving darkness.
In this applet, the pattern is built up by moving across the screen checking the relative phase of the waves from the two slits at each point on the screen.
The wavelength and slit separation can each be adjusted to see how the pattern changes.
Code by Nicholas Anderson and Lawrence Hook.