Skip to main content

RasterParticleLayer

Mapbox spec: raster-particle

import { RasterParticleLayer } from '@rnmapbox/maps';

RasterParticleLayer

RasterParticleLayer renders a particle animation driven by velocity data from a raster array source. This is typically used to visualize wind patterns, ocean currents, or other directional flow data.

@experimental This component requires Mapbox Maps SDK v11.4.0 or later

props

id

string

required A string that uniquely identifies the source in the style to which it is added.

existing

boolean

The id refers to an existing layer in the style. Does not create a new layer.

sourceID

string

The source from which to obtain the data to style. If the source has not yet been added to the current style, the behavior is undefined. Inferred from parent source only if the layer is a direct child to it.

defaults to: Mapbox.StyleSource.DefaultSourceID

sourceLayerID

string

Identifier of the layer within the source identified by the sourceID property from which the receiver obtains the data to style.

aboveLayerID

string

Inserts a layer above aboveLayerID.

belowLayerID

string

Inserts a layer below belowLayerID

layerIndex

number

Inserts a layer at a specified index

filter

FilterExpression

Filter only the features in the source layer that satisfy a condition that you define

minZoomLevel

number

The minimum zoom level at which the layer gets parsed and appears.

maxZoomLevel

number

The maximum zoom level at which the layer gets parsed and appears.

slot

'bottom' | 'middle' | 'top'

The slot this layer is assigned to. If specified, and a slot with that name exists, it will be placed at that position in the layer order.

v11 only

style

RasterParticleLayerStyleProps

required Customizable style attributes

styles


visibility

Name: visibility

Mapbox spec: visibility

Description

Whether this layer is displayed.

Type

enum

Default Value

visible

Supported Values

visible - The layer is shown.
none - The layer is not shown.

Expression

Parameters: ``


rasterParticleArrayBand

Name: rasterParticleArrayBand

Mapbox spec: raster-particle-array-band

Description

Displayed band of raster array source layer

Type

string


rasterParticleCount

Name: rasterParticleCount

Mapbox spec: raster-particle-count

Description

Defines the amount of particles per tile.

Type

number

Default Value

512

Minimum

1


rasterParticleColor

Name: rasterParticleColor

Mapbox spec: raster-particle-color

Description

Defines a color map by which to colorize a raster particle layer, parameterized by the ["rasterParticleSpeed"] expression and evaluated at 256 uniformly spaced steps over the range specified by rasterParticleMaxSpeed.

Type

color

Expression

Parameters: raster-particle-speed


rasterParticleMaxSpeed

Name: rasterParticleMaxSpeed

Mapbox spec: raster-particle-max-speed

Description

Defines the maximum speed for particles. Velocities with magnitudes equal to or exceeding this value are clamped to the max value.

Type

number

Default Value

1

Minimum

1


rasterParticleSpeedFactor

Name: rasterParticleSpeedFactor

Mapbox spec: raster-particle-speed-factor

Description

Defines a coefficient for the speed of particles’ motion.

Type

number

Default Value

0.2

Minimum

0

Maximum

1

Expression

Parameters: zoom


rasterParticleSpeedFactorTransition

Name: rasterParticleSpeedFactorTransition

Description

The transition affecting any changes to this layer’s rasterParticleSpeedFactor property.

Type

{ duration, delay }

Units

milliseconds

Default Value

{duration: 300, delay: 0}


rasterParticleFadeOpacityFactor

Name: rasterParticleFadeOpacityFactor

Mapbox spec: raster-particle-fade-opacity-factor

Description

Defines defines the opacity coefficient applied to the faded particles in each frame. In practice, this property controls the length of the particle tail.

Type

number

Default Value

0.98

Minimum

0

Maximum

1

Expression

Parameters: zoom


rasterParticleFadeOpacityFactorTransition

Name: rasterParticleFadeOpacityFactorTransition

Description

The transition affecting any changes to this layer’s rasterParticleFadeOpacityFactor property.

Type

{ duration, delay }

Units

milliseconds

Default Value

{duration: 300, delay: 0}


rasterParticleResetRateFactor

Name: rasterParticleResetRateFactor

Mapbox spec: raster-particle-reset-rate-factor

Description

Defines a coefficient for a time period at which particles will restart at a random position, to avoid degeneration (empty areas without particles).

Type

number

Default Value

0.8

Minimum

0

Maximum

1