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 @@
- Preparation + Add Pendula - +
+ + +
Simulation diff --git a/public/styles.css b/public/styles.css index 4518cc0..0080834 100644 --- a/public/styles.css +++ b/public/styles.css @@ -132,7 +132,15 @@ button:active { justify-content: space-between; } .horizontal_group > * { - width: 32%; + width: auto; + flex: 1; + margin: 5px; +} +.horizontal_group > *:last-child { + margin-right: 0; +} +.horizontal_group > *:first-child { + margin-left: 0; } #normalize_btn { @@ -154,6 +162,12 @@ button:active { background-image: url("data/images/add.svg"); } +#delete_btn { + border-color: #810000; + background-color: #ffa7a7; + background-image: url("data/images/delete.svg"); +} + #play_btn { border-color: #0000c2; background-color: #b1b1ff;