xxxxxxxxxx
let len = 0;
let dir = 0;
let x = 0;
let y = 0;
let px = 0;
let py = 0;
function setup() {
createCanvas(600, 600);
background(255);
noLoop();
}
function draw() {
stroke(1)
strokeWeight(2)
/*line(100,550,100,50);
line(25,475,425,475);
line(63,434,100,48);
line(100,45,121,473);
*/
dir = random(0);
x = random(0, width);
y = random(0, height);
len = random(10, 500);
if (x >= 0 && x <= width && y >= 0 && y <= height) {
line(px, py, x, y);
px = x;
py = y;
//previous x, x ; previous y, y
}
}
function mousePressed() {
draw();
angle = random(TWO_PI); // rastgele açı
dir = random(10, 500);
}