-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgps.js
54 lines (42 loc) · 929 Bytes
/
gps.js
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
var marker
var map = new AMap.Map("container", {
resizeEnable: true,
// center: [116.397428, 39.90923],
center:lineArr[0],
zoom: 17
});
marker = new AMap.Marker({
map: map,
// position: [116.478935,39.997761],
position: lineArr[0],
icon: "https://webapi.amap.com/images/car.png",
offset: new AMap.Pixel(-26, -13),
autoRotation: true,
angle:-90,
});
var polyline = new AMap.Polyline({
map: map,
path: lineArr,
showDir:true,
strokeColor: "#28F",
strokeOpacity: 1,
strokeWeight: 6,
});
var passedPolyline = new AMap.Polyline({
map: map,
strokeColor: "#AF5",
strokeWeight: 6,
});
marker.on('moving', function (e) {
passedPolyline.setPath(e.passedPath);
});
map.setFitView();
function pauseAnimation () {
marker.pauseMove();
}
function resumeAnimation () {
marker.resumeMove();
}
function stopAnimation () {
marker.stopMove();
}