values this framethe stages of one frameindex.htmlBuy.btn.dotscaletime →1.01.11.20150300 ms1.01.21.405001000 mslinear 1.10ease 1.160%50%100%1.btn {2 transition: scale 0.3s;3}4.btn:hover {5 scale: 1.2;6}time–progress–scale–StyleLayoutPaintComposite1.2pulse 1sframe
Front: the stylesheet, the values each frame, and the stages of a frameBack: the browser (button and dot) and the graph of scale over timeMovers: the mouse pointer, a value or animation on its way, a frameBack: the browser with a button and a dot, and a graph of scale over time. Front: the stylesheet, the values the browser computes each frame, and the four stages of a frame. Without a transition the button jumps to 1.2 in one frame; with transition: scale 0.3s it grows over 300 ms along the ease curve, frame by frame, and shrinks back when the mouse leaves. The keyframe animation then grows the dot to 1.4 and back in one second, with no hover needed. Animating scale lets the browser skip layout. The figure plays every transition and animation about eight times slower than a real browser, so each frame can be seen.

Transitions

  1. Start without any motion. When the mouse moves over the button, .btn:hover matches and scale: 1.2 applies. On the very next frame the button is 1.2 times bigger. On the graph of scale over time that is one sudden jump.

Keyframe animations

How the browser paints

What happens

;; step 1/10 · jump
.btn:hover { scale: 1.2; }   no transition yet
mouse over the button   :hover matches
scale   1.00 → 1.20 on the next frame
nothing in between: a jump

The figure plays every transition and animation about eight times slower than a real browser, so each frame can be seen. The value cells update in 50 ms steps for the transition and 100 ms steps for the animation; a real browser computes a new value on every frame.