user
Write a response that appropriately completes the request.

### Instruction:
Explain how light travels.

### Response:
assistant
Light travels in waves, and is composed of both electrical and magnetic fields. These fields vibrate in a periodic manner, and the speed of light is determined by the frequency of these oscillations. Light travels in straight lines, and when it is reflected, refracted, absorbed, or diffracted, its direction is changed. When light passes through transparent substances, such as glass or water, it might be bent, causing its speed and direction to change.