home/ atoms/ processing-easing-motion

Easing moves a value toward a target by a fraction of the remaining distance each frame

Rather than teleporting to a position, easing produces smooth approach: each frame, the current position is updated by x += (targetX - x) * easing, where easing is a small float (e.g., 0.05). This creates an exponential decay: fast initial movement that slows as the target is approached. The result never reaches the target exactly (it asymptotically approaches), so a threshold check (if (abs(dx) > 1.0)) is used to stop the update. Easing is the simplest form of organic-feeling motion and is the foundation of spring and inertia simulations.

Examples

float x = 0; float easing = 0.05; void draw() { float targetX = mouseX; x += (targetX - x) * easing; ellipse(x, 50, 33, 33); }

Assessment

Predict the motion of a shape using easing=0.5 vs easing=0.05; explain how to stop the calculation when the position is close enough to the target.

“x += (targetX - x) * easing;”
corpus · processing-handbook-no-login-mirror-pdf-reas-and-fry · chunk 53