Advertisement
xeromino

mono

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