diff options
author | elioat <elioat@tilde.institute> | 2024-12-01 14:02:40 -0500 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2024-12-01 14:02:40 -0500 |
commit | 1768e1fd0ddc4a059869caa8ff4b08b5734e3982 (patch) | |
tree | 7ab28b5f71b1dde0e7c2f8cbe3226c084abff706 /html/bp-sand/index.html | |
parent | 1f5d84d1ab29cc642319f6a6097d776090732ffb (diff) | |
download | tour-1768e1fd0ddc4a059869caa8ff4b08b5734e3982.tar.gz |
*
Diffstat (limited to 'html/bp-sand/index.html')
-rw-r--r-- | html/bp-sand/index.html | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/html/bp-sand/index.html b/html/bp-sand/index.html index e34e33c..48c98d8 100644 --- a/html/bp-sand/index.html +++ b/html/bp-sand/index.html @@ -34,7 +34,10 @@ <canvas id="sandCanvas"></canvas> <div class="controls"> <input type="number" id="bpmInput" value="60" min="10" max="300"> - <button id="toggleButton">Start</button> + <div> + <button id="clearSand">Clear</button> + <button id="toggleButton">Start</button> + </div> </div> <script> @@ -42,6 +45,7 @@ const ctx = canvas.getContext('2d'); const bpmInput = document.getElementById('bpmInput'); const toggleButton = document.getElementById('toggleButton'); + const clearSandButton = document.getElementById('clearSand'); const controls = document.querySelector('.controls'); let bpm = 60; @@ -145,6 +149,10 @@ // Event Listeners toggleButton.addEventListener('click', toggleBPM); + clearSandButton.addEventListener('click', () => { + sandParticles = []; + }); + bpmInput.addEventListener('input', (e) => { bpm = parseInt(e.target.value); if (isRunning) { |