animation-direction

  • Revision slug: CSS/animation-direction
  • Revision title: animation-direction
  • Revision id: 22211
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 1 words added, 1 words removed

Revision Content

{{ CSSRef() }}

{{ SeeCompatTable() }}

Summary

The animation-direction CSS property indicates whether the animation should play in reverse on alternate cycles.

It is often convenient to use the shorthand property {{ cssxref("animation") }} to set all animation properties at once.

  • {{ Xref_cssinitial() }}: normal
  • Applies to: block-level and inline-level elements
  • {{ Xref_cssinherited() }}: no
  • Media: {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }}: as specified

Syntax

animation-direction: normal | alternate [, normal | alternate]*

Values

normal
The animation should play forward each cycle. In other words, each time the animation cycles, the animation will reset to the beginning state and start over again. This is the default animation direction setting.
alternate
The animation should reverse direction each cycle. When playing in reverse, the animation steps are performed backward. In addition, timing functions are also reversed; for example, an ease-in animation is replaced with an ease-out animation when played in reverse.

Examples

See CSS animations for examples.

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support

{{ CompatVersionUnknown() }}

(as -webkit-animation-direction)

{{ CompatGeckoDesktop("5.0") }}

(as -moz-animation-direction)

{{ CompatUnknown() }} {{ CompatUnknown() }}

4.0

(as -webkit-animation-direction)

Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

Specifications

See also

  • CSS animations
  • {{ domxref("Event/AnimationEvent", "AnimationEvent") }}
  • {{template("CSS_Reference:animation")}

Revision Source

<p>{{ CSSRef() }}</p>
<p>{{ SeeCompatTable() }}</p>
<h3>Summary</h3>
<p>The <code>animation-direction </code>CSS property indicates whether the animation should play in reverse on alternate cycles.</p>
<p>It is often convenient to use the shorthand property {{ cssxref("animation") }} to set all animation properties at once.</p>
<ul> <li>{{ Xref_cssinitial() }}: normal</li> <li>Applies to: block-level and inline-level elements</li> <li>{{ Xref_cssinherited() }}: no</li> <li>Media: {{ Xref_cssvisual() }}</li> <li>{{ Xref_csscomputed() }}: as specified</li>
</ul>
<h3>Syntax</h3>
<pre class="eval">animation-direction: normal | alternate [, normal | alternate]*
</pre>
<h3>Values</h3>
<dl> <dt><code>normal</code></dt> <dd>The animation should play forward each cycle. In other words, each time the animation cycles, the animation will reset to the beginning state and start over again. This is the default animation direction setting.</dd> <dt><code>alternate</code></dt> <dd>The animation should reverse direction each cycle. When playing in reverse, the animation steps are performed backward. In addition, timing functions are also reversed; for example, an <code>ease-in</code> animation is replaced with an <code>ease-out</code> animation when played in reverse.</dd>
</dl>
<h3>Examples</h3>
<p>See <a href="/en/CSS/CSS_animations" title="en/CSS/CSS animations">CSS animations</a> for examples.</p>
<h3 name="Browser_Compatibility">Browser compatibility</h3>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
<table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari (WebKit)</th> </tr> <tr> <td>Basic support</td> <td> <p>{{ CompatVersionUnknown() }}</p> <p>(as <code>-webkit-animation-direction</code>)</p> </td> <td> <p>{{ CompatGeckoDesktop("5.0") }}</p> <p>(as <code>-moz-animation-direction</code>)</p> </td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td> <p>4.0</p> <p>(as <code>-webkit-animation-direction</code>)</p> </td> </tr> </tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Phone</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>Basic support</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> </tr> </tbody>
</table>
</div>
<h3>Specifications</h3>
<ul> <li><a class="external" href="http://www.w3.org/TR/css3-animations" title="http://www.w3.org/TR/css3-animations">CSS Animations Module Level 3</a></li>
</ul>
<h2>See also</h2>
<ul> <li><a href="/en/CSS/CSS_animations" title="en/CSS/CSS animations">CSS animations</a></li> <li>{{ domxref("Event/AnimationEvent", "AnimationEvent") }}</li> <li>{{template("CSS_Reference:animation")}</li>
</ul>
Revert to this revision