diff --git a/disco.mp3 b/disco.mp3 new file mode 100644 index 0000000..7faff26 Binary files /dev/null and b/disco.mp3 differ diff --git a/fairies.mp3 b/fairies.mp3 new file mode 100644 index 0000000..73848d6 Binary files /dev/null and b/fairies.mp3 differ diff --git a/funkydisco.mp3 b/funkydisco.mp3 new file mode 100644 index 0000000..855f5a4 Binary files /dev/null and b/funkydisco.mp3 differ diff --git a/funkydisco2.mp3 b/funkydisco2.mp3 new file mode 100644 index 0000000..841dfd5 Binary files /dev/null and b/funkydisco2.mp3 differ diff --git a/index.html b/index.html index 5f12297..1b7e83d 100644 --- a/index.html +++ b/index.html @@ -21,43 +21,57 @@

Random Disco Light Simulator

- 2. Time interval + (with which the color changes randomly):
[Negative interval or no input will be treated as 0 interval][Negative interval or no input will be treated as 0 interval]
- + -
-
- - -
+ Select + + + + + + +
+ + +
+
+ + +
Random Disco Light Simulator target="_blank" > - - -
-
- - - + + + +
+ + + + + + + +
The timer has ended. The page will reload.
diff --git a/script.js b/script.js index c842a22..df5b530 100644 --- a/script.js +++ b/script.js @@ -49,8 +49,9 @@ document.addEventListener('DOMContentLoaded', () => { let set_time = document.getElementById("time").value; let unit = document.getElementById("unit").value; let view = document.getElementById("view").value; + let soundEffect = document.getElementById("sound").value; - if (countdownValue && countdownValue > 0 && Number(n) >= 0 && Number.isInteger(Number(n)) && n !== "" && unit !== "unit" && view !== "select") { + if (countdownValue && countdownValue > 0 && Number(n) >= 0 && Number.isInteger(Number(n)) && n !== "" && unit !== "unit" && view !== "select" && soundEffect !=="none") { // Clear error message if everything is correct document.getElementById("error").innerHTML = ""; @@ -59,6 +60,11 @@ document.addEventListener('DOMContentLoaded', () => { // Start the countdown timer startCountdown(countdownValue); + + // Start the sound effect + const audio = document.getElementById(soundEffect); + audio.loop = true; // Loop the audio + audio.play(); } else { // Display error message if any input is missing or invalid document.getElementById("error").innerHTML = "Please fill out all required fields correctly!"; diff --git a/style.css b/style.css index 2d56747..11c713c 100644 --- a/style.css +++ b/style.css @@ -100,7 +100,7 @@ strong { } #view, -#unit { +#unit, #sound{ text-align: center; border-radius: 10px; background-color: rgba(255, 255, 255, 0.07); diff --git a/upbeatdisco.mp3 b/upbeatdisco.mp3 new file mode 100644 index 0000000..c48e8fa Binary files /dev/null and b/upbeatdisco.mp3 differ