Advertisement
xeromino

vase

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