CSS3 animation-timing-function Property
Example
Play the animation at the same speed from beginning to end:
Try it Yourself »
More examples at the bottom of this page.
Browser Support
| Property | |||||
|---|---|---|---|---|---|
| animation-timing-function | 43.0 4.0 -webkit- |
10.0 | 16.0 5.0 -moz- |
9.0 4.0 -webkit- |
30.0 15.0 -webkit- 12.0 -o- |
Tag definition and usage instructions
animation-timing-function specifies how an animation will complete a cycle.
The speed curve defines the time an animation takes to change from one set of CSS styles to another.
The speed curve is used to make changes smoother.
| Default Value: | ease |
|---|---|
| Inherited: | no |
| version: | CSS3 |
| JavaScript Syntax: | object object.style.animationTimingFunction="linear" |
Syntax
The mathematical function used by animation-timing-function is called a cubic Bézier curve, or speed curve. With this function, you can use your own values or use one of the predefined values:
| Value | Description | Testing |
|---|---|---|
| linear | The animation has the same speed from start to end. | Testing |
| ease | Default. The animation starts at a low speed, then speeds up, and slows down before the end. | Testing |
| ease-in | The animation starts at a low speed. | Testing |
| ease-out | The animation ends at a low speed. | Testing |
| ease-in-out | The animation starts and ends at a low speed. | Testing |
| steps(int,start|end) | Specifies the number of intervals (steps) in the timing function. There are two parameters; the first parameter specifies the number of intervals, and this parameter must be a positive integer (greater than 0). The second parameter is optional, indicating whether the animation runs continuously from the beginning or the end of the time segment. The meanings are as follows:
|
|
| cubic-bezier(n,n,n,n) | Your own values in the cubic-bezier function. Possible values are numbers from 0 to 1. |
Tip:Please try using different values in the "Try it" feature below.
Online Examples
Example
To better understand the different timing function values, five different div elements with five different values are provided here:
Try it Yourself »
Example
Same as the example above, but the speed curve is defined through the cubic-bezier function:
Try it Yourself »
Related Articles
CSS3 Tutorial:CSS3 Animations
other extensions