Hello,
I’m hoping someone can find the flaw in my logic here. My goal is to create an even overlay checkerboard that has a transparency of 50. Here is my code in setup:
background(255);
int fillColor = 0;
int gridDimensions = 32;
for (int i = 0; i < gridDimensions; i++) {
if (gridDimensions % 2 == 0)fillColor ^= 1;
for (int j = 0; j < gridDimensions; j++) {
fillColor ^= 1;
fill(fillColor*255, 50);
rect(i*gridDimensions,
j*gridDimensions,
i*gridDimensions+width/gridDimensions,
j*gridDimensions+height/gridDimensions);
}
}
My result is unexpected. Here’s the image I get and I’m unsure where I went wrong.