Timing: Why Motion Needs Easing
An easing function bends time: it takes the fraction of the animation's time that has passed and returns the fraction of the distance that should be covered. Linear motion starts at full speed and stops dead; easing lets the speed build up and die away, which is what real things with mass do, so eased motion looks natural.
What the symbols mean
- Position
Where the object is right now.
- Start value
Where the motion begins.
- End value
Where the motion ends.
- Easing function
Turns the fraction of time passed into the fraction of distance covered, with E(0) = 0 and E(1) = 1.
- Clock time
Seconds since the motion started.
- Duration
How long the whole motion takes, in seconds.
What the symbols mean
- Power
2 is quad, 3 cubic, 4 quart, 5 quint. Bigger means a slower start (or finish) and a faster other end.
What the symbols mean
- Velocity
How fast the object moves, in units per second.
- Slope of the easing
How many times the average speed the object is moving right now.
Explanation
An easing function is a rule for how far along a motion should be at each moment. It takes one number, the fraction of the animation's time that has passed, and gives back one number, the fraction of the distance that should be covered by then. The name comes from animators, who talk about a motion easing in (starting gently) and easing out (settling gently). The formula has only three pieces: (the clock in seconds divided by the duration , so it runs from to ), (the easing function, which bends that clock) and the lerp from Lerp: Blending Between Two Values, which turns a fraction into a real position between and . Every easing function in this unit plugs into that one slot. It's a small idea with a big effect on how motion feels.
Position against time, and velocity against time. Graph with time across and progress up. The plain choice , called linear, is a straight line. Its slope is the velocity, and a straight line has the same slope everywhere: the object is at full speed on the very first frame and still at full speed on the last. A moment earlier it was sitting still, so its velocity jumps from to full in an instant, and back to at the end. That's an infinite acceleration, twice. Nothing with mass does that, which is why linear motion looks mechanical.
The velocity of the real motion comes from the chain rule. Position is , and the inside function has derivative , so
The fraction is the average speed (distance over time), and says how many times the average you're moving right now.
Ease-in: start slow. Take with . Its slope is at , so the motion starts from rest, and it's at , so it arrives at times the average speed. is called quad, cubic, quart and quint. The bigger , the longer it lingers at the start and the harder it finishes.
Ease-out: end slow. Play an ease-in backwards and upside down: . Replacing by runs the clock backwards, and flips progress, so the graph is the ease-in turned about the center point . Now the motion leaves at times the average speed and glides to a stop.
Ease-in-out: both. Squeeze an ease-in into the first half of the time and the first half of the distance, and an ease-out into the second half:
For that's , then ; for it's , then . Both halves pass through with the same slope, , so the join is smooth. Smoothstep, , is another ease-in-out, one cubic for the whole way.
Same trip, same time: the speed has to go somewhere. Every easing function starts at and ends at , so by the Fundamental Theorem of Calculus,
The area under every velocity graph is the same. Easing doesn't make a motion faster or slower overall; it moves the speed around. If an eased motion starts slow and ends slow, it has to make up for it in the middle: ease-in-out cubic peaks at times the average speed. That quick middle is part of the look.
Slow in and slow out. Hand-drawn animators wrote this down as one of their twelve principles of animation (in Frank Thomas and Ollie Johnston's book The Illusion of Life): put more drawings near the key poses and fewer in between. Frames are shown at equal time steps, so drawings bunched near a pose mean the motion is slow there. An easing function is that same idea as a formula. Evaluate it at equal steps of , and the positions bunch up wherever the slope is small.
Watch the names, though. In code (Penner's easing equations, CSS, nearly every library) ease-in means the motion starts slowly. Some animation tools use "ease in" for slowing down into a keyframe, which code would call ease-out. Check which convention you're reading.
In code, the whole thing is a few lines:
const easeInQuad = (t: number) => t * t;
const easeOutQuad = (t: number) => 1 - (1 - t) * (1 - t);
const easeInOutQuad = (t: number) => (t < 0.5 ? 2 * t * t : 1 - 2 * (1 - t) * (1 - t));
// every frame: normalize and clamp the clock, ease it, then lerp
const t = Math.min(Math.max(elapsed / duration, 0), 1);
x = a + (b - a) * easeOutQuad(t);
A common mistake. It's tempting to write easeOutQuad(elapsed) with the elapsed time in seconds. An easing function only knows the interval : after s you'd get , and after s you'd get , so the object turns around and flies backward. Normalize, clamp, ease, lerp, in that order.
A common mistake. looks like an ease-out, since it rises fast and flattens. But its slope is infinite at , so it starts with a jolt worse than linear's. And runs from down to , backwards. The ease-out partner of is , the reversed and flipped copy.
Which one when. In interfaces, something entering the screen or answering a tap usually uses ease-out: it reacts at once and settles gently, so it feels responsive. Something leaving uses ease-in: it gathers speed and is gone. Something moving from one spot on screen to another uses ease-in-out. Ease-in on a response to a click feels sluggish, because nothing seems to happen at first. The Easing Zoo adds the other shapes: overshoots, wobbles and bounces.
There are animations further down: the two motions side by side with their position graphs, their velocity graphs with the area that adds up to the distance, the whole family as the power changes, and the frames of each motion laid out like an animator's onion skin.
See it
Worked examples
A card slides from px to px in s with ease-out cubic, . Where is it s after it starts, and how fast is it moving then?
- 1
First turn the clock into a fraction of the duration: . The card is of the way through its time.
Build ease-in-out cubic out of the ease-in and the ease-out , check that the two halves join smoothly, and find its top speed.
- 1
Start with the ease-in, . It should fill the first half of the time, . Feeding it makes it run twice as fast, so it finishes when reaches : .
Practice
Type your answer and check it. Solve them all to complete the lesson.
A door swings open from to in s using ease-in quad, . What angle, in degrees, has it reached s after it starts?
Evaluate ease-out cubic, , at .
Which of these is an ease-out: it starts at , ends at , and arrives with zero velocity?
A tooltip leaves the screen by sliding px in s with ease-in quad, . How fast is it moving, in px/s, at the instant it reaches the end?
A ball moves px in s with ease-in-out quad ( for and for ), and the game draws a frame every s. How many pixels does the ball move between the frame at s and the frame at s?
A notification slides away with ease-in quad, , over s. At what time, in seconds after it starts, is it exactly halfway?
In a cutscene, the camera's field of view eases from to between s and s with ease-out quad, . What is the field of view, in degrees, at s?
The hardest one here. Get it, and you've got this lesson.
A symmetric ease-in-out is built from power halves: for and for . A designer wants its top speed to be exactly times the average speed. Find . Then, using that for a px move lasting s, find how far the object has moved after s, in px to 2 decimal places. Enter , then the distance.
Where it's used
Every interface toolkit and game engine ships these curves, because timing is most of what makes motion feel good. A phone's app drawer opens with an ease-out so it answers your finger immediately and settles softly; a dismissed card leaves with an ease-in so it gathers speed and is gone; a camera in a cutscene glides between shots with an ease-in-out so it never lurches. Motion design specs list a duration and an easing for each transition (typically 150 to 300 ms for small interface moves), and game developers tune easings to make menus, pickups and hit reactions feel snappy. The velocity formula is how you check that a fast exit doesn't blur, or that a long camera move never exceeds a comfortable speed.