-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgps.html
57 lines (45 loc) · 12.6 KB
/
gps.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
56
57
<html><head><meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width"><title>Polyline Replay</title><link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css"/> <link href="gps.css" rel="stylesheet" type="text/css"/> </head> <body> <div id="container"></div><div class="input-card"><h4>Polyline Replay</h4><div class="input-item"><input type="button" class="btn" value="Replay" id="start" onclick="startAnimation()"/><input type="button" class="btn" value="Pause" id="pause" onclick="pauseAnimation()"/></div><div class="input-item"><input type="button" class="btn" value="Continue" id="resume" onclick="resumeAnimation()"/><input type="button" class="btn" value="Stop" id="stop" onclick="stopAnimation()"/></div></div><script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=ÄúÉêÇëµÄkeyÖµ"></script><script>var lineArr = [[121.615479, 31.279848],[121.614548, 31.279848],[121.613396, 31.279858],[121.612633, 31.279879],[121.611526, 31.280022],[121.610603, 31.280165],[121.609993, 31.280251],[121.609398, 31.280319],[121.60865, 31.280333],[121.607857, 31.280333],[121.606758, 31.280319],[121.606033, 31.280247],[121.605621, 31.280209],[121.604393, 31.280087],[121.604225, 31.280005],[121.60421, 31.278074],[121.60421, 31.277174],[121.604225, 31.272413],[121.60424, 31.271681],[121.60424, 31.271528],[121.60421, 31.267559],[121.60421, 31.267088],[121.604195, 31.266567],[121.604195, 31.266489],[121.604141, 31.265793],[121.60405, 31.265152],[121.60363, 31.262022],[121.603493, 31.260929],[121.60334, 31.25984],[121.603271, 31.259535],[121.603127, 31.25902],[121.602943, 31.258467],[121.60273, 31.257952],[121.602402, 31.257223],[121.602234, 31.257063],[121.601944, 31.256636],[121.601723, 31.256338],[121.601532, 31.256102],[121.601456, 31.255999],[121.601173, 31.255697],[121.60067, 31.255196],[121.600349, 31.25491],[121.600029, 31.254648],[121.599846, 31.254519],[121.599632, 31.254358],[121.599236, 31.254097],[121.598701, 31.253752],[121.598274, 31.253485],[121.596672, 31.252399],[121.59613, 31.252035],[121.595512, 31.251648],[121.59507, 31.251362],[121.594543, 31.251015],[121.594009, 31.250673],[121.593033, 31.250031],[121.590729, 31.248516],[121.590172, 31.248152],[121.58976, 31.247873],[121.589478, 31.24769],[121.588928, 31.247335],[121.587395, 31.246349],[121.586815, 31.245985],[121.586746, 31.245947],[121.585892, 31.245346],[121.58567, 31.245209],[121.585526, 31.245117],[121.584038, 31.244175],[121.582771, 31.24346],[121.58223, 31.243196],[121.581398, 31.242813],[121.580139, 31.242218],[121.579964, 31.24217],[121.579506, 31.242085],[121.578766, 31.241785],[121.578163, 31.241516],[121.577736, 31.241346],[121.577621, 31.241306],[121.576996, 31.241037],[121.576836, 31.240952],[121.57666, 31.240833],[121.576294, 31.240515],[121.576118, 31.240417],[121.574783, 31.239832],[121.574715, 31.239799],[121.574699, 31.239792],[121.572365, 31.238756],[121.572021, 31.238607],[121.571114, 31.238186],[121.56913, 31.237209],[121.568153, 31.236706],[121.567909, 31.236563],[121.566109, 31.235674],[121.564438, 31.234869],[121.563354, 31.234354],[121.563049, 31.234259],[121.562805, 31.234127],[121.561996, 31.233675],[121.561798, 31.23358],[121.561691, 31.233528],[121.561295, 31.233324],[121.561172, 31.233255],[121.560997, 31.23315],[121.559464, 31.232349],[121.557732, 31.231432],[121.556152, 31.230688],[121.555412, 31.230324],[121.554214, 31.229713],[121.553856, 31.229563],[121.55278, 31.22905],[121.552734, 31.229027],[121.552292, 31.228834],[121.552002, 31.228729],[121.551399, 31.228533],[121.550781, 31.228285],[121.550011, 31.228024],[121.546852, 31.226954],[121.545509, 31.226501],[121.545189, 31.226376],[121.544579, 31.226116],[121.543785, 31.225689],[121.543198, 31.225321],[121.541878, 31.224344],[121.541641, 31.224194],[121.541466, 31.224207],[121.539993, 31.223429],[121.539482, 31.223143],[121.539291, 31.223028],[121.539017, 31.222818],[121.538811, 31.222683],[121.538445, 31.222364],[121.537857, 31.222578],[121.536888, 31.223143],[121.535393, 31.22401],[121.535355, 31.224045],[121.53344, 31.225142],[121.532433, 31.225729],[121.532021, 31.22596],[121.531502, 31.226271],[121.530754, 31.226698],[121.530205, 31.227022],[121.529732, 31.227304],[121.528397, 31.228077],[121.527893, 31.228373],[121.526917, 31.228945],[121.525612, 31.229696],[121.525284, 31.229891],[121.524681, 31.23015],[121.523758, 31.230413],[121.521774, 31.231119],[121.520508, 31.231554],[121.517265, 31.232691],[121.516205, 31.233061],[121.515602, 31.233265],[121.514503, 31.233643],[121.513939, 31.233841],[121.513191, 31.234072],[121.513008, 31.234131],[121.512093, 31.234409],[121.511154, 31.234686],[121.509972, 31.235048],[121.509193, 31.235264],[121.509171, 31.235424],[121.509148, 31.235596],[121.508934, 31.236334],[121.508789, 31.236744],[121.508469, 31.236805],[121.508163, 31.236689],[121.507645, 31.236534],[121.50753, 31.236502],[121.507179, 31.236471],[121.506577, 31.236467],[121.506157, 31.236507],[121.505997, 31.236534],[121.505562, 31.236649],[121.505173, 31.236767],[121.50473, 31.236927],[121.504433, 31.23704],[121.504158, 31.237148],[121.503754, 31.237345],[121.503403, 31.237535],[121.502953, 31.237728],[121.502037, 31.238087],[121.501808, 31.238169],[121.501305, 31.23822],[121.500771, 31.238333],[121.500374, 31.238388],[121.499817, 31.238415],[121.499496, 31.238411],[121.498901, 31.238356],[121.498299, 31.238243],[121.49794, 31.238142],[121.497299, 31.237896],[121.497139, 31.237822],[121.496643, 31.237556],[121.496452, 31.237423],[121.495911, 31.236948],[121.494194, 31.235291],[121.494019, 31.235147],[121.493004, 31.234167],[121.492958, 31.234127],[121.491722, 31.233004],[121.491432, 31.232779],[121.491219, 31.232632],[121.490906, 31.23246],[121.490311, 31.232187],[121.489914, 31.232008],[121.487831, 31.231102],[121.487473, 31.230968],[121.487221, 31.230925],[121.487015, 31.230938],[121.486816, 31.23098],[121.486519, 31.231129],[121.48632, 31.23119],[121.486153, 31.23122],[121.485207, 31.231348],[121.48497, 31.231358],[121.484497, 31.231346],[121.484215, 31.231302],[121.483788, 31.231207],[121.483131, 31.231092],[121.482834, 31.231037],[121.482666, 31.230993],[121.482544, 31.230961],[121.482269, 31.230846],[121.482124, 31.230787],[121.481812, 31.230619],[121.481461, 31.230438],[121.480721, 31.230036],[121.48027, 31.229799],[121.480194, 31.229662],[121.479988, 31.229553],[121.47847, 31.228756],[121.477859, 31.228434],[121.477219, 31.228056],[121.476196, 31.227377],[121.476105, 31.227331],[121.475861, 31.227186],[121.475586, 31.227058],[121.47467, 31.226662],[121.473732, 31.22628],[121.472519, 31.225752],[121.471962, 31.225519],[121.471603, 31.225365],[121.468765, 31.224213],[121.468452, 31.224106],[121.468239, 31.224052],[121.467888, 31.223976],[121.467606, 31.223934],[121.467575, 31.223925],[121.467529, 31.223921],[121.467476, 31.223915],[121.467033, 31.223862],[121.466766, 31.223845],[121.466202, 31.223845],[121.465828, 31.223862],[121.465324, 31.223907],[121.464844, 31.223944],[121.463875, 31.224007],[121.46315, 31.224026],[121.461975, 31.224007],[121.460358, 31.223989],[121.459877, 31.223989],[121.458344, 31.223984],[121.456726, 31.223957],[121.456551, 31.223957],[121.455582, 31.223911],[121.455055, 31.223854],[121.454575, 31.223751],[121.454254, 31.223658],[121.453636, 31.223415],[121.452927, 31.223143],[121.451897, 31.222752],[121.451553, 31.222618],[121.450951, 31.222387],[121.449181, 31.221716],[121.448502, 31.221502],[121.448151, 31.221397],[121.447609, 31.221279],[121.447136, 31.221189],[121.446625, 31.221121],[121.445709, 31.221003],[121.445114, 31.220888],[121.444756, 31.220787],[121.444466, 31.220686],[121.443916, 31.220434],[121.443314, 31.220045],[121.443024, 31.21987],[121.442871, 31.219801],[121.442726, 31.21973],[121.442581, 31.219671],[121.442451, 31.219627],[121.441917, 31.219505],[121.440781, 31.219345],[121.440514, 31.219276],[121.44017, 31.219145],[121.439758, 31.218945],[121.439438, 31.218725],[121.439255, 31.218576],[121.438759, 31.218138],[121.438438, 31.217882],[121.438171, 31.217695],[121.43766, 31.217396],[121.43647, 31.216715],[121.436028, 31.216431],[121.435219, 31.215847],[121.434349, 31.215096],[121.434052, 31.214869],[121.433754, 31.214649],[121.433556, 31.214531],[121.432999, 31.214226],[121.431999, 31.213772],[121.431496, 31.213484],[121.431313, 31.21335],[121.430916, 31.213005],[121.430595, 31.212614],[121.430305, 31.212158],[121.430183, 31.211958],[121.429993, 31.211662],[121.429825, 31.211435],[121.429626, 31.211216],[121.429398, 31.211012],[121.428909, 31.210703],[121.428528, 31.210543],[121.42823, 31.210442],[121.427925, 31.210373],[121.427544, 31.210325],[121.427162, 31.2103],[121.426392, 31.21026],[121.425751, 31.210186],[121.425339, 31.210117],[121.425049, 31.210052],[121.423721, 31.209743],[121.42321, 31.209614],[121.422821, 31.209518],[121.422089, 31.209345],[121.420898, 31.209093],[121.418404, 31.208565],[121.416382, 31.208141],[121.415932, 31.208046],[121.415039, 31.207865],[121.414452, 31.207661],[121.414062, 31.207504],[121.413582, 31.207253],[121.413292, 31.207071],[121.411522, 31.205847],[121.411156, 31.205595],[121.410782, 31.205338],[121.408913, 31.203976],[121.408302, 31.203524],[121.407913, 31.203251],[121.407539, 31.202978],[121.406532, 31.202291],[121.406235, 31.202108],[121.405624, 31.201799],[121.404922, 31.20154],[121.404442, 31.201406],[121.403511, 31.201172],[121.40345, 31.201155],[121.403145, 31.201077],[121.402588, 31.200933],[121.401688, 31.200706],[121.40136, 31.200621],[121.400703, 31.200451],[121.398926, 31.200001],[121.398285, 31.199835],[121.397499, 31.19961],[121.397011, 31.199436],[121.396225, 31.199099],[121.395691, 31.198837],[121.393433, 31.19754],[121.392952, 31.197254],[121.392708, 31.197096],[121.391899, 31.196615],[121.389183, 31.195017],[121.388832, 31.194799],[121.387581, 31.194057],[121.386978, 31.193697],[121.386833, 31.193615],[121.385643, 31.192924],[121.38446, 31.192301],[121.383415, 31.191805],[121.38224, 31.191284],[121.381508, 31.190994],[121.38063, 31.190664],[121.380104, 31.190496],[121.379623, 31.190332],[121.379135, 31.190182],[121.378105, 31.189861],[121.376953, 31.189497],[121.371956, 31.18792],[121.371025, 31.187618],[121.370438, 31.187435],[121.369431, 31.187113],[121.367805, 31.186607],[121.36718, 31.186407],[121.367012, 31.186361],[121.366631, 31.186319],[121.366318, 31.186245],[121.365929, 31.186132],[121.364273, 31.185616],[121.363777, 31.185486],[121.363632, 31.185455],[121.363525, 31.185442],[121.363251, 31.18541],[121.362976, 31.185364],[121.362732, 31.18535],[121.362534, 31.185337],[121.36216, 31.18535],[121.361717, 31.185383],[121.361359, 31.185423],[121.360863, 31.185505],[121.360687, 31.185543],[121.360435, 31.185591],[121.360229, 31.185646],[121.359695, 31.185816],[121.359123, 31.186056],[121.358818, 31.186193],[121.358421, 31.186398],[121.357941, 31.186644],[121.357567, 31.186831],[121.357376, 31.186935],[121.357048, 31.187162],[121.356865, 31.187304],[121.356667, 31.187458],[121.356438, 31.18767],[121.35614, 31.187908],[121.355431, 31.188751],[121.35498, 31.189276],[121.354713, 31.189583],[121.354408, 31.190178],[121.354401, 31.190182],[121.353371, 31.19138],[121.35305, 31.19179],[121.353012, 31.191858],[121.353004, 31.191996],[121.352982, 31.192085],[121.352791, 31.192314],[121.352524, 31.192587],[121.351944, 31.193129],[121.351433, 31.193542],[121.351006, 31.193789],[121.350998, 31.194159],[121.350975, 31.194363],[121.35096, 31.194679],[121.350937, 31.195082],[121.350914, 31.19537],[121.350906, 31.195608],[121.350853, 31.196112],[121.349861, 31.196062],[121.349434, 31.196043],[121.349297, 31.196037],[121.348648, 31.19599],[121.34568, 31.195889]];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 startAnimation () {
// marker.moveAlong(lineArr, 8000);
//}
function pauseAnimation () {
marker.pauseMove();
}
function resumeAnimation () {
marker.resumeMove();
}
function stopAnimation () {
marker.stopMove();
}function startAnimation () { marker.moveAlong(lineArr, 80000);}</script></body></html>