change color depending on time from white to black and back

float scale;

void setup() {
  size(640, 360);
  noStroke();
  scale = width/20;
}

void draw() { 
  for (int i = 0; i < scale; i++) {
    colorMode(RGB, (i+1) * scale * 5);
    fill(millis()%((i+1) * scale * 5));
    rect(200,200,200,200);
  }
}

Help please. Or is there any option to set maximals or minimals? for example instead of black go max to grey

Tagged:
Sign In or Register to comment.