float x; float easing = 0.05; void setup() { size(480, 120); } void draw() { float targetX = mouseX; x += (targetX - x) * easing; ellipse(x, 40, 12, 12); }