xxxxxxxxxx
21
function setup() {
createCanvas(windowWidth, windowHeight);
}
function draw() {
background(255);
for (let y = 0; y < height; y += 100) {
for (let x = 0; x < width; x += 100) {
let cx = width / 2;
let cy = height / 2;
let distToCenter = dist(x, y, cx, cy);
let maxDistToCenter = dist(0, 0, cx, cy);
let normalisedDistance = 1 - distToCenter / maxDistToCenter;
let r = 200 * normalisedDistance * normalisedDistance;
circle(x, y, r);
}
}
}