xxxxxxxxxx
47
let h;
let b;
let pathWidth;
function setup() {
createCanvas(400, 400);
colorMode(HSB);
pathWidth = width/10;
newColours();
}
function draw() {
background(h, 0, b);
strokeWeight(10);
let z = 0;
while(z < height * 2) {
stroke(h, map(z, 0, height, 0, 255), b);
const l = left(z);
const r = right(z);
line(l.x, l.y, l.x - width/2, l.y - height * 2);
line(r.x, r.y, r.x + width/2, r.y - height * 2);
z ++;
}
}
function newColours() {
h = 100;//random(255);
b = 50;//random(255);
}
function left(z) {
return createVector(sin(z/mouseX) * (width - pathWidth)/2, z);
}
function right(z) {
return createVector(width - (1 - sin(z/mouseX)) * (width - pathWidth), z)
}