Advertisement
xeromino

breathe

Nov 24th, 2013
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 KB | None | 0 0
  1. color bg = #F2EBBF;
  2. color str = #5C4B51;
  3. int num = 40;
  4. Bow[] bows = new Bow[num];
  5.  
  6. void setup() {
  7.   size(500, 500);
  8.   background(bg);
  9.   noFill();
  10.   stroke(str,75);
  11.   strokeWeight(2);
  12.   float theta = PI/2;
  13.   float y = 90;
  14.   float diam_x = 100;
  15.  
  16.   for (int i=0; i<num; i++) {
  17.     bows[i]= new Bow(diam_x, y, theta);
  18.     theta += TAU/num;
  19.     y += (height-120)/num;
  20.     diam_x += 7;
  21.   }
  22. }
  23.  
  24.  
  25. void draw() {
  26.   background(bg);
  27.   for (int i=0; i<bows.length; i++) {
  28.     bows[i].display();
  29.   }
  30.  
  31.   //if (frameCount % 3 == 0 && frameCount<121) saveFrame("image-####.gif");
  32. }
  33. class Bow {
  34.   float diam, diam_x, theta, y, sw;
  35.  
  36.   Bow(float _diam_x, float _y, float _theta) {
  37.     diam_x = _diam_x;
  38.     y = _y;
  39.     theta = _theta;
  40.   }
  41.  
  42.   void display() {
  43.     diam = map(cos(theta), -1, 1, 20, 150);
  44.     sw = map(cos(theta), -1, 1, 1, 10);
  45.     strokeWeight(sw);
  46.     //line(0, y, 150, y);
  47.     arc(width/2, y, diam_x, diam, PI, TAU);
  48.     //line(350, y, 500, y);
  49.     theta += 0.0523;
  50.   }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement