//project
var yspace = 10;
var xspace = 25;
var x1 = 1;
var y1 = 299;
var x2 = 399;
var y2 = 1;
function setup(){
createCanvas(400, 300);
background(0);
}
function draw() {
for(var i = 0; i < 100; i +=1){
strokeWeight(0.01);
stroke(255);
line(x1, height - yspace * i, xspace * i, y2);
line(x1, yspace * i, xspace * i, y1);
line(xspace * i, y1, x2, height - yspace * i);
line(x2, yspace * i, xspace * i, y2);
}
}
This was a really cool project for me, I think my favorite part is that when you refresh the page you can almost see the loop working as it draws up. The math behind the concepts of this code are also super interesting.