xeromino

bincreatures

Jan 29th, 2014
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. int circleResolution;
  2. float radius, theta;
  3.  
  4. void setup() {
  5.   size(500, 300);
  6.   background(#202020);
  7. }
  8.  
  9. void draw() {
  10.  
  11.   fill(#202020,100);
  12.   noStroke();
  13.   rect(0, 0, width, height);
  14.   float div=12;
  15.  
  16.   for (int j=0; j<div;j++) {
  17.     pushMatrix();
  18.     translate(width/div/2+(width/div)*j, height/2);
  19.     circleResolution = (int) map(sin(theta+(TAU/div)*j), -1, 1, 14, 35) ;
  20.     radius = map(sin(theta+(TAU/div)*j), -1, 1, 40, 80) ;
  21.  
  22.     float angle = TWO_PI/circleResolution;
  23.  
  24.     stroke(240,200);    
  25.     strokeWeight(1);
  26.  
  27.     for (int i=0; i<=circleResolution; i++) {
  28.       float x = cos(HALF_PI+angle*i) * radius;
  29.       float y = sin(HALF_PI+angle*i) * radius;
  30.       line(0, 0, x, y);
  31.     }
  32.     popMatrix();
  33.   }
  34.   theta += 0.0523;
  35.  
  36.   if (frameCount % 4 == 0 && frameCount < 121) saveFrame("image-###.gif");
  37. }
Advertisement
Add Comment
Please, Sign In to add comment