sequence of rects
@author
color[] colors = {
color(216, 36, 72),
color(221, 163, 0),
color(0),
color(44, 182, 170),
color(221, 163, 0),
color(255)
};
void setup(){
size(500, 500);
frameRate(5);
rectMode(CENTER);
noStroke();
}
void draw(){
background(221, 163, 0);
for(int i = 0; i < colors.length; i++){
int colorIndex = (colors.length + frameCount - i) % colors.length;
if(i == colors.length - 1 && (colorIndex == 1 || colorIndex == 4)){
continue;
}
fill(colors[colorIndex]);
float x = map(i, 0, colors.length - 1, width / 2 + 100, width / 2 - 100);
float y = map(i, 0, colors.length - 1, height/ 2 - 100, height / 2 + 100);
rect(x, y, 200, 200);
}
}