-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimation.html
34 lines (33 loc) · 1.05 KB
/
animation.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
<!DOCTYPE HTML>
<html>
<head>
<script src="http://www.webglearth.com/v2/api.js"></script>
<script>
var earth;
function initialize() {
earth = new WE.map('earth_div');
earth.setView([46.8011, 8.2266], 3);
WE.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',{
attribution: '© OpenStreetMap contributors'
}).addTo(earth);
// Start a simple rotation animation
var before = null;
requestAnimationFrame(function animate(now) {
var c = earth.getPosition();
var elapsed = before? now - before: 0;
before = now;
earth.setCenter([c[0], c[1] + 0.1*(elapsed/30)]);
requestAnimationFrame(animate);
});
}
</script>
<style>
html, body{padding: 0; margin: 0;}
#earth_div{ top: 0; right: 0; bottom: 0; left: 0; position: absolute !important;}
</style>
<title>WebGL Earth API v2: Animation</title>
</head>
<body onload="initialize()">
<div id="earth_div"></div>
</body>
</html>