Advertisement
xeromino

Scribbled circle

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