Plugin to add falling snow to your MapGL map
npm install mapgl-snowPlugin to add falling snow to your 2GIS MapGL map.
Install with NPM:
``bash`
npm install mapgl-snow
Then initialize with passing MapGL Map object:
`js
import { load } from '@2gis/mapgl';
import { Snow } from 'mapgl-snow';
load().then((mapgl) => {
// Initialize MapGL map
const map = new mapgl.Map('map', {
center: [82.920412, 55.030111],
zoom: 15,
key: 'YOUR MAPGL API KEY',
});
// Initialize snow
const snow = new Snow(map);
// Change snow options on the fly
snow.setOptions(options);
});
`
Install in browser:
`html`
Snow options have several fields:
- minZoom – the minimum zoom from which the snow will be showncolor
- – the color of the snowflakes in RGBA format, e.g. [255, 255, 255, 1]size
- – the size of the snowflakesparticleNumber
- – the amount of the snowflakesvelocityX
- , velocityY, velocityZ – the wind speed in each directiondispersion` – the dispersion of the speed
-