xxxxxxxxxx
26
let noiseOffset = 0;
let circleDiameter = 30;
function setup() {
createCanvas(400, 50);
frameRate(15);
fill(color('orange'));
}
function draw() {
background(color('lightblue'));
stroke(0); // Draw the line in black.
line(width / 2, 0, width / 2, height);
noStroke(); // Disable stroke so that circles are not outlined.
// Draw a circle at a random x location.
let randomX = random(width/2, width);
circle(randomX, height / 2, circleDiameter);
// Draw a circle at the next noise location
noiseOffset += 0.02;
let noiseX = map(noise(noiseOffset), 0, 1, 0, width/2);
circle(noiseX, height / 2, circleDiameter);
}