-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
47 lines (47 loc) · 2.67 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
41
42
43
44
45
46
47
<html>
<head>
<title>Planet Observer</title>
<script src="https://aframe.io/releases/0.7.0/aframe.min.js"></script>
<script src="https://unpkg.com/aframe-point-component/dist/aframe-point-component.min.js"></script>
<script src="./hygdata.js"></script>
</head>
<body>
<a-scene>
<a-assets>
<a-asset-item id="venus" src="./assets/planet1/scene.gltf"></a-asset-item>
<a-asset-item id="moon" src="./assets/planet2/scene.gltf"></a-asset-item>
<a-asset-item id="earth" src="./assets/planet3/scene.gltf"></a-asset-item>
<a-asset-item id="mercury" src="./assets/planet4/scene.gltf"></a-asset-item>
<a-asset-item id="mars" src="./assets/planet5/scene.gltf"></a-asset-item>
</a-assets>
<!-- 3d planets -->
<a-entity position="0 0 0" gltf-model="#venus"></a-entity>
<a-entity position="15 20 0" gltf-model="#moon"></a-entity>
<a-entity position="-10 5 -20" gltf-model="#earth"></a-entity>
<a-entity position="35 5 10" gltf-model="#mercury"></a-entity>
<a-entity position="-19 9 5" gltf-model="#mars"></a-entity>
<!-- 2d planets -->
<!-- <a-sphere position="0 0 0" perspective="true" radius="1.5" color="#a7afc7" id="planet1"></a-sphere>
<a-sphere position="15 20 0" perspective="true" radius="1.0" color="#c7a7af" id="planet2"></a-sphere>
<a-sphere position="-30 30 20" perspective="true" radius="1.0" color="#afc7a7" id="planet3"></a-sphere>
<a-sphere position="-10 5 -20" perspective="true" radius="1.0" color="#c7bfa7" id="planet4"></a-sphere>
<a-sphere position="35 5 10" perspective="true" radius="1.0" color="#c7afa7" id="planet5"></a-sphere> -->
<a-point position="0 0 0" color="#fff" size="0.07" perspective="true"></a-point>
<a-sky color="#060315"></a-sky>
<a-entity class="camwrap" position="0 0 0">
<a-camera look-controls wasd-controls="fly:true acceleration:1" near="1" position="0 0 20" user-height="0" fov="60">
</a-camera>
</a-entity>
</a-scene>
<script>
const multi = x => 0.07 * x, pt = document.querySelector("a-point"), cam = document.querySelector("a-camera");
setTimeout(function() {
cam.components["wasd-controls"].keys["KeyW"] = true;
}, 8000);
setTimeout(function() {
pt.components.point.setPoints(
hygdata.map(star => [multi(star.x), multi(star.y), multi(star.z)]))
}, 1000);
</script>
</body>
</html>