# ¿Cómo rotar Colores?

Alguien me puede colaborar con este codigo ¿Qué tengo de malo? face_with_head_bandage:
Cada vez que se de clic Izquierdo en cualquiera de los cinco círculos, los colores de los círculo rotan una posición a la derecha y permanecen así hasta que se de clic de nuevo y vuelvan a girar.

``````boolean rote=true;
int[] x ={70, 180, 290, 400, 510};

int []y ={170, 170, 170, 170, 170};

int []la= {90, 90, 90, 90, 90};

int []an= {90, 90, 90, 90, 90};

int []fondo= {#F51936, #F0B41D, #209526, #203495, #8D2095};

void setup() {

size(600, 400);
}

void draw() {
background(245);
textSize(18);
fill(0);
stroke(0);
text("Juan Esteban L.S", 450, 360);

for ( int i=0; i<x.length; i++) {
fill(fondo[i]);
ellipse(x[i], y[i], la[i], an[i]);

if (mousePressed) {
if (mouseButton==LEFT) {
if (rote) {
fill(#8D2095);
ellipse(70, 170, 90, 90);
fill(#0F0CF0);
ellipse(180, 170, 90, 90);
fill(#209526);
ellipse(290, 170, 90, 90);

}
}
}
}
if (mouseButton==LEFT &&
mouseX>150 &&
mouseX<150+80 &&
mouseY>160 && mouseY<160+75) {
rote = !rote;

}
}

``````
``````
//

boolean rote=true;

int[] x ={70, 180, 290, 400, 510};

int []y ={170, 170, 170, 170, 170};

int []la= {90, 90, 90, 90, 90};

int []an= {90, 90, 90, 90, 90};

int []fondo= {#F51936, #F0B41D, #209526, #203495, #8D2095};

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

void draw() {
background(245);

textSize(18);
fill(0);
stroke(0);
text("<-        Juan Esteban L.S", 450, 360);

for ( int i=0; i<x.length; i++) {
fill(fondo[i]);
ellipse(x[i], y[i], la[i], an[i]);
}
}

void mousePressed() {
color a= fondo[0];

for (int i=0; i<fondo.length-1; i++) {
fondo[i] = fondo[i+1] ;
}
fondo[fondo.length-1] = a;
}
//

``````
1 Like

For those of us who don’t know Spanish, we have Google Translate:

Can someone help me with this code. What’s wrong with me? face_with_head_bandage:
Each time you Left click on any of the five circles, the colors of the circles rotate one position to the right and stay that way until you click again and rotate again.

Hello,

Also, when using Google Chrome (English language version) right click on the page and select “Translate to English”:

`:)`

Thank you

My version is not correct and not complete then

I think it’s rotating left, not right

Also I don’t check whether we are clicking in a circle or not