Class RadialGradientLayerMaptiler
Implements
Index
Constructors
Properties
Methods
Constructors
Maptilerconstructor
Creates a new RadialGradientLayer instance.
Parameters
- gradient: boolean | GradientDefinition
Configuration options for the radial gradient or a boolean value. If a boolean is provided, default configuration options will be used. If an
RadialGradientLayerConstructorOptionsis provided, it will be merged with default options.
Returns RadialGradientLayer
- gradient: boolean | GradientDefinition
Properties
Maptilerid
A unique layer id.
MaptilerrenderingMode
Either "2d" or "3d". Defaults to "2d".
Maptilertype
The layer's type. Must be "custom".
Methods
MaptilergetConfig
Returns the current gradient configuration of the radial gradient layer.
Returns GradientDefinition
The current gradient configuration.
Maptilerhide
Returns void
MaptileronAdd
Adds the radial gradient layer to the specified map. This method is called by the map when the layer is added to it.
Parameters
- map: Map
The MapSDK instance to which this layer is being added
- gl: WebGLRenderingContext | WebGL2RenderingContext
The WebGL rendering context used for rendering the layer
Returns void
void
- map: Map
MaptileronRemove
Optional method called when the layer has been removed from the Map with Map.removeLayer. This gives the layer a chance to clean up gl resources and event listeners.
Parameters
- _map: Map
- gl: WebGLRenderingContext | WebGL2RenderingContext
The gl context for the map.
Returns void
Maptilerprerender
- prerender(
_gl: WebGLRenderingContext | WebGL2RenderingContext,
_options: CustomRenderMethodInput,
): voidOptional method called during a render frame to allow a layer to prepare resources or render into a texture.
The layer cannot make any assumptions about the current GL state and must bind a framebuffer before rendering.
Parameters
- _gl: WebGLRenderingContext | WebGL2RenderingContext
- _options: CustomRenderMethodInput
Returns void
Maptilerrender
- render(
gl: WebGLRenderingContext | WebGL2RenderingContext,
options: CustomRenderMethodInput,
): voidCalled during a render frame allowing the layer to draw into the GL context.
The layer can assume blending and depth state is set to allow the layer to properly blend and clip other layers. The layer cannot make any other assumptions about the current GL state.
If the layer needs to render to a texture, it should implement the
prerendermethod to do this and only use therendermethod for drawing directly into the main framebuffer.The blend function is set to
gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA). This expects colors to be provided in premultiplied alpha form where ther,gandbvalues are already multiplied by theavalue. If you are unable to provide colors in premultiplied form you may want to change the blend function togl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA).Parameters
Returns void
MaptilersetAnimationActive
Parameters
- active: boolean
Returns void
MaptilersetGradient
Sets a new gradient for the radial gradient layer and animates the transition.
This method first animates the current gradient out, then updates the gradient property with the new gradient definition, and finally animates the new gradient in.
Parameters
- gradient: boolean | GradientDefinition
The new gradient definition to set for this layer.
Returns Promise<void>
A promise that resolves when the new gradient is set and animated in.
- gradient: boolean | GradientDefinition
MaptilershouldUpdate
Checks if the gradient needs to be updated based on the provided specification.
Parameters
OptionalnewSpec: boolean | GradientDefinition
Returns boolean
True if the gradient needs to be updated, false otherwise.
Maptilershow
Returns void
A custom map layer that renders a radial gradient effect, typically used as a halo around a globe. This layer uses WebGL for rendering and provides animation capabilities.
The layer is implemented as a 3D custom layer that renders a billboard quad with a radial gradient shader. The gradient can be configured with multiple color stops and can be animated.
Example
Remarks
You shouldn't have to use this class directly. Instead, use the
Map.setHalomethod to create and add a halo layer to the map.