diff --git a/public/data/scripts/ts/manager.ts b/public/data/scripts/ts/manager.ts index be73b06..d413151 100644 --- a/public/data/scripts/ts/manager.ts +++ b/public/data/scripts/ts/manager.ts @@ -1,6 +1,6 @@ class Manager { - pendulums: Pendulum[] = [] + pendula: Pendulum[] = [] timescale = 1; gravity = 9.81; @@ -16,7 +16,7 @@ class Manager { let rad = i / count / 1e3 + p.PI * 1.05; let hue = i / count * 100; let color = p.color(hue, 100, 100); - this.pendulums.push( + this.pendula.push( new Pendulum([1, 1, 1, 1, 1, 1, 1, 1], [50, 50, 50, 50, 50, 50, 50, 100 + i / count / 10000], color) ); } @@ -72,6 +72,11 @@ class Manager { methods: { add() { + }, + deleteAll(){ + if (confirm("Delete all pendulums?")){ + manager.pendula.splice(0); + } }, resetMasses(){ for (let i = 0; i < this.maxSegmentCount; i++) @@ -103,14 +108,14 @@ class Manager { update(){ if (this.playing) { const h = this.timescale / Math.max(p.frameRate(), 1); - this.pendulums.forEach(p => p.update(h)); + this.pendula.forEach(p => p.update(h)); } } draw(){ p.push() p.translate(p.width / 2, p.height / 2); - this.pendulums.forEach(p => p.draw()); + this.pendula.forEach(p => p.draw()); p.pop(); } diff --git a/public/index.html b/public/index.html index e9874b9..3734d94 100644 --- a/public/index.html +++ b/public/index.html @@ -16,7 +16,7 @@