xxxxxxxxxx
61
let bgHue, bgSaturation, bgBrightness;
let hue, saturation, brightness;
let x, y;
let w;
function setup() {
createCanvas(1000, 1000);
colorMode(HSB, 360, 100, 100, 100);
bgHue = random(0, 360);
bgSaturation = random(5, 15);
bgBrightness = random(90, 100);
background(bgHue, bgSaturation, bgBrightness);
hue = (bgHue + 180) % 360;
saturation = random(40, 70);
brightness = random(20, 60);
x = width / 2;
y = height / 2;
w = random(10, 50);
}
function draw() {
moveWalker();
drawWalker();
}
function drawWalker() {
w = w + random(-1.51, 1.5);
if (w < 0) {
w = 0;
} else if (w > 200) {
w = 200;
}
strokeWeight(0.5);
fill(hue, saturation, brightness, 50);
stroke(bgHue, bgSaturation, bgBrightness, 50);
ellipse(x, y, w, w);
}
function moveWalker() {
x = x + random(-w / 3, w / 3);
y = y + random(-w / 3, w / 3);
if (x < -w / 2) {
x = width + w / 2;
} else if (x > width + w / 2) {
x = -w / 2;
}
if (y < -w / 2) {
y = height + w / 2;
} else if (y > height + w / 2) {
y = -w / 2;
}
}