---
title: "ParticleLayerOptions | Weather SDK | JavaScript maps SDK"
description: "Documentation for Weather JS"
---

# Type Alias ParticleLayerOptions

Options specific to the particle visualization

type ParticleLayerOptions \= {  
    [angleDirectionShiftSkip](#angledirectionshiftskip)?: number;  
    [color](#color)?: [RgbaColor](https://docs.maptiler.com/sdk-js/modules/weather/api-reference/types/RgbaColor/);  
    [decodeAsWaves](#decodeaswaves)?: boolean;  
    [decodeChannels](#decodechannels)?: string;  
    [decodeMagnitudeMax](#decodemagnitudemax)?: number;  
    [decodeMax](#decodemax): number;  
    [decodeMin](#decodemin): number;  
    [density](#density)?: number;  
    [drawAsLines](#drawaslines)?: boolean;  
    [fadeFactor](#fadefactor)?: number;  
    [fastColor](#fastcolor)?: [RgbaColor](https://docs.maptiler.com/sdk-js/modules/weather/api-reference/types/RgbaColor/);  
    [fastIsLarger](#fastislarger)?: boolean;  
    [fastSpeed](#fastspeed)?: number;  
    [fieldColorMax](#fieldcolormax)?: number;  
    [fieldColorMin](#fieldcolormin)?: number;  
    [maxAmount](#maxamount)?: number;  
    [pixelRatio](#pixelratio)?: number;  
    [refreshInterval](#refreshinterval)?: number;  
    [renderTrails](#rendertrails)?: boolean;  
    [size](#size)?: number;  
    [speed](#speed)?: number;  
    [uniformSpeed](#uniformspeed)?: boolean;  
    [useAlphaAsMask](#usealphaasmask)?: boolean;  
}

##### Index

### Properties

[angleDirectionShiftSkip?](#angledirectionshiftskip) [color?](#color) [decodeAsWaves?](#decodeaswaves) [decodeChannels?](#decodechannels) [decodeMagnitudeMax?](#decodemagnitudemax) [decodeMax](#decodemax) [decodeMin](#decodemin) [density?](#density) [drawAsLines?](#drawaslines) [fadeFactor?](#fadefactor) [fastColor?](#fastcolor) [fastIsLarger?](#fastislarger) [fastSpeed?](#fastspeed) [fieldColorMax?](#fieldcolormax) [fieldColorMin?](#fieldcolormin) [maxAmount?](#maxamount) [pixelRatio?](#pixelratio) [refreshInterval?](#refreshinterval) [renderTrails?](#rendertrails) [size?](#size) [speed?](#speed) [uniformSpeed?](#uniformspeed) [useAlphaAsMask?](#usealphaasmask)

## Properties

### `Optional`angleDirectionShiftSkip[](#angledirectionshiftskip)

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)

### `Optional`color[](#color)

color?: [RgbaColor](https://docs.maptiler.com/sdk-js/modules/weather/api-reference/types/RgbaColor/)

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

### `Optional`decodeAsWaves[](#decodeaswaves)

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).

### `Optional`decodeChannels[](#decodechannels)

decodeChannels?: string

Channels to read the UV values from. Defaults to `rg`

### `Optional`decodeMagnitudeMax[](#decodemagnitudemax)

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[](#decodemax)

decodeMax: number

Maximum encoded value.

### decodeMin[](#decodemin)

decodeMin: number

Minimum encoded value.

### `Optional`density[](#density)

density?: number

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

### `Optional`drawAsLines[](#drawaslines)

drawAsLines?: boolean

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

### `Optional`fadeFactor[](#fadefactor)

fadeFactor?: number

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

### `Optional`fastColor[](#fastcolor)

fastColor?: [RgbaColor](https://docs.maptiler.com/sdk-js/modules/weather/api-reference/types/RgbaColor/)

Color of the particle when moving "fast". RGBA 0-255. Defaults to [color](#color)

### `Optional`fastIsLarger[](#fastislarger)

fastIsLarger?: boolean

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

### `Optional`fastSpeed[](#fastspeed)

fastSpeed?: number

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

### `Optional`fieldColorMax[](#fieldcolormax)

fieldColorMax?: number

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

### `Optional`fieldColorMin[](#fieldcolormin)

fieldColorMin?: number

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

### `Optional`maxAmount[](#maxamount)

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](#density).

### `Optional`pixelRatio[](#pixelratio)

pixelRatio?: number

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

### `Optional`refreshInterval[](#refreshinterval)

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`.

### `Optional`renderTrails[](#rendertrails)

renderTrails?: boolean

Render the trails of the particles. Defaults to `true`.

### `Optional`size[](#size)

size?: number

Size of the particle. Defaults to `1`

### `Optional`speed[](#speed)

speed?: number

Speed factor of the particles. Defaults to `0.001`

### `Optional`uniformSpeed[](#uniformspeed)

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`

### `Optional`useAlphaAsMask[](#usealphaasmask)

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`.
