RandomLines
function setup() {
createCanvas(400, 400);
frameRate(300);
}
function draw() {
x1 = random(400);
y1 = random(400);
x2 = random(400);
y2 = random(400);
if (x1 != x2){
slope = (y2-y1)/(x2-x1);//calculate slope
strokeWeight(0.2)
if (slope <0){
stroke(168, 121, 50)
}
if (slope >0){
stroke(92, 169, 250);
}
if (slope == 0){
stroke(0)
}
line(x1,y1,x2,y2)
}
}