Fill color not working

Not sure what I expected isn’t happening?
The following draws a square, loops, reduces size of square and rotates slightly. Each square should be filled with a color that changes.
However, at the end of the program, all the squares are filled with the same color, which is the initial color
Any pointers would be good

Thanks
Neil

int r=216;
int g=33;
int b=33;

void setup(){
 size(400,400);
 noLoop();
}

void draw(){
 translate(200,200);
 rectMode(RADIUS);
 for(int x=150;x>0;x=x-5){
   rect(0,0,x,x);
   rotate(2);
   fill(r,g,b);
   g++;
   b++;
 }
}
1 Like

Sorry, please ignore my post. It is working, but the color change I was making was too small

Also, traditionally, one sets the fill color BEFORE they draw the shape - not AFTER.

Nobody paints a picture and then decided what colors to use later. Set the color first!

1 Like