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