-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.html
55 lines (46 loc) · 1.57 KB
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="lib/leaflet/dist/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="lib/leaflet/dist/leaflet.ie.css" /><![endif]-->
<script src="lib/leaflet/build/deps.js"></script>
<script src="lib/leaflet/debug/leaflet-include.js"></script>
<link rel="stylesheet" href="dist/leaflet.animation.css" />
<script src="dist/leaflet.animation.min.js"></script>
<script src="debug/data.js"></script>
</head>
<body>
<div id="map" style="width: 800px; height: 600px;"></div>
<script type="text/javascript">
var layerOsm = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
subdomains: ["a", "b", "c"],
maxZoom: 18
});
var map = new L.Map('map', {
}).addLayer(layerOsm).setView(new L.LatLng(40.524724, -3.816153), 5);
var animationControl = L.control.animation({
animationControl: true,
playbackSpeed: 1000,
playbackSpeeds: [100, 500, 1000, 10000, 100000],
stepWidth: 1000
}).addTo(map);
for(var i = 0; i < data.length; i++) {
var track = data[i].track;
var latlngs = new Array();
for(var j = 0; j < track.length; j++) {
latlngs.push(new L.LatLngAnimated(
track[j].lat,
track[j].lng,
track[j].t));
}
var polyline = L.polylineAnimated(latlngs, {
color: data[i].color,
weight: 3,
smoothFactor: 0
}).addTo(map);
animationControl.addAnimatedGeometry(polyline);
}
animationControl.play();
</script>
</body>
</html>