Advertisement
xeromino

canofworms

Jan 19th, 2015
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. int num=50, frames=120;
  2. long rs;
  3. float theta;
  4.  
  5. void setup() {
  6.   size(750, 500);
  7.   blendMode(DIFFERENCE);
  8.   rs =(long) random(10000);
  9.   //strokeCap(SQUARE);
  10.   rectMode(CENTER);
  11. }
  12.  
  13. void draw() {
  14.   randomSeed(rs);
  15.   background(0);
  16.   for (int i=0; i<num; i++) {
  17.     float x = width/2;
  18.     float y = height/2;
  19.     pushMatrix();
  20.     translate(x,y);
  21.     int speed=int(random(1,4));
  22.     int dir=random(1)>.5?1:-1;
  23.     rotate(theta*dir*speed);
  24.     float w = random(width*.2, width*1.2);
  25.     float h = w;
  26.     float start = random(TWO_PI);
  27.     float end = start + random(PI/4, PI/2);
  28.     stroke(255);
  29.     strokeWeight(random(20,100));  
  30.     noFill();
  31.     arc(0, 0, w, h, start, end);
  32.     popMatrix();
  33.   }
  34.   theta += TWO_PI/frames;
  35.   //if (frameCount<=frames) saveFrame("image-###.gif");  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement