Advertisement
xeromino

slicedCircle

Sep 26th, 2015
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. int points = 20, frames = 240;
  2. float d = 180, theta=3*PI/2;
  3.  
  4. void setup() {
  5.   size(540, 540);
  6. }
  7.  
  8. void draw() {
  9.   background(255);
  10.   fill(0);
  11.   noStroke();
  12.   beginShape();
  13.   float arcAmount = map(sin(theta),-1,1,radians(30), radians(300));
  14.   for (int i=0; i<points+3; i++) {
  15.     float angle = arcAmount/points*i;
  16.     float x = width/2 + cos(angle)*d;
  17.     float y = height/2 + sin(angle)*d;
  18.     curveVertex(x, y);
  19.   }
  20.   endShape(CLOSE);
  21.   theta += TWO_PI/frames;
  22.   if (frameCount<=frames) saveFrame("image-###.gif");
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement