animation-timing-function

  • Revision slug: CSS/animation-timing-function
  • Revision title: animation-timing-function
  • Revision id: 341535
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{ CSSRef() }}

{{ SeeCompatTable() }}

Summary

The CSS animation-timing-function property specifies how a CSS animation should progress over the duration of each cycle. The possible values are one or several {{ xref_csstimingfunction() }}.

For keyframed animations, the timing function applies between keyframes rather than over the entire animation. In other words, the timing function is applied at the start of the keyframe and at the end of the keyframe.

An animation timing function defined within a keyframe block applies to that keyframe; otherwise. If no timing function is specified for the keyframe, the timing function specified for the overall animation is used.

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

  • {{ xref_cssinitial() }} ease
  • Applies to all elements, and {{ cssxref("::before") }} and {{ cssxref("::after") }} pseudo-elements
  • {{ xref_cssinherited() }} no
  • Media {{ xref_cssvisual() }}
  • {{ xref_csscomputed() }} as specified
  • {{ xref_cssanimatable() }} no
  • {{ xref_csscanonicalorder() }} the unique non-ambiguous order defined by the formal grammar

Syntax

Formal grammar: <timing-function> [, <timing-function>]*
animation-timing-function: ease
animation-timing-function: ease-in
animation-timing-function: ease-out
animation-timing-function: ease-in-out
animation-timing-function: linear
animation-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1)
animation-timing-function: step-start
animation-timing-function: step-stop
animation-timing-function: steps(4, end)

animation-timing-function: ease, step-start, cubic-bezier(0.1, 0.7, 1.0, 0.1)

Values

<timingfunction>
Each {{ xref_csstimingfunction() }} represents the timing function to link to the corresponding property to animate, as defined in {{ cssxref("animation-property") }}.

Examples

See CSS animations for examples.

Specifications

Specification Status Comment
{{ SpecName('CSS3 Animations', '#animation-timing-function', 'animation-timing-function') }} {{ Spec2('CSS3 Animations') }}  

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{ CompatVersionUnknown() }}{{ property_prefix("-webkit") }} {{ CompatGeckoDesktop("5.0") }}{{ property_prefix("-moz") }}
{{ CompatGeckoDesktop("16.0") }}
10 12 {{ property_prefix("-o") }}
12.10 #
4.0{{ property_prefix("-webkit") }}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatVersionUnknown() }}{{ property_prefix("-webkit") }} {{ CompatGeckoMobile("5.0") }}{{ property_prefix("-moz") }}
{{ CompatGeckoMobile("16.0") }}
{{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

See also

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

Revision Source

<p>{{ CSSRef() }}</p>
<p>{{ SeeCompatTable() }}</p>
<h2 id="Summary">Summary</h2>
<p>The <a href="/en/CSS" title="CSS">CSS</a> <code>animation-timing-function</code> property specifies how a CSS animation should progress over the duration of each cycle. The possible values are one or several {{ xref_csstimingfunction() }}.</p>
<p>For keyframed animations, the timing function applies between <a href="/en-US/docs/CSS/@keyframes" title="/en-US/docs/CSS/@keyframes">keyframes</a> rather than over the entire animation. In other words, the timing function is applied at the start of the keyframe and at the end of the keyframe.</p>
<p>An animation timing function defined within a keyframe block applies to that keyframe; otherwise. If no timing function is specified for the keyframe, the timing function specified for the overall animation is used.</p>
<p>It is often convenient to use the shorthand property {{ cssxref("animation") }} to set all animation properties at once.</p>
<ul class="cssprop">
  <li><dfn>{{ xref_cssinitial() }}</dfn> <code>ease</code></li>
  <li><dfn>Applies to</dfn> all elements, and {{ cssxref("::before") }} and {{ cssxref("::after") }} <a href="/en/CSS/Pseudo-elements" title="Pseudo-elements">pseudo-elements</a></li>
  <li><dfn>{{ xref_cssinherited() }}</dfn> no</li>
  <li><dfn>Media</dfn> {{ xref_cssvisual() }}</li>
  <li><dfn>{{ xref_csscomputed() }}</dfn> as specified</li>
  <li><dfn>{{ xref_cssanimatable() }}</dfn> no</li>
  <li><dfn>{{ xref_csscanonicalorder() }}</dfn> the unique non-ambiguous order defined by the formal grammar</li>
</ul>
<h2 id="Syntax">Syntax</h2>
<pre class="twopartsyntaxbox">
Formal grammar: &lt;timing-function&gt; [, &lt;timing-function&gt;]*
</pre>
<pre>
animation-timing-function: ease
animation-timing-function: ease-in
animation-timing-function: ease-out
animation-timing-function: ease-in-out
animation-timing-function: linear
animation-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1)
animation-timing-function: step-start
animation-timing-function: step-stop
animation-timing-function: steps(4, end)

animation-timing-function: ease, step-start, cubic-bezier(0.1, 0.7, 1.0, 0.1)
</pre>
<h3 id="Values">Values</h3>
<dl>
  <dt>
    <code>&lt;timingfunction&gt;</code></dt>
  <dd>
    Each {{ xref_csstimingfunction() }} represents the timing function to link to the corresponding property to animate, as defined in {{ cssxref("animation-property") }}.</dd>
</dl>
<h2 id="Examples">Examples</h2>
<p>See <a href="/en/CSS/CSS_animations" title="en/CSS/CSS_animations">CSS animations</a> for examples.</p>
<h2 id="Specifications" name="Specifications">Specifications</h2>
<table class="standard-table">
  <thead>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>{{ SpecName('CSS3 Animations', '#animation-timing-function', 'animation-timing-function') }}</td>
      <td>{{ Spec2('CSS3 Animations') }}</td>
      <td>&nbsp;</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_Compatibility" name="Browser_Compatibility">Browser compatibility</h2>
<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") }}<br />
          {{ CompatGeckoDesktop("16.0") }}</td>
        <td>10</td>
        <td>12 {{ property_prefix("-o") }}<br />
          12.10 <a href="http://my.opera.com/ODIN/blog/2012/08/03/a-hot-opera-12-50-summer-time-snapshot" title="http://my.opera.com/ODIN/blog/2012/08/03/a-hot-opera-12-50-summer-time-snapshot">#</a></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>{{ CompatVersionUnknown() }}{{ property_prefix("-webkit") }}</td>
        <td>{{ CompatGeckoMobile("5.0") }}{{ property_prefix("-moz") }}<br />
          {{ CompatGeckoMobile("16.0") }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_also">See also</h2>
<ul>
  <li><a href="/en-US/docs/CSS/Tutorials/Using_CSS_animations" title="Tutorial about CSS animations">Using CSS animations</a></li>
  <li>{{ domxref("AnimationEvent", "AnimationEvent") }}</li>
  <li>{{ CSS_Reference:animation() }}</li>
</ul>
Revert to this revision