xxxxxxxxxx
37
function setup() {
createCanvas(400, 400);
}
function draw() {
background(255, 232, 241);
noStroke();
fill(54, 29, 3);
/* right triangle I
for (let r = 0; r <= 400; r+= 20) {
for (let c = r; c <= 400; c += 20) {
ellipse(c, r, 10, 10)
}
}
*/
/* right triangle II
for (let r = 0; r <= 400; r+= 20) {
for (let c = 0; c <= r; c += 20) {
ellipse(c, r, 10, 10)
}
}
*/
/* equilateral triangle
for (let r = 10; r <= 400; r += 20) {
for (let c = 0; c <= r; c += 20) { // # of circles in a row is the same as the # row, e.g. three circles in the third row
let center = width/2;
let x = center - r / 2 + c; // Centered x position
ellipse(x, r, 10, 10); // Ellipse with diameter 10
}
}
*/
}