-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
170 lines (145 loc) · 4.83 KB
/
index.html
File metadata and controls
170 lines (145 loc) · 4.83 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>nayla</title>
<style>
body {
margin: 0;
padding: 0;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center; /* Pusatkan secara vertikal */
align-items: center; /* Pusatkan secara horizontal */
background: url('background menu.png') no-repeat center center;
background-size: cover;
overflow: hidden;
}
#buttons-container {
display: flex;
flex-direction: column; /* Ubah layout menjadi kolom */
align-items: center; /* Pusatkan secara horizontal */
gap: -40px; /* Tambahkan jarak antar tombol */
padding: 40px;
border-radius: 10px;
}
.button {
width: 210px; /* Lebar tombol diperbesar */
height: 60px; /* Tinggi tombol diperbesar */
background: url('button-bg.png') no-repeat center center;
background-size: contain;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
transition: transform 0.3s ease; /* Efek transisi saat hover */
}
.button01 {
width: 210px; /* Lebar tombol diperbesar */
height: 60px; /* Tinggi tombol diperbesar */
background: url('button-bg.png') no-repeat center center;
background-size: contain;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
transition: transform 0.3s ease; /* Efek transisi saat hover */
}
.button:hover {
transform: scale(1.05); /* Efek zoom saat hover */
}
.button img {
width: 60%; /* Ukuran ikon diperbesar */
height: auto;
margin-bottom: 10px;
}
.button01:hover {
transform: scale(1.05); /* Efek zoom saat hover */
}
.button01 img {
width: 41%; /* Ukuran ikon diperbesar */
height: auto;
margin-bottom01: 10px;
}
.robot {
position: absolute;
width: 120px;
height: auto;
bottom: 0%;
animation: moveRobot 30s linear infinite;
}
@keyframes moveRobot {
0% {
left: -10%;
}
50% {
left: 50%;
}
100% {
left: 110%;
}
}
#toggleAudioImg {
position: absolute;
top: 30px;
left: 30px;
width: 30px; /* Ukuran gambar */
cursor: pointer;
transition: transform 0.3s ease;
}
#toggleAudioImg:hover {
transform: scale(0.9); /* Zoom out dengan scale */
}
/* Tambahan styling untuk body */
body {
margin: 0;
height: 100vh;
}
</style>
</head>
<body>
<img id="toggleAudioImg" src="sound button.png" alt="Play Audio">
<audio id="audio" loop>
<source src="sound/backsound01.mp3" type="audio/mp3">
Your browser does not support the audio element.
</audio>
<!-- Animasi -->
<img src="robot.gif" alt="robot" class="robot">
<!-- Kontainer Tombol -->
<div id="buttons-container">
<a href="mode level.html">
<div class="button">
<img src="play game.png" alt="Icon 1" loading="lazy">
</div>
</a>
<a href="mode leve.html">
<div class="button">
<img src="menu game.png" alt="Icon 2">
</div>
</a>
<a href="mode leve.html">
<div class="button01">
<img src="quit game.png" alt="Icon 3">
</div>
</a>
</div>
<script>
const audio = document.getElementById('audio');
const buttonImg = document.getElementById('toggleAudioImg');
function toggleAudio() {
if (audio.paused) {
audio.play().then(() => {
buttonImg.src = "sound button.png"; // Ganti gambar saat audio diputar
}).catch((error) => {
console.error("Audio playback failed:", error);
});
} else {
audio.pause();
buttonImg.src = "sound button.png"; // Ganti gambar saat audio dihentikan
}
}
buttonImg.addEventListener('click', toggleAudio);
</script>
</body>