Advertisement
xeromino

test

Sep 17th, 2014
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. int num = 20;
  2. //int steps = 120;
  3. float theta; //, r;
  4. int maxFrameCount = 120;
  5. float t;
  6.  
  7. void setup() {
  8.   size(500, 500);
  9.   //frameRate(25);
  10. }
  11.  
  12.  
  13. void draw() {
  14.   background(255);
  15.   t = (float)frameCount/maxFrameCount;
  16.   theta = TWO_PI*t;
  17.   translate(width/2, height/2);
  18.   pushMatrix();
  19.   rotate(theta/num);
  20.   for (int i=0; i<num; i++) {
  21.     pushMatrix();
  22.     float offSet = TWO_PI/num*i;
  23.     rotate(offSet);
  24.     float sz = map(sin(theta+offSet), -1, 1, 5, 40);
  25.     ellipse(150, 0, sz, sz);
  26.     popMatrix();
  27.   }
  28.   popMatrix();
  29.   if (frameCount%1==0 && t<=1) saveFrame("image-###.gif");
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement