xxxxxxxxxx
39
var space = 20;
let x = 0;
let y = 0;
function setup() {
createCanvas(400, 400);
background(0,0,0);
}
function draw() {
let randomNumber = random();
// background(0);
strokeWeight(2);
stroke("#FF00D7");
//line(x1, y1, x2, y2);
if(randomNumber > 0.5){
// \line
line(x,y,x+space,y+space);
}else{
// /line
line(x,y+space,x+space,y);
}
if(x < width){
x = x + space;
} else {
x = 0;
y = y + space;
}
if(y > height){
noLoop();
}
// text('x:'+mouseX+"- y:"+mouseY,mouseX,mouseY);
}