Animation Effects
Animation is a process of creating the illusion of motion by placing still images one after another in a typical format. For instance, a ball can be made to appear rising from the ground by placing its pictures showing different positions in succession. CSS provides the following properties to enable you to animate different elements of a Web page:
- animation-name: Specifies the name of the animation that is to be applied on an element
- animation-duration : Specifies the time duration an animation takes to complete one cycle
- animation-timing-function : Specifies the progress of an animation
- animation-iteration-count: Specifies the number of animation cycles
- animation-direction: Specifies whether the animation is played in reverse or alternate direction
- animation-delay: Specifies a time period after which an animation starts
In addition to the preceding properties, there is a property, named animation, which can be used as an alternative for all other properties. In other words, the animation property can accept the values of all the other properties, such as animation-name, animation-duration, animation-timing-function, animation-iteration-count, animation-direction, and animation-delay. The following code snippet shows an example of using the animation properties:
img { -webkit-animation-name: resize; -webkit-animation-duration: 1s; -webkit-animation-iteration-count: infinite; -webkit-animation-direction: alternate; -webkit-animation-timing-function: ease; }
In the preceding code snippet, we have applied the resize animation effect and set the animation duration to 1 second. The iteration count is set to infinite, which means that the animation cycle is repeated infinite times.
Click here for demos to see animation effects:
demo
