Tag transition-timing-function

⏱️ CSS transition-timing-function — Control the Animation Curve

The transition-timing-function defines the speed curve of a transition, i.e., how fast or slow a property changes at different points in time. It controls the feel of your animation — whether it’s snappy, smooth, bouncy, or relaxed.


📘 Syntax

selector {
transition-timing-function: ease | linear | ease-in | ease-out | ease-in-out | cubic-bezier(n,n,n,n) | steps(n, direction);
}
  • Use named values for simplicity
  • Use cubic-bezier() for custom curves
  • Use steps() for choppy, frame-by-frame animations

🔹 Common Timing Functions

FunctionDescriptionFeel
linearConstant speed from start to finish🟢 Robotic, steady
easeStarts slow, speeds up, slows down (default)🌙 Natural, smooth
ease-inStarts slow, then speeds up🚀 Accelerating
ease-outStarts fast, then slows down🛬 Decelerating
ease-in-outStarts & ends slow, speeds up in the middle🌊 Balanced and calm
cubic-bezierFully custom animation curve🎨 Tailor-made timing
steps(n)Jumps in n steps instead of smooth transition🎞 Frame-based animation

✍️ Example: Ease vs Linear

.box {
transition: transform 1s;
}

.box.ease {
transition-timing-function: ease;
}

.box.linear {
transition-timing-function: linear;
}

✅ Both boxes animate in 1 second — but one eases, the other moves evenly.


🖼️ Image Idea: Animation Curve Graphs

A visual chart showing curves for:

  • ease
  • linear
  • ease-in
  • ease-out
  • ease-in-out

🎯 Purpose: Show how the speed varies over time for each function.


🔍 Custom cubic-bezier() Function

.card {
transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

✅ This creates a bounce effect (springy animation).

You can use tools like cubic-bezier.com to design your own timing functions visually.


🧪 steps() for Discrete Transitions

.loader {
transition: background-position 1s steps(4, end);
}

✅ Creates a stepped animation, like a sprite or countdown.


💡 Best Use Cases

UI ElementRecommended Timing Function
Buttonsease-in-outease
Modals/overlaysease-outcubic-bezier
Tooltipsease-inease-out
Loaders/spritessteps()

✅ Summary

Propertytransition-timing-function
What it controlsThe pace or rhythm of an animation
Default valueease
Other valueslinearease-inease-outsteps(), etc.
For advanced controlUse cubic-bezier()

🔚 Final Thought

The transition-timing-function gives your animations personality. Whether you want subtle, punchy, playful, or cinematic effects — it all depends on how time flows across the animation.