C
S
S
  
A
n
i
m
a
t
i
o
n
(Hover over me!)
Specifies the name or names of the CSS properties to which transitions should be applied. Only properties listed here are animated during transitions; changes to all other properties occur instantaneously as usual.
Specifies the duration over which transitions should occur. You can specify a single duration that applies to all properties during the transition, or multiple values to allow each property to transition over a different period of time.
Specifies a function to define how intermediate values for properties are computed. Timing functions determine how intermediate values of the transition are calculated. Most timing functions can be specified by providing the graph of the corresponding function, as defined by four points defining a cubic bezier. You can also choose easing from specfic easing functions Cheat Sheet.
Defines how long to wait between the time a property is changed and the transition actually begins.
To create a CSS animation sequence, you style the element you want to animate with the animation property or its sub-properties. This lets you configure the timing, duration, and other details of how the animation sequence should progress. This does not configure the actual appearance of the animation, which is done using the @keyframes at-rule explained further down the page.
These are animation's sub properties:
Declares the name of the @keyframes at-rule to manipulate
The length of time it takes for an animation to complete one cycle
Sub Properties- XS or Xms
Establishes preset acceleration curves such as ease or linear
Sub Properties- ease, ease-out, ease-in, ease-in-out, linear, cubic-bezier(x1, y1, x2, y2) (e.g. cubic-bezier(0.5, 0.2, 0.3, 1.0))
The time between the element being loaded and the start of the animation sequence
Sub Properties- XS or Xms
Sets the direction of the animation after the cycle. Its default resets on each cycle
Sub Properties- normal, alternate
The number of times the animation should be performed
Sub Properties- (number)
Sets which values are applied before/after the animation. For example, you can set the last state of the animation to remain on screen, or you can set it to switch back to before when the animation began.
Sub Properties- forwards, backwards, both, none
Pause/Play the animation
Sub Properties- paused, running
Once you have named your animation and set your animation properties on the element you are animating, it is time to set up the keyframes. In a new line of CSS, write@keyframes (animation-name) to target the animation you just configured. The CSS will look something like this...
Each @keyframes at-rule defines what should happen at specific moments during the animation. For example, 0% is the beginning of the animation and 100% is the end. To add more keyframes enter a new percent between 1-99 and the enter the property value you want. For example to make pacman turn red too, add a 33% {background-color: red} and reconfigure your percent values like this...
You can also comma-separate the values to declare multiple animations on a selector as well. In the example below, we want to change the color of pacman in a @keyframe whilst also animating his eating motion.