Advertisement
xeromino

fountain

Feb 19th, 2015
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. int num = 10000, frames=60;
  2. float theta;
  3. long rs;
  4.  
  5. void setup() {
  6.   size(540, 540);
  7.   rs = (long) random(23232323);
  8. }
  9.  
  10. void draw() {
  11.   randomSeed(rs);
  12.   background(20);
  13.   noStroke();
  14.   translate(width/2, height/2);
  15.   for (int i=0; i<num; i++) {
  16.     pushMatrix();
  17.     float r = random(TWO_PI);
  18.     rotate(r);
  19.     float s = 100;
  20.     float d =  random(s, height*.35);
  21.     if (random(1)>.9) d = random(s,height*.45);
  22.     //if (random(1)>.97) d = random(s-50,s-10);
  23.     float s2 = s + random(-10,10);
  24.     float x = map(sin(theta+random(TWO_PI)), -1, 1, s2, d);
  25.     float sz = random(1, 2);
  26.     fill(255,150);
  27.     ellipse(x, 0, sz, sz);
  28.     //line(100,0,x,0);
  29.     popMatrix();
  30.   }
  31.   theta += TWO_PI/frames;
  32.   //if (frameCount<=frames) saveFrame("image-###.gif");
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement