xxxxxxxxxx
37
let angle = 0;
let x = 250;
let y = 250;
let squareSize = 50;
function setup() {
createCanvas(windowWidth, windowHeight);
angleMode(DEGREES);
}
function draw() {
background(0);
fill(255);
for (let x = 0; x < windowWidth; x += squareSize) {
for (let y = 0; y < windowHeight; y += squareSize) {
// BEGIN TRANSFORMATION USING PUSH()
push();
// translate origin point of canvas to center
// of gride square
translate(x + squareSize/2, y + squareSize/2);
//
let xAdj = squareSize/2 + sin(frameCount + x) * 10;
let yAdj = squareSize/2 + sin(frameCount + y) * 10;
circle(xAdj, yAdj, 25)
pop();
// END TRANSFORMATION USING POP
}
}
}