Advertisement
xeromino

p201_2

Jan 28th, 2014
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int circleResolution, s;
  2. float radius, theta, angle;
  3.  
  4. void setup() {
  5.   size(500, 500);
  6.   background(20);
  7. }
  8.  
  9. void draw() {
  10.  
  11.   strokeCap(SQUARE);
  12.  
  13.   background(20);
  14.   translate(width/2, height/2);
  15.  
  16.   circleResolution = (int) map(sin(theta), -1, 1, 40, 70) ;
  17.   radius = map(sin(theta), -1, 1, 100, 150) ;
  18.  
  19.   angle = TWO_PI/circleResolution;
  20.  
  21.   drawCircle(20, 240, 1.0);
  22.   drawCircle(15, 20, .75);
  23.   drawCircle(10, 240, .5);
  24.  
  25.   theta += 0.0523;
  26.  
  27.   if (frameCount % 4 == 0 && frameCount < 121) saveFrame("image-###.gif");
  28. }
  29.  
  30. void drawCircle(int sw, int s, float scal) {
  31.   strokeWeight(sw);
  32.   stroke(s,200);
  33.  
  34.   for (int i=0; i<=circleResolution; i++) {
  35.     float x = cos(HALF_PI+angle*i) * radius*scal*random(1, 1.5);
  36.     float y = sin(HALF_PI+angle*i) * radius*scal*random(1, 1.5);
  37.     line(0, 0, x, y);
  38.   }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement