Advertisement
xeromino

Untitled

Oct 8th, 2013
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. int num = 25;
  2. myLine[] lines = new myLine[num];
  3. color bg = #000000;
  4. color f = #00CCCC;
  5. color s = #006666;
  6. float y, theta, diam;
  7. float speed = .4;
  8.  
  9. void setup() {
  10.   size(500, 500);
  11.   background(bg);
  12.  
  13.   for (int i=0; i<lines.length; i++) {
  14.     float _y = i*(height/num);
  15.     lines[i]= new myLine(_y);
  16.   }
  17. }
  18.  
  19. void draw() {
  20.   background(bg);
  21.   fill(f);
  22.   stroke(s);
  23.   strokeWeight(3);
  24.   ellipse(width/2, height/2, 300, 300);
  25.  
  26.   for (int i=0; i<lines.length; i++) {
  27.     lines[i].display();
  28.   }
  29.   fill(bg);
  30.   stroke(f);
  31.   strokeWeight(20);
  32.   diam = map(sin(theta), -1, 1, 100, 200);
  33.   ellipse(width/2, height/2, diam, diam);
  34.   theta += .03;
  35.  
  36. }
  37. class myLine {
  38.   float y;
  39.  
  40.   myLine(float _y) {
  41.     y = _y;
  42.   }
  43.  
  44.   void display() {
  45.     strokeWeight(10);
  46.     stroke(bg);
  47.     y -= speed;
  48.     if (y < 0) y = height;
  49.     line(0, y, width, y);
  50.   }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement