CSS transitions provide a way to control animation speed when changing CSS properties. Instead of having property changes take effect immediately, you can cause the changes in a property to take place over some time. For example, if you change the color of an element from white to black, usually the change is instantaneous. With CSS transitions enabled, changes occur at time intervals that follow an acceleration curve, all of which can be customized.
Animations that involve transitioning between two states are often called implicit transitions as the states in between the start and final states are implicitly defined by the browser.
CSS transitions let you decide which properties to animate (by listing them explicitly) when the animation will start (by setting a delay), how long the transition will last (by setting a duration), and how the transition will run (by defining a timing function, e.g. linearly or quick at the beginning, slow at the end).
Transition Property Details
transition-property: The specific CSS property whose value change needs to be transitioned (or) all, if all the transitional properties need to be transitioned.
Example background, width, height, etc.
transition-duration: The duration (or period) in seconds or milliseconds over which the transition must take place.
Example 2sec, 1minute, etc.
transition-timing-function: A function that describes how the intermediate values during the transition are calculated. Commonly used values are ease, ease-in, ease-out, ease-in-out, and linear.
Example ease, ease-out, etc.
transition-delay: The amount of time that must have elapsed before the transition can start. Can be specified in seconds (s) or milliseconds.
What Is the Difference Between Transform and Transition In CSS?
CSS transitions allow you to smoothly change properties over a given time by using timing functions. On the other hand, CSS Transforms allows CSS elements to be transformed in two-dimensional or three-dimensional space.
What are CSS Timing Functions?
A CSS timing function is used to allow a transition to change speed during its course, using the transition-timing-function and animation-timing-function transitions properties.
What are CSS Easing Functions?
Easing functions specify the rate of change of a parameter over time, allowing you to add more realism to your transitions.
Which Properties you can Animate using CSS Animations?
A lot! They are the same you can animate using CSS Transitions, too.