sketch
//Brandon Yi
//btyi
//Section A
var dx1;
var dy1;
var dx2;
var dy2;
var numLines = 25;
function setup() {
createCanvas(300, 400);
background(200);
line(10,10,10,390);
line(10,390,290,390);
line(10,10,290,10);
line(290,10,290,390);
dx = (290-10)/numLines; //setting x increments
dy = (390-10)/numLines; //setting y increments
}
function draw() {
//setting moveable points for increments
var x1 = 290;
var y1 = 390;
var x2 = 10;
var y2 = 10;
var x3 = 10;
var y3 = 10;
for (var i = 0; i <= numLines; i += 1) {
line(10, 10, x1, y1);
x1 -= dx;
line(290,390,x2,y2);
y2 += dy;
line(290,10,x3,y3);
x3 += dx;
y3 += dy;
}
noLoop();
}
I had a little bit of trouble working around the diagonal piece of my artwork. I think at first I struggled a little bit to understand my own code, but after solidifying the idea that dx and dy are the increments, it made sense that I would need to use them in my code for the diagonal piece.