xxxxxxxxxx
function setup() {
createCanvas(windowWidth, windowHeight);
noStroke();
}
function draw() {
background(255);
// crear un ciclo
let tiempo = frameCount % 300;
// normalizar a 0-1
tiempo = tiempo / 300;
// escalar a PI * 2 (3.1416 * 2)
tiempo = tiempo * TWO_PI;
let posicion1 = map( cos(tiempo), -1, 1, 0, windowWidth );
fill(70,100,255,100);
ellipse(posicion1, windowHeight/2, 200, 200);
let posicion2 = map( sin(tiempo), -1, 1, 0, windowWidth );
fill(255,80,35,100);
ellipse(posicion2, windowHeight/2, 200, 200);
}