The animation-timing-function property shapes how fast an animation moves between keyframes. It controls acceleration and deceleration, not the total duration.
01
Speed Curves
Control animation pacing.
02
Keywords
ease, linear, and more.
03
Default ease
Smooth start and finish.
04
ease-in / ease-out
Enter and exit motion.
05
cubic-bezier()
Custom motion curves.
06
steps()
Jump between frames.
Fundamentals
Definition and Usage
The animation-timing-function CSS property defines how intermediate values are calculated during an animation. It controls the speed curve, meaning how quickly the animation accelerates, decelerates, or stays constant over time.
Two animations can have the same duration and keyframes but feel completely different because of their timing function. A menu slide might use ease-out to slow down gently at the end, while a loader might use linear for steady rotation.
💡
Beginner Tip
Timing function controls how speed changes. animation-duration controls how long the animation takes. You usually need both.
Foundation
📝 Syntax
Set animation-timing-function to a keyword, steps(), or cubic-bezier():
The box moves at a steady, constant speed across the track.
Constant speed
Best for loaders and mechanical motion.
ease-in
The box starts slowly and accelerates toward the end of the track.
Slow start, fast finish
Good for elements leaving the screen.
ease-out
The box moves quickly at first, then decelerates as it reaches the end.
Fast start, slow finish
Popular for menus and modal entrances.
ease-in-out
The box starts and ends slowly with faster movement in the middle.
Smooth at both ends
Balanced choice for sliding UI elements.
Concept
Timing Function vs Duration
These two properties work together but control different things:
Property
Controls
Example question it answers
animation-duration
Total time the animation takes
“How long should this run?”
animation-timing-function
How speed changes during that time
“Should it start fast or slow?”
A 2-second animation with linear moves evenly for the full 2 seconds. The same 2-second animation with ease-in still lasts 2 seconds, but most of the visible movement happens near the end.
Advanced
Understanding cubic-bezier()
cubic-bezier(x1, y1, x2, y2) lets you design a custom easing curve. Each value is between 0 and 1 for the control points that shape acceleration:
Common presets like ease and ease-in-out are built-in cubic-bezier curves. Custom values are useful when you want a snappier or more playful feel than the keywords provide.
Compare
linear vs ease-in-out
Value
Speed pattern
Best for
linear
Same speed throughout
Spinners, progress bars, marquee text
ease-in-out
Slow start and end, faster middle
Sliding panels, cards, and natural UI motion
Preview
👀 Live Preview
This box uses animation-timing-function: ease-in-out with animation-direction: alternate:
The box slows down at both ends of each slide, creating smoother back-and-forth motion.
Hands-On
Examples Gallery
Try animation-timing-function with ease-in-out motion, linear vs ease comparison, custom cubic-bezier curves, and stepped animation.
📚 Keyword Timing Functions
Start with built-in keywords before moving to custom curves.
Example 1 — Smooth Motion with ease-in-out
Move a box across the screen with slow starts and finishes at both ends.
steps(4, end) divides the 2-second animation into four visible jumps instead of smooth continuous growth.
🧠 How animation-timing-function Works
1
Keyframes define states
You set the start and end values, such as translateX(0) to translateX(200px).
Keyframes
2
Duration sets total time
animation-duration decides how long the full animation cycle lasts.
Duration
3
Timing function shapes speed
The browser distributes progress using your chosen curve, such as ease-out or cubic-bezier().
Curve
=
🎬
Natural-looking motion
The same keyframes can feel mechanical, smooth, or playful depending on the timing function.
Compatibility
Universal Browser Support
animation-timing-function is supported in all modern browsers alongside CSS animations.
✓ Baseline · CSS Animations
Control animation curves in modern browsers
Chrome, Firefox, Safari, Edge, and Opera support keyword timing functions, cubic-bezier(), and steps().
98%Modern browser support
Google Chrome43+ · Desktop & Mobile
Full support
Mozilla Firefox16+ · Desktop & Mobile
Full support
Apple Safari9+ · macOS & iOS
Full support
Microsoft Edge12+ · Modern versions
Full support
Opera30+ · Modern versions
Full support
Legacy browsers
Very old browsers without CSS animation support also lack timing function control.
💻
Internet ExplorerIE 9 and earlier · No CSS animation support
None
animation-timing-function property98% supported
Bottom line: Use keyword curves for most UI motion and cubic-bezier for custom polish.
Wrap Up
Conclusion
The animation-timing-function property gives you fine control over animation pacing. Keywords like ease-out and ease-in-out cover most UI needs, while cubic-bezier() and steps() unlock custom and frame-based motion.
Pair timing functions with clear keyframes and appropriate durations to create animations that feel smooth, responsive, and professional.
Test motion with real duration values, not just defaults
Respect prefers-reduced-motion for accessibility
❌ Don’t
Confuse timing function with animation duration
Use linear for every UI animation by default
Overuse extreme cubic-bezier values without testing
Forget that steps() creates jumps, not smooth motion
Mix up comma-separated order when using multiple animations
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about animation-timing-function
Use these points when shaping animation speed curves.
5
Core concepts
📈01
Speed Curve
Controls pacing, not duration.
Purpose
⚡02
Default ease
Smooth start and finish.
Default
🔄03
Keywords
linear, ease-in, ease-out.
Syntax
🎯04
cubic-bezier()
Custom motion curves.
Advanced
📚05
steps()
Frame-by-frame jumps.
Special
❓ Frequently Asked Questions
The animation-timing-function property controls the speed curve of an animation. It defines how quickly or slowly the animation progresses between keyframes over its duration.
The initial value is ease, which starts slowly, speeds up in the middle, and slows down again before finishing.
animation-duration sets how long the animation takes. animation-timing-function sets how the speed changes during that time, such as constant speed with linear or slow start with ease-in.
Use cubic-bezier() when predefined keywords like ease or ease-in-out do not match the motion you want. It lets you create custom acceleration and deceleration curves.
The steps() function breaks an animation into discrete jumps instead of smooth motion. It is useful for sprite sheets, flipbook-style effects, and stepped progress indicators.