how to make directional animation in css code example

Example 1: animation-direction property

animation-direction  can have the following values -
(1) normal : forward direction, this is the default value.
(2) reverse : the animation sets in the reverse direction ( backward ).
(3) alternate : the animation plays normal first and then reverse.
(4) alternate-reverse: the animation plays reverse first and then normal.


NOTE: animation-duration also matters in animation-direction.

Example 2: css move animation

article {
    animation-name            : displaceContent;
    animation-duration        : 1s;
    animation-delay           : 4s;
    animation-iteration-count : 1;
    animation-fill-mode       : forwards;
}
@keyframes displaceContent {
    from { transform : translateY(0em) }
    to   { transform : translateY(3em) } /* slide down to make room for advertisements */
}

Tags:

Css Example