Friday, November 4, 2016

4 de nov


float [] x, y, rotY;
color [] col;
int cant;
float grow;
void setup() {
  size (1280, 800, OPENGL);
  smooth();
  cant = 25;
  grow = 10;
  x = new float[cant];
  y = new float[cant];
  col = new color[cant];
  rotY = new float[cant];
  int renglones = 5;
  int columnas = 5;
  int contar_cols = 0;
  for (int i=0; i<cant; i+=1) {
    col[i] = color(120, random(100,125), map(i, 0, cant-1, 0, 155));
    x[i] = map (i%renglones, 0, renglones-1, 150, width-150);
    y [i] = map(contar_cols, 0, columnas-1, 150, height-150);
    rotY[i] = map(i, 0, cant-1, 0, TWO_PI);
    if (i%columnas==columnas-1) {
      contar_cols+=1;
    }
  }
}
void draw() {
  background(0);
noFill();
grow+=0.5;
  for (int i=0; i<cant; i+=1) {
    rotY[i]+=0.01;
    pushMatrix();
    translate (x[i], y[i]);
    rotateY(rotY[i]);
    for (int j=0; j<10; j+=1) {
      fill(255,10);
      stroke(col[i]);
      box(grow);
      rotateX(map(mouseX, 0, width, 0, 1));
      rotateZ(map(mouseY,0,height,0,QUARTER_PI));
      scale (1.1);
    }

    popMatrix();
  }
  //saveFrame("cuadro-########.jpg");
}