-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
292 lines (285 loc) · 12.3 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
<html>
<head>
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="https://cdn.rawgit.com/matthewbryancurtis/aframe-star-system-component/db4f1030/index.js"></script>
<script src="https://rawgit.com/protyze/aframe-curve-component/master/dist/aframe-curve-component.min.js"></script>
<script src="https://rawgit.com/protyze/aframe-alongpath-component/master/dist/aframe-alongpath-component.min.js"></script>
<title>Merry Christmas Everyone!</title>
<link rel="icon" href="static/images/icon.svg" />
</head>
<body>
<a-scene background="color: #000000">
<a-assets>
<img id="sun" src="./static/images/sun.jpg" />
<img id="mercury" src="./static/images/mercury.jpg" />
<img id="venus" src="./static/images/venus.jpg" />
<img id="earth" src="./static/images/earth.jpg" />
<img id="mars" src="./static/images/mars.jpg" />
<img id="jupiter" src="./static/images/jupiter.jpg" />
<img id="saturn" src="./static/images/saturn.jpg" />
<img id="uranus" src="./static/images/uranus.jpg" />
<img id="neptune" src="./static/images/neptune.jpg" />
<a-asset-item id="christmas-tree" src="./static/models/ChristmasTree/ChristmasTree.glb"></a-asset-item>
<a-asset-item id="astronaut" src="./static/models/ChristmasAstronaut/ChristmasAstronaut.glb"></a-asset-item>
<a-asset-item id="asteroid" src="./static/models/Asteroid/Asteroid.glb"></a-asset-item>
<a-asset-item id="red-flying-saucer" src="./static/models/FlyingSaucer/RedFlyingSaucer.glb"></a-asset-item>
<a-asset-item id="green-flying-saucer" src="./static/models/FlyingSaucer/GreenFlyingSaucer.glb"></a-asset-item>
<a-asset-item id="gold-flying-saucer" src="./static/models/FlyingSaucer/GoldFlyingSaucer.glb"></a-asset-item>
<a-asset-item id="silver-flying-saucer" src="./static/models/FlyingSaucer/SilverFlyingSaucer.glb"></a-asset-item>
<a-asset-item id="purple-flying-saucer" src="./static/models/FlyingSaucer/PurpleFlyingSaucer.glb"></a-asset-item>
<a-asset-item id="tardis" src="./static/models/TARDIS/Tardis.glb"></a-asset-item>
<a-asset-item id="ornament-string" src="./static/models/OrnamentString/OrnamentString.glb"></a-asset-item>
<a-asset-item id="nakatomi-plaza-sign" src="./static/models/NakatomiPlazaSign/NakatomiPlazaSign.glb"></a-asset-item>
</a-assets>
<a-entity star-system></a-entity>
<a-entity id="camera" camera look-controls></a-entity>
<a-light
type="ambient"
position="-81 88 -108"
intensity="1.5">
</a-light>
<a-entity
gltf-model="#christmas-tree"
position="-80 -60 -110"
scale="0.5 0.5 0.5">
</a-entity>
<a-entity
gltf-model="#astronaut"
position="80 -55 -110"
scale="0.4 0.4 0.4"
rotation="-15 -50 0"
animation="
property: object3D.position.y;
to: -51;
dir: alternate;
dur: 1000;
loop: true">
</a-entity>
<a-entity
gltf-model="#red-flying-saucer"
position="-1000 250 -610"
animation="
property: rotation;
to: 0 360 0;
loop: true;
dur: 6000"
animation__2="
property: position;
to: 1000 250 -610;
loop: true;
dir: alternate;
dur: 10000;
">
</a-entity>
<a-entity
gltf-model="#red-flying-saucer"
position="1000 50 -610"
animation="
property: rotation;
to: 0 360 0;
loop: true;
dur: 6000"
animation__2="
property: position;
to: -1000 50 -610;
loop: true;
dir: alternate;
dur: 10000;
">
</a-entity>
<a-curve id="track__green-flying-saucer-1">
<a-curve-point position="1000 150 500"></a-curve-point>
<a-curve-point position="1000 150 -500"></a-curve-point>
<a-curve-point position="0 150 -1000"></a-curve-point>
<a-curve-point position="-1000 150 -500"></a-curve-point>
<a-curve-point position="-1000 150 500"></a-curve-point>
<a-curve-point position="0 150 1000"></a-curve-point>
<a-curve-point position="1000 150 500"></a-curve-point>
</a-curve>
<a-entity
gltf-model="#green-flying-saucer"
position="0 0 1000"
alongpath="
curve: #track__green-flying-saucer-1;
loop: true;
rotate: true;
dur: 50000"
animation="
property: rotation;
to: 0 360 0;
loop: true;
dur: 6000">
</a-entity>
<a-curve id="track__gold-flying-saucer-1">
<a-curve-point position="-500 600 -250"></a-curve-point>
<a-curve-point position="-500 600 250"></a-curve-point>
<a-curve-point position="0 600 500"></a-curve-point>
<a-curve-point position="500 600 250"></a-curve-point>
<a-curve-point position="500 600 -250"></a-curve-point>
<a-curve-point position="0 600 -500"></a-curve-point>
<a-curve-point position="-500 600 -250"></a-curve-point>
</a-curve>
<a-entity
gltf-model="#gold-flying-saucer"
position="0 600 -1000"
alongpath="
curve: #track__gold-flying-saucer-1;
loop: true;
rotate: true;
dur: 50000"
animation="
property: rotation;
to: 0 360 0;
loop: true;
dur: 6000">
</a-entity>
<a-curve id="track__silver-flying-saucer-1">
<a-curve-point position="-500 -600 -250"></a-curve-point>
<a-curve-point position="-500 -600 250"></a-curve-point>
<a-curve-point position="0 -600 500"></a-curve-point>
<a-curve-point position="500 -600 250"></a-curve-point>
<a-curve-point position="500 -600 -250"></a-curve-point>
<a-curve-point position="0 -600 -500"></a-curve-point>
<a-curve-point position="-500 -600 -250"></a-curve-point>
</a-curve>
<a-entity
gltf-model="#silver-flying-saucer"
position="1000 -600 500"
alongpath="
curve: #track__silver-flying-saucer-1;
loop: true;
rotate: true;
dur: 50000"
animation="
property: rotation;
to: 0 360 0;
loop: true;
dur: 6000">
</a-entity>
<a-curve id="track__purple-flying-saucer-1">
<a-curve-point position="-1000 0 -500"></a-curve-point>
<a-curve-point position="-1000 0 500"></a-curve-point>
<a-curve-point position="0 0 1000"></a-curve-point>
<a-curve-point position="1000 0 500"></a-curve-point>
<a-curve-point position="1000 0 -500"></a-curve-point>
<a-curve-point position="0 0 -1000"></a-curve-point>
<a-curve-point position="-1000 0 -500"></a-curve-point>
</a-curve>
<a-entity
gltf-model="#purple-flying-saucer"
position="0 0 -1000"
alongpath="
curve: #track__purple-flying-saucer-1;
loop: true;
rotate: true;
dur: 50000"
animation="
property: rotation;
to: 0 360 0;
loop: true;
dur: 6000">
</a-entity>
<a-entity
gltf-model="#ornament-string"
position="-59 5.4 -110"
scale="0.2 0.2 0.2">
</a-entity>
<a-entity
gltf-model="#nakatomi-plaza-sign"
position="-56.7 -1 -115"
rotation="15 0 0"
scale="0.1 0.1 0.1">
</a-entity>
<a-entity
gltf-model="#tardis"
position="0 0 10000"
rotation="0 180 0"
scale="1 1 1">
</a-entity>
<a-text
value="Merry"
font="./static/fonts/Gwendolyn-Bold-msdf.json"
color="#FFFFFF"
negate="false"
scale="100 100 100"
position="-50 80 -110">
</a-text>
<a-text
value="Christmas"
font="./static/fonts/Gwendolyn-Bold-msdf.json"
color="#FFFFFF"
negate="false"
scale="100 100 100"
position="-40 50 -110">
</a-text>
<a-text
id="customOutput"
font="./static/fonts/Gwendolyn-Bold-msdf.json"
color="#FFFFFF"
negate="false"
scale="100 100 100"
position="-30 20 -110">
</a-text>
</a-scene>
<script src="./static/scripts/SolarSystem.js"></script>
<script src="./static/scripts/CustomTextHandler.js"></script>
<script src="./static/scripts/AsteroidHandler.js"></script>
<script src="./static/scripts/SpeedHandler.js"></script>
<script src="./static/scripts/SoundHandler.js"></script>
<script>
window.addEventListener("load", async () => {
const solarSystem = new SolarSystem();
const customTextHandler = new CustomTextHandler();
const asteroidHandler = new AsteroidHandler();
const speedHandler = new SpeedHandler();
const soundHandler = new SoundHandler();
fetch("./static/scripts/planets.json")
.then(response => response.json())
.then(jsonResponse => {
solarSystem.generateSun();
solarSystem.generatePlanets(jsonResponse["planets"]);
solarSystem.generateRings([jsonResponse["planets"][5], jsonResponse["planets"][6]]);
solarSystem.generateAsteroids();
solarSystem.generateOrnamentStrings(jsonResponse["planets"]);
const params = customTextHandler.receiveParameters();
customTextHandler.updateText(params);
const asteroids = asteroidHandler.collateAsteroids();
for (const asteroid of asteroids) {
const initialPosition = asteroidHandler.generateNewPosition();
asteroidHandler.setInitialPosition(initialPosition, asteroid);
const positions = asteroidHandler.generateNewPosition();
asteroidHandler.travelToNewPosition(positions, asteroid);
setInterval(() => {
const positions = asteroidHandler.generateNewPosition();
asteroidHandler.travelToNewPosition(positions, asteroid);
}, 15000);
}
const speed = speedHandler.receiveParameters();
speedHandler.updateSpeed(speed);
});
soundHandler.receiveParameters();
soundHandler.setup();
});
console.log(
"🦄🦄🦄\n" +
"Hello there!\n\n" +
"If you're reading this right now, I'm assuming you're a very nosy person, " +
"looking to see if there are any warnings or errors," +
"or even random rude words that I've accidentally left in from debugging.\n\n" +
"I can confirm that all rude words have been removed, as I want to make sure this scene is family friendly uno 🤷♀️!\n\n" +
"However, you may see a few warnings about to do with resizing or something... but just like every developer, I'm ignoring them since this is a random personal project, and you can too (please) x\n\n" +
"Anyhoo, if you are one of these very nosy people, then I like you, your curiosity about this scene has brought you here, " +
"so I think I owe you a small reward!\n\n" +
"This small reward is a secret I'll let you in on...\n\n" +
"You may know that you can put in a name in URL to personalise your message, so your URL could look like 'https://cbridges851.github.io/christmas-2021/?name=Christa' " +
"which would then display 'Merry Christmas Christa'. " +
"You can also use the URL to change the speed you go in the scene, so your URL could look like 'https://cbridges851.github.io/christmas-2021/?name=Christa&speed=5000' (by the way, the name parameter doesn't have to be there, so could just be 'https://cbridges851.github.io/christmas-2021/?speed=5000').\n\n" +
"I hope that helps if you would like to get around this place a bit faster!\n\n" +
"You can also toggle sound via the URL. e.g. 'https://cbridges851.github.io/christmas-2021/?sound=false' or 'https://cbridges851.github.io/christmas-2021/?sound=true' Again, it doesn't matter whether the name and speed are in the URL or not.\n\n" +
"There we go! I hope you have a very Merry Christmas and a prosperous New Year! \n\n" +
"All the best,\n\n" +
"Christa\n" +
"🦄🦄🦄");
</script>
</body>
</html>