Advertisement
xeromino

Vertex circle

Oct 5th, 2013
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. int num = 50;
  2. float r;
  3. float theta;
  4. int ox, oy;
  5. color ccol = #000000;
  6.  
  7. void setup() {
  8.   size(400, 300);
  9.   background(255);
  10.   noFill();
  11.   ox = width/2;
  12.   oy = height/2;
  13.   r = height/2.5;
  14. }
  15.  
  16. void draw() {
  17.  
  18.   if (frameCount % 10 ==0 && frameCount < 201) {
  19.     drawVCircle();
  20.     saveFrame("line-####.gif");
  21.   }
  22.  
  23. }
  24.  
  25. void drawVCircle() {
  26.  
  27.   stroke(ccol, 150);
  28.   strokeWeight(random(1, 2));
  29.   beginShape();
  30.   for (int i=0; i < num; i++) {
  31.     theta = random(TAU);
  32.     //float over = random(20);
  33.     float over = 0;
  34.     float x = ox + over + sin(theta)*r;
  35.     float y = oy + over + cos(theta)*r;
  36.     vertex(x, y);
  37.   }
  38.   endShape();
  39. }
  40.  
  41. void mouseClicked() {
  42.   drawVCircle();
  43. }
  44.  
  45. void keyPressed() {
  46.   save(random(1234)+".jpg");
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement