liveBook · Manning

Deceleration

As explained in Math for Web Design

Deceleration is a reduction in speed or acceleration opposite to the direction of motion.

Deceleration reduces an animation’s speed near its destination, making digital motion feel more like a physical object settling instead of stopping abruptly. section 12.1 section 12.1.1

Shape deceleration with cubic Bézier control points:

  • Move x2 earlier to begin deceleration sooner, or later to preserve speed for longer. section 11.2.2
  • Adjust y2 to control the final approach: larger values create a gentler finish, while smaller values create a faster finish. section 11.2.2
  • Use an ease-out curve when motion should accelerate initially and gradually lose momentum at the end. section 12.1.1
  • Keep y-values between 0 and 1 for standard easing; values above 1 create overshoot, and negative values create anticipation. section 11.5

Sliding dialog

A dialog animated with constant speed looks mechanical. Replacing linear progress with eased progress—1 - Math.pow(1 - progress, 3)—makes it slow naturally as it reaches the center of the viewport. section 12.1.1

Listing 12.2 Animating a dialog onto the screen with an ease-out curve
function openDialog() {
    if (isAnimating) return;
    isAnimating = true;

    let dialog = document.getElementById('dialog');
    let start = -300;
    let end = (window.innerHeight / 2) - (dialog.offsetHeight / 2);
    let distance = end - start;
    let duration = 1000;
    let startTime = Date.now();

    function animate() {
        let elapsed = Date.now() - startTime;
        let progress = elapsed / duration;

        if (progress >= 1) {
            isAnimating = false;
            return;
        }
        const eased = 1 - Math.pow(1 - progress, 3);  #1
        let currentTop = start + eased * distance;
        dialog.style.top = currentTop + 'px';

        requestAnimationFrame(animate);
    }

    animate();
}

Inspect the JavaScript listing to see deceleration applied directly to normalized animation progress before calculating the dialog’s position. section 12.1.1

How Math for Web Design covers it

How deep it goes
Explains deceleration through cubic Bézier control points and a JavaScript ease-out formula, but does not derive Bézier mathematics.
Examples
Uses sliding dialogs, ease-out curves, bounce effects, fade effects, and shopping-cart feedback to demonstrate deceleration.
What it assumes
Assumes basic animation implementation and introduces physical motion expectations through concrete UI examples.
What you can do after
Apply it via CSS and JavaScript to create smoother entrances, finishes, fades, and feedback animations.
How it connects
Connects deceleration with acceleration, momentum, friction, cubic Bézier curves, easing functions, and CSS animations.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Math for Web Design. The section links point to the parts of the book it draws on.