class Tornado {
 int xPos = 0;
 int yPos = 0;
 int lineWidth = 0;
 int tornadoWidth = 0;
 
 Tornado(int x, int y, int width, int tWidth) {
  this.xPos = x;
  this.yPos = y;
  this.lineWidth = width;
  this.tornadoWidth = tWidth;
}
  
 void draw(int moveX) {
   stroke(255, 255, 255);
   int offset = (this.tornadoWidth - this.lineWidth) / 2;
   line(this.xPos + offset + moveX, this.yPos, this.lineWidth + offset + moveX, this.yPos);
  
 } 
}

Tornado[] lines = new Tornado[40];
int lastWidth = 200;
int lastTop = 0;
int tornadoWidth = 200;
void setup() {
  size(300, 250);
  background(0,0,0);
  for(int i = 0; i < lines.length; i++) {
    lines[i] = new Tornado(40, lastTop + 40, lastWidth + 40, tornadoWidth);
    
    int randomWidthVariance = int(random(0,10));
    int newWidth = lastWidth - randomWidthVariance;
    lastWidth = newWidth;
    
    int randomVariance = int(random(2, 8));
    int newY = randomVariance + lastTop;
    lastTop = newY;     
  }
}

int frameDelay = 10;

void draw() {
  if(frameDelay ==0) {
  background(0,0,0);
  for(int i = 0; i < lines.length; i++) {
    int xPos = int(random(0, 40));
     lines[i].draw(xPos); 
  }
  frameDelay = 10;
  } else {
    frameDelay--;
  }
}


