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

No comments:

Post a Comment