-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
60 lines (54 loc) · 1.62 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
56
57
58
59
60
<!DOCTYPE html>
<html lang="en">
<head>
<title>Display a map</title>
<meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel='stylesheet' href='https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css' />
<script src='https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js'></script>
<script src="index.js"></script>
<style>
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
</style>
</head>
<body>
<div id="map"></div>
<script>
const map = new maplibregl.Map({
container: 'map', // container id
style: 'https://demotiles.maplibre.org/style.json', // style URL
center: [0, 0], // starting position [lng, lat]
zoom: 1 // starting zoom
});
map.on('load', e=>{
window.line = new LineAnimation('anim',{
autoStart: true,
duration:1500,
loop: true,
headColor: `rgba(200,0,0,1)`,
tailColor: `rgba(200,0,0,0)`,
geojson: {
"type": "Feature",
"properties": {},
"geometry": {
"coordinates": [
[
-16,
51
],
[
54,
2
]
],
"type": "LineString"
}
}
});
line.addTo(map);
})
</script>
</body>
</html>