Skip to content

Instantly share code, notes, and snippets.

Created August 21, 2014 13:47
Show Gist options
  • Save anonymous/171203a580e65ed975b3 to your computer and use it in GitHub Desktop.
Save anonymous/171203a580e65ed975b3 to your computer and use it in GitHub Desktop.
var point_list = L.Polyline.fromEncoded(_encoded).addTo(map);
route_lines = [L.polyline(point_list)],
markers = [];
$.each(route_lines, function(i, route_line) {
var animated_marker = L.animatedMarker(route_line.getLatLngs(), {
icon: walk_icon,
distance: 50,
interval: 5000,
autoStart: false,
});
function pan_map(){
map.panTo({ lat: animated_marker['_latlng'].lat, lon: animated_marker['_latlng'].lng });
}
pan_map();
var f_interval = setInterval(function() {
if (_flag == 1) {
animated_marker.stop();
clearInterval(f_interval);
}
pan_map();
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment