> For the complete documentation index, see [llms.txt](https://docs.mapbox.com/mapbox-gl-js/ja/llms.txt)

# Create a wind particle animation

This example adds a data-driven particle animation onto a map.

A wind tileset derived from the Global Forecast System (GFS) is visualized as a particle animation. First, a [`raster-array` source](https://docs.mapbox.com/style-spec/reference/sources/#raster-array) is added containing the wind tileset in the [Mapbox Raster Tile](https://docs.mapbox.com/mapbox-tiling-service/guides/raster-mts/) format. Then, a [`raster-particle` layer](https://docs.mapbox.com/style-spec/reference/layers/#raster-particle) is added to render the animation.

> **Note (warning): Accessing Sources with Raster Layers**
> 
> This example uses a pre-built `raster-array` source. To create your own raster array source for particle visualization, you'll need to upload and process your data using Mapbox Tiling Service — see the [Visualize Wind Data](https://docs.mapbox.com/mapbox-tiling-service/examples/raster-mts-wind/) example for steps.

> Example code:

**JavaScript**

```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Create a wind particle animation</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<link href="https://api.mapbox.com/mapbox-gl-js/v3.28.1/mapbox-gl.css" rel="stylesheet">
<script src="https://api.mapbox.com/mapbox-gl-js/v3.28.1/mapbox-gl.js"></script>
<style>
body { margin: 0; padding: 0; }
#map { position: absolute; top: 0; bottom: 0; width: 100%; }
</style>
</head>
<body>
<div id="map"></div>
<script>
    const map = new mapboxgl.Map({
        // TO MAKE THE MAP APPEAR YOU MUST
        // ADD YOUR ACCESS TOKEN FROM
        // https://account.mapbox.com
        accessToken: 'YOUR_MAPBOX_ACCESS_TOKEN',
        container: 'map',
        // Choose from Mapbox's core styles, or make your own style with Mapbox Studio
        style: 'mapbox://styles/mapbox/standard',
        config: {
            basemap: {
                theme: 'monochrome',
                lightPreset: 'night'
            }
        },
        maxZoom: 2,
        minZoom: 2,
        zoom: 2,
        center: [-28, 47]
    });

    map.on('load', () => {
        map.addSource('raster-array-source', {
            'type': 'raster-array',
            'url': 'mapbox://rasterarrayexamples.gfs-winds',
            'tileSize': 512
        });
        map.addLayer({
            'id': 'wind-layer',
            'type': 'raster-particle',
            'source': 'raster-array-source',
            'source-layer': '10winds',
            'paint': {
                'raster-particle-speed-factor': 0.4,
                'raster-particle-fade-opacity-factor': 0.9,
                'raster-particle-reset-rate-factor': 0.4,
                'raster-particle-count': 4000,
                'raster-particle-max-speed': 40,
                'raster-particle-color': [
                    'interpolate',
                    ['linear'],
                    ['raster-particle-speed'],
                    1.5,
                    'rgba(134,163,171,256)',
                    2.5,
                    'rgba(126,152,188,256)',
                    4.12,
                    'rgba(110,143,208,256)',
                    4.63,
                    'rgba(110,143,208,256)',
                    6.17,
                    'rgba(15,147,167,256)',
                    7.72,
                    'rgba(15,147,167,256)',
                    9.26,
                    'rgba(57,163,57,256)',
                    10.29,
                    'rgba(57,163,57,256)',
                    11.83,
                    'rgba(194,134,62,256)',
                    13.37,
                    'rgba(194,134,63,256)',
                    14.92,
                    'rgba(200,66,13,256)',
                    16.46,
                    'rgba(200,66,13,256)',
                    18.0,
                    'rgba(210,0,50,256)',
                    20.06,
                    'rgba(215,0,50,256)',
                    21.6,
                    'rgba(175,80,136,256)',
                    23.66,
                    'rgba(175,80,136,256)',
                    25.21,
                    'rgba(117,74,147,256)',
                    27.78,
                    'rgba(117,74,147,256)',
                    29.32,
                    'rgba(68,105,141,256)',
                    31.89,
                    'rgba(68,105,141,256)',
                    33.44,
                    'rgba(194,251,119,256)',
                    42.18,
                    'rgba(194,251,119,256)',
                    43.72,
                    'rgba(241,255,109,256)',
                    48.87,
                    'rgba(241,255,109,256)',
                    50.41,
                    'rgba(256,256,256,256)',
                    57.61,
                    'rgba(256,256,256,256)',
                    59.16,
                    'rgba(0,256,256,256)',
                    68.93,
                    'rgba(0,256,256,256)',
                    69.44,
                    'rgba(256,37,256,256)'
                ]
            }
        });
    });
</script>

</body>
</html>
```

**React**

```jsx
import React, { useEffect, useRef } from 'react';
import * as mapboxgl from 'mapbox-gl/esm';

import 'mapbox-gl/dist/mapbox-gl.css';

const MapboxExample = () => {
  const mapContainerRef = useRef();
  const mapRef = useRef();

  useEffect(() => {
    mapRef.current = new mapboxgl.Map({
      // TO MAKE THE MAP APPEAR YOU MUST
      // ADD YOUR ACCESS TOKEN FROM
      // https://account.mapbox.com
      accessToken: 'YOUR_MAPBOX_ACCESS_TOKEN',
      container: mapContainerRef.current,
      style: 'mapbox://styles/mapbox/standard',
      config: {
        basemap: {
          theme: 'monochrome',
          lightPreset: 'night'
        }
      },
      maxZoom: 2,
      minZoom: 2,
      zoom: 2,
      center: [-28, 47]
    });

    mapRef.current.on('load', () => {
      mapRef.current.addSource('raster-array-source', {
        type: 'raster-array',
        url: 'mapbox://rasterarrayexamples.gfs-winds',
        tileSize: 512
      });
      mapRef.current.addLayer({
        id: 'wind-layer',
        type: 'raster-particle',
        source: 'raster-array-source',
        'source-layer': '10winds',
        paint: {
          'raster-particle-speed-factor': 0.4,
          'raster-particle-fade-opacity-factor': 0.9,
          'raster-particle-reset-rate-factor': 0.4,
          'raster-particle-count': 4000,
          'raster-particle-max-speed': 40,
          'raster-particle-color': [
            'interpolate',
            ['linear'],
            ['raster-particle-speed'],
            1.5,
            'rgba(134,163,171,256)',
            2.5,
            'rgba(126,152,188,256)',
            4.12,
            'rgba(110,143,208,256)',
            4.63,
            'rgba(110,143,208,256)',
            6.17,
            'rgba(15,147,167,256)',
            7.72,
            'rgba(15,147,167,256)',
            9.26,
            'rgba(57,163,57,256)',
            10.29,
            'rgba(57,163,57,256)',
            11.83,
            'rgba(194,134,62,256)',
            13.37,
            'rgba(194,134,63,256)',
            14.92,
            'rgba(200,66,13,256)',
            16.46,
            'rgba(200,66,13,256)',
            18.0,
            'rgba(210,0,50,256)',
            20.06,
            'rgba(215,0,50,256)',
            21.6,
            'rgba(175,80,136,256)',
            23.66,
            'rgba(175,80,136,256)',
            25.21,
            'rgba(117,74,147,256)',
            27.78,
            'rgba(117,74,147,256)',
            29.32,
            'rgba(68,105,141,256)',
            31.89,
            'rgba(68,105,141,256)',
            33.44,
            'rgba(194,251,119,256)',
            42.18,
            'rgba(194,251,119,256)',
            43.72,
            'rgba(241,255,109,256)',
            48.87,
            'rgba(241,255,109,256)',
            50.41,
            'rgba(256,256,256,256)',
            57.61,
            'rgba(256,256,256,256)',
            59.16,
            'rgba(0,256,256,256)',
            68.93,
            'rgba(0,256,256,256)',
            69.44,
            'rgba(256,37,256,256)'
          ]
        }
      });
    });
  }, []);

  return <div id="map" ref={mapContainerRef} style={{ height: '100%' }}></div>;
};

export default MapboxExample;
```