function setup() { createCanvas(400, 400); background(220); var step = 400 / 9; var line_xys = [ [0, 0, 400, 400], [400, 0, 0, 400], ]; for (var i = 0; i < 2; i++) { line(...line_xys[i]); } for (var i = 0; i < 9; i++) { var top_left = 0; var bottom_right = 400; var top_x = top_left + step * i; var bottom_x = bottom_right - step * i; line(top_x, 0, bottom_x, 400); } }