float x = 0; float speed = 100; // pixels per second float lastTime; void setup() { size(400, 400); lastTime = millis(); } void draw() { background(240); ellipse(x, height / 2, 50, 50); float currentTime = millis(); float deltaTime = (currentTime - lastTime) / 1000.0; // convert to seconds x += speed * deltaTime; lastTime = currentTime; }