animation

  • Revision slug: CSS/animation
  • Revision title: animation
  • Revision id: 22262
  • Created:
  • Creator: leaverou
  • Is current revision? No
  • Comment 5 words added, 2 words removed

Revision Content

{{ draft() }}

{{ SeeCompatTable() }}

Summary

The animation property is a shorthand property for {{ cssxref("animation-name") }}, {{ cssxref("animation-duration") }}, {{ cssxref("animation-timing-function") }}, {{ cssxref("animation-delay") }}, {{ cssxref("animation-iteration-count") }} and {{ cssxref("animation-direction") }}.

A list of CSS properties that can be animated is available; it's worth noting that these are the same properties supported by CSS transitions.

  • {{ xref_cssinitial() }}: 0
  • Applies to: block-level and inline-level elements
  • {{ xref_cssinherited() }}: no
  • Media: {{ xref_cssvisual() }}
  • {{ xref_csscomputed() }}: as specified

Syntax

animation:  [ <animation-name> || <animation-duration> || <animation-timing-function> || <animation-delay> ||
              <animation-iteration-count> || <animation-direction>] 
            [, [<animation-name> || <animation-duration> || <animation-timing-function> || <animation-delay> ||
              <animation-iteration-count> || <animation-direction>] ]*  

Examples

See CSS animations for examples.

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{ CompatVersionUnknown() }}{{ property_prefix("-webkit") }} {{ CompatGeckoDesktop("5.0") }}{{ property_prefix("-moz") }} 10{{ property_prefix("-ms") }} {{ CompatUnknown() }} 4.0{{ property_prefix("-webkit") }}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} iOS 2.0{{ property_prefix("-webkit") }}

Specifications

  • {{ spec("http://www.w3.org/TR/css3-animations/#the-animation-shorthand-property-", "CSS Animations Module Level 3: animation", "WD") }}

See also

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

{{ languages( { "ja": "ja/CSS/animation"} ) }}

Revision Source

<p>{{ draft() }}</p>
<p>{{ SeeCompatTable() }}</p>
<h3>Summary</h3>
<p>The <code>animation</code> property is a shorthand property for {{ cssxref("animation-name") }}, {{ cssxref("animation-duration") }}, {{ cssxref("animation-timing-function") }}, {{ cssxref("animation-delay") }}, {{ cssxref("animation-iteration-count") }} and {{ cssxref("animation-direction") }}.</p>
<p>A <a href="/en/CSS/CSS_transitions#Properties_that_can_be_animated" title="en/CSS/CSS_transitions#Properties_that_can_be_animated">list of CSS properties that can be animated</a> is available; it's worth noting that these are the same properties supported by <a href="/en/CSS/CSS_transitions" title="en/CSS/CSS_transitions">CSS transitions</a>.</p>
<ul> <li>{{ xref_cssinitial() }}: 0</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:  [ &lt;animation-name&gt; || &lt;animation-duration&gt; || &lt;animation-timing-function&gt; || &lt;animation-delay&gt; ||
              &lt;animation-iteration-count&gt; || &lt;animation-direction&gt;] 
            [, [&lt;animation-name&gt; || &lt;animation-duration&gt; || &lt;animation-timing-function&gt; || &lt;animation-delay&gt; ||
              &lt;animation-iteration-count&gt; || &lt;animation-direction&gt;] ]*  
</pre>
<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>{{ CompatVersionUnknown() }}{{ property_prefix("-webkit") }}</td> <td>{{ CompatGeckoDesktop("5.0") }}{{ property_prefix("-moz") }}</td> <td>10{{ property_prefix("-ms") }}</td> <td>{{ CompatUnknown() }}</td> <td>4.0{{ property_prefix("-webkit") }}</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>iOS 2.0{{ property_prefix("-webkit") }}</td> </tr> </tbody> </table>
</div>
<h3>Specifications</h3>
<ul> <li>{{ spec("http://www.w3.org/TR/css3-animations/#the-animation-shorthand-property-", "CSS Animations Module Level 3: animation", "WD") }}</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>{{ CSS_Reference:animation() }}</li>
</ul>
<p>{{ languages( { "ja": "ja/CSS/animation"} ) }}</p>
Revert to this revision