Advertisement
xeromino

drip

Nov 27th, 2013
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. int num = 30;
  2. float offset, step;
  3. Linn[] lines = new Linn[num-2];
  4. color bg = #35263D;
  5. color q = #ABB785;
  6.  
  7. void setup() {
  8.   size(500, 500);
  9.   background(bg);
  10.   rectMode(CENTER);
  11.  
  12.   float y = 50;
  13.   float theta = 0;
  14.   step = (height-2*y)/num;
  15.   println(step);
  16.  
  17.   for (int i=0; i<num-2; i++) {
  18.     lines[i]= new Linn(int(y+step), theta);
  19.     y += step;
  20.     theta += TAU/num ;
  21.   }
  22. }
  23.  
  24. void draw() {
  25.   background(bg);
  26.  
  27.   for (int i=0; i<lines.length; i++) {
  28.     lines[i].display();
  29.   }
  30.  
  31.   //if (frameCount % 4 == 0 && frameCount<121) saveFrame("image-####.gif");
  32.  
  33. }
  34.  
  35. class Linn {
  36.   float offset, theta, y;
  37.  
  38.   Linn(float _y, float _theta) {
  39.     y = _y;
  40.     theta = _theta;
  41.   }
  42.  
  43.   void display() {
  44.     offset = map(sqrt(sin(theta)), -1, 1, 10, 120);
  45.     fill(q,80);
  46.     stroke(q);
  47.     strokeWeight(2);
  48.     //quad(width/2, y, width/2+offset, y, width/2, y+step, 50+(width/2-50)-offset, y+step);
  49.     ellipse(width/2,y,offset, offset);
  50.     theta -= 0.0523;
  51.   }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement