xxxxxxxxxx
31
let gap_x = 50;
let gap_y = 50;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
grid();
}
function drawVLine(x) {
stroke("red");
line(x, 0, x, height);
}
function drawHLine(y) {
stroke("blue")
line(0, y, width, y);
}
function grid() {
for (let i = gap_x; i < width; i += gap_x) {
drawVLine(i);
}
for (let i = gap_y; i < width; i += gap_y) {
drawHLine(i);
}
}