The light that shades HoloMap.Layer.FillExtrusion layers.
<HoloMap.Light anchor="viewport" color="#ffffff" intensity={0.4} position={[1.15, 210, 30]} />Like HoloMap.Sky, the light is a property of the map rather than a layer:
the component's presence sets it, and its absence returns the map to the
light the style declares, or to MapLibre's default light for a style that
declares none. Only fill-extrusion layers are lit, so on a map without one
the component changes nothing you can see.
Props
| Prop | Type | Notes |
|---|---|---|
anchor | string | "viewport", the default: the light stays where it is as the map rotates. "map": the light turns with the map |
color | color | The colour of the light. Default "#ffffff" |
intensity | number | 0-1. Higher gives more contrast between lit and shaded faces. Default 0.5 |
position | list | [radial, azimuthal, polar]: the light's distance from the base of what it lights, its direction in degrees clockwise from the top of the viewport, or from north with anchor="map", and its height in degrees from straight above, 0, to straight below, 180. Default [1.15, 210, 30] |
color, intensity and position accept an expression on the zoom as well
as a literal, such as a light that grows stronger as the map zooms in:
<HoloMap.Light intensity={["interpolate", ["linear"], ["zoom"], 14, 0.2, 17, 0.6]} />Applying it
The light is set with MapLibre's setLight once the style has loaded, and
as its props change. MapLibre moves to the new light over the style's
transition, 300 ms unless the style sets another. A prop left unset, or
set back to nil, takes the style's own value for it, else MapLibre's
default.
A change to HoloMap.Map's style keeps the light: it is set again over
the new style's own light once the new style has loaded, whether MapLibre
diffs the new style or builds it from scratch, and once MapLibre has built
the style again after a WebGL context loss, from a copy that holds only
the style's own light.
A value MapLibre refuses, such as an anchor that is neither of the two,
leaves the light as it was. MapLibre logs it to the browser console rather
than reporting it through on_error: its light reports errors to no
listener of the map.
Summary
Functions
Returns true to indicate that the callee module is a component module (has "use Hologram.Component" directive).
Returns the list of property definitions for the compiled component.
Functions
@spec __is_hologram_component__() :: boolean()
Returns true to indicate that the callee module is a component module (has "use Hologram.Component" directive).
Examples
iex> __is_hologram_component__()
true
Returns the list of property definitions for the compiled component.