Coder Social home page Coder Social logo

mapgl-snow's Introduction

mapgl-snow

Plugin to add falling snow to your 2GIS MapGL map.

snow-preview

See a demo

Using

Install with NPM:

npm install mapgl-snow

Then initialize with passing MapGL Map object:

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>
    <head>
        <script src="https://mapgl.2gis.com/api/js/v1"></script>
        <script src="https://unpkg.com/mapgl-snow"></script>
    <head>
    <body>
        <div id="map"></div>
        <script>
            const map = new mapgl.Map('map', {
                center: [37.590783, 55.731226],
                zoom: 13.48,
                key: 'Your API key here',
            });
            const snow = new mapglSnow.Snow(map);
        </script>
    </body>
</html>

Snow options have several fields:

  • minZoom – the minimum zoom from which the snow will be shown
  • color – the color of the snowflakes in RGBA format, e.g. [255, 255, 255, 1]
  • size – the size of the snowflakes
  • particleNumber – the amount of the snowflakes
  • velocityX, velocityY, velocityZ – the wind speed in each direction
  • dispersion – the dispersion of the speed

mapgl-snow's People

Contributors

trufi avatar kalyanov avatar itanka9 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.