8000 csswg-drafts/css3-animations/CSSAnimation.html at c60f88717c2dcf5103072e871610cf06737e240e · w3c/csswg-drafts · GitHub
Skip to content

Latest commit

 

History

History
1835 lines (1740 loc) · 60 KB

File metadata and controls

1835 lines (1740 loc) · 60 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>
CSS Animation
</title>
<link href="base.css" rel="stylesheet" type="text/css">
<style type="text/css">
@media print {
/* the following doesn't work for now,
instead we rely on a patched version of html2ps which has this built-in */
.dlink { display: none }
/* the following doesn't work for now,
instead we rely on a patched version of html2ps which has this built-in */
div.navbar {
display: none;
}
html { margin: 0 !important }
body { font-family: serif }
th, td { font-family: inherit }
a { color: inherit !important }
div.example:before { font-family: serif !important }
pre.example:before { font-family: serif !important }
a:link, a:visited { text-decoration: none !important }
a:link:after, a:visited:after { /* create a cross-ref "see..." */ }
}
@page {
margin: 1.5cm 1.1cm;
}
/* html body { margin-left: 8.5em } /* Overrides 70px in base.css */
body {counter-reset: exampleno figure}
h2, h3, h5, h6 { margin-top: 2em }
h1, h2, h3, h4, h5, h6 { page-break-after: avoid; font-family: inherit }
div.figure, div.sidefigure, pre, table.propdef, table.propdef-extra,
div.example { page-break-inside: avoid }
dt { page-break-after: avoid }
span.id {float: right; font-weight: bold}
/* p, p.note + p, p.testlink + p, p.note, p.issue { */
p, p.testlink + p, p.issue, p.mtb {
/* text-indent: 2em; */
margin-bottom: 0.6em;
margin-top: 0.6em
}
p + p, p + div.sidefigure + p {
/* text-indent: 2em; */
margin-top: 0
}
dd p {
margin-top: 0
}
h1 + h2 {
margin-top: 0;
}
pre {
text-align: left; /* fixes justification in Mac IE 5 */
text-indent: 0; /* fixes indent in Mac Netscape 6 */
margin-top: 1em;
margin-bottom: 1em;
font-size: 90% /*smaller*/;
}
/*
var {
font-style: normal;
}
*/
img {
border-style: none;
color: white;
}
.toc {
text-indent: 0;
}
@media all { /* NS < 6 doesn't like borders around inline elements... */
body {
line-height: 1.3;
}
a:link, a:visited {
/* color: inherit;*/
}
a.logo:link, a.logo:visited {
padding: 0;
border-style: none;
}
/* Hmm, this seems to confuse many browsers... */
dt { margin-left: 0; margin-top: 1em; color: #030; font-weight: bold;}
dd { margin-left: 2em }
dl, ul, ol { margin-left: 1em; padding-left: 0 }
li { margin-left: 2em; padding-left: 0 }
}
ul.indexlist { margin-left: 0; /*column-width: 13em; columns: 13em*/ }
ul.indexlist li { margin-left: 0; list-style: none }
ul.indexlist li li { margin-left: 1em }
div.example:before {
content: "Example";
content: "Example " counter(exampleno, upper-roman);
font: bold small sans-serif;
/*float: left;*/
position: absolute;
top: -0.6em;
left: -2.5em;
width: 7.5em;
text-align: center;
line-height: 1em;
color: #FFF8DD;
background: #600;
padding: 0.1em;
border: thin solid #999;
/*margin: -1.3em 0 0.3em -2.5em;*/
}
div.example {
counter-increment: exampleno;
}
pre.example:before {
content: "Example";
content: "Example " counter(exampleno, upper-roman);
font: bold small sans-serif;
/*float: left;*/
position: absolute;
top: -0.6em;
left: -2.5em;
width: 7.5em;
text-align: center;
line-height: 1em;
color: #FFF8DD;
background: #600;
padding: 0.1em;
border: thin solid #999;
/*margin: -1.3em 0 0.3em -2.5em;*/
}
pre.example {
counter-increment: exampleno;
}
div.example, div.illegal-example, div.html, div.illegal-html, div.xml,
div.illegal-xml, pre.example, pre.illegal-example, pre.html,
pre.illegal-html, pre.xml, pre.illegal-xml {
background: #FFF8DD;
padding: 0.5em;
margin: 1em 0;
border: thin solid #999;
position: relative;
}
pre.example, pre.illegal-example, pre.html,
pre.illegal-html, pre.xml, pre.illegal-xml {
padding-top: 1.5em;
}
div.example { color: #600 }
pre.example { color: #600 }
pre.illegal-example { color: red }
div.illegal-example { color: red }
div.illegal-example p { color: black }
div.html { color: #600 }
pre.html { color: #600 }
pre.illegal-html { color: red }
div.illegal-html { color: red }
div.illegal-html p { color: black }
pre.deprecated-html { color: red }
div.deprecated-html { color: red }
div.deprecated-html p { color: black }
div.xml { color: #600 }
pre.xml { color: #600 }
pre.illegal-xml { color: red }
div.illegal-xml { color: red }
div.illegal-xml p { color: black }
code { font-size: 90% }
.css { color: #800 } /* inline CSS code (SPAN/CODE) */
code.css { font-family: inherit; font-size: 100% }
code.html { color: #600 } /* inline HTML */
code.xml { color: #600 } /* inline XML */
.property { } /* name of a CSS property (SPAN) */
.prop-name { color: #2A2AA5; font-weight: bold; font-size: 90%} /* name of a CSS property (SPAN) */
.prop-value { font-weight: bold; font-size: 90%} /* CSS property value (SPAN) */
.descriptor { } /* name of a CSS descriptor (SPAN) */
.issue { color: #c00 } /* editorial remark, open issue */
.type { font-style: italic } /* A <type> value for a property */
dfn { font-weight: bolder; /*font-size: 1em*/ }
/* Class note is a non-normative note. May be inline or a P or DIV */
.note {
/* font-weight: bold; */
color: green
}
p.note, div.note {
/* margin: 1em 2em; */
}
p.note:before, span.note:before { content: "\25B6" " " }
div.note > p:first-child:before { content: "\25B6" " " }
< 77EC div class="react-code-text react-code-line-contents" style="min-height:auto">
.normref { color: red }
.informref { color: green }
/* ToC not indented, but font style shows hierarchy */
ul.toc {margin: 1em 0; padding: 0; font-weight: bold}
ul.toc ul {margin: 0; padding: 0; font-weight: normal}
ul.toc ul ul {margin: 0 /*0 0 2em*/; font-style: italic}
ul.toc ul ul ul {margin: 0}
ul.toc li {margin: 0.6em 0; padding: 0}
ul.toc li li {margin: 0}
/*
ul.toc li li li, ul.toc li li li ul {margin-left: 0; display: inline}
ul.toc li li li ul, ul.toc li li li ul li {margin-left: 0; display: inline}
*/
@media all { /* NS4 doesn't align the floats properly :-( */
/* Section numbers in a column of their own */
ul.toc span.secno {margin-right: 1em} /* workaround for Opera6 */
ul.toc span.secno {float: left; width: 4em; margin-left: -5em}
/*ul.toc span.secno {text-align: right}*/
ul.toc li {clear: both}
ul.toc {margin-left: 5em}
/* If we had 'tab', floats would not be needed here:
ul.toc span.secno {tab: 5em right; margin-right: 1em}
ul.toc li {text-indent: 5em hanging}
The second line in case items wrap
*/
}
ul.index {
list-style: disc; /* Mac NS has problem with 'none' */
list-style: none;
}
s, del {text-decoration: line-through; color: red}
u, ins {text-decoration: underline; background: #bfa}
div.figure, div.sidefigure {
text-align: center;
margin: 2.5em 0;
}
div.sidefigure {
float: right;
width: 50%;
margin: 0 0 0.5em 0.5em
}
div.figure img, div.sidefigure img {
display: block;
margin: auto;
max-width: 100%
}
p.caption, caption {
text-align: center;
font-style: italic;
font-size: 90%;
margin: 1.5em 2em;
text-indent: 0;
}
p.caption:before {
content: "Figure " counter(figure) ". ";
font-weight: bold;
}
p.caption {
counter-increment: figure;
}
/* DL list is indented, but figure inside it is not */
dd { margin-left: 2em }
dd div.figure { margin-left: -2em }
sup {
vertical-align: super;
font-size: 80%
}
/* "Equations" (not real MathML, but simple HTML) are put in a
blockquote and may have an equation number. We make sure the
blockquote has enough margin on the right and then put the equation
number there. */
blockquote {
margin: 0.5em 4em 0.5em 2em;
text-indent: 0;
}
.eqno {
text-align: right;
float: right;
width: 3em;
margin: 0 -4em 0 0;
font-weight: bold;
/* background: silver; color: black; padding: 0.1em */
}
table.equiv-table { border-spacing: 0; margin: 0.5em 0 }
table.equiv-table th, table.equiv-table td { padding: 0.3em }
table.equiv-table th { text-align: left }
/* table.equiv-table th:first-child { text-align: right } */
table.equiv-table td, table.equiv-table th { border-bottom: thin solid #666 }
table.equiv-table { border-bottom: hidden }
table.equiv-table { empty-cells: show }
table.equiv-table caption { margin: 0.5em 0 0 0 }
/* Style for table of properties */
table.proptable {
font-size: small;
border-collapse: collapse;
border-spacing: 0;
text-align: left;
margin: 1em 0;
}
@media print { /* Use the wide margin in print */
table.proptable {margin: 1em 0 1em -8.5em}
}
table.proptable td, table.proptable th {
padding: 0.4em;
border-style: solid none none dotted;
border-width: thin;
border-color: red;
}
table.proptable th:first-child, table.proptable td:first-child {
border-left-style: none;
}
/* Style for table that defines a property or a descriptor */
table.propdef, table.propdef-extra, table.descdef {
border-spacing: 0;
border-collapse: collapse;
width: 100%;
table-layout: fixed;
background: #DEF;
margin-top: 1.2em;
margin-bottom: 1.2em
}
table.propdef td, table.propdef-extra td, table.descdef td {
padding: 0 0.3em;
vertical-align: baseline;
}
/*
table.propdef dfn, table.propdef-extra dfn, table.descdef dfn {
font-weight: bold;
font-style: normal
}
*/
table.propdef td:first-child,
table.propdef-extra td:first-child,
table.descdef td:first-child {
font-style: italic;
width: 8.1em
}
table.propdef td[colspan]:first-child,
table.propdef-extra td[colspan]:first-child,
table.descdef td[colspan]:first-child {
font-style: inherit
}
table.propdef tr:first-child,
table.propdef-extra tr:first-child,
table.descdef tr:first-child {
background: #005A9C;
color: white
}
/* table.propdef tr:first-child td { padding-top: 0.1em; padding-bottom: 0.1em } */
/* This would replace :first-child for Opera, but it confuses WinIE :-( */
/*
table.propdef td { width: 8em }
table.propdef td + td { width: auto }
table.propdef tr { background: #005A9C; color: white }
table.propdef tr + tr { background: transparent; color: black }
*/
/* CSS modules typically don't use MUST, SHOULD etc. from RFC 2119,
or, if they do, they don't put them in uppercase. But the following
class is provided in case a spec wants to use RFC 2119 terms in
uppercase in the source. */
em.rfc2119 {
text-transform: lowercase;
font-variant: small-caps;
font-style: normal
}
/* In Profile specs, a table of required features: */
table.features th {
background: #00589f;
color: #fff;
text-align: left;
padding: 0.2em 0.2em 0.2em 0.5em;
}
table.features td {
vertical-align: top;
border-bottom: 1px solid #ccc;
padding: 0.3em 0.3em 0.3em 0.7em;
}
body { line-height: 1.4; }
.issue, .todo {
//display: none;
margin: 1em;
border: 2px solid;
padding: 1em;
}
span.issue, span.todo {
border-width: 1px;
margin: 0; padding: 0;
}
.issue { border-color: red; }
.todo { border-color: yellow; }
.issue:before, .todo:before {
content: attr(class) ": ";
text-transform: uppercase;
font-weight: bold;
}
.issue { background: rgb(255,224,224); color: black; }
.todo { background: rgb(255,255,192); color: black; }
.syntax {
padding: 1em;
margin: 1em 0;
border: 1px black solid;
background: rgb(224,224,255);
color: black;
}
.idl-code {
margin: 0;
font-family: monospace;
border: 1px solid black;
color: black;
background-color: #dfdfdf;
}
</style>
</head>
<body>
<h1>
CSS Animation
</h1>
<h2>
21 November 2008
</h2>
<dl>
<dt>
Authors:
</dt>
<dd>
Dave Hyatt (<a href="mailto:hyatt@apple.com">hyatt@apple.com</a>), <a href="http://www.apple.com/">Apple</a>
</dd>
<dd>
Dean Jackson (<a href="mailto:dino@apple.com">dino@apple.com</a>), <a href="http://www.apple.com/">Apple</a>
</dd>
<dd>
Chris Marrin (<a href="mailto:cmarrin@apple.com">cmarrin@apple.com</a>), <a href="http://www.apple.com/">Apple</a>
</dd>
</dl>
<hr>
<!-- ======================================================================================================= -->
<h2>
1 Introduction
</h2>
<p>
This document introduces new CSS features to enable animation.
</p>
<p>
Animation is currently possible in languages like SVG, but no system exists for the native animation of CSS styles. This proposal introduces <em>defined animations</em>, which specify the values that CSS properties will take over a given time interval.
</p>
<p>
This specification is an extension to <a href="CSSTransitions.html">CSS Transitions</a>.
</p>
<h2>
2 Keyframes
</h2>
<p>
In a simple transition, since both the starting value and ending value
are known, a single timing function and duration determine the
intermediate values of the animating property. If finer control of the
intermediate values is required, keyframes can be used.
</p>
<p>
Keyframes are specified using a specialized CSS at-rule. A <span
class="prop-name">@keyframes</span> rule consists of the keyword
"@keyframes", followed by an identifier giving a name for the animation
(which will be referenced using <span
class="prop-name">'animation-name'</span>), followed by a set of style
rules (delimited by curly braces).
</p>
<p>
The <i>keyframe selector</i> for a keyframe style rule consists of a
comma-separated list of percentage values or the keywords 'from' or
'to'. The selector is used to specify the percentage along the duration
of the animation that the keyframe represents. The
keyframe itself is specified by the block of property values declared on
the selector. The keyword 'from' is equivalent to the value 0. The
keyword 'to' is equivalent to the value 100%. Note that the percentage
unit specifier must be used on percentage values. Therefore, "0" is an
invalid keyframe selector.
</p>
<p>
Keyframes can be specified in any order. The selector determines
the placement of the keyframe in the animation.
</p>
<p>
Every keyframe declaration must have a keyframe rule for
0% or 100%, possibly defined using "from" or "to". A keyframe
declaration without these keyframe selectors is invalid and will not
be available for animation.
</p>
<p>
The <i>keyframe declaration</i> for a keyframe rule consists of
properties and values. Properties that are unable to be
animated are ignored in these rules, with the exception of <span
class="prop-name">animation-timing-function'</span>, the behavior
of which is described below.
</p>
<p>
The @keyframes rule that is used by an animation will be the last one encountered in sorted rules order that matches the name of the animation. <span class="prop-name">@keyframes</span> rules do not cascade; therefore an animation will never derive keyframes from more than one <span class="prop-name">@keyframes</span> rule.
</p>
<p>
To determine the set of keyframes, all of the values in selectors are sorted in increasing order by time. If there are any duplicates, then the last keyframe specified inside the <span class="prop-name">@keyframes</span> rule will be used to provide the keyframe information for that time. There is no cascading within a <span class="prop-name">@keyframes</span> rule if multiple keyframes specify the same keyframe selector values.
</p>
<div class="example">
<p style="display:none">
Example(s):
</p>
<pre>
@keyframes 'wobble' {
0% {
left: 100px;
}
40% {
left: 150px;
}
60% {
left: 75px;
}
100% {
left: 100px;
}
}
</pre>Four keyframes are specified for the animation named "wobble". In the first keyframe, shown at the beginning of the animation cycle, the 'left' value of the animation is 100px. By 40% of the animation duration, 'left' value has animated to 150px. At 60% of the animation duration, the 'left' value has animated back to 75px. At the end of the animation cycle, the 'left' value has returned to 100px. The diagram below shows the state of the animation if it were given a duration of 10s.
<div class="figure">
<img src="animation1.png" alt="">
</div>
<p class="caption">
Animations states specified by keyframes
</p>
</div>
<p>
The following is the grammar for the keyframes rule.
</p>
<pre>
keyframes-rule: '@keyframes' IDENT '{' keyframes-blocks '}';
keyframes-blocks: [ keyframe-selectors block ]* ;
keyframe-selectors: [ 'from' | 'to' | PERCENTAGE ] [ ',' [ 'from' | 'to' | PERCENTAGE ] ]*;
</pre>
<!-- ======================================================================================================= -->
<h3>
2.1 Timing functions for keyframes
</h3>
<p>
A keyframe style rule may also declare the timing function that is to be used as the animation moves to the next keyframe.
</p>
<div class="example">
<p style="display:none">
Example(s):
</p>
<pre>
@keyframes 'bounce' {
from {
top: 100px;
animation-timing-function: ease-out;
}
25% {
top: 50px;
animation-timing-function: ease-in;
}
50% {
top: 100px;
animation-timing-function: ease-out;
}
75% {
top: 75px;
animation-timing-function: ease-in;
}
to {
top: 100px;
}
}
</pre>Five keyframes are specified for the animation named "bounce". Between the first and second keyframe (ie. between 0 and 25%) an "ease-out" timing function is used. Between the second and third keyframe (ie. between 25% and 50%) an "ease-in" timing function is used. And so on. The effect will appear as an element that moves up the page 50px, slowing down as it reaches its highest point then speeding up as it falls back to 100px. The second half of the animation behaves in a similar manner, but only moves the element 25px units up the page.
</div>
<p>
See <a href="#animation-timing-function_tag">the <span class="prop-name">'animation-timing-function'</span> property</a> for more information.
</p><!-- ======================================================================================================= -->
<h2>
3 Animations
</h2>
<p>
Animations are similar to transitions in that they change the presentational value of CSS properties over time. The principal difference is that while transitions trigger <i>implicitly</i> when property values change, animations are <i>explicitly</i> executed when the animation properties are applied. Because of this, animations require explicit values for the properties being animated. These values are specified using animation keyframes, described above.
</p>
<p>
Many aspects of the animation can be controlled, including how many times the animation iterates, whether or not it alternates between the begin and end values, and whether or not the animation should be running or paused. An animation can also delay its start time.
</p>
<div class="example">
<p style="display:none">
Example(s):
</p>
<pre>
div {
animation-name: 'diagonal-slide';
animation-duration: 5s;
animation-iteration-count: 10;
}
@keyframes 'diagonal-slide' {
from {
left: 0;
top: 0;
}
to {
left: 100px;
top: 100px;
}
}
</pre>This will produce an animation that moves an element from (0, 0) to (100px, 100px) over five seconds and repeats itself nine times (for a total of ten iterations).
</div>
<!-- ======================================================================================================= -->
<h3>
3.1 Animation behavior
</h3>
<p>
CSS Animations affect computed property values. During the execution of an animation, the
computed value for a property is controlled by the animation. This overrides the value
specified in the normal styling system.
</p>
<p>
In the case of multiple animations specifying behavior for the same property, the animation
defined last will override the previously defined animations.
</p>
<p>
An animation does not affect the computed value before the application of the animation,
before the animation delay has expired, and after the end of the animation.
</p>
<div class="figure">
<img src="sandwich.png" alt="">
</div>
<p class="caption">
Computation of animated property values
</p>
<p>
The diagram above shows how property values are computed. The intrinsic style is shown at the
top of the diagram. The computed value is derived from intrinsic style at the times when an
animation is not running and also when an animation is delayed (see below for specification of
animation delay). During an animation, the computed style is derived from the animated value.
</p>
<p>
The start time of an animation is the latter of two moments: the time at which the style is
resolved that specifies the animation, or the time the document's load event is fired.
Therefore, an animation specified in the document stylesheet will begin at the document load.
An animation specified on an element by modifying the style after the document has loaded will
start when the style is resolved. That may be immediately in the case of a pseudo style rule
such as hover, or may be when the scripting engine returns control to the browser (in the case
of style applied by script).
</p>
<p>
An animation applies to an element if the element has a value for
<span class="prop-name">'animation-name'</span> that references a valid
keyframes rule. Once an animation has started it continues until it ends
or the <span class="prop-name">'animation-name'</span> is removed. The values
used for the keyframes and animation properties are snapshotted at the
time the animation starts. Changing them during the execution of the
animation has no effect. Note also, that changing the value of
<span class="prop-name">'animation-name'</span> does not necessarily
restart an animation (e.g. if a list of animations are applied and
one is removed from the list, only that animation will stop; The other
animations will continue). In order to restart an animation, it must be
removed then reapplied.
</p>
<!-- ======================================================================================================= -->
<h3>
3.2 The <span class="prop-name">'animation-name'</span> Property
</h3>
<p>
The <span class="prop-name">'animation-name'</span> property defines a
list of animations that apply. Each name is used to select the keyframe at-rule
that provides the property values for the animation. If the name does
not match any keyframe at-rule, there are no properties to be animated
and the animation will not execute. Furthermore, if the animation name
is 'none' then there will be no animation. This can be used to override
any animations coming from the cascade.
</p>
<table class="propdef">
<tbody>
<tr>
<td>
<em>Name:</em>
</td>
<td>
<dfn id="animation-name">animation-name</dfn>
</td>
</tr>
<tr>
<td>
<em>Value:</em>
</td>
<td>
none | IDENT [, none | IDENT ]*
</td>
</tr>
<tr>
<td>
<em>Initial:</em>
</td>
<td>
none
</td>
</tr>
<tr>
<td>
<em>Applies&nbsp;to:</em>
</td>
<td>
block-level and inline-level elements
</td>
</tr>
<tr>
<td>
<em>Inherited:</em>
</td>
<td>
no
</td>
</tr>
<tr>
<td>
<em>Percentages:</em>
</td>
<td>
N/A
</td>
</tr>
<tr>
<td>
<em>Media:</em>
</td>
<td>
visual
</td>
</tr>
<tr>
<td>
<em>Computed value:</em>
</td>
<td>
Same as specified value.
</td>
</tr>
</tbody>
</table>
<!--
<p>
It is possible for elements to have multiple animations running that change the same property or properties. In this case the animations combine in a manner defined by the property. For example, animations on <span class="prop-name">opacity</span> will add together and animations on <span class="prop-name">transform</span> will have their transformation matrices multiplied.
</p>
<div class="example">
<p style="display:none">
Example(s):
</p>
<pre>
@keyframes 'border-bloat' {
from {
border-width: 0;
}
to {
border-width: 10px;
}
}
@keyframes 'border-diet' {
from {
border-width: 4px;
}
to {
border-width: 2px;
}
}
div {
animation-name: 'border-bloat', 'border-diet';
animation-duration: 10s, 4s;
}
</pre>
<p>
The above example has two animations executing on the same property, <span class="prop-name">border-width</span>. The animations are additive. That is, the
resulting value for the property will be the addition of the values from the
two animations.
</p>
<p>
At time '0s' the element's border will be 4px wide (0px from 'border-bloat' plus 4px from 'border-diet').
At time '4s' the element's border will be 6px wide (4px from 'border-bloat' plus 2px from 'border-diet').
At time '10s' the element's border will be 10px wide (10px from 'border-bloat' and no addition from
'border-diet' as it is no longer executing).
</p>
</div>
-->
<!-- ======================================================================================================= -->
<h3>
3.3 The <span class="prop-name">'animation-duration'</span> Property
</h3>
<p>
The <span class="prop-name">'animation-duration'</span> property defines the length of time that an animation takes to complete one cycle.
</p>
<table class="propdef">
<tbody>
<tr>
<td>
<em>Name:</em>
</td>
<td>
<dfn id="animation-duration">animation-duration</dfn>
</td>
</tr>
<tr>
<td>
<em>Value:</em>
</td>
<td>
&lt;time&gt; [, &lt;time&gt;]*
</td>
</tr>
<tr>
<td>
<em>Initial:</em>
</td>
<td>
0
</td>
</tr>
<tr>
<td>
<em>Applies&nbsp;to:</em>
</td>
<td>
block-level and inline-level elements
</td>
</tr>
<tr>
<td>
<em>Inherited:</em>
</td>
<td>
no
</td>
</tr>
<tr>
<td>
<em>Percentages:</em>
</td>
<td>
N/A
</td>
</tr>
<tr>
<td>
<em>Media:</em>
</td>
<td>
visual
</td>
</tr>
<tr>
<td>
<em>Computed value:</em>
</td>
<td>
Same as specified value.
</td>
</tr>
</tbody>
</table>
<p>
By default the value is '0', meaning that the animation cycle is immediate (i.e. there will be no animation). A negative value for <span class="prop-name">animation-duration</span> is treated as '0'.
</p>
<!-- ======================================================================================================= -->
<h3 id="animation-timing-function_tag">
3.4 The <span class="prop-name">'animation-timing-function'</span> Property
</h3>
<p>
The <span class="prop-name">'animation-timing-function'</span> property describes how the animation will progress over one cycle of its duration. See <a href="CSSTransitions.html#transition-timing-function_tag">the <span class="prop-name">'transition-timing-function'</span> property</a> for a complete description of timing function calculation.
</p>
<table class="propdef">
<tbody>
<tr>
<td>
<em>Name:</em>
</td>
<td>
<dfn id="animation-timing-function">animation-timing-function</dfn>
</td>
</tr>
<tr>
<td>
<em>Value:</em>
</td>
<td>
ease | linear | ease-in | ease-out | ease-in-out | cubic-bezier(&lt;number&gt;, &lt;number&gt;, &lt;number&gt;, &lt;number&gt;) [, ease | linear | ease-in | ease-out | ease-in-out | cubic-bezier(&lt;number&gt;, &lt;number&gt;, &lt;number&gt;, &lt;number&gt;)]*
</td>
</tr>
<tr>
<td>
<em>Initial:</em>
</td>
<td>
ease
</td>
</tr>
<tr>
<td>
<em>Applies&nbsp;to:</em>
</td>
<td>
block-level and inline-level elements
</td>
</tr>
<tr>
<td>
<em>Inherited:</em>
</td>
<td>
no
</td>
</tr>
<tr>
<td>
<em>Percentages:</em>
</td>
<td>
N/A
</td>
</tr>
<tr>
<td>
<em>Media:</em>
</td>
<td>
visual
</td>
</tr>
<tr>
<td>
<em>Computed value:</em>
</td>