Thursday, October 22, 2015

Animated Polylines in Leaflet


I've been waiting for this Leaflet plug-in for a while. Leaflet.Polyline.SnakeAnim animates a polyline on a Leaflet map so that you can show an animated route on your map.

The GitHub page for the plug-in includes an animate GIF of Leaflet.Polyline.SnakeAnim in action but doesn't include a working example. I've therefore created a quick demo map. In my demo I've changed one main thing from the demo.html on the GitHub page. I've moved

map.addLayer(path);

inside the animation function so that the route polyline doesn't appear on the map before it starts animating. To animate the route on the map just press the button.

No comments: