0.1.1 • Published 6 years ago

leaflet-snow v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Leaflet.Snow

WebGL snow animation for Leaflet maps. Extends L.Polygon.

Demo

Installation

works with leaflet@1.x.x

npm install leaflet
npm install leaflet-snow
import L from 'leaflet';
import 'leaflet-snow';

Usage

let map = L.map(...);

let points = [[latlngs], [latlngs], ...],
    options = {
        speed: 100,
        layersCount: 1,
        density: 1,
        size: 10,
        color: 'Oxffffff',
        opacity: 1
    },
    snow = L.snow(points, options).addTo(map);

API reference

Factory

FactoryDescription
L.snow(LatLng[] latlngs, options options?)Create snow animation inside (multi)polygon with given latlngs.

Options

OptionTypeDefaultRangeDescription
speedNumber500-InfinitySnow speed (px/s)
layersCountNumber11-5Number of snow layers. Snowflakes increase their size and decrease their density and speed from back to top layers
densityNumber11-5Density coefficient of bottom snow layer
sizeNumber101- InfinitySnowflake size (px) at front layer
colorStringOxa6b3e9Snow color hex value
opacityNumber10-1Snow opacity

Methods

MethodDescription
setSpeed(Number)Sets snow speed (px/s)
setLayersCount(Number)Sets snow layers count (1-5)
setDensity(Number)Sets snow back layer density (1-5)
setSize(Number)Sets snowflake size at front layer (px)
setColor(hex string)Sets snow color
setOpacity(Number)Sets snow opacity (0-1)

License

0.1.1

6 years ago

0.1.0

6 years ago