leaflet-routing-machine icon indicating copy to clipboard operation
leaflet-routing-machine copied to clipboard

Animate found route

Open perliedman opened this issue 10 years ago • 5 comments

Add an option to animate the display of a new route, such that it grows from the start waypoint towards the destination.

Look for example at this example, which looks pretty nice when a new result is found: https://www.mapbox.com/blog/dc-bikeshare-revisited/

perliedman avatar Apr 10 '15 08:04 perliedman

An option is to use D3 http://zevross.com/blog/2014/09/30/use-the-amazing-d3-library-to-animate-a-path-on-a-leaflet-map/. I'm using it in a sample that visualizes different driving times for our routing http://ptv-logistics.github.io/fl-labs/

oliverheilig avatar Jun 24 '15 12:06 oliverheilig

A Leaflet plugin that does more or less exactly this: https://github.com/IvanSanchez/Leaflet.Polyline.SnakeAnim

perliedman avatar Nov 02 '15 09:11 perliedman

that nearly works, however it requires #191 and if you snakeIn the L.Routing.line by changing line 582 to read: this._line.addTo(this._map).snakeIn();

there is a bit of a problem as L.Routing.line is a layergroup that contains some stuff around the markers plus a polyline for each style assigned to the routeline, so they all get animated. It kind of needs to draw the first stuff fast, then the last style layer gets animated but I can't figure out how to do that.

AlanBell avatar Jan 05 '16 17:01 AlanBell

Add an option to animate the display of a new route, such that it grows from the start waypoint towards the destination.

I want to do that using leaflet routing machine How can I do that?

ahmaag951 avatar Oct 24 '18 09:10 ahmaag951

I want to do that using leaflet routing machine How can I do that?

I achieved this animation using only CSS. See: https://gis.stackexchange.com/a/349912/157737

aldalaimi avatar Feb 07 '20 10:02 aldalaimi