let cols = 100, rows = 100;
let squareX = 200, squareY = 200, squareSize = 400;
let nodeWidth, nodeHeight;
let colors = ['#e34132', '#2b0804', '#8b512c'];
nodeWidth = squareSize / cols;
nodeHeight = squareSize / rows;
for (let col = 0; col < cols; col++) {
for (let row = 0; row < rows; row++) {
let x = squareX + col * nodeWidth;
let y = squareY + row * nodeHeight;
let randColor = colors[int(random(colors.length))];
nodes[col][row] = new Node(x, y, randColor);
rect(0, 0, width, height);
let t = frameCount / 10000;
for (let col = 0; col < cols; col++) {
for (let row = 0; row < rows; row++) {
nodes[col][row].update(t);
let dx = noise(nx + 300, ny + 500, nx + ny + t) * 2 - 1;
let dy = noise(nx + 100, ny + 300, nx + ny + t) * 2 - 1;
let range = random(1, random(1, 7000));
let wei = map(sin(t), -1, 1, -range, range);
let newX = this.originalX + dx * wei;
let newY = this.originalY + dy * wei;
let dotSize = map(sin(t), -1, 1, 1, 4);
ellipse(newX, newY, dotSize, dotSize);