Advertisement
xeromino

Gulp

Oct 9th, 2013
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.22 KB | None | 0 0
  1. int num = 20;
  2. myLine[] lines = new myLine[num];
  3. color bg = #C02942;
  4. color f = #ECD078;
  5. color s = #006666;
  6. float y, theta, diam;
  7. float speed = .3;
  8. float diam1=1;
  9. float diam2 = 0;
  10. boolean grow1 = true;
  11. boolean grow2 = true;
  12.  
  13.  
  14. void setup() {
  15.   size(300, 300);
  16.   background(bg);
  17.   noStroke();
  18.   diam1= 0;
  19.  
  20.   for (int i=0; i<lines.length; i++) {
  21.     float _y = i*(height/num);
  22.     lines[i]= new myLine(_y);
  23.   }
  24. }
  25.  
  26. void draw() {
  27.   background(bg);
  28.   fill(f);
  29.   if (grow1) diam1 +=4;
  30.   if (diam1 > width*.75) grow1 = false;
  31.   ellipse(width/2, height/2, diam1, diam1);
  32.   for (int i=0; i<lines.length; i++) {
  33.     lines[i].display();
  34.   }
  35.   fill(#542437);
  36.   ellipse(width/2, height/2, diam2, diam2);
  37.   if (frameCount > 90 && grow2==true) {
  38.     diam2 += 30;
  39.   }
  40.   else {
  41.     diam2 -= 3*.9;
  42.   }
  43.   if (diam2 > diam1+10) {
  44.     grow2 = false;
  45.     diam1 = 0;
  46.   }
  47.   if (diam2 < 1) diam2 =0;
  48.  
  49.   //if (frameCount % 4 == 0) saveFrame("line-###.gif");
  50.   //if (frameCount > 211) noLoop();
  51. }
  52.  
  53. class myLine {
  54.   float y;
  55.  
  56.   myLine(float _y) {
  57.     y = _y;
  58.   }
  59.  
  60.   void display() {
  61.     strokeWeight(8);
  62.     stroke(bg);
  63.     y -= speed;
  64.     if (y < 0) y = height;
  65.     line(0, y, width, y);
  66.     noStroke();
  67.   }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement