xxxxxxxxxx
46
let x;
let y;
let r;
let g;
let b;
function setup() {
createCanvas(500, 500);
x = width / 2;
y = height / 2;
r = random(255);
g = random(255);
b = random(255);
background(32);
}
function draw(){
for(let i = 0; i < 100; i++){
draw2();
}
}
function draw2() {
let nextX = x + random(-20, 20);
let nextY = y + random(-20, 20);
nextX = constrain(nextX, 0, width);
nextY = constrain(nextY, 0, height);
r += random(-10, 10);
g += random(-10, 10);
b += random(-10, 10);
r = constrain(r, 0, 255);
g = constrain(g, 0, 255);
b = constrain(b, 0, 255);
stroke(r, g, b);
line(x, y, nextX, nextY);
x = nextX;
y = nextY;
}