Advertisement
xeromino

ring

May 16th, 2015
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. int num = 40, circles=80, frames=60;
  2. float theta;
  3.  
  4. void setup() {
  5.   size(540, 540);
  6. }
  7.  
  8. void draw() {
  9.   randomSeed(3453);
  10.   background(0);
  11.   noStroke();
  12.   float angle = 0;
  13.   for (int j=0; j<circles; j++) {
  14.     fill(255, 25);
  15.     float r = random(TWO_PI);
  16.     beginShape(TRIANGLE_STRIP);
  17.     float r2 = random(30, 50);
  18.     for (int i=0; i<num; i++) {
  19.       angle=TWO_PI/num*i+r;
  20.       float offSet=TWO_PI/num*i;
  21.       float d = 120+cos(offSet*3)*r2;
  22.       float x = width/2 +sin(theta+offSet)*10 + sin(angle)*d;
  23.       float y = height/2 + cos(theta+offSet)*10 + cos(angle)*d;
  24.       vertex(x, y);
  25.       ellipse(x, y, 3, 3);
  26.     }  
  27.     endShape(CLOSE);
  28.   }
  29.   theta+=TWO_PI/frames;
  30.   //if (frameCount<=frames) saveFrame("imge-###.gif");
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement