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");
}

Friday, October 14, 2016

Arrays 2

//ARRAY LISTADO
float [] y = new float[300];
float [] x = new float[300];
float [] tam = new float[300];
color [] col = new color [300];
void setup() {
  size(1080, 720);

  for (int i=0; i<300; i+=1) {
    x[i]=map(i,0,299,0,width);
    y[i]=height/2;
    tam[i] = random(10,500);
    col [i] = color(random(255),random(255),random(255));
  }
  noFill();
}
void draw() {
  background(110);
  for (int i=0; i<300; i+=1) {
    stroke (col[i]);
    ellipse(x[i], y[i], tam[i], tam[i]);
  }
}

Arrays 1

//ARRAY LISTADO
float [] y = new float[300];
float [] x = new float[300];
float [] tam = new float[300];
void setup() {
  size(1080, 720);

  for (int i=0; i<300; i+=1) {
    x[i]=random(width);
    y[i]=random(height);
    tam[i] = random(10, 200);
  }
  noFill();
}
void draw() {
  background(110);
  for (int i=0; i<300; i+=1) {
    ellipse(x[i], y[i], tam[i], tam[i]);
  }
}

Friday, October 7, 2016

7 de Octubre

 PImage mi_imagen;
PShape mi_forma;
float ang;
void setup() {
  size(1080, 720);
  background(0);
  mi_imagen = loadImage("imagen.png");
  mi_forma = loadShape("forma.svg");
  ang = 0;
}
void draw() {
  noStroke();
  fill(0, 80);
 // rect(0, 0, width, height);
  ang+=0.05;
  imageMode(CENTER);
  shapeMode(CENTER);
  translate(mouseX,mouseY);
  rotate(ang);
  scale (map(cos(ang),-1,1,0.25,1));
  tint(map(tan(-ang),-1,1,100,255), map(sin(ang), -1, 1, 0, 255), random(150));
  image(mi_imagen, 0, 0);
  //shape(mi_forma, 0,0);
}

Friday, September 23, 2016

imágenes y formas

PImage dibujo;
PShape forma;

void setup(){
size(1080,720);
dibujo = loadImage("forma_imagen.png");
forma = loadShape("dibujo_forma.svg");
}
void draw(){
  background(0);
  tint (255,0,0);
  image(dibujo, 100,100);
  shape(forma, 500,100);
}