diff --git a/js/animation2a.js b/js/animation2a.js index ef3f68b..29f4800 100644 --- a/js/animation2a.js +++ b/js/animation2a.js @@ -73,7 +73,8 @@ Animation2a.prototype.createGlobalGrid = function() { const bounds = this.container.getBoundingClientRect(); const grid = new Grid(); - for (let i = 0; i < 2; i++) { + const n = Random.num(1, 3); + for (let i = 0; i < n; i++) { const w = Random.num(50, 200); const h = Random.num(50, 200); diff --git a/js/animation2b.js b/js/animation2b.js index fffeea4..83df344 100644 --- a/js/animation2b.js +++ b/js/animation2b.js @@ -14,7 +14,7 @@ function Animation2b() { this.container = document.getElementById('animation2b'); this.particles = []; - this.grid = createGlobalGrid(this.container, this.bounds); + this.grid = this.createGlobalGrid(this.container, this.bounds); const controls = new Controls( document.getElementById('controls2b'), @@ -68,10 +68,12 @@ Animation2b.prototype.updateSpeed = function(value) { this.particles.forEach(p => p.updateConfig({ speed: value })); } -function createGlobalGrid(container, bounds) { +Animation2b.prototype.createGlobalGrid = function() { + const bounds = this.container.getBoundingClientRect(); const grid = new Grid(); - for (let i = 0; i < 2; i++) { + const n = Random.num(1, 3); + for (let i = 0; i < n; i++) { const w = Random.num(50, 200); const h = Random.num(50, 200);