|
|
|
@ -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); |
|
|
|
|
|
|
|
|
|