xxxxxxxxxx
26
let xstart, ystart, x, y, xspeed, yspeed, scl;
function setup() {
createCanvas(windowWidth, windowHeight);
xstart = 50;
ystart = 350;
x = xstart;
y = ystart;
scl = 0.05;
xspeed = 15*scl;
yspeed = -1*scl;
}
function draw() {
background(0);
x += xspeed;
y += yspeed;
stroke(255);
strokeWeight(10);
line(xstart, ystart, x, y);
if((x < 0 || x > width) || (y < 0 || y > height)) {
x = xstart;
y = ystart;
}
}