CSS3 ANIMATION

CSS3 Animation Properties

Animation must be bind to a selector type by specifying at least these two properties:

The following table lists the @keyframes rule and all the animation properties:


Property

Description

@keyframes

Specifies the animation keyframes

animation

A shorthand property for setting ALL the animation properties, except the animation-play-state and the animation-fill-mode property

animation-name (REQUIRED)

Specifies the name of the @keyframes animation

animation-duration (REQUIRED)

Specifies how many seconds or milliseconds an animation takes to complete one cycle

animation-delay

Specifies when the animation will start

animation-direction

Specifies whether or not the animation should play in reverse on alternate cycles

animation-iteration-count

Specifies the number of times an animation should be played

animation-timing-function

Specifies the speed curve of the animation

animation-fill-mode

Specifies what CSS properties will apply for the element when the animation is finished or when it has a delay

animation-play-state

Specifies whether the animation is running or paused

 

NOTE: Beside the required animation-name and animation-duration properties, two other animation properties that are good to assign is animation-timing-function (or easing) which determine how the speed is DISTRIBUTED across the animation (i.e. fast to slow, slow to fast, etc.)
There are two major ways of defining easing:


1. Predefined key words include:

2. The second way to define easing is to use the easing function (i.e., cubic-bezier(x1, y1, x2, y2)). The easing keywords are actually shortcuts of Bezier curves as such you can define you own. Go to http://www.cubic-bezier.com/  to define your own and then copy and paste the code into your project.
-webkit-animation-timing-function: cubic-bezier (.53, 1.46, 1,-0.49);
Ceaser is another tool that can be used that is located at http://mathewlein.com/ceaser/
The second is the animation-iteration-count which determines how many times the animation will play. The default is 1 if it is not defined.

NOTE: Two additional properties are animation-delay (how long the animation will delay before starting in units of second or milliseconds) and animation-fill-mode. Normally, the animation will move back to its original position, to prevent this set the animation-fill-mode.

The final two properties that you may want to set is the animation-direction for each iteration:

And the animation-play-state which determine whether the animation is running or paused