xxxxxxxxxx
32
let colors = ["#00B6FF", "#0036FF", "#13DDFF", "#79C7FF", "#0A8BE2", "#00A3FF", "#1A35E3", "#013BD7","#F9FFF2"];
let a;
let b;
function setup() {
createCanvas(windowWidth, windowHeight);
let c = color(random(colors));
c.setAlpha(40);
background(c);
}
function draw() {
let x = random(0,150);
let y = random(0,200); //x and y control the vector’s length
let h = random(70,80); //h is alpha
drawLines(mouseX,mouseY,x,y,h);
}
function drawLines(a,b,x,y,h) {
push();
translate(a, b);
v = p5.Vector.random2D();
v.mult(random(x, y));
strokeWeight(4);
let c = color(random(colors));
c.setAlpha(random(0, h));
stroke(c);
line(0, 0, v.x, v.y);
pop();
}