Is this something like this you are looking for ?
final int nbOfLines = 50;
ArrayList<CustomLine> lines;
void setup() {
size(900, 900);
frameRate(60);
lines = new ArrayList<CustomLine>();
createLines();
}
void draw() {
background(20);
for (int i = 0; i < lines.size(); i++) {
lines.get(i).run();
}
if (lines.get(lines.size() - 1).isOutOfScreen()) {
createLines();
}
}
void createLines() {
lines.clear();
int y = height;
for (int i = 0; i < nbOfLines; i++) {
y += random(10) + 1;
lines.add(new CustomLine(y));
}
}
class CustomLine {
private int y;
CustomLine(int y) {
this.y = y;
}
void run() {
move();
display();
}
void move() {
y -= 2;
}
void display() {
stroke(200);
line(0, y, width, y);
}
boolean isOutOfScreen() {
return y < 0;
}
}
The idea is to have a method that create as many lines as needed.
Then in the draw loop, it first moves the lines up and then it checks if the last line is out of screen. If so, you create a new bunch of line and it starts over and over.