Explain the ease-in and ease-out in CSS
Last Updated :
16 Feb, 2024
The ease-in
and ease-out
are timing functions in CSS used to control the speed of a CSS animation or transition over time. They define the rate of change of the animation, determining how quickly or slowly it accelerates or decelerates. Both ease-in
and ease-out
are variations of the more general ease
timing function.
Syntax:
// The ease-in timing function
.element {
transition: property-name duration ease-in;
}
// The ease-out timing function
.element {
transition: property-name duration ease-out;
}
// The ease timing function
.element
{
transition: property-name duration ease;
}
ease-in
:
- The
ease-in
timing function starts the animation slowly and gradually accelerates toward the end.
- The initial phase of the animation is slower, providing a smooth and gentle start.
ease-out
:
- The
ease-out
timing function starts the animation quickly and decelerates toward the end.
- The initial phase of the animation is faster, and it slows down as it progresses, giving a smooth and gentle finish.
ease
:
- The
ease
timing function is a combination of ease-in
and ease-out
.
- It starts slow, accelerates in the middle, and then decelerates towards the end, providing a balanced and natural feel.
Share your thoughts in the comments
Please Login to comment...