-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
53 lines (39 loc) · 1.23 KB
/
index.js
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
var menuAudio = new Audio('assets/menu.mp3');
menuAudio.play();
menuAudio.addEventListener('ended', () => {
menuAudio.currentTime = 0;
menuAudio.play();
});
function startGame() {
window.location.href = "game/game.html";
}
function showInstructions() {
document.getElementById('instructionsPopup').style.display = 'flex';
}
function closeInstructions() {
document.getElementById('instructionsPopup').style.display = 'none';
}
function showInfo() {
document.getElementById('infoPopup').style.display = 'flex';
}
function closeInfo() {
document.getElementById('infoPopup').style.display = 'none';
}
const scrollContent = document.getElementById('scrollContent');
scrollContent.addEventListener('mouseover', () => {
scrollContent.style.animationPlayState = 'paused';
});
scrollContent.addEventListener('mouseout', () => {
scrollContent.style.animationPlayState = 'running';
});
const images = [
'url("assets/background.png")',
'url("assets/background -2.png")'
];
let currentIndex = 0;
function cambiarFondo() {
document.getElementById('startScreen').style.backgroundImage = images[currentIndex];
currentIndex = (currentIndex + 1) % images.length;
}
setInterval(cambiarFondo, 500);
cambiarFondo();