aframe light (component) Directional


Directional lights are like a light source that is infinitely far away, but shining from a specific direction, like the sun. Thus, absolute position do not have an effect on the intensity of the light on an entity. We can specify the direction using the position component.

The example below creates a light source shining from the upper-left at a 45-degree angle. Note that because only the vector matters, position="-100 100 0" and position="-1 1 0" are the same.

<a-entity light="type: directional; color: #EEE; intensity: 0.5" position="-1 1 0"></a-entity>

We can specify the direction of the directional light with its orientation by creating a child entity it targets. For example, pointing down its -Z axis:

<a-light type="directional" position="0 0 0" rotation="-90 0 0" target="#directionaltarget">
    <a-entity id="directionaltarget" position="0 0 -1"></a-entity>