xxxxxxxxxx
42
/*
----- Coding Tutorial by Patt Vira -----
Name: Circular Grid Graphics
Video Tutorial: https://youtu.be/mGsYV9jt010?si=zkmBJffHZSIrK-KF
Connect with Patt: @pattvira
https://www.pattvira.com/
----------------------------------------
*/
let rows;
let cols;
let spacing = 10;
let size = [];
function setup() {
createCanvas(400, 400);
rows = height/spacing;
cols = width/spacing;
for (let i=0; i<cols; i++){
size[i] = [];
for (let j=0; j<rows; j++){
// size[i][j] = (spacing-2)*((i+1)/cols);
size[i][j] = (spacing)*((j+1)/rows);
// size[i][j] = (spacing-2)*((rows-j)/rows);
}
}
}
function draw() {
background(0);
for (let i=0; i<cols; i++){
for (let j=0; j<rows; j++){
noStroke();
fill(j/rows*255);
ellipse(spacing/2+i*spacing, spacing/2+j*spacing, size[i][j], size[i][j]);
}
}
}