xxxxxxxxxx
38
let t1 = 0;
let t2 = 10;
let t3 = 50;
let t4 = 60;
let r1 = 50;
let r2 = 60;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(200);
noStroke();
let x1 = map(noise(t1), 0, 1, 0, width);
let y1 = map(noise(t2), 0, 1, 0, height);
let x2 = noise(t3) * width;
let y2 = noise(t4) * height;
if (dist(x1, y1, x2, y2) < (r1 + r2)/2) {
fill(255, 0, 0);
} else {
fill(0);
}
circle(x1, y1, r1);
circle(x2, y2, r2);
t1 += 0.007;
t2 += 0.007;
t3 += 0.02;
t4 += 0.02;
}