Advertisement
xeromino

bells

Dec 21st, 2013
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. color bg = #202020; // #5D3D6C;
  2. color f1 = #ffffff; //#A4B595;
  3. color f2 = #ffffff; // #EA6793;
  4. float y1, y2, theta, diam1, diam2, l, maxdiam, sw1, sw2;
  5. int top = 5;
  6.  
  7. void setup() {
  8.   size(500, 300);
  9.   background(bg);
  10.   fill(f1);
  11.   stroke(255);
  12.   noStroke();
  13.   l = (width/top);
  14.   maxdiam = .7*(width/top);
  15. }
  16.  
  17.  
  18. void draw() {
  19.   background(bg);
  20.  
  21.   for (int i=1; i<top; i++) {
  22.     //fill(f1);
  23.     y1 = map(sin(theta), -1, 1, 100, 200);
  24.     diam1 = map(sin(theta), -1, 1, 5, maxdiam);
  25.     sw1 = map(sin(theta), -1, 1, 1, 5);
  26.     strokeWeight(sw1);
  27.     ellipse(i*l, y1, diam1, diam1);
  28.   }
  29.   for (int i=1; i<top-1; i++) {
  30.     //fill(f2);
  31.     y2 = map(sin(theta), -1, 1, 200, 100);
  32.     diam2 = map(sin(theta), -1, 1, maxdiam, 5);
  33.     sw1 = map(sin(theta), -1, 1, 5, 1);
  34.     strokeWeight(sw1);
  35.     ellipse(l/2+i*l, y2, diam2, diam2);
  36.   }
  37.   theta += 0.0523;
  38.  
  39.   if (frameCount % 2 == 0 && frameCount<121) saveFrame("image-####.gif");
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement