xxxxxxxxxx
37
let n; //line amount
let spacing = 100;
let offScreen = 200;
let gap = 60; //gap for starting point
let step = 0;
let speedy = 1;
let x = new Array(n);
let x2 = new Array(n);
let y2 = new Array(n);
function setup() {
createCanvas(1000, 1000);
n = width;
stroke(251, 148, 231);
for (i = 0; i < n; i = i + spacing) {
x[i] = random(-1 * (width + offScreen), width + offScreen);
x2[i] = random(width / 2 - gap, width / 2 + gap);
//y2[i] = random(200-gap, 200+gap);
}
}
function draw() {
background(0);
for (i = 0; i < n; i = i + spacing) {
if (x[i] + step * speedy < width) {
line(x[i] + (step * speedy), i, i, i);
} else {
line(x[i] + (step * -speedy), i, i, i);
}
}
step++;
}