diff --git a/index.html b/index.html index 3e89f79..d4c1947 100644 --- a/index.html +++ b/index.html @@ -23,12 +23,13 @@ window.addEventListener('keydown', function (event) { if (event.code === 'Space') { - const dx = 1000 * (Math.random() - 0.5); - const dy = 1000 * (Math.random() - 0.5); - //simulation.splatAtLocation(500, 500, dx, dy); simulation.multipleSplats(1); } }); + + window.addEventListener('beforeunload', () => { + simulation.stop(); + });