-
Notifications
You must be signed in to change notification settings - Fork 317
/
index.html
40 lines (32 loc) · 1.31 KB
/
index.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
<head>
<style> body { margin: 0; } </style>
<script src="//unpkg.com/globe.gl"></script>
<!--<script src="../../dist/globe.gl.js"></script>-->
</head>
<body>
<div id="globeViz"></div>
<script type="module">
import * as THREE from '//unpkg.com/three/build/three.module.js';
const world = new Globe(document.getElementById('globeViz'), { animateIn: false })
.globeImageUrl('//unpkg.com/three-globe/example/img/earth-blue-marble.jpg')
.bumpImageUrl('//unpkg.com/three-globe/example/img/earth-topology.png');
// Auto-rotate
world.controls().autoRotate = true;
world.controls().autoRotateSpeed = 0.35;
// Add clouds sphere
const CLOUDS_IMG_URL = './clouds.png'; // from https://github.com/turban/webgl-earth
const CLOUDS_ALT = 0.004;
const CLOUDS_ROTATION_SPEED = -0.006; // deg/frame
new THREE.TextureLoader().load(CLOUDS_IMG_URL, cloudsTexture => {
const clouds = new THREE.Mesh(
new THREE.SphereGeometry(world.getGlobeRadius() * (1 + CLOUDS_ALT), 75, 75),
new THREE.MeshPhongMaterial({ map: cloudsTexture, transparent: true })
);
world.scene().add(clouds);
(function rotateClouds() {
clouds.rotation.y += CLOUDS_ROTATION_SPEED * Math.PI / 180;
requestAnimationFrame(rotateClouds);
})();
});
</script>
</body>