xxxxxxxxxx
39
let margin;
let cols = 10
let rows = 10;
function setup() {
createCanvas(windowWidth, windowHeight);
margin = width / 4;
noStroke();
fill('#fffff1');
}
function draw() {
background(0);
let spacing = height/20;
let offsetX = (cols - 1) * spacing / 2;
let offsetY = (rows - 1) * spacing / 2;
let wavePhase = 2;
translate(width/2, height/2);
for (let i = 0; i < cols; i++) {
for (let j = 0; j < rows; j++) {
let waveOffset = (i+j)/wavePhase;
let wave = sin(radians(frameCount * 2) - waveOffset);
let waveMapped = map(wave, -1, 1, -width/100, width/100)
let x = i * spacing - offsetX + waveMapped;
let y = j * spacing - offsetY + waveMapped;
circle(x, y, width/50);
}
}
// if(frameCount == 1) saveGif('sin', 3)
}