Leaflet Moving Marker
Usage
Installation
npm install --save leaflet-moving-marker
API
Provide an array of destinations
and marker will walk through each destination until array of destinations is drained.
Leaflet.movingMarkerlatLng: L.LatLng, options: MovingMarkerOptions;
marker.start()
Starts the marker movement.
marker.pause()
Pause marker movement.
Events
'start'
When marker starts moving.
'destination'
When marker arrives to a new destination. Called with the destination object.
'destinationsdrained'
When all destinations are moved to and there is no more destination to go to.
'paused'
When marker is paused this event is fired.
Example
ar marker = L; marker;
Rotating the marker
Using provided events and Leaflet DivIcon
it's possible to rotate the marker on each destination..
First create a DivIcon
that has a rotate
method:
var RotatingIcon = LDivIcon;
Use your icon with Moving Marker:
var icon = ;var marker = L;
Hook to start
and destination
events to rotate your marker:
marker;marker;
Development
npm install
and npm start
to watch for changes and see the results in browser.
License
MIT