Skip to main content

light

The light attribute provides a global light source for the map. The light attribute affects the fill-extrusion layer. The specific usage is as follows:

"light": {
"anchor": `"viewport"`,
"color": "white",
"intensity": 0.4
}

View lighting method (Anchor)

Optional attribute. enum. Optional one of "map" and "viewport", the default is "viewport".

Whether the fill-extrusion layer’s geometry is lit relative to the map or view.

"map": The light’s position is aligned with the map’s rotation.

"viewport": The position of the light is aligned with the rotation of the view.

"anchor": `"map"`

##Color Optional attribute. color. Default is "#ffffff". Supports interpolate expressions. Transitionable.

The color tint used to illuminate the fill-extrusion layer geometry.

Light intensity (Intensity)

Optional attribute. number between 0 and 1, default value 0.5. Supports interpolate expressions. Transitionable.

Light intensity (from 0 to 1). The larger the value, the stronger the light.

##Position Optional attribute. array. Default value [1.15,210,30]. Supports interpolate expressions. Transitionable.

The position of the light source relative to the geometry being lit (extruded), in [r polar coordinates, a azimuth angle, p polar angle], r represents the distance from the center of the bottom of the object to the light source, a represents the position of the light source relative to 0° (when the light source is 0°. The anchor point is set to correspond to the top of the view, or 0° when the light source. The anchor point is set to the north direction of the map, rotated clockwise), and p represents the height of the light source (from 0° to 180°).

"position": [
1.5,
90,
80
]