Giter Club home page Giter Club logo

leaflet-ant-path's Introduction

Leaflet Ant Path

Creates a leaflet polyline with a 'ant-path' animated flux

Live demo here

Installing

Via Bower:

 bower install leaflet-ant-path

Via NPM:

 npm install leaflet-ant-path

Or just download this source code

Requirements

- Leaflet >= 0.7.7
- Soon compatible with Leaflet 1.0.0 :+1:

Browser compatibility

Tested on:

- Firefox 43
- Chrome 45
- Chromium 47

UMD compatible

Can be used with asynchronous module loaders and CommonJS packers

Using the plugin

It's just like a polyline:

    // Using the AntPath
    var antPolyline = new L.Polyline.AntPath(latlngs, options);
    
    //or use the factory
    antPolyline = L.polyline.antPath(latlngs, options);
    
    antPolyline.addTo(map);
    
    // ... And the MultiAntPath
    var antPolyline = new L.MultiPolyline.MultiAntPath(latlngsList, options);
    
    //or use the factory
    antPolylines = L.multiPolyline.multiAntPath(latlngsList, options);
    
    antPolylines.addTo(map);
    

Note for AMD/CommonJS:
The direct use as 'AntPath' now is deprecated and instead is exported by default, the modules which contains the AntPath and MultiAntPath

Using with AMD:

require(['leafletAntPath'], function(AntPathModule) {
    // ...
    var antPolyline = new AntPathModule.AntPath(latlngs, options);
    antPolyline.addTo(map);
    
    var multiAntPolylines = new AntPathModule.MultiAntPath(latlngs, options);
    multiAntPolylines.addTo(map);
});

Using with browerify:

    var AntPath = require('leafletAntPath').AntPath;
    var MultiAntPath = require('leafletAntPath').MultiAntPath;
    
    //or just
    import {AntPath, MultiAntPath} from 'leafletAntPath';
    
    // ...
    var antPolyline = new AntPath(latlngs, options);
    antPolyline.addTo(map);

Parameters

The AntPath extends from the FeatureGroup, but you initialise with the same options of a common Polyline, with some extra options, like the flux color.

name type example description
latlngs L.LatLng[] or Array[number, number] [ [0, 10], [-20, 0], ... ] A array of latitude and longitudes (same as used in Polyline constructor )
options Object {color: 'red', weight: 5, ...} Same as the Polyline options plus the extra options bellow
options.paused boolean true/false Starts with the animation paused (default: false)
options.pulseColor string #FF00FF Adds a color to the dashed flux (default: 'white')
options.delay string 120 Add a delay to the animation flux (default: 400)
options.dashArray [number, number] [15, 30] The size of the animated dashes (default: [10, 20])

Building and Testing

To run the build, before install the npm and gulp dependencies, then run:

To build

    gulp style
    ...
    gulp compress

To test:

    gulp test

License

This project is under the MIT LICENSE

leaflet-ant-path's People

Contributors

banzo avatar braandl avatar rubenspgcavalcante avatar

Watchers

 avatar  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.