0.2.0 • Published 5 years ago

leaflet-rain v0.2.0

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Leaflet.Rain

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

Demo

Installation

works with leaflet@1.0.0 and higher

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

Usage

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

let points = [[latlngs], [latlngs], ...],
    options = {
        angle: 80,
        width: 1,
        spacing: 10,
        length: 4,
        interval: 10,
        speed: 1,
        color: 'Oxa6b3e9'
    },
    rain = L.rain(points, options).addTo(map);

API reference

Factory

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

Options

OptionTypeDefaultDescription
angleNumber80Rain angle (degrees)
widthNumber1Drop width (px)
spacingNumber10X-spacing between drops (px)
lengthNumber4Drop length (px)
intervalNumber10Y-spacing between drops (px)
speedNumber1Rain speed factor. Values greater 1 increase speed
colorStringOxa6b3e9Rain color hex value

Methods

MethodDescription
setAngle(Number)Sets rain angle (degrees).
setWidth(Number)Sets drop width (px).
setSpacing(Number)Sets x-spacing between drops (px).
setLength(Number)Sets drop length (px).
setInterval(Number)Sets y-spacing between drops (px).
setSpeed(Number)Sets rain speed factor.
setColor(hex string)Sets rain color.

License

0.2.0

5 years ago

0.1.0

5 years ago