size(200, 200); background(255); noFill(); stroke(0); int x1 = 0; int x2 = width; int y1 = 0; int y2 = height; int lineNum = 40; int lineGap = height/lineNum; int clrGap = 256/lineNum; int clr = 0; int counter = 0; while (counter<40){ stroke(clr,0,0); line(x1,y1,x2,y2); y2 = y2-lineGap; clr = clr + clrGap; counter = counter +1; }