Strip paintings lines rect()

edited June 2016 in Questions about Code

Hello, Iam very new to processing. I have to code rectangles all over my screen, which changes the color randomly and also thespeed. I already coded one single strip that changes the color. But I have to do as many as fits in the screen. And each have to appear differently. For example one changes his color, the one below changes the speed, the other one changes the size etc. And all has to interact at once.

int n= 100; 
color [] z= new color [n];
int h= 10;
//int s= 100; komische scheisse
//int b;
int x= 0;
float[] colors;

void setup() {
  size(400,400);
  colors= new float [height];
  background (255);
  colorMode(HSB, 360, 200, 100);
  frameRate (30);
  noStroke();

  for (int i= 0; i<n; i++) {
    z [i]= color (h,i% 100,100);
  }

}

void draw() {
  x=0;
  color z0=z[n-1];

 for (int i= n-1; i > 0; i--) {
    z[i]= z [i-1]; }
    z[0] = z0; 


  for (int i = 0; i < n; i++) {
   fill(z[i]);
       rect(x, 0, width, 6);
      x=x+4;}

rect(0, 20, width, 55);



}

Thank you in advance!!:)))))

Tagged:

Comments

Sign In or Register to comment.