int h = 200; // hieght int w = 200; // width int yGap = 10; // the gap (on Y axis) to craete between each line. int yPos = 0; // The variable that will define y position for each line. int counter = 0; // a counter variable for our loop int loopNum = h/yGap; // math for getting the number of lines to draw .. // .. depending on the hight of our stage and the gap between each line int redVal = 256; // value to use in red component of the Stroke() command int redGap = 256/loopNum; // add this value for each new line. size(w,h); strokeWeight(1); while(counter < 16){ if(counter>4 && counter<13){ strokeWeight(counter-1); } if(counter>12 && counter<16){ yGap = counter*2; strokeWeight(counter*2); } stroke(redVal,0,0); redVal -= redGap; line(0,yPos, w,yPos); yPos += yGap; // same as: ypos = ypos + yGap --> set yPos to its own value plus yGap --> increase yPos by yGap counter ++; }