Actually, the speed of light is affected by the medium it travels through. The speed of light in a vacuum is a constant. It moves slightly slower in air, and slower still in water or clear glass. That's why a light ray bends as it moves from one medium to another. This phenomenon is called refraction. Refraction is what makes lenses work.
Also, the change in speed of light in glass is different for different frequencies (colors), so the angle of refraction is different. That's why you get a spectrum when sunlight shines through a prism. It is also why rainbows happen.
I think the reason light is slowed down in a medium is that when a photon (particle of light) happens to hit an atom, it can get absorbed. The energy causes one or more electrons to be knocked outward to higher orbitals. When they later return to their original lower (home) orbitals, another photon is emitted. The net effect is as if the same photon moves out of the atom as entered it, but it is delayed.
Also, the change in speed of light in glass is different for different frequencies (colors), so the angle of refraction is different. That's why you get a spectrum when sunlight shines through a prism. It is also why rainbows happen.
I think the reason light is slowed down in a medium is that when a photon (particle of light) happens to hit an atom, it can get absorbed. The energy causes one or more electrons to be knocked outward to higher orbitals. When they later return to their original lower (home) orbitals, another photon is emitted. The net effect is as if the same photon moves out of the atom as entered it, but it is delayed.