lunes, 11 de abril de 2016

processing 2



float noiseScale = 0.005;
float noiseOffsetX;
float noiseOffsetY;

void setup () {
 
  size (800, 600, P2D);
  background(255);
  smooth();
  noFill();
  stroke(0,0,0,32);
  for ( int i = 0; i<150; i++){
    noiseOffsetX += 5;
    noiseOffsetY +=7.1;
    drawOneStream();
  }
}
void drawOneStream(){
float px = 0;
float py = height/2.0;
float vx = 150;
float vy = 0;
 int pcnt = 0;
 while ((px>=0) && (px<width) && (py<height) && (py>=0)){
   point(px, py);
   float xNoise = noise((pcnt+noiseOffsetX) * noiseScale);
   float yNoise = noise((pcnt+noiseOffsetY) * noiseScale);
   vx = ((2*vx) + 1 + map(xNoise, 0, 1, -1, 1))/4.0;
   vy = ((3*vy) + map(yNoise, 0, 1, -1, 1))/4.0;
   px += vx;
   py += vy;
   pcnt++;
 }
 }












No hay comentarios.:

Publicar un comentario