xxxxxxxxxx
20
function setup() {
createCanvas(windowWidth, windowHeight);
}
let periodSec = 1;
function draw() {
background(255, 180, 255);
let amplitude = width / 2;
let xOffset = width / 4;
let period = periodSec * getTargetFrameRate();
let x = amplitude * sin((TWO_PI / period) * frameCount);
let y = height / 2;
ellipse(x + xOffset, y, 25);
}