【Processing】noise

 

f:id:osushi_94:20180206001155p:plain

 

 

 

int NUM= 500;
float[] x = new float[NUM];
float[] y = new float[NUM];
float[] noiseX = new float[NUM];
float[] noiseY = new float[NUM];
color c;

void setup(){
  size(500,500);
  background(0);
  colorMode(HSB,360,100,100,100);
  c = color(random(360),100,100.50);
}


void draw(){
 
  
  for(int i = 0; i < NUM; i++){
  x [i] += 5*noise(noiseX[i],noiseY[i]) ;
  y [i] = i;
  
  noStroke();
  
  fill(c);
  ellipse(x[i],y[i],1,1) ;
  
  noiseX[i] += random(0.01);
  noiseY[i] += random(0.01);
  
  if(x [i] > width){
    float a = x [i] - width;
  x [i] = 0 + a ;
  c = color(random(360),100,100,50);
  }
  
  }
}