about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--html/bp-sand/index.html10
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) {