ExamplePlay an animation with the same speed from beginning to end:
Try it yourself » |
The animation-timing-function property is not supported in any browsers.
Safari and Chrome support an alternative, the -webkit-animation-timing-function property.
The animation-timing-function specifies the speed curve of the animation.
The speed curve defines the TIME an animation uses to change from one set of CSS styles to another.
The speed curve is used to make the changes smoothly.
Default value: | ease |
---|---|
Inherited: | no |
Version: | CSS3 |
JavaScript syntax: | object.style.animationTimingFunction="linear" |
animation-timing-function: value; |
The animation-timing-function uses a mathematical function, called the Cubic
Bèzier
curve, to make the speed curve. You can use your own
values in this function, or use one of the pre-defined values:
Value | Description |
---|---|
linear | The animation has the same speed from start to end |
ease | Default. The animation has a slow start, then fast, before it ends slowly |
ease-in | The animation has a slow start |
ease-out | The animation has a slow end |
ease-in-out | The animation has both a slow start and a slow end |
cubic-bezier(n,n,n,n) | Define your own values in the cubic-bezier function Possible values are numeric values from 0 to 1 |
Tip: Try the different values in the Try it Yourself section below.
![]() |
Try it Yourself |
ExampleTo better understand the different timing function values;
Try it yourself » |
ExampleSame as the example above, but the speed curves are defined with the cubic-bezier function:
Try it yourself » |