xxxxxxxxxx
//import java.util.List;
//List<Shape> shapes;
ArrayList<Shape> shapes;
void setup() {
size(800, 600);
shapes = new ArrayList<Shape>();
for (int i=0; i<3; i++) { // Crea objetos **Círculos** y los almacena en ArrayList
shapes.add( new Circle((width/4)*(i+1), (height/4)));
}
for (int i=0; i<3; i++) { // Crea objetos **Cuadrados** y los almacena en ArrayList
shapes.add(new Square((width/4)*(i+1), (height/4)*2 ));
}
for (int i=0; i<3; i++) { // Crea objetos **Triángulos** y los almacena en ArrayList
shapes.add(new Triangle((width/4)*(i+1),(height/4)*3 ));
}
}
void draw() {
background(#182B3A); // 2F404E 011627 F5DDDD // E0F2E9 // CEB5A7 FCDDF2
for(int i=0; i<shapes.size(); i++){
shapes.get(i).display();
if(i%2==0 && !mousePressed){
shapes.get(i).changeColor(#FFB91C);
}
else{
shapes.get(i).changeColor(#FF0D19); //550000
}
}
}