CSS animation Property
Example
Binding an animation to a <div> element, using the shorthand property:
div {
animation: mymove 5s infinite;
/* "mymove" is the animation name.
"5s" is the duration for completing a animation.
"infinite" is the number of count for which a animation will run.*/
}
animation: mymove 5s infinite;
/* "mymove" is the animation name.
"5s" is the duration for completing a animation.
"infinite" is the number of count for which a animation will run.*/
}
Definition and Usage
The animations are used for changing visible properties of elements with time.
The animation
property is a shorthand property for:
- animation-name
- animation-duration
- animation-timing-function
- animation-delay
- animation-iteration-count
- animation-direction
- animation-fill-mode
- animation-play-state
Note: Always specify the animation-duration property, otherwise the duration is 0, and will never be played.
Default value: | none 0 ease 0 1 normal none running |
---|---|
Inherited: | no |
Animatable: | no. |
Version: | CSS3 |
JavaScript syntax: | object.style.animation="mymove 5s infinite" |
- Inherited : "Inherited = no" means that it cannot takes (inherit) it's value from it's parent element.
- object - object in javascript means the element on which
animation
is applied. - Animatable - "Animatable = no" means that it cannot be animated with CSS
@keyframes
.
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Numbers followed by -webkit-, -moz-, or -o- specify the first version that worked with a prefix.
Property | |||||
---|---|---|---|---|---|
animation | 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- |
CSS Syntax
animation: name duration timing-function delay iteration-count direction fill-mode play-state;
Property Values
Value | Description |
---|---|
animation-name | Specifies the name of the keyframe (used for creating animation styles for different points of time) you want to bind to the selector |
animation-duration | Specifies how many seconds or milliseconds an animation takes to complete |
animation-timing-function | Specifies the speed curve of the animation |
animation-delay | Specifies a delay before the animation will start |
animation-iteration-count | Specifies how many times an animation should be played |
animation-direction | Specifies whether or not the animation should play in reverse on alternate cycles |
animation-fill-mode | Specifies what values are applied by the animation outside the time it is executing |
animation-play-state | Specifies whether the animation is running or paused |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
Comments
Post a Comment