Hi,
I have a really basic question about how ofSetColor() behaves in loops. For example I would like to draw a rectangle that changes color from white to black at each iteration of the the draw() loop. I tried this using the following code:
void draw() {
for (int color=0; color<=255; color++){
ofSetColor(color);
ofRect(0,0,100,100);
} }
However I get a white rectangle and no transition at all. Seems like the rectangle is displayed at the last color the loop touches (i.e. if I change the loop to be from 0 to 100, the rectangle will have a gray color - 100 in intensity).
I know that there are other ways to do this - have a counter and increment it in the update() or draw() loop ( I’ve checked this and it works) - I am just curious why this method doesn’t work.
Thanks,
Andrei