Advertisement
xeromino

sign

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