transition-timing-function
Sets the transition’s easing curve: accelerating, decelerating, or stepped motion.
- Initial value
ease- Inherited
- No
- Animatable
- no
- Applies to
- all elements and the ::before and ::after pseudo-elements
- JavaScript
element.style.transitionTimingFunction = "ease-out"
Example
#.drawer {
transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}<p style="margin: 0; color: #a3a3a3;">A curve with a fast start and soft braking is a good choice for sliding panels.</p>Definition and usage
#The transition-timing-function property decides how the pace of change is distributed over time. linear changes the value evenly, ease-in starts slowly and speeds up, ease-out starts fast and slows down, and ease-in-out combines both.
A custom curve is described by the cubic-bezier() function. Values outside the 0-1 range create an overshoot and spring effect. The steps() function splits the transition into discrete steps, like frame-by-frame animation.
The newer linear() function lets you write an arbitrarily complex curve as a list of points, for example a realistic bounce.
Syntax
#transition-timing-function: ease | linear | ease-in | ease-out | ease-in-out | steps(…) | cubic-bezier(…) | linear(…);Values
#- A gentle start, a fast middle, a gentle finish.
- A constant pace from start to finish.
- A slow start that speeds up.
- A fast start that slows down.
- Four discrete steps instead of smooth motion.
cubic-bezier(.34, 1.56, .64, 1)
spring
A slight overshoot of the target and a return.
Values in practice
#ease
.demo { transition-timing-function: ease; }linear
.demo { transition-timing-function: linear; }ease-in
.demo { transition-timing-function: ease-in; }ease-out
.demo { transition-timing-function: ease-out; }steps(4)
.demo { transition-timing-function: steps(4); }cubic-bezier(.34, 1.56, .64, 1)
.demo { transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); }Browser support
#Widely available
Works in all modern browsers, phones included. You can use it without worry.
- Chrome
- Edge
- Firefox
- Safari
Good practices
#- Elements appearing on screen usually look best with
ease-out, and disappearing ones withease-in. - You can easily tune
cubic-bezier()curves in the browser’s developer tools by clicking the icon next to the value.
Related entries
#Practise it in lessons
#Spotted a mistake or missing an example? Write to us.