The <singletransitiontimingfunction>
CSS data type denotes a mathematical function that describes how fast onedimensional values change during animations. This lets you vary the animation's speed over the course of its duration.
"Smooth" timing functions are often called easing functions. They correlate a time ratio to an output ratio, both expressed as <number>
s. For these values, 0.0
represents the initial state, and 1.0
represents the final state.
Depending on the specific function used, the calculated output can sometimes grow to be greater than 1.0
or smaller than 0.0
during the course of an animation. This causes the animation to go farther than the final state, and then return. For some properties, such as left
or right
, this creates a kind of "bouncing" effect.
However, certain properties will restrict the output if it goes outside an allowable range. For example, a color component greater than 255
or smaller than 0
will be clipped to the closest allowed value (255
and 0
, respectively). Some cubicbezier()
curves exhibit this property.
Timing functions
CSS supports two kinds of timing functions: the subset of the cubic Bézier curves that are functions, and staircase functions. The most useful of these functions are given a keyword that allows them to be easily referenced.
The cubicbezier()
class of timing functions
The cubicbezier()
functional notation defines a cubic Bézier curve. As these curves are continuous, they are often used to smooth down the start and end of the animation and are therefore sometimes called easing functions.
A cubic Bézier curve is defined by four points P_{0}, P_{1}, P_{2}, and P_{3}. P_{0} and P_{3} are the start and the end of the curve and, in CSS these points are fixed as the coordinates are ratios (the abscissa the ratio of time, the ordinate the ratio of the output range). P_{0} is (0, 0)
and represents the initial time and the initial state, P_{3} is (1, 1)
and represents the final time and the final state.
Not all cubic Bézier curves are suitable as timing functions as not all are mathematical functions; i.e., curves that for a given abscissa have zero or one value. With P_{0} and P_{3} fixed as defined by CSS, a cubic Bézier curve is a function, and is therefore valid, if and only if the abscissas of P_{1} and P_{2} are both in the [0, 1]
range.
Cubic Bézier curves with the P_{1} or P_{2} ordinate outside the [0, 1]
range may generate bouncing effects.
When you specify an invalid cubicbezier
curve, CSS ignores the whole property.
Syntax
cubicbezier(x_{1}, y_{1}, x_{2}, y_{2})
where:
 x_{1}, y_{1}, x_{2}, y_{2}
 Are
<number>
values representing the abscissas, and ordinates of the P_{1} and P_{2} points defining the cubic Bézier curve. x_{1} and x_{2} must be in the range [0, 1] or the value is invalid.
Examples
These cubic Bézier curves are valid for use in CSS:
/* The canonical Bézier curve with four <number> in the [0,1] range. */ cubicbezier(0.1, 0.7, 1.0, 0.1) /* Using <integer> is valid as any <integer> is also a <number>. */ cubicbezier(0, 0, 1, 1) /* Negative values for ordinates are valid, leading to bouncing effects.*/ cubicbezier(0.1, 0.6, 0.2, 0) /* Values > 1.0 for ordinates are also valid. */ cubicbezier(0, 1.1, 0.8, 4)
These cubic Bézier curves definitions are invalid:
/* Though the animated output type may be a color, Bézier curves work w/ numerical ratios.*/ cubicbezier(0.1, red, 1.0, green) /* Abscissas must be in the [0, 1] range or the curve is not a function of time. */ cubicbezier(2.45, 0.6, 4, 0.1) /* The two points must be defined, there is no default value. */ cubicbezier(0.3, 2.1) /* Abscissas must be in the [0, 1] range or the curve is not a function of time. */ cubicbezier(1.9, 0.3, 0.2, 2.1)
The steps()
class of timing functions
The steps()
functional notation defines a step function dividing the domain of output values in equidistant steps.
This subclass of step functions are sometimes also called staircase functions.
steps(2, start)
steps(4, end)
Syntax
steps(number_of_steps, direction)
where:
 number_of_steps
 Is a strictly positive
<integer>
, representing the amount of equidistant treads composing the stepping function.  direction
 Is a keyword indicating if it the function is left or rightcontinuous:

