Streams of particles don’t swerve when they meet a barrier – they either pass or not:
Because photons vibrate, those passing too close to an edge encounter a slight electron field drag on their edge side causing them to swerve behind it. 3
How much they swerve depends on their wavelength and phase as they encounter the edge. Look closely. Notice the slight color fringe in the bent rays. Like the last rays from a sun below the horizon, long wavelengths are bent more than short ones due to longer proximity to the edge:4
Such “bending” around an edge is characteristic of waves in general. e.g. Long wavelength (low frequency) sound waves bend around walls and rocks. However, sound waves bend as a result of spreading air or water pressure behind an edge. Photon diffraction does not depend on the medium it travels through.
Altough it occurs for a different reason than the bending of sound waves, this similar bending of light around an edge was an early clue to its wave-like nature.
While these fringes are scarcely noticeable with a single edge, this effect from hundreds of edges close together (a diffraction grating) adds up producing vivid spectra:
Similar spectral effects also appear in reflections from the fine grooves on compact audio disks.
More compelling evidence of the wave properties of photons appears when photons of a single wavelength are directed at two adjacent slits:
With two edges, each slit diffracts photons in both directions. At various locations photons diffracted in the same direction from each slit cross paths. When these photons are in the opposite phase of vibration, their energies cancel producing darkness at that location. At another location photons from each slit will arrive in phase, and their energies sum resulting in brightness.
Treating streams of photons like linear rays is great for visualizing how images are formed and lighting application. Yet it is their vibration that determines what they do and how to control them.