Making a loop infinite

Hello, so I need help with finding a way to make the black striped lines infinte, currently it starts at -100, but the lines stops printing after a little. Also im having trouble with the yellow solid line, currently the lines print on top of the yellow line i want the yellow line to be on top of the black lines I currently do not know what I am doing wrong.

void setup() {
  size(600,400);
}
int offset = -100;
int offset2 = 900;
int offset3 = -100;
int offset4 = -100;
int offset5 = -200;
void draw() {
  stroke(1);
  strokeWeight(3);
  background(98,96,96);
  stroke(2);
  strokeWeight(1);
  for (int i = 0; i <= 1000; i = i+5 ) {//I need help here
 line(offset+i,0,offset+i,400);// I need help here
 fill(255,248,31);
 rect(offset+i*13,200,40,10);//I need help here
 rect(offset2,0,50,500);
 fill(219,22,4);
 rect(offset,mouseY,100,70);
 fill(0,0,0);
 rect(offset+50,mouseY+15,30,40);
 fill(0,255,0);
 rect(offset3,mouseY-200,100,70);
 fill(0,0,0);
 rect(offset3+50,mouseY-185,30,40);
}
offset +=2;
offset2 -=2;
offset3 +=1;
}
1 Like

draw() loops in itself

modify the for loop by killing it in bring i++; at the end of draw().

1 Like