xxxxxxxxxx
39
let x;
let y;
let r;
let g;
let b;
function setup() {
createCanvas(1920 / 2, 1080 / 2);
background(255, 0, 0);
x = width / 2;
y = height / 2;
r = random(255);
g = random(255);
b = random(255);
}
function draw() {
const maxDistance = 5;
let nextX = x + random(-maxDistance, maxDistance);
let nextY = y + random(-maxDistance, maxDistance);
nextX = constrain(nextX, 0, width);
nextY = constrain(nextY, 0, height);
const colorDistance = 10;
r += random(-colorDistance, colorDistance);
g += random(-colorDistance, colorDistance);
b += random(-colorDistance, colorDistance);
r = constrain(r, 0, 255);
g = constrain(g, 0, 255);
b = constrain(b, 0, 100);
stroke(r, g, b);
line(x, y, nextX, nextY);
x = nextX;
y = nextY;
}