sketch
var dx1;
var dy1;
var dx2;
var dy2;
var numLines = 50;
function setup() {
createCanvas(400, 300);
// x1, x2, endx1, endx2
line(50, 50, 150, 300);
// y1, y2, endy1, endy2
line(300, 300, 350, 100);
//endx1 - x1/numlines
dx1 = (150-50)/numLines;
//endx2 - x2/numlines
dy1 = (300-50)/numLines;
//endy1 - y1/numlines
dx2 = (350-300)/numLines;
//endy2 - y2/numlines
dy2 = (100-300)/numLines;
}
function draw() {
background(255, mouseX, mouseY);
var x1 = 50;
var y1 = 50;
var x2 = 300;
var y2 = 300;
for (var i = 0; i <= numLines; i += 1) {
line(x1, y1, x2, y2);
x1 += dx1;
y1 += dy1;
x2 += dx2;
y2 += dy2;
}
//noLoop();
stroke(255,0,0);
var x11 = 50;
var y11 = 50;
var x22 = 300;
var y22 = 300;
for (var i = 0; i <= numLines; i += 1) {
line(x1, y1, x2, y2);
x1 += dx1;
y1 += dy1;
x2 += dx2;
y2 += dy2;
}
//noLoop();
stroke(0,255,0);
var x113 = 50;
var y113 = 50;
var x223 = 300;
var y223 = 300;
for (var i = 0; i <= 50; i += 1) {
line(x223, y223, x113, y11);
x113 += dx1;
y113 += dy1;
x223 += dx2;
y223 += dy2;
}
//noLoop();
for(var y = 0; y<=300; y+=15){
stroke(mouseX, mouseY,40);
line(y,0,400,y);
stroke(mouseY,mouseX,200);
line(0,y,y-5,300);
}
}