-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
28 lines (24 loc) · 995 Bytes
/
Copy pathscripts.js
File metadata and controls
28 lines (24 loc) · 995 Bytes
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
document.addEventListener('DOMContentLoaded', function () {
const playButton = document.getElementById('playButton');
const pinkNoise = document.getElementById('pinkNoise');
const volumeControl = document.getElementById('volumeControl');
const statusMessage = document.getElementById('statusMessage');
// Function to play or pause the pink noise
function togglePinkNoise() {
if (pinkNoise.paused) {
pinkNoise.play();
statusMessage.textContent = 'Pink noise is playing.';
} else {
pinkNoise.pause();
statusMessage.textContent = 'Pink noise is not playing.';
}
}
// Function to update the volume
function updateVolume() {
pinkNoise.volume = volumeControl.value;
}
// Event listener for the play button
playButton.addEventListener('click', togglePinkNoise);
// Event listener for the volume control
volumeControl.addEventListener('input', updateVolume);
});