The cubic-bezier
function is a transition timing function which is often used for custom and smooth transitions.
transition-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1);
The function takes four parameters:
cubic-bezier(P1_x, P1_y, P2_x, P2_y)
These parameters will be mapped to points which are part of a Bézier curve:
For CSS Bézier Curves, P0 and P3 are always in the same spot. P0 is at (0,0) and P3 is at (1,1), which menas that the parameters passed to the cubic-bezier function can only be between 0 and 1.
If you pass parameters which aren't in this interval the function will default to a linear
transition.
Since cubic-bezier is the most flexible transition in CSS, you can translate all other transition timing function to cubic-bezier functions:
linear
: cubic-bezier(0,0,1,1)
ease-in
: cubic-bezier(0.42, 0.0, 1.0, 1.0)
ease-out
: cubic-bezier(0.0, 0.0, 0.58, 1.0)
ease-in-out
: cubic-bezier(0.42, 0.0, 0.58, 1.0)