---
agentTools:
  projectIndex: https://whsjs.readme.io/llms.txt
---

# DirectionalLight

[components / lights / DirectionalLight.js](https://github.com/WhitestormJS/whitestorm.js/blob/dev/src/framework/components/lights/DirectionalLight.js)

`WHS.DirectinalLight` creates a light that shines from a specific direction not from a specific position.

This light will behave as though it is infinitely far away and the rays produced from it are all parallel.

The best analogy would be a light source that acts like the sun: the sun is so far away that all sunlight hitting objects comes from the same angle.

It has the same options as `WHS.AmbientLight` in `light` paramater, but it also supports `pos` and `target` paramaters.

[block:code]
{
  "codes": [
    {
      "code": "new WHS.DirectionalLight( {\n  light: {\n    color: 0xffffff,\n    intensity: 0.2\n  },\n\n  position: [10, 20, 10]\n}).addTo(world);",
      "language": "javascript"
    }
  ]
}
[/block]

[block:callout]
{
  "type": "info",
  "body": "This light will fall down from vec3(10, 20, 10) to vec3(0, 0, 0)"
}
[/block]