xxxxxxxxxx
34
let x0 = 100; let y0 = 100;
let spacing = 50;
let colorArr = [];
let c = 0;
function setup() {
createCanvas(400, 400);
for (let i=0; i<5; i++){
colorArr[i] = [];
for (let j=0; j<3; j++){
colorArr[i][j] = c;
c+=20;
}
}
}
function draw() {
background(220);
for (let i=0; i<5; i++){
for (let j=0; j<3; j++){
fill(colorArr[i][j]);
ellipse(x0 + i*spacing, y0 + j*spacing, 50, 50);
}
}
for (let i=0; i<5; i++){
for (let j=0; j<3; j++){
fill(255, 0, 0);
text(colorArr[i][j], x0 + i*spacing, y0 + j*spacing);
}
}
}