-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
1750 lines (1505 loc) · 86.1 KB
/
script.js
File metadata and controls
1750 lines (1505 loc) · 86.1 KB
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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
const inactivityTimeout = 60000; // 5 minutes (adjust as needed)
let inactivityTimer; // Variable to hold the reference to the setTimeout function
// Function to reload the page
function reloadPage() {
window.location.reload();
}
// Function to reset the inactivity timer
function resetInactivityTimer() {
// Clear the existing timer, if any
clearTimeout(inactivityTimer);
// Set a new timer to reload the page after the specified duration of inactivity
inactivityTimer = setTimeout(reloadPage, inactivityTimeout);
}
// Event listeners to track user activity and reset the inactivity timer
document.addEventListener('mousemove', resetInactivityTimer);
document.addEventListener('keydown', resetInactivityTimer);
document.addEventListener('scroll', resetInactivityTimer);
// Initial setup: Start the inactivity timer when the page loads
resetInactivityTimer();
// Check if the browser is Chrome
if (navigator.userAgent.indexOf("Chrome") != -1) {
console.log("You are using Chrome!");
}
// Check if the browser is Firefox
else if (navigator.userAgent.indexOf("Firefox") != -1) {
console.log("You are using Firefox!");
}
// Check if the browser is Safari
else if (navigator.userAgent.indexOf("Safari") != -1) {
console.log("You are using Safari!");
}
// Check if the browser is Internet Explorer
else if (navigator.userAgent.indexOf("MSIE") != -1 || !!document.documentMode == true) {
console.log("You are using Internet Explorer!");
}
// Check if the browser is Edge
else if (navigator.userAgent.indexOf("Edge") != -1) {
console.log("You are using Edge!");
}
// If none of the above, assume it's some other browser
else {
console.log("You are using some other browser!");
}
window.addEventListener('load', toggleOrbit)
let hamburger = document.querySelector('.hamburger-menu')
let lineTop = document.querySelector('.line-top')
let lineMiddle = document.querySelector('.line-middle')
let lineBottom = document.querySelector('.line-bottom')
let mobileNav = document.querySelector('.mobile-nav-menu')
hamburger.addEventListener('click', mobileMenuPopup)
function mobileMenuPopup() {
mobileNav.classList.toggle('mobile-hidden')
hamburger.classList.toggle('hamburger-menu-move')
lineTop.classList.toggle('line-top-move')
lineMiddle.classList.toggle('line-middle-move')
lineBottom.classList.toggle('line-bottom-move')
}
let mobilePopupBtn = document.querySelector('.mobile-popup-btn')
let mobilePopup = document.getElementById('mobile-popup')
mobilePopupBtn.addEventListener('click', closeMobilePopup)
function closeMobilePopup() {
mobilePopup.style.opacity = "0"
modalInfo.classList.add('display-none')
spaceship.classList.add('display-none')
gradientMask.classList.add('display-none')
setTimeout(function () {
mobilePopup.style.display = "none"
controlsContainer.style.opacity = "0.75"
}, 1000)
playMusic()
}
let musicBtn = document.querySelector('.music-btn')
let isMusicOn = false
let musicIcon = document.querySelector('.music-icon')
musicBtn.addEventListener('click', playMusic)
function playMusic() {
var soundtrack = document.getElementById("music");
if (!isMusicOn) {
soundtrack.play();
soundtrack.loop = true;
musicIcon.src = "./assets/volume-up.png"
isMusicOn = true
} else {
soundtrack.pause();
soundtrack.loop = true;
musicIcon.src = "./assets/no-sound.png"
isMusicOn = false
}
}
let liftOffActive = false
let liftOffBtn = document.querySelector('.lift-off-btn');
let spaceship = document.querySelector('.rocket-modal')
let modalInfo = document.querySelector('.modal-info')
let gradientModal = document.querySelector('.gradient-bg')
let rocketInfoContainer = document.querySelector('.rocket-modal-info')
let gradientMask = document.querySelector('.gradient-mask')
let controlsContainer = document.querySelector('.orbit-controls-container')
liftOffBtn.addEventListener('click', liftOff);
function liftOff() {
// Check if the browser is Safari
if (!liftOffActive) {
console.log("You are using Safari!");
modalInfo.style.opacity = "0"
spaceship.classList.add('takeoff-animation');
gradientMask.classList.add('modal-move')
playMusic()
setTimeout(displayNone, 4000)
// setTimeout(toggleOrbit, 1000)
liftOffActive = true
}
}
function displayNone() {
spaceship.classList.add('display-none')
rocketInfoContainer.classList.add('display-none')
gradientModal.classList.add('display-none')
controlsContainer.style.opacity = "0.75"
}
/* =========================== DECLARATIONS =========================== */
/* =========================== MENU BUTTONS =========================== */
let mercuryMenuBtn = document.getElementById("mercury-menu")
let venusMenuBtn = document.getElementById("venus-menu")
let earthMenuBtn = document.getElementById("earth-menu")
let marsMenuBtn = document.getElementById("mars-menu")
let jupiterMenuBtn = document.getElementById("jupiter-menu")
let saturnMenuBtn = document.getElementById("saturn-menu")
let uranusMenuBtn = document.getElementById("uranus-menu")
let neptuneMenuBtn = document.getElementById("neptune-menu")
let sunMenuBtn = document.getElementById("sun-menu")
let moonMenuBtn = document.getElementById("moon-menu")
let cometMenuBtn = document.getElementById("comet-menu")
let asteroidMenuBtn = document.getElementById("asteroid-menu")
let meteorMenuBtn = document.getElementById("meteor-menu")
let satelliteMenuBtn = document.getElementById("satellite-menu")
let alienMenuBtn = document.getElementById("alien-menu")
let mercuryMobileMenuBtn = document.getElementById("mobile-mercury-menu")
let venusMobileMenuBtn = document.getElementById("mobile-venus-menu")
let earthMobileMenuBtn = document.getElementById("mobile-earth-menu")
let marsMobileMenuBtn = document.getElementById("mobile-mars-menu")
let jupiterMobileMenuBtn = document.getElementById("mobile-jupiter-menu")
let saturnMobileMenuBtn = document.getElementById("mobile-saturn-menu")
let uranusMobileMenuBtn = document.getElementById("mobile-uranus-menu")
let neptuneMobileMenuBtn = document.getElementById("mobile-neptune-menu")
let sunMobileMenuBtn = document.getElementById("mobile-sun-menu")
let moonMobileMenuBtn = document.getElementById("mobile-moon-menu")
/* =========================== INDIVIDUAL PLANETS ===================== */
let mercury = document.getElementById('mercury');
let venus = document.getElementById('venus');
let earth = document.getElementById('earth');
let mars = document.getElementById('mars');
let jupiter = document.getElementById('jupiter');
let saturn = document.getElementById('saturn');
let neptune = document.getElementById('neptune');
let uranus = document.getElementById('uranus');
let sun = document.getElementById('sun')
let moon = document.getElementById('moon')
/* ========================= PLANET ROTATION ======================== */
let mercuryRotate = document.querySelector('.mercury-rotate')
let venusRotate = document.querySelector('.venus-rotate')
let earthRotate = document.querySelector('.earth-rotate')
let marsRotate = document.querySelector('.mars-rotate')
let jupiterRotate = document.querySelector('.jupiter-rotate')
let saturnRotate = document.querySelector('.saturn-rotate')
let uranusRotate = document.querySelector('.uranus-rotate')
let neptuneRotate = document.querySelector('.neptune-rotate')
let moonRotate = document.querySelector('.moon-rotate')
/* ========================= PLANET SLIDE MOTION ======================== */
let mercurySlide = document.querySelector('.mercury-slide')
let venusSlide = document.querySelector('.venus-slide')
let earthSlide = document.querySelector('.earth-slide')
let marsSlide = document.querySelector('.mars-slide')
let jupiterSlide = document.querySelector('.jupiter-slide')
let saturnSlide = document.querySelector('.saturn-slide')
let uranusSlide = document.querySelector('.uranus-slide')
let neptuneSlide = document.querySelector('.neptune-slide')
/* ========================= Planet Shadow Motion ======================== */
let mercuryShadow = document.getElementById('mercury-shadow')
let venusShadow = document.getElementById('venus-shadow')
let earthShadow = document.getElementById('earth-shadow')
let marsShadow = document.getElementById('mars-shadow')
let jupiterShadow = document.getElementById('jupiter-shadow')
let saturnShadow = document.getElementById('saturn-shadow')
let uranusShadow = document.getElementById('uranus-shadow')
let neptuneShadow = document.getElementById('neptune-shadow')
let moonShadow = document.getElementById('moon-shadow')
/* ============ Star Background ========================== */
let stars = document.querySelector('.star-map')
/* =========== Setting Up Landing Page ====================== */
/* =========== Array of stars with randomized position, size and opacity ====================== */
for (let i = 0; i < 700; i++) {
let star = document.createElement('span');
let randomSize = Math.ceil((Math.random() * 2));
if (window.innerWidth < 600) {
randomSize = Math.ceil((Math.random() * 1));
}
let width = window.innerWidth;
let starPos = (Math.random() * width);
let randomSpeed = 0
while (randomSpeed < 200) {
randomSpeed = Math.ceil((Math.random() * 100) * 25);
}
star.classList.add('star');
star.style.opacity = (Math.random());
star.style.top = (Math.random() * 100) + '%';
star.style.left = starPos + 'px';
star.style.width = randomSize + 'px';
star.style.height = randomSize + 'px';
stars.appendChild(star);
star.style.animation = `cometMoveRight ${randomSpeed}s linear infinite`;
}
for (let i = 0; i < 200; i++) {
let star = document.createElement('span');
let randomSize = Math.ceil((Math.random() * 3));
if (window.innerWidth < 600) {
randomSize = (Math.random() * 1);
}
let width = window.innerWidth;
let starPos = (Math.random() * width);
star.classList.add('star');
star.style.opacity = (Math.random());
star.style.top = (Math.random() * 100) + '%';
star.style.left = starPos + 'px';
star.style.width = randomSize + 'px';
star.style.height = randomSize + 'px';
star.style.animation = `twinkle 7s linear infinite`;
star.style.animationDelay = (Math.random() * 400) + 's';
stars.appendChild(star);
}
for (let i = 0; i < 700; i++) {
let star = document.createElement('span');
let randomSize = Math.ceil((Math.random() * 2));
if (window.innerWidth < 600) {
randomSize = Math.ceil((Math.random() * 1));
}
let width = window.innerWidth;
let starPos = (Math.random() * width) * -1;
let randomSpeed = 0
while (randomSpeed < 100) {
randomSpeed = Math.ceil((Math.random() * 100) * 25);
}
star.classList.add('star');
star.style.opacity = (Math.random());
star.style.top = (Math.random() * 100) + '%';
star.style.left = starPos + 'px';
star.style.width = randomSize + 'px';
star.style.height = randomSize + 'px';
stars.appendChild(star);
star.style.animation = `cometMoveRight ${randomSpeed}s linear infinite`;
}
/* ============== Shooting Star ================ */
setInterval(shootingStarLeft, 30000);
function shootingStarLeft() {
let comet = document.createElement('span');
let randomSpeed = (Math.random() * 2);
comet.classList.add('asteroid');
cometXPos = 105;
cometYPos = (Math.random() * 100);
comet.style.left = cometXPos + "vw";
comet.style.top = cometYPos + "vh";
stars.appendChild(comet)
}
/* =============== Initial Function for animating orbits =================== */
// window.addEventListener('load', orbit);
/* ======== This is the default orbit animation =============== */
function orbit() {
}
/* ========== ORBIT CONTROLS =============== */
let currentOrbit = 1;
let slideSpeed = 6;
let rotationSpeed = 12;
let orbitControlBtn = document.querySelector('.orbit-control-btn')
let orbitActive = false
let planetRotate = document.querySelectorAll('.rotate')
let planetSlide = document.querySelectorAll('.slide')
let shadowRotate = document.querySelectorAll('.shadow-rotate')
let planet = document.querySelectorAll('.planet')
orbitControlBtn.addEventListener("click", function () {
toggleOrbit()
});
function toggleOrbit() {
if (orbitActive) {
orbitActive = false
orbitControlBtn.innerHTML = '<h3>Resume Orbit</h3>';
for (let i = 0; i < planetRotate.length; i++) {
planetRotate[i].style.animationPlayState = "paused"
planetSlide[i].style.animationPlayState = "paused"
shadowRotate[i].style.animationPlayState = "paused"
planet[i].style.animationPlayState = "paused"
}
moonRotate.style.animationPlayState = "paused"
sun.style.animationPlayState = "paused"
} else {
orbitActive = true
for (let i = 0; i < planetRotate.length; i++) {
planetRotate[i].style.animationPlayState = "running"
planetSlide[i].style.animationPlayState = "running"
shadowRotate[i].style.animationPlayState = "running"
planet[i].style.animationPlayState = "running"
}
orbitControlBtn.innerHTML = '<h3>Pause Orbit</h3>'
moonRotate.style.animationPlayState = "running"
sun.style.animationPlayState = "running"
}
console.log('click')
}
/* ==================== QUIZ ================ */
let quizBtn = document.querySelector('.quiz-btn')
let quizModal = document.querySelector('.quiz-modal-bg')
let chosenQuestions = []
let answer = ''
let userGuess = ''
let userChosenAnswer = false
let currentQuestionNumber = 1;
let questionAnswered = false;
let isUserCorrect = false;
let quizQuestion = document.querySelector('.quiz-question')
let questionNumber = document.querySelector('.question-number')
let quizOptionBtn = document.querySelectorAll('.quiz-answer')
let optionA = document.querySelector('.a')
let optionB = document.querySelector('.b')
let optionC = document.querySelector('.c')
let optionD = document.querySelector('.d')
let quizAnswerBtn = document.querySelector('.quiz-answer-btn')
let rocketProgressLine = document.querySelector('.quiz-rocket-line')
let rocketProgress = document.querySelector('.quiz-rocket')
let progressNumber = 0
let quizModalContainer = document.querySelector('.quiz-modal')
let quizSun = document.querySelector('.quiz-sun')
let quizContent = document.querySelector('.quiz-content')
let quizProgressContainer = document.querySelector('.quiz-progress-container')
let quizDestination = document.querySelector('.quiz-destination')
let landingRocket = document.querySelector('.landing-rocket-container')
let winQuizStatement = document.querySelector('.win-quiz-statement')
let flame = document.querySelector('.flame')
let quizCLoseBtn = document.querySelector('.close-quiz-btn')
let quizWinBtn = document.querySelector('.quiz-win-btn')
let nextQuizBtn = document.querySelector('.next-quiz-btn')
let makemakeBtn = document.querySelector('.makemake-btn')
quizBtn.addEventListener('click', startQuiz)
quizAnswerBtn.addEventListener('click', nextQuestion)
quizCLoseBtn.addEventListener('click', closeQuiz)
quizWinBtn.addEventListener('click', closeQuizWin)
nextQuizBtn.addEventListener('click', nextQuiz)
makemakeBtn.addEventListener('click', makemakeBtnFunction)
function nextQuiz() {
quizContent.classList.remove('full-opacity')
quizProgressContainer.classList.remove('full-opacity')
winQuizStatement.classList.remove('fade-in')
quizContent.classList.remove('fade-out')
quizProgressContainer.classList.remove('fade-out')
quizDestination.classList.remove('move-up')
landingRocket.classList.remove('move-down')
flame.classList.remove('flame-animation')
flame.classList.add('flame-on')
quizSun.classList.remove('full-opacity')
setTimeout(startQuiz, 500)
if (categoryNum > 5) {
setTimeout(function () {
makemakeBtn.classList.remove('display-none')
nextQuizBtn.classList.add('display-none');
}, 12000)
}
}
function makemakeBtnFunction() {
quizContent.classList.remove('full-opacity')
quizProgressContainer.classList.remove('full-opacity')
winQuizStatement.classList.remove('fade-in')
quizContent.classList.remove('fade-out')
quizProgressContainer.classList.remove('fade-out')
quizDestination.classList.remove('move-up')
landingRocket.classList.remove('move-down')
flame.classList.remove('flame-animation')
flame.classList.add('flame-on')
quizSun.classList.remove('full-opacity')
categoryNum = 0
category = planetTriviaList[categoryNum]
closeQuiz()
setTimeout(makemakeInteraction, 2500)
for (let i = 0; i < planetDestination.length; ++i) {
planetDestination[i].innerHTML = planetDestinationName[categoryNum]
}
setTimeout(function() {
makemakeBtn.classList.add('display-none')
nextQuizBtn.classList.remove('display-none');
}, 2000)
}
function closeQuiz() {
quizContent.classList.remove('full-opacity')
quizProgressContainer.classList.remove('full-opacity')
quizSun.classList.remove('full-opacity')
quizModalContainer.classList.remove('quiz-modal-animation')
setTimeout(function () {
quizModal.classList.remove('full-opacity')
}, 2000)
setTimeout(function () {
quizModal.classList.add('display-none')
}, 5000)
}
function closeQuizWin() {
quizContent.classList.remove('full-opacity')
quizProgressContainer.classList.remove('full-opacity')
quizSun.classList.remove('full-opacity')
winQuizStatement.classList.remove('fade-in')
quizContent.classList.remove('fade-out')
quizProgressContainer.classList.remove('fade-out')
quizDestination.classList.remove('move-up')
landingRocket.classList.remove('move-down')
flame.classList.remove('flame-animation')
flame.classList.add('flame-on')
setTimeout(function () {
quizModalContainer.classList.remove('quiz-modal-animation')
}, 1500)
setTimeout(function () {
quizModal.classList.remove('full-opacity')
}, 3000)
setTimeout(function () {
flame.classList.remove('flame-on')
quizModal.classList.add('display-none')
quizSun.classList.remove('sun-move')
flame.classList.remove('flame-on')
}, 5000)
}
quizOptionBtn.forEach(btn => {
btn.addEventListener('click', function () {
for (let i = 0; i < quizOptionBtn.length; ++i) {
quizOptionBtn[i].classList.remove('active-answer')
}
this.classList.add('active-answer')
userGuess = this.value
userChosenAnswer = true;
})
});
let planetTriviaList = ["general_trivia", "moon_trivia", "mars_trivia", "jupiter_trivia", "saturn_trivia", "uranus_trivia", "neptune_trivia"]
let categoryNum = 0
let category = planetTriviaList[categoryNum]
function startQuiz() {
if (progressNumber >= 100) {
progressNumber = 0
rocketProgressLine.style.width = (progressNumber + 4) + '%'
rocketProgress.style.left = progressNumber + '%'
}
quizModal.classList.remove('display-none')
if (categoryNum > 6) {
categoryNum = 0
category = planetTriviaList[categoryNum]
}
setTimeout(function () {
populateQuestion(category, categoryNum)
quizModal.classList.add('full-opacity')
quizModalContainer.classList.add('quiz-modal-animation')
}, 10)
setTimeout(function () {
quizProgressContainer.classList.add('full-opacity')
quizSun.classList.add('full-opacity')
quizSun.classList.remove('sun-move')
quizContent.classList.add('full-opacity')
}, 2500)
}
let quizEarth = document.querySelector('.quiz-earth')
let quizMoon = document.querySelector('.quiz-moon')
let quizStarted = false
let quizLocationPlanet = ["./assets/planets/earth.png", "./assets/planets/moon.png", "./assets/planets/mars.png", "./assets/planets/jupiter.png", "./assets/planets/saturn.png", "./assets/planets/uranus.png", "./assets/planets/neptune.png"]
let quizDestinationPlanet = ["./assets/planets/moon.png", "./assets/planets/mars.png", "./assets/planets/jupiter.png", "./assets/planets/saturn.png", "./assets/planets/uranus.png", "./assets/planets/neptune.png", "./assets/planets/makemake.png"]
let planetDestinationName = ["The Moon", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "The Mystery Planet"]
let planetDestination = document.querySelectorAll('.planet-destination-name')
let quizAnimationPlanet = document.querySelector('.quiz-destination')
let quizAnimationDestinationName = document.querySelector('.quiz-animation-destination-name')
function populateQuestion(category, categoryNum) {
for (let i = 0; i < quizOptionBtn.length; ++i) {
quizOptionBtn[i].classList.remove('active-answer')
quizOptionBtn[i].classList.remove('correct-answer')
quizOptionBtn[i].classList.remove('wrong-answer')
}
rocketProgressLine.style.width = (progressNumber + 4) + '%'
rocketProgress.style.left = progressNumber + '%'
quizStarted = true
quizEarth.src = quizLocationPlanet[categoryNum]
quizMoon.src = quizDestinationPlanet[categoryNum]
for (let i = 0; i < planetDestination.length; ++i) {
planetDestination[i].innerHTML = planetDestinationName[categoryNum]
}
setTimeout(function () {
quizAnimationPlanet.src = quizDestinationPlanet[categoryNum]
}, 1500)
let num = 0
fetch('quiz.json')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
do {
num = Math.floor(Math.random() * 14);
} while (chosenQuestions.includes(num));
chosenQuestions.push(num)
quizQuestion.innerHTML = data.trivia[categoryNum][category][num].question
optionA.innerHTML = '<h2>' + data.trivia[categoryNum][category][num].options.a + '</h2>'
optionB.innerHTML = '<h2>' + data.trivia[categoryNum][category][num].options.b + '</h2>'
optionC.innerHTML = '<h2>' + data.trivia[categoryNum][category][num].options.c + '</h2>'
optionD.innerHTML = '<h2>' + data.trivia[categoryNum][category][num].options.d + '</h2>'
answer = data.trivia[categoryNum][category][num].correct_answer
})
.catch(error => {
console.error('There was an error', error)
})
}
function nextQuestion() {
if (!userChosenAnswer) {
if (quizContent) {
quizContent.classList.add('no-answer');
}
} else {
if (!questionAnswered) {
currentQuestionNumber += 1
questionAnswered = true;
quizContent.classList.remove('no-answer');
if (userGuess == answer) {
for (let i = 0; i < quizOptionBtn.length; ++i) {
if (quizOptionBtn[i].value == answer) {
quizOptionBtn[i].classList.remove('active-answer')
quizOptionBtn[i].classList.add('correct-answer')
progressNumber += 20
rocketProgressLine.style.width = (progressNumber + 4) + '%'
rocketProgress.style.left = progressNumber + '%'
}
}
} else {
for (let i = 0; i < quizOptionBtn.length; ++i) {
if (quizOptionBtn[i].value == answer) {
quizOptionBtn[i].classList.remove('active-answer')
quizOptionBtn[i].classList.add('correct-answer')
} else if (quizOptionBtn[i].value == userGuess) {
quizOptionBtn[i].classList.remove('active-answer')
quizOptionBtn[i].classList.add('wrong-answer')
}
}
}
if (progressNumber >= 100) {
quizAnswerBtn.innerHTML = "<h2>Fly To " + planetDestinationName[categoryNum] + "</h2>"
} else {
quizAnswerBtn.innerHTML = "<h2>Next Question</h2>"
}
} else {
quizContent.classList.remove('no-answer');
if (progressNumber >= 100) {
winningAnimation()
for (let i = 0; i < quizOptionBtn.length; ++i) {
quizOptionBtn[i].classList.remove('active-answer')
quizOptionBtn[i].classList.remove('correct-answer')
quizOptionBtn[i].classList.remove('wrong-answer')
}
} else {
for (let i = 0; i < quizOptionBtn.length; ++i) {
quizOptionBtn[i].classList.remove('active-answer')
quizOptionBtn[i].classList.remove('correct-answer')
quizOptionBtn[i].classList.remove('wrong-answer')
}
isUserCorrect = false
questionAnswered = false
quizAnswerBtn.innerHTML = "<h2>Submit Answer</h2>"
populateQuestion(category, categoryNum)
}
userChosenAnswer = false;
}
}
userGuess = ''
}
function winningAnimation() {
quizAnimationDestinationName.innerHTML = planetDestinationName[categoryNum]
if (categoryNum == 4 || categoryNum == 3) {
quizDestination.style.width = '700px'
} else {
quizDestination.style.width = '550px'
}
if (categoryNum > 6) {
categoryNum = 0;
} else {
categoryNum += 1;
}
chosenQuestions = []
answer = ''
userGuess = ''
progressNumber = 0
category = planetTriviaList[categoryNum]
quizAnswerBtn.innerHTML = "<h2>Submit Answer</h2>"
questionAnswered = false
quizSun.classList.add('sun-move')
quizContent.classList.add('fade-out')
flame.classList.remove('flame-on')
quizProgressContainer.classList.add('fade-out')
quizDestination.classList.add('move-up')
landingRocket.classList.add('move-down')
flame.classList.add('flame-animation')
setTimeout(function () {
winQuizStatement.classList.add('fade-in');
}, 5000);
for (let i = 0; i < planetDestinationName.length; ++i) {
planetDestination[i].innerHTML = planetDestinationName[categoryNum]
}
}
/*======= This is a list of objects for all the planets, objects, moon and sun within the site. They contain the information that is used to populate the modal when the user interacts with the menu or inidivudal planet ========= */
const planets = [
{
name: "Mercury",
info1: "<strong>Closest to the Sun:</strong> Mercury is the closest planet to the Sun in our solar system. It's only about 36 million miles (58 million kilometers) away!",
info2: "<strong>Rapid Orbit:</strong> Mercury zooms around the Sun faster than any other planet. It completes an orbit roughly every 88 Earth days.",
info3: "<strong>No Atmosphere:</strong> Unlike Earth, Mercury doesn't have much of an atmosphere. This means there's no air to breathe, and temperatures can be extremely hot during the day and very cold at night.",
info4: "<strong>Extreme Temperatures:</strong> Because Mercury is so close to the Sun, its surface can get incredibly hot, reaching up to 800 degrees Fahrenheit (427 degrees Celsius). But at night, temperatures can plunge to around -290 degrees Fahrenheit (-179 degrees Celsius).",
info5: "<strong>Rocky and Cratered:</strong> Mercury is a rocky planet, similar to Earth, Mars, and Venus. Its surface is covered in craters, which are scars from impacts with space rocks.",
info6: "<strong>Tiny Planet, Big Core:</strong> Even though Mercury is smaller than many moons in our solar system, it has an enormous iron core that makes up about 60% of its mass.",
info7: "<strong>Short Days, Long Years:</strong> A day on Mercury (from one sunrise to the next) is much longer than a day on Earth, lasting about 176 Earth days. However, a year on Mercury is only about 88 Earth days long!",
info8: "<strong>No Moons or Rings:</strong> Mercury doesn't have any moons or rings like some other planets in our solar system. It's a bit of a loner in that regard!",
info9: "<strong>Named After a Speedy Messenger:</strong> The planet Mercury is named after the ancient Roman messenger god, known for his speed. This name was chosen because of how quickly Mercury moves across the sky.",
info10: "<strong>Visited by a Spacecraft:</strong> The only spacecraft to visit Mercury so far is NASA's MESSENGER (MErcury Surface, Space ENvironment, GEochemistry, and Ranging) mission. It orbited the planet for over four years, providing a wealth of information about this hot, little world.",
funFact: "Mercury has a crater named after Dr.Seuss",
diameter: "4,879 km",
orbit: "88 days",
rotation: "1,408 hours",
moons: "0",
temp: "167°C",
link: "",
image: "./assets/planets/mercury.png"
},
{
name: "Venus",
info1: "<strong>Morning and Evening Star:</strong> Venus is often called the 'Morning Star' or the 'Evening Star' because it's one of the brightest objects in the sky and can be seen just before sunrise or just after sunset.",
info2: "<strong>Similar Size, Different World:</strong> Venus is similar in size to Earth, which is why it's often called Earth's 'sister planet.' However, it has a very different environment.",
info3: "<strong>Extreme Greenhouse Effect:</strong> Venus has an incredibly thick atmosphere made mostly of carbon dioxide. This creates a powerful greenhouse effect, making Venus the hottest planet in our solar system, even hotter than Mercury!",
info4: "<strong>A Day Longer Than a Year:</strong> Venus has an extremely slow rotation on its axis, taking about 243 Earth days to complete one rotation. This means a day on Venus (one spin) is actually longer than a year on Venus (orbit around the Sun), which only takes about 225 Earth days!",
info5: "<strong>No Moons or Rings:</strong> Like Mercury, Venus doesn't have any moons or rings. It's a bit of a cosmic loner in that regard.",
info6: "<strong>Volcanic Activity:</strong> Venus is thought to be a very volcanically active planet. It has more volcanoes than any other planet in our solar system. Some of these volcanoes might still be active!",
info7: "<strong>Heavy Metal Surface:</strong> Venus' surface is rocky and covered with plains, mountains, and highland regions. It's also believed to have a lot of metal in its composition.",
info8: "<strong>Runaway Greenhouse Effect:</strong> The thick atmosphere of Venus traps heat so effectively that its surface can reach temperatures of about 900 degrees Fahrenheit (475 degrees Celsius), which is hotter than the surface of Mercury!",
info9: "<strong>Russian Landers:</strong> The Soviet Union's Venera program was the first to successfully send spacecraft to Venus. They landed a series of landers on Venus in the 1970s and early 1980s.",
info10: "<strong>Named After the Goddess of Love:</strong> Venus is named after the Roman goddess of love and beauty. It's one of the five planets visible to the naked eye and has fascinated people for centuries.",
childSource: "",
funFact: "",
diameter: "12,104 km",
orbit: "225 days",
rotation: "5,832 km",
moons: "0",
temp: "464°C",
link: "",
image: "./assets/planets/venus.png"
},
{
name: "Earth",
info1: "<strong>Third Rock from the Sun:</strong> Earth is the third planet from the Sun in our solar system. It's just the right distance from the Sun to have the perfect conditions for life.",
info2: "<strong>Blue Planet:</strong> Earth is often called the 'Blue Planet' because about 70% of its surface is covered in water. That's why it looks blue from space!",
info3: "<strong>Home to Many Creatures:</strong> Earth is home to a huge variety of creatures, from tiny ants to enormous elephants, and from colorful fish to soaring birds. It's like a big, bustling house for all living things!",
info4: "<strong>The Only Planet with Life:</strong> As far as we know, Earth is the only planet in our solar system that has life. That's what makes it so special!",
info5: "<strong>Amazing Ecosystems:</strong> Earth has different kinds of environments called ecosystems. For example, a forest is an ecosystem, and so is a desert. Each one is like a unique neighborhood for plants and animals.",
info6: "<strong>The Moon's Buddy:</strong> Earth has a special friend called the Moon. It's the only natural satellite we have, and it orbits around us. Sometimes, you can see it really bright in the night sky!",
info7: "<strong>Earth's Layers:</strong> Just like an onion, Earth has layers. The outer layer is called the crust, then comes the mantle, and finally the core. It's like having a hidden treasure deep inside!",
info8: "<strong>Tectonic Plates:</strong> The Earth's crust is divided into big pieces called tectonic plates. They float on the semi-molten mantle below. Sometimes they move, causing earthquakes and building mountains.",
info9: "<strong>Weather Wonders:</strong> Earth's atmosphere is like a big blanket of air that surrounds the planet. It's what gives us weather - rain, snow, wind, and sunshine!",
info10: "<strong>Beautiful Landforms:</strong> Earth has some amazing features like mountains, valleys, rivers, and oceans. The Grand Canyon, for example, is a gigantic gorge carved by the Colorado River. It's like nature's artwork!",
childSource: "",
funFact: "",
diameter: "12,742 km",
orbit: "365 days",
rotation: "24 hours",
moons: "1",
temp: "15°C",
link: "",
image: "./assets/planets/earth.png"
},
{
name: "Mars",
info1: "<strong>Fourth Planet from the Sun:</strong> Mars is the fourth planet from the Sun in our solar system, making it Earth's neighbor.",
info2: "<strong>Nickname - The Red Planet:</strong> Mars gets its reddish color from iron oxide, which is like rust, covering its surface. This gives it a distinct and easily recognizable appearance.",
info3: "<strong>Olympus Mons - The Tallest Volcano:</strong> Mars is home to the largest volcano in the solar system, called Olympus Mons. It's about 13.6 miles (22 kilometers) high, which is nearly three times the height of Mount Everest!",
info4: "<strong>Valles Marineris - The Grand Canyon of Mars:</strong> Mars also hosts a canyon called Valles Marineris, which is about 2,500 miles (4,000 kilometers) long, making it much longer and deeper than the Grand Canyon on Earth.",
info5: "<strong>Frozen Polar Caps:</strong> Just like Earth, Mars has polar ice caps, but they're made of water and carbon dioxide. During the winter, they expand, and in the summer, they shrink.",
info6: "<strong>Thin Atmosphere:</strong> Mars has a very thin atmosphere, which is mostly carbon dioxide. This means there's not enough air for humans to breathe, and the surface pressure is only about 0.6% of Earth's.",
info7: "<strong>Dusty Storms:</strong> Mars experiences enormous dust storms that can cover the entire planet and last for weeks or even months. These storms can sometimes make it difficult for spacecraft to communicate with Earth.",
info8: "<strong>Possible Water on Mars:</strong> Scientists have found evidence suggesting that there might be water, either in liquid or frozen form, under the surface of Mars. This raises the possibility of life, past or present.",
info9: "<strong>Mars Rovers:</strong> NASA has sent several rovers to Mars to explore its surface. Rovers like Curiosity and Perseverance have been busy studying rocks, soil, and even searching for signs of ancient life.",
info10: "<strong>Inspiration for Stories:</strong> Mars has captured the imagination of people for centuries, and it's often featured in science fiction stories as a place where humans might one day explore and even colonize.",
childSource: "",
funFact: "",
diameter: "6,779 km",
orbit: "365 days",
rotation: "24 hours",
moons: "2",
temp: "-65°C",
link: "",
image: "./assets/planets/mars.png"
},
{
name: "Jupiter",
info1: "<strong>Giant of the Solar System:</strong> Jupiter is the largest planet in our solar system. It's so big that over 1,300 Earths could fit inside it!",
info2: "<strong>King of Moons:</strong> Jupiter has a whopping 79 known moons, including the four largest: Io, Europa, Ganymede, and Callisto, which are known as the Galilean moons.",
info3: "<strong>Famous Red Spot:</strong> Jupiter has a giant storm called the Great Red Spot. This storm has been raging for over 350 years and is so big that it could fit about three Earths inside it!",
info4: "<strong>Rapid Rotation:</strong> Jupiter spins very quickly on its axis, completing one rotation in about 10 hours. This rapid rotation causes it to have a flattened shape at the poles.",
info5: "<strong>Strongest Magnetic Field:</strong> Jupiter has the strongest magnetic field of any planet in our solar system. This magnetic field is over 20,000 times stronger than Earth's!",
info6: "<strong>Gas Giant:</strong> Jupiter is mainly composed of gases like hydrogen and helium, similar to the Sun. It doesn't have a solid surface like Earth.",
info7: "<strong>Rings of Jupiter:</strong> Although not as prominent as Saturn's rings, Jupiter does have a faint ring system made up of dust particles.",
info8: "<strong>Famous Discoverer:</strong> Jupiter was named after the king of the Roman gods. It was one of the five planets visible to the naked eye and was known to ancient civilizations.",
info9: "<strong>Exploration by Spacecraft:</strong> Several spacecraft have visited Jupiter, including the famous Galileo spacecraft and the more recent Juno mission, which is currently studying the planet in detail.",
info10: "<strong>Mini Solar System:</strong> Jupiter is sometimes called a 'mini solar system' because it has its own set of planets, its moons. Ganymede, the largest moon in the solar system, is even bigger than the planet Mercury!",
childSource: "",
funFact: "",
diameter: "139,820 km",
orbit: "4,333 days",
rotation: "10 hours",
moons: "75",
temp: "-110°C",
link: "",
image: "./assets/planets/jupiter.png"
},
{
name: "Saturn",
info1: "<strong>Ringed Wonder:</strong> Saturn is famous for its spectacular ring system, which is made up of icy particles and dust. These rings make Saturn one of the most recognizable planets in the solar system.",
info2: "<strong>Gorgeous Gases:</strong> Like Jupiter, Saturn is a gas giant, meaning it's mostly composed of hydrogen and helium. It doesn't have a solid surface like Earth.",
info3: "<strong>Many, Many Rings:</strong> Saturn's rings are divided into thousands of smaller ringlets. They're not solid like a hula hoop but are made up of countless individual particles, each orbiting the planet.",
info4: "<strong>Tilted Rings:</strong> Saturn's rings are tilted relative to the planet's equator. This gives them a unique appearance when viewed from different angles.",
info5: "<strong>Moon Magnet:</strong> Saturn has more than 80 known moons, and its largest moon, Titan, is even bigger than the planet Mercury. Titan is the only moon in our solar system with a substantial atmosphere.",
info6: "<strong>Fast Spinner:</strong> Saturn is a speedy spinner! It completes one rotation on its axis in about 10.5 hours. However, its equator spins faster than its poles, making it a bit squished.",
info7: "<strong>Named After a Roman God:</strong> Saturn is named after the Roman god of agriculture and wealth. It's one of the five planets visible to the naked eye and was known to ancient civilizations.",
info8: "<strong>Cassini-Huygens Mission:</strong> The Cassini spacecraft, along with the Huygens probe, spent over 13 years studying Saturn and its moons. It provided us with a wealth of information about this incredible planet.",
info9: "<strong>Hexagonal Storm:</strong> Saturn's north pole has a strange, hexagonal-shaped storm that's been observed by the Cassini spacecraft. It's a massive, persistent cloud pattern.",
info10: "<strong>Low Density:</strong> Despite being very large, Saturn is less dense than water. If you could find a bathtub big enough to hold it, Saturn would float!",
childSource: "",
funFact: "",
diameter: "116,460 km",
orbit: "10,759 days",
rotation: "11 hours ",
moons: "53",
temp: "-140°C",
link: "",
image: "./assets/planets/saturn.png"
},
{
name: "Uranus",
info1: "<strong>Tilted on Its Side:</strong> Uranus is unique among the planets because it spins on its side. This means its poles experience long periods of sunlight followed by long periods of darkness.",
info2: "<strong>Coldest Planet in the Solar System:</strong> Uranus is the coldest planet in our solar system, even though it's not the farthest from the Sun. Its average temperature is about -224 degrees Celsius (-371 degrees Fahrenheit).",
info3: "<strong>Ice Giant:</strong> Like Neptune, Uranus is classified as an ice giant, which means it's mostly made up of ices like water, ammonia, and methane, along with a small rocky core.",
info4: "<strong>Faint Rings:</strong> Uranus has a system of rings, but they're much fainter and less prominent than Saturn's dazzling rings. They were first discovered in 1977.",
info5: "<strong>Weird Magnetic Field:</strong> Uranus has a magnetic field that's tilted at an extreme angle - about 98 degrees from its axis of rotation! This is very different from the other planets.",
info6: "<strong>27 Known Moons:</strong> As of my last knowledge update in September 2021, Uranus has 27 known moons. The five largest moons are Miranda, Ariel, Umbriel, Titania, and Oberon.",
info7: "<strong>Named After a Greek God:</strong> Uranus is named after the ancient Greek god of the sky. It's the only planet named after a Greek god, while the others are named after Roman deities.",
info8: "<strong>Voyager 2 Mission:</strong> The only spacecraft to have visited Uranus is NASA's Voyager 2. It flew by the planet in 1986 and provided valuable data about this mysterious world.",
info9: "<strong>Retrograde Rotation of Moons:</strong> Most of Uranus's moons orbit in the opposite direction of the planet's rotation, which is quite unusual in our solar system.",
info10: "<strong>Long, Long Years:</strong> A year on Uranus (the time it takes to orbit the Sun) is about 84 Earth years. This means that a person on Uranus would have a very long birthday cycle!",
childSource: "",
funFact: "",
diameter: "50,724 km",
orbit: "30,687 days",
rotation: "17 hours",
moons: "127",
temp: "-195°C",
link: "",
image: "./assets/planets/uranus.png"
},
{
name: "Neptune",
info1: "<strong>Eighth Planet from the Sun:</strong> Neptune is the eighth planet from the Sun in our solar system, making it the farthest known planet from our star.",
info2: "<strong>Giant Ice Ball:</strong> Neptune is an ice giant, which means it's mostly made of icy substances like water, ammonia, and methane. It's so cold there that these elements are frozen solid!",
info3: "<strong>Stormy Weather:</strong> Neptune is known for having the most violent and powerful storms in the solar system. The biggest storm on Neptune is called the Great Dark Spot.",
info4: "<strong>Bluish Glow:</strong> Neptune appears a beautiful deep blue color because its atmosphere contains a lot of methane, which absorbs red light and reflects blue light.",
info5: "<strong>Far, Far Away:</strong> Neptune is incredibly far from Earth. If you could travel at the speed of light, it would still take over four hours to reach Neptune from Earth!",
info6: "<strong>Ringed World:</strong> Just like Saturn, Neptune has rings. However, they're not as bright and noticeable as Saturn's. They are made of dust and ice particles.",
info7: "<strong>Triton:</strong> A Mysterious Moon: Neptune has a large moon called Triton. It's one of the coldest places in the solar system, even colder than Pluto! Triton is also unique because it orbits Neptune in the opposite direction of most moons.",
info8: "<strong>Strong Winds:</strong> The winds on Neptune are incredibly fast, reaching speeds of up to 1,200 miles per hour (about 1,900 kilometers per hour). That's faster than the strongest hurricane winds on Earth!",
info9: "<strong>Thirteen Hours of Daylight:</strong> A day on Neptune is about 16 hours and 6 minutes long, which is only a little longer than a day on Earth. However, a year on Neptune is much longer, lasting about 165 Earth years!",
info10: "<strong>Unexplored and Mysterious:</strong> We've only visited Neptune once, when the spacecraft Voyager 2 flew by in 1989. There's still so much we don't know about this distant and fascinating planet!",
funFact: "Surface winds can measure 2,100km/hr",
diameter: "49,244 km",
orbit: "60,190 days",
rotation: "16 hours",
moons: "14",
temp: "-200°C",
link: "",
image: "./assets/planets/neptune.png"
}
,
{
name: "The Sun",
info1: "<strong>Solar Sizzle:</strong> The Sun is so hot that you could cook a pizza in just a few seconds if it were close enough (though, I wouldn't recommend trying!).",
info2: "<strong>Cosmic Ballerina:</strong> Despite its massive size, the Sun rotates at different rates at its equator and poles. This causes a sort of 'cosmic dance'!",
info3: "<strong>Sunny Day Out:</strong> If you could drive a car to the Sun at a steady speed of 60 mph (97 km/h), it would take you about 193 years to get there. Don't forget the sunscreen!",
info4: "<strong>Fluffy Clouds, Fiery Sun:</strong> Despite its appearance, the Sun isn't a solid object. It's a gigantic ball of super-hot gas that's held together by its own gravity!",
info5: "<strong>Nuclear Disco Party:</strong> The Sun throws an enormous nuclear party every second, releasing energy equivalent to a trillion atomic bombs!",
info6: "<strong>Ancient Star Wisdom:</strong> Every beam of sunlight you see is like a time-traveling messenger from the past. The light you're seeing now actually started its journey about 8 minutes ago!",
info7: "<strong>Stellar Teenager:</strong> The Sun is like a cosmic teenager, having been around for about 4.6 billion years. Scientists estimate it has about 5 billion years of 'teenage' rebellion left before it transforms into a red giant!",
info8: "<strong>Celestial DJ:</strong> The Sun emits a constant stream of charged particles, creating a sort of solar wind. This cosmic DJ sometimes causes mesmerizing light shows called auroras on Earth!",
info9: "<strong>Sunstronaut Dreams:</strong> If you could stand on the Sun (which, for the record, you can't because it's not a solid surface), you'd weigh about 27 times what you do on Earth. That's like strapping a bunch of your friends onto your back!",
info10: "<strong>Super Solar Sunflower:</strong> Plants on Earth need sunlight to grow, but the Sun is so powerful that it could grow a sunflower over 100 feet (30 meters) tall in just one month! Imagine a garden with those!",
funFact: "",
diameter: "1,400,000 km",
orbit: "0 days",
rotation: "27 days",
moons: "0",
temp: "5,600°C",
link: "",
image: "./assets/planets/sun.png"
}
,
{
name: "The Moon",
info1: "<strong>Earth's Only Natural Satellite:</strong> The Moon is the only natural satellite of Earth. It's about 1/6th the size of Earth.",
info2: "<strong>Close Neighbor:</strong> The Moon is relatively close to Earth, about 238,855 miles (384,400 kilometers) away on average.",
info3: "<strong>Tidally Locked:</strong> The Moon is tidally locked to Earth, which means it always shows the same face to our planet. This is why we only see one side of the Moon from Earth.",
info4: "<strong>No Atmosphere:</strong> Unlike Earth, the Moon doesn't have an atmosphere. This means there's no air to breathe, and it also leads to extreme temperature differences between day and night.",
info5: "<strong>Moon Phases:</strong> The Moon goes through different phases during its orbit around Earth, including full moon, crescent moon, and new moon. These changes in appearance are due to the position of the Moon relative to the Sun and Earth.",
info6: "<strong>Gravity Differences:</strong> The gravity on the Moon is much weaker than on Earth. If you were on the Moon, you would weigh about 1/6th of what you do on Earth.",
info7: "<strong>Apollo Missions:</strong> Between 1969 and 1972, NASA's Apollo program sent astronauts to the Moon. The first manned mission, Apollo 11, resulted in Neil Armstrong and Buzz Aldrin becoming the first humans to walk on the Moon.",
info8: "<strong>Ancient Surface:</strong> The Moon's surface is covered in craters, mountains, and plains. Many of the craters were formed by impacts from asteroids and comets billions of years ago.",
info9: "<strong>Regolith:</strong> The Moon's surface is covered in a layer of loose, fragmented material called regolith. It's made up of small rocks, dust, and broken rock fragments.",
info10: "<strong>Moonquakes:</strong> The Moon experiences moonquakes, which are caused by the gravitational interactions with Earth and the cooling and contracting of the lunar surface. These quakes can be much weaker than those on Earth.",
childSource: "",
funFact: "",
diameter: " 3,475 km",
orbit: "27 days",
rotation: "27 days",
moons: "0",
temp: "-183 to 106°C",
link: "",
image: ""
}
,
{
name: "Asteroid",
info1: "<strong>Rocky Celestial Bodies:</strong> Asteroids are small, rocky objects that orbit the Sun. They're like leftover building materials from the formation of the solar system.",
info2: "<strong>Asteroid Belt:</strong> Most asteroids are found in the asteroid belt, a region located between the orbits of Mars and Jupiter. This area is like a busy highway of asteroids.",
info3: "<strong>Various Sizes:</strong> Asteroids come in many different sizes, from small boulders a few meters across to massive bodies that can be hundreds of kilometers in diameter.",
info4: "<strong>Not Round Like Planets:</strong> Unlike planets, asteroids don't have a spherical shape. They can be irregularly shaped and sometimes even resemble potatoes or lumpy rocks.",
info5: "<strong>Close Approaches to Earth:</strong> Some asteroids come close to Earth, but most are not a threat to our planet. NASA keeps a watchful eye on any potentially hazardous asteroids.",
info6: "<strong>Impact History:</strong> Asteroid impacts have played a significant role in shaping the history of our planet. The most famous impact was the one that led to the extinction of the dinosaurs about 66 million years ago.",
info7: "<strong>Asteroid Moons:</strong> Some asteroids have their own small moons. These are like mini-satellites that orbit around the asteroid.",
info8: "<strong>Carbonaceous Chondrites:</strong> Certain types of asteroids, known as carbonaceous chondrites, are believed to be some of the oldest and most primitive materials in the solar system.",
info9: "<strong>Exploration Missions:</strong> Space agencies like NASA and JAXA have sent spacecraft to study and even land on asteroids. For example, NASA's OSIRIS-REx mission successfully collected a sample from the asteroid Bennu in 2020.",
info10: "<strong>Potential Resources:</strong> Some scientists believe that asteroids could be mined for valuable resources like metals, water, and even rare minerals in the future. This idea is being explored for potential use in space exploration and industry. ",
funFact: "Mercury has a crater named after Dr.Seuss",
diameter: "<10 km",
orbit: "Varies",
rotation: "Nil",
moons: "0",
temp: "-50°C",
link: "",
image: "./assets/planets/mercury.png"
}
,
{
name: "Comet",
info1: "<strong>Icy Visitors:</strong> Comets are icy bodies that originate from the outer regions of the solar system, often referred to as the Oort Cloud or the Kuiper Belt. They are sometimes called 'dirty snowballs.'",
info2: "<strong>Orbiting the Sun:</strong> Just like planets, comets orbit the Sun, but their orbits can be highly elliptical, meaning they have elongated and stretched-out paths around the Sun.",
info3: "<strong>Tails of Light:</strong> When a comet gets close to the Sun, it starts to heat up. This causes the icy nucleus to release gas and dust, creating a bright glowing coma (the head) and often two tails—a gas tail and a dust tail—pointing away from the Sun.",
info4: "<strong>Nucleus:</strong> The solid core of a comet is called the nucleus. It's made up of ice, dust, and small rocks. Some comet nuclei are only a few kilometers wide, while others can be much larger.",
info5: "<strong>Haley's Comet:</strong> One of the most famous comets is Halley's Comet, named after the astronomer Edmund Halley. It's visible from Earth about once every 76 years.",
info6: "<strong>Long Period vs. Short Period Comets:</strong> Comets are categorized based on their orbital period. Long-period comets take a long time to orbit the Sun, sometimes thousands of years, while short-period comets have much shorter orbits.",
info7: "<strong>Deep Impact:</strong> In 2005, NASA's Deep Impact mission intentionally crashed a probe into the comet Tempel 1. This impact allowed scientists to study the interior of the comet and learn more about its composition.",
info8: "<strong>Kuiper Belt Comets:</strong> Some comets originate from the Kuiper Belt, a region of the solar system beyond Neptune. These are known as short-period comets.",
info9: "<strong>Comet NEOWISE:</strong> In 2020, Comet NEOWISE became visible to the naked eye and put on a spectacular show for observers around the world.",
info10: "<strong>Comet Hyakutake:</strong> In 1996, Comet Hyakutake made one of the closest approaches to Earth of any comet in centuries, allowing for stunning views from the ground.",