|
size(300, 300);
fill(255, 0, 0);
noStroke();
int xWidth = 20;
int yWidth = 20;
for (int j = 0; j < 300 / yWidth; j++) {
for (int i = 0; i < 300 / xWidth; i++) {
if (i % 2 == 0) {
if (j % 2 == 0) {
fill(0, 0, 0);
} else {
fill(0, 255, 0);
}
} else {
if (j % 2 == 0) {
fill(0, 0, 255);
} else {
fill(255, 0, 0);
}
}
rect(i * xWidth, j * yWidth, xWidth, yWidth);
}
}
|
|