start
denotes a leftcontinuous function, so that the first step happens when the animation begins;end
denotes a rightcontinuous function, so that the last step happens when the animation ends.
end
is the default.
Examples
These timing functions are valid:
/* There is 5 treads, the last one happens right before the end of the animation. */ steps(5, end) /* A twostep staircase, the first one happening at the start of the animation. */ steps(2, start) /* The second parameter is optional. */ steps(2)
These timing function are invalid:
/* The first parameter must be an <integer> and cannot be a real value, even if it is equal to one. */ steps(2.0, end) /* The amount of steps must be nonnegative. */ steps(3, start) /* There must be at least one step.*/ steps(0, end)
The frames()
class of timing functions
Note: The name of the frames()
timing function is currently under discussion, so it is currently disabled in browser release versions until a final decision is reached.
The frames()
functional notation defines a frames function dividing the domain of output values into equidistant intervals. The difference between frames()
and steps()
is that with frames()
, the start (0%) and end (100%) states are shown for an equal amount of time to the other intervals.
frames(2), frames(4)
Syntax
frames(number_of_frames)
where:
 number_of_frames
 Is a strictly positive
<integer>
, representing the amount of equidistant intervals composing the stepping function.
Examples
These timing functions are valid:
/* The parameter is a positive integer. */ frames(10)
Note: You can see a working transition example using the frames() function in our GitHub.
These timing function are invalid:
/* The parameter must be an <integer> and cannot be a real value, even if it is equal to one. */ frames(2.0) /* The amount of frames must be nonnegative. */ frames(3) /* There must be at least two frames.*/ frames(0)
Keywords for common timing functions
linear
The animation moves from beginning to end at a constant rate. This keyword represents the timing function cubicbezier(0.0, 0.0, 1.0, 1.0)
.
ease
The animation starts slowly, accelerates sharply, and then slows gradually towards the end. This keyword represents the timing function cubicbezier(0.25, 0.1, 0.25, 1.0)
. It is similar to easeinout
, though it accelerates more sharply at the beginning.
easein
The animation starts slowly, and then progressively speeds up until the end, at which point it stops abruptly. This keyword represents the timing function cubicbezier(0.42, 0.0, 1.0, 1.0)
.
easeinout
The animation starts slowly, speeds up, and then slows down towards the end. This keyword represents the timing function cubicbezier(0.42, 0.0, 0.58, 1.0)
. At the beginning, it behaves like the easein
function; at the end, it is like the easeout
function.
easeout
The animation starts abruptly, and then progressively slows down towards the end. This keyword represents the timing function cubicbezier(
0.0, 0.0, 0.58, 1.0
)
.
stepstart
The animation jumps immediately to its final state, where it stays until the end. This keyword represents the timing function steps(1, start)
.
stepend
The animation stays in its initial state until the end, at which point it jumps directly to its final state. This keyword represents the timing function steps(1, end)
.
Specifications
Specification  Status  Comment 

CSS Animations The definition of '<singletransitiontimingfunction>' in that specification. 
Working Draft  Defines <singletimingfunction> as a synonym for <singletransitiontimingfunction> of the CSS Transitions Module. 
CSS Transitions The definition of '<singletransitiontimingfunction>' in that specification. 
Working Draft  Initial definition. 
Browser compatibility
Desktop  Mobile  

Basic support  Chrome Full support 4  Edge ?  Firefox Full support 4  IE Full support 10  Opera Full support 10.5  Safari Full support 3.1  WebView Android Full support 4  Chrome Android ?  Edge Mobile ?  Firefox Android Full support 4  Opera Android Full support 10  Safari iOS Full support 2  Samsung Internet Android ? 
cubicbezier() with ordinate ∉ [0,1]  Chrome Full support 16  Edge ?  Firefox Full support 4  IE Full support 10  Opera Full support 12.1  Safari Full support Yes  WebView Android Full support Yes  Chrome Android ?  Edge Mobile ?  Firefox Android Full support 4  Opera Android ?  Safari iOS ?  Samsung Internet Android ? 
steps()  Chrome Full support 8  Edge ?  Firefox Full support 4  IE Full support 10  Opera Full support 12.1  Safari Full support 5.1  WebView Android Full support 4  Chrome Android ?  Edge Mobile ?  Firefox Android Full support 4  Opera Android ?  Safari iOS Full support 5  Samsung Internet Android ? 
Legend
 Full support
 Full support
 Compatibility unknown
 Compatibility unknown