On this page

Type Alias ParticleLayerOptions

Options specific to the particle visualization

type ParticleLayerOptions = {
    angleDirectionShiftSkip?: number;
    color?: RgbaColor;
    decodeAsWaves?: boolean;
    decodeChannels?: string;
    decodeMagnitudeMax?: number;
    decodeMax: number;
    decodeMin: number;
    density?: number;
    drawAsLines?: boolean;
    fadeFactor?: number;
    fastColor?: RgbaColor;
    fastIsLarger?: boolean;
    fastSpeed?: number;
    fieldColorMax?: number;
    fieldColorMin?: number;
    maxAmount?: number;
    pixelRatio?: number;
    refreshInterval?: number;
    renderTrails?: boolean;
    size?: number;
    speed?: number;
    uniformSpeed?: boolean;
    useAlphaAsMask?: boolean;
}
Index

Properties

angleDirectionShiftSkip?: number

This angle respresents the change of direction of a particle between a render call and the next. If a particle changes direction abruptly with an angle greater than angleDirectionShiftSkip, then it is no longer rendered.

A value of 30 (degrees) is a good compromise to reduce the "splashing" effect particle can have on the side of hurricanes at semi-global-scale zoom level.

Default: 90 (no skipping unless the particle changes direction to go backward between two render calls, which is unlikely)

color?: RgbaColor

Color of the particle. RGBA 0-255. Defaults to [255, 255, 255, 192]

decodeAsWaves?: boolean

Decode the channels as "direction + period" rather than "UV".

If true, the first channel is assumed to be direction (0-360deg) and the second to be the period (1/speed).

decodeChannels?: string

Channels to read the UV values from. Defaults to rg

decodeMagnitudeMax?: number

Upper bound on the magnitude of the decoded field vector when packing a normalized scalar into the second particle RTT attachment (for coloring). Defaults to √2 × max(|decodeMin|, |decodeMax|), a safe upper bound when each channel lies in [decodeMin, decodeMax].

decodeMax: number

Maximum encoded value.

decodeMin: number

Minimum encoded value.

density?: number

Number of particles visible per 1000 px^2. Default is 2.

drawAsLines?: boolean

Draw the particles as lines (size is length). Defaults to false.

fadeFactor?: number

How much the particles fade over time. Default value is 0.1.

fastColor?: RgbaColor

Color of the particle when moving "fast". RGBA 0-255. Defaults to color

fastIsLarger?: boolean

If this is true, the particles gets slighly larger as they become faster. Default: false

fastSpeed?: number

What is considered "fast" (in px/sec) for coloring purposes. Only makes sense when fastColor is used.

fieldColorMax?: number

Upper bound (inclusive) for full fastColor: at or above this, the fast color is used. Between min and max, colors interpolate linearly. Defaults to decodeMagnitudeMax when omitted.

fieldColorMin?: number

Lower bound (inclusive) of decoded scalar magnitude for particle color: at or below this, color is used. Must be >= 0. Defaults to 0.

maxAmount?: number

Quantity of particles to be created. Default value is 128. Has to be a power of 2 and at least 4. The actual exact number will be particles * particles. Try to keep this value as low as possible to optimize performance.

The number of actually visible particles is determined by density.

pixelRatio?: number

Use more pixels to make particles more smooth (especially when tilted). Defaults to 2 for normal displays and 1 for HiDPI displays.

refreshInterval?: number

Time interval (in milliseconds) how often the particles are refreshed to avoid degradation. Random 1/16 of the particles is always randomly reset. Default value is 800.

renderTrails?: boolean

Render the trails of the particles. Defaults to true.

size?: number

Size of the particle. Defaults to 1

speed?: number

Speed factor of the particles. Defaults to 0.001

uniformSpeed?: boolean

When true, the speed of particles (and trail length) will be the same in number of pixel traveled per second, regardless of the size of the screen, which is convenient to provide a comparable experience on mobile/desktop.

If disabled, the particles will be slower and with a shorter trail on smalled screen such as mobile.

Default: false

useAlphaAsMask?: boolean

If true, the particles will only be displayed where the alpha channel is 255. This is to be set to true for tilesets that do not cover the entire globe. Default value is false.

Was this helpful?
SDK JS
Modules
Reference
types
ParticleLayerOptions