css3-animations/Overview.src.html

Tue, 10 Apr 2012 16:34:56 -0700

author
Sylvain Galineau <sylvaing@microsoft.com>
date
Tue, 10 Apr 2012 16:34:56 -0700
changeset 5444
e44608181b73
parent 5427
0da4dbf93293
child 5911
27544a0821fd
permissions
-rw-r--r--

Resolution for bug 14659 - animationiteration event and last iteration

     1 <!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN'
     2   'http://www.w3.org/TR/html4/strict.dtd'>
     4 <html lang="en">
     5 <head>
     6   <title>CSS Animations</title>
     7   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     8   <link rel="stylesheet" type="text/css" href="../default.css">
     9   <link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-ED.css">
    10 </head>
    12 <body>
    14 <div class="head">
    15 <!--logo-->
    17 <h1>CSS Animations</h1>
    19 <h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2>
    20 <dl>
    21   <dt>This version:
    22     <dd><a href="[VERSION]">http://dev.w3.org/csswg/css3-animations/</a>
    23     <!--http://www.w3.org/TR/[YEAR]/WD-[SHORTNAME]-[CDATE]/-->
    24   <dt>Latest version:
    25     <dd><a
    26       href="http://www.w3.org/TR/css3-animations/">[LATEST]</a>
    27   <dt>Editor's draft:
    28     <dd><a href="http://dev.w3.org/csswg/[SHORTNAME]/">http://dev.w3.org/csswg/[SHORTNAME]/</a>
    30   <dt>Previous version:
    31     <dd><a href="http://www.w3.org/TR/2012/WD-css3-animations-20120403/">
    32       http://www.w3.org/TR/2012/WD-css3-animations-20120403/</a>
    33   <dt id="editors-list">Editors:
    34     <dd><a href="mailto:dino@apple.com">Dean Jackson</a> (<a
    35       href="http://www.apple.com/">Apple Inc</a>)
    36     <dd><a href="mailto:hyatt@apple.com">David Hyatt</a> (<a
    37       href="http://www.apple.com/">Apple Inc</a>)
    38     <dd><a href="mailto:cmarrin@apple.com">Chris Marrin</a> (<a
    39       href="http://www.apple.com/">Apple Inc</a>)
    40     <dd><a href="mailto:sylvaing@microsoft.com">Sylvain Galineau</a>
    41       (<a class=org href="http://www.microsoft.com/">Microsoft</a>)
    42     <dd class=vcard><a class=fn href="http://dbaron.org/">L. David Baron</a>
    43       (<a class=org href="http://www.mozilla.org/">Mozilla</a>)
    45   <dt>Issues list:
    46     <dd><a href="https://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&amp;product=CSS&amp;component=Animations&amp;resolution=---&amp;cmdtype=doit">in Bugzilla</a>
    48   <dt>Discussion:</dt>
    49     <dd><a href="http://lists.w3.org/Archives/Public/www-style/">www-style@w3.org</a> with subject line &ldquo;<kbd>[[SHORTNAME]] <var>&hellip; message topic &hellip;</var></kbd>&rdquo;
    51   <dt>Test suite:
    52     <dd>none yet
    53 </dl>
    55 <!--copyright-->
    57 <hr title="Separator for header">
    58 </div>
    60 <h2 class="no-num no-toc" id="abstract">Abstract</h2>
    62 <p>This CSS module describes a way for authors to animate the values of CSS properties over time, using keyframes.
    63     The behavior of these keyframe animations can be controlled by specifying their duration, number of repeats,
    64     and repeating behavior.
    65 </p>
    67 <h2 class="no-num no-toc" id="status">Status of this document</h2>
    68 <!--status-->
    71 <h2 class="no-num no-toc" id="contents">Table of contents</h2>
    72 <!--toc-->
    75 <h2 id="introduction">Introduction</h2>
    77     <p><em>This section is not normative.</em>
    79     <p>
    80         CSS Transitions [[!CSS3-TRANSITIONS]] provide a way to interpolate CSS property values
    81         when they change as a result of underlying property changes. This provides an easy way to do simple animation,
    82         but the start and end states of the animation are controlled by the existing property values,
    83         and transitions provide little control to the author on how the animation progresses.
    84     </p>
    85     <p>
    86         This proposal introduces <em>defined animations</em>, in which the author can
    87         specify the changes in CSS properties over time as a set of keyframes. Animations are similar to transitions
    88         in that they change the presentational value of CSS properties over time.
    89         The principal difference is that while transitions trigger <i>implicitly</i> when property values change, animations
    90         are <i>explicitly</i> executed when the animation properties are applied. Because of this, animations require explicit 
    91         values for the properties being animated. These values are specified using animation keyframes, described below.
    92     </p>
    93     <p>
    94         Many aspects of the animation can be controlled, including how many times the animation iterates, whether or not 
    95         it alternates between the begin and end values, and whether or not the animation should be running or paused.
    96         An animation can also delay its start time.
    97     </p>
    99     <h2 id="animations">Animations</h2>
   101     <p>
   102       CSS Animations affect computed property values. During the execution of an animation, the
   103       computed value for a property is controlled by the animation. This overrides the value
   104       specified in the normal styling system.
   105     </p>
   107     <p>
   108       If at one point in time there are multiple animations specifying behavior  
   109       for the same property, the animation whose name occurs last in the value  
   110       of 'animation-name' will override the other animations at that point.
   111     </p>
   113     <p>
   114       An animation does not affect the computed value before the application of the animation,
   115       before the animation delay has expired, and after the end of the animation.
   116     </p>
   118     <div class="figure">
   119       <img src="sandwich.png" alt="">
   120     </div>
   121     <p class="caption">
   122       Computation of animated property values
   123     </p>
   125     <p>
   126       The diagram above shows how property values are computed. The intrinsic style is shown at the
   127       top of the diagram. The computed value is derived from intrinsic style at the times when an
   128       animation is not running and also when an animation is delayed (see below for specification of
   129       animation delay). During an animation, the computed style is derived from the animated value.
   130     </p>
   132     <p>
   133       The start time of an animation is the latter of two moments: the time at which the style is
   134       resolved that specifies the animation, or the time the document's load event is fired.
   135       Therefore, an animation specified in the document style sheet will begin at the document load.
   136       An animation specified on an element by modifying the style after the document has loaded will
   137       start when the style is resolved. That may be immediately in the case of a pseudo style rule
   138       such as hover, or may be when the scripting engine returns control to the browser (in the case
   139       of style applied by script).
   140     </p>
   142     <p>
   143       An animation applies to an element if the element has a value for
   144       <code class="property">'animation-name'</code> that references a valid
   145       keyframes rule. Once an animation has started it continues until it ends
   146       or the <code class="property">'animation-name'</code> is removed. The values
   147       used for the keyframes and animation properties are snapshotted at the
   148       time the animation starts. Changing them during the execution of the
   149       animation has no effect. Note also, that changing the value of 
   150       <code class="property">'animation-name'</code> does not necessarily
   151       restart an animation (e.g., if a list of animations are applied and
   152       one is removed from the list, only that animation will stop; The other
   153       animations will continue). In order to restart an animation, it must be
   154       removed then reapplied. 
   155     </p>
   157     <p>
   158       The end of the animation is defined by the combination of the
   159       <code class="property">'animation-duration'</code>,
   160       <code class="property">'animation-iteration-count'</code> and
   161       <code class="property">'animation-fill-mode'</code> properties.
   162     </p>
   164     <div class="example">
   165       <p style="display:none">
   166         Example(s):
   167       </p>
   168       <pre>
   169     div {
   170       animation-name: diagonal-slide;
   171       animation-duration: 5s;
   172       animation-iteration-count: 10;
   173     }
   175     @keyframes diagonal-slide {
   177       from {
   178         left: 0;
   179         top: 0;
   180       }
   182       to {
   183         left: 100px;
   184         top: 100px;
   185       }
   187     }
   189     </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).
   190     </div>
   192     <h2>Keyframes</h2>
   193       <p>
   194         Keyframes are used to specify the values for the animating properties at various points
   195         during the animation. The keyframes specify the behavior of one cycle of the animation;
   196         the animation may iterate one or more times.
   197       </p>
   198       <p>
   199         Keyframes are specified using a specialized CSS at-rule. A <code
   200         class="property">@keyframes</code> rule consists of the keyword
   201         "@keyframes", followed by an identifier giving a name for the animation
   202         (which will be referenced using <code class="property">'animation-name'</code>),
   203         followed by a set of style rules (delimited by curly braces).
   204       </p>
   205       <p>
   206         The <i>keyframe selector</i> for a keyframe style rule consists of a
   207         comma-separated list of percentage values or the keywords 'from' or
   208         'to'. The selector is used to specify the percentage along the duration
   209         of the animation that the keyframe represents. The
   210         keyframe itself is specified by the block of property values declared on
   211         the selector. The keyword 'from' is equivalent to the value 0%. The
   212         keyword 'to' is equivalent to the value 100%. Note that the percentage
   213         unit specifier must be used on percentage values. Therefore, "0" is an
   214         invalid keyframe selector.
   215       </p>
   216       <p>
   217         If a 0% or "from" keyframe is not specified, then the user agent
   218         constructs a 0% keyframe using the computed values of the properties
   219         being animated. If a 100% or "to" keyframe is not specified, then the user agent
   220         constructs a 100% keyframe using the computed values of the properties
   221         being animated.
   222       </p>
   223       <p>
   224         The <i>keyframe declaration</i> for a keyframe rule consists of
   225         properties and values. Properties that are unable to be
   226         animated are ignored in these rules, with the exception of <code
   227         class="property">'animation-timing-function'</code>, the behavior 
   228         of which is described below.
   229       </p>
   230       <p class="note">
   231           NOTE: describe what happens if a property is not present in all keyframes.
   232       </p>
   233       <p>
   234         The @keyframes rule that is used by an animation will be the last one encountered in sorted rules order
   235         that matches the name of the animation specified by the <code class="property">'animation-name'</code> property.
   236         <code class="css">@keyframes</code> rules do not cascade;
   237         therefore an animation will never derive keyframes from more than one <code class="css">@keyframes</code> rule.
   238       </p>
   239       <p>
   240         To determine the set of keyframes, all of the values in the selectors are sorted in increasing order by time.
   241         If there are any duplicates, then the last keyframe specified inside the <code class="css">@keyframes</code> rule
   242         will be used to provide the keyframe information for that time. There is no cascading within a
   243         <code class="css">@keyframes</code> rule if multiple keyframes specify the same keyframe selector values.
   244       </p>
   245       <p>
   246         If property is not specified for a keyframe, or is specified but invalid, the animation of that property proceeds
   247         as if that keyframe did not exist. Conceptually, it is as if a set of keyframes is constructed for each property
   248         that is present in any of the keyframes, and an animation is run independently for each property.
   249       </p>
   250       <div class="example">
   251         <p style="display:none">
   252           Example(s):
   253         </p>
   254         <pre>
   255   @keyframes wobble {
   256     0% {
   257       left: 100px;
   258     }
   260     40% {
   261       left: 150px;
   262     }
   264     60% {
   265       left: 75px;
   266     }
   268     100% {
   269       left: 100px;
   270     }
   271   }
   273   </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.
   274         <div class="figure">
   275           <img src="animation1.png" alt="">
   276         </div>
   277         <p class="caption">
   278           Animations states specified by keyframes
   279         </p>
   280       </div>
   282       <p>
   283         The following is the grammar for the keyframes rule.
   284       </p>
   286       <pre>
   288         keyframes_rule: KEYFRAMES_SYM S+ IDENT S* '{' S* keyframes_blocks '}' S*;
   290         keyframes_blocks: [ keyframe_selector '{' S* declaration? [ ';' S* declaration? ]* '}' S* ]* ;
   292         keyframe_selector: [ FROM_SYM | TO_SYM | PERCENTAGE ] S* [ ',' S* [ FROM_SYM | TO_SYM | PERCENTAGE ] S* ]*;
   294         @{K}{E}{Y}{F}{R}{A}{M}{E}{S}   {return KEYFRAMES_SYM;}
   295         {F}{R}{O}{M}                   {return FROM_SYM;}
   296         {T}{O}                         {return TO_SYM;}
   297       </pre>
   298       <!-- ======================================================================================================= -->
   299       <h3 id="timing-functions"><a id="timing-functions-for-keyframes-">
   300         Timing functions for keyframes
   301       </a></h3>
   302       <p>
   303         A keyframe style rule may also declare the timing function that is to be used as the animation moves to the next keyframe.
   304       </p>
   305       <div class="example">
   306         <p style="display:none">
   307           Example(s):
   308         </p>
   309         <pre>
   310   @keyframes bounce {
   312     from {
   313       top: 100px;
   314       animation-timing-function: ease-out;
   315     }
   317     25% {
   318       top: 50px;
   319       animation-timing-function: ease-in;
   320     }
   322     50% {
   323       top: 100px;
   324       animation-timing-function: ease-out;
   325     }
   327     75% {
   328       top: 75px;
   329       animation-timing-function: ease-in;
   330     }
   332     to {
   333       top: 100px;
   334     }
   336   }
   338   </pre>Five keyframes are specified for the animation named "bounce". Between the first and second keyframe (i.e., between 0% and 25%) an "ease-out" timing function is used. Between the second and third keyframe (i.e., 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. A timing function specified on the "to" or 100% keyframe is ignored
   339       </div>
   340       <p>
   341         See <a href="#animation-timing-function_tag">the <code class="property">'animation-timing-function'</code>
   342           property</a> for more information.
   343       </p><!-- ======================================================================================================= -->
   345       <!-- ======================================================================================================= -->
   346       <h3 id="animation-name-property"><a id="the-animation-name-property-">
   347         The <code class="property">'animation-name'</code> Property
   348       </a></h3>
   349       <p>
   350         The <code class="property">'animation-name'</code> property defines a
   351         list of animations that apply. Each name is used to select the keyframe at-rule
   352         that provides the property values for the animation. If the name does
   353         not match any keyframe at-rule, there are no properties to be animated
   354         and the animation will not execute. Furthermore, if the animation name
   355         is 'none' then there will be no animation. This can be used to override
   356         any animations coming from the cascade. If animations are attempting to
   357         modify the same property, then the animation closest to the end of the
   358         list of names wins.
   359       </p>
   360       <p id="list-matching">
   361         Each animation listed by name should have a corresponding value
   362         for the other animation properties listed below. In the case where the
   363         lists of values for the other animation properties do not have
   364         the same length, the length of the 'animation-name' list
   365         determines the number of items in each list examined when
   366         starting transitions.  The lists are matched up from the first
   367         value: excess values at the end are not used.  If one of the
   368         other properties doesn't have enough comma-separated values to
   369         match the number of values of 'animation-name', the UA must
   370         calculate its used value by repeating the list of values until
   371         there are enough.  This truncation or repetition does not affect
   372         the computed value.
   373         <span class="note">
   374           Note: This is analogous to the behavior of the 'background-*'
   375           properties, with 'background-image' analogous to
   376           'animation-name'.
   377         </span>
   378       </p>
   380       <table class="propdef">
   381         <tbody>
   382           <tr>
   383             <td>
   384               <em>Name:</em>
   385             </td>
   386             <td>
   387               <dfn id="animation-name">animation-name</dfn>
   388             </td>
   389           </tr>
   390           <tr>
   391             <td>
   392               <em>Value:</em>
   393             </td>
   394             <td>
   395               [ none | &lt;IDENT&gt; ] [, [ none | &lt;IDENT&gt; ] ]*
   396             </td>
   397           </tr>
   398           <tr>
   399             <td>
   400               <em>Initial:</em>
   401             </td>
   402             <td>
   403               none
   404             </td>
   405           </tr>
   406           <tr>
   407             <td>
   408               <em>Applies&nbsp;to:</em>
   409             </td>
   410             <td>
   411               all elements, :before and :after pseudo elements
   412             </td>
   413           </tr>
   414           <tr>
   415             <td>
   416               <em>Inherited:</em>
   417             </td>
   418             <td>
   419               no
   420             </td>
   421           </tr>
   422           <tr>
   423             <td>
   424               <em>Percentages:</em>
   425             </td>
   426             <td>
   427               N/A
   428             </td>
   429           </tr>
   430           <tr>
   431             <td>
   432               <em>Media:</em>
   433             </td>
   434             <td>
   435               visual
   436             </td>
   437           </tr>
   438           <tr>
   439             <td>
   440               <em>Computed value:</em>
   441             </td>
   442             <td>
   443               Same as specified value.
   444             </td>
   445           </tr>
   446         </tbody>
   447       </table>
   449       <!--
   450       <p>
   451         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 <code class="property">'opacity'</code> will add together and animations on <code class="property">'transform'</code> will have their transformation matrices multiplied.
   452       </p>
   453       <div class="example">
   454         <p style="display:none">
   455           Example(s):
   456         </p>
   457         <pre>
   458         @keyframes 'border-bloat' {
   459           from {
   460             border-width: 0;
   461           }
   462           to {
   463             border-width: 10px;
   464           }
   465         }
   467         @keyframes 'border-diet' {
   468           from {
   469             border-width: 4px;
   470           }
   471           to {
   472             border-width: 2px;
   473           }
   474         }
   476         div {
   477           animation-name: 'border-bloat', 'border-diet';
   478           animation-duration: 10s, 4s;
   479         }
   480       </pre>
   481       <p>
   482       The above example has two animations executing on the same property, <code class="property">'border-width'</code>. The animations are additive. That is, the 
   483       resulting value for the property will be the addition of the values from the
   484       two animations.
   485       </p>
   486       <p>
   487         At time '0s' the element's border will be 4px wide (0px from 'border-bloat' plus 4px from 'border-diet'). 
   488         At time '4s' the element's border will be 6px wide (4px from 'border-bloat' plus 2px from 'border-diet').
   489         At time '10s' the element's border will be 10px wide (10px from 'border-bloat' and no addition from
   490         'border-diet' as it is no longer executing).
   491       </p>
   492     </div>
   493   -->
   496       <!-- ======================================================================================================= -->
   497       <h3 id="animation-duration-property"><a id="the-animation-duration-property-">
   498         The <code class="property">'animation-duration'</code> Property
   499       </a></h3>
   500       <p>
   501         The <code class="property">'animation-duration'</code> property defines the length of time that an animation takes to complete one cycle.
   502       </p>
   503       <table class="propdef">
   504         <tbody>
   505           <tr>
   506             <td>
   507               <em>Name:</em>
   508             </td>
   509             <td>
   510               <dfn id="animation-duration">animation-duration</dfn>
   511             </td>
   512           </tr>
   513           <tr>
   514             <td>
   515               <em>Value:</em>
   516             </td>
   517             <td>
   518               &lt;time&gt; [, &lt;time&gt;]*
   519             </td>
   520           </tr>
   521           <tr>
   522             <td>
   523               <em>Initial:</em>
   524             </td>
   525             <td>
   526               0s
   527             </td>
   528           </tr>
   529           <tr>
   530             <td>
   531               <em>Applies&nbsp;to:</em>
   532             </td>
   533             <td>
   534               all elements, :before and :after pseudo elements
   535             </td>
   536           </tr>
   537           <tr>
   538             <td>
   539               <em>Inherited:</em>
   540             </td>
   541             <td>
   542               no
   543             </td>
   544           </tr>
   545           <tr>
   546             <td>
   547               <em>Percentages:</em>
   548             </td>
   549             <td>
   550               N/A
   551             </td>
   552           </tr>
   553           <tr>
   554             <td>
   555               <em>Media:</em>
   556             </td>
   557             <td>
   558               visual
   559             </td>
   560           </tr>
   561           <tr>
   562             <td>
   563               <em>Computed value:</em>
   564             </td>
   565             <td>
   566               Same as specified value.
   567             </td>
   568           </tr>
   569         </tbody>
   570       </table>
   572       <p>
   573         By default the value is '0s', meaning that the animation cycle is
   574         immediate. A negative value for <code
   575         class="property">'animation-duration'</code> is treated as '0s'. In this
   576         case <code class="property">'animation-fill-mode'</code> still applies,
   577         so an animation that fills backwards will show the value of the 0%
   578         keyframe during any delay period, and an animation that fill forwards
   579         will retain the value specified at the 100% keyframe, even if the
   580         animation was instantaneous. Also, animation events are still fired.
   581       </p>
   583       <!-- ======================================================================================================= -->
   584       <h3 id="animation-timing-function-property"><a id="animation-timing-function_tag">
   585         The <code class="property">'animation-timing-function'</code> Property
   586       </a></h3>
   587       <p>
   588         The <code class="property">'animation-timing-function'</code> property describes how the animation will progress over one cycle of its duration. See the <code class="property">'transition-timing-function'</code> property [[!CSS3-TRANSITIONS]] for a complete description of timing function calculation.
   589       </p>
   590       <table class="propdef">
   591         <tbody>
   592           <tr>
   593             <td>
   594               <em>Name:</em>
   595             </td>
   596             <td>
   597               <dfn id="animation-timing-function">animation-timing-function</dfn>
   598             </td>
   599           </tr>
   600           <tr>
   601             <td>
   602               <em>Value:</em>
   603             </td>
   604             <td>
   605               [ ease | linear | ease-in | ease-out | ease-in-out | step-start | step-end | steps(&lt;number&gt;[, [ start | end ] ]?) | cubic-bezier(&lt;number&gt;, &lt;number&gt;, &lt;number&gt;, &lt;number&gt;) ] [, [ ease | linear | ease-in | ease-out | ease-in-out | step-start | step-end | steps(&lt;number&gt;[, [ start | end ] ]?) | cubic-bezier(&lt;number&gt;, &lt;number&gt;, &lt;number&gt;, &lt;number&gt;)] ]*
   606             </td>
   607           </tr>
   608           <tr>
   609             <td>
   610               <em>Initial:</em>
   611             </td>
   612             <td>
   613               ease
   614             </td>
   615           </tr>
   616           <tr>
   617             <td>
   618               <em>Applies&nbsp;to:</em>
   619             </td>
   620             <td>
   621               all elements, :before and :after pseudo elements
   622             </td>
   623           </tr>
   624           <tr>
   625             <td>
   626               <em>Inherited:</em>
   627             </td>
   628             <td>
   629               no
   630             </td>
   631           </tr>
   632           <tr>
   633             <td>
   634               <em>Percentages:</em>
   635             </td>
   636             <td>
   637               N/A
   638             </td>
   639           </tr>
   640           <tr>
   641             <td>
   642               <em>Media:</em>
   643             </td>
   644             <td>
   645               visual
   646             </td>
   647           </tr>
   648           <tr>
   649             <td>
   650               <em>Computed value:</em>
   651             </td>
   652             <td>
   653               Same as specified value.
   654             </td>
   655           </tr>
   656         </tbody>
   657       </table>
   659       <p>
   660         For a keyframed animation, the <code class="property">'animation-timing-function'</code> applies
   661         between keyframes, not over the entire animation. For example, in the case of an ease-in-out timing function, an animation will ease in at the start of the keyframe and ease out at the end of the keyframe. A <code class="property">'animation-timing-function'</code> defined within a keyframe block applies to that keyframe, otherwise the timing function specified for the animation is used.
   662       </p>
   664       <!-- ======================================================================================================= -->
   665       <h3 id="animation-iteration-count-property"><a id="the-animation-iteration-count-property-">
   666         The <code class="property">'animation-iteration-count'</code> Property
   667       </a></h3>
   668       <p>
   669         The <code class="property">'animation-iteration-count'</code> property defines the number of times
   670         an animation cycle is played. The default value is one, meaning the animation will play from
   671         beginning to end once. A value of <code class="css">'infinite'</code> will cause the animation to
   672         repeat forever. Non-integer numbers will cause the animation to end part-way through a cycle.
   673         Negative values of <code class="property">'animation-iteration-count'</code> are invalid.
   674         This property is often used with an <code class="property">'animation-direction'</code> value of
   675         <code class="css">alternate</code>, which will cause the animation to play in reverse on alternate cycles.
   676       </p>
   677       <table class="propdef">
   678         <tbody>
   679           <tr>
   680             <td>
   681               <em>Name:</em>
   682             </td>
   683             <td>
   684               <dfn id="animation-iteration-count">animation-iteration-count</dfn>
   685             </td>
   686           </tr>
   687           <tr>
   688             <td>
   689               <em>Value:</em>
   690             </td>
   691             <td>
   692               [ infinite | &lt;number&gt; ] [, [ infinite | &lt;number&gt; ] ]*
   693             </td>
   694           </tr>
   695           <tr>
   696             <td>
   697               <em>Initial:</em>
   698             </td>
   699             <td>
   700               1
   701             </td>
   702           </tr>
   703           <tr>
   704             <td>
   705               <em>Applies&nbsp;to:</em>
   706             </td>
   707             <td>
   708               all elements, :before and :after pseudo elements
   709             </td>
   710           </tr>
   711           <tr>
   712             <td>
   713               <em>Inherited:</em>
   714             </td>
   715             <td>
   716               no
   717             </td>
   718           </tr>
   719           <tr>
   720             <td>
   721               <em>Percentages:</em>
   722             </td>
   723             <td>
   724               N/A
   725             </td>
   726           </tr>
   727           <tr>
   728             <td>
   729               <em>Media:</em>
   730             </td>
   731             <td>
   732               visual
   733             </td>
   734           </tr>
   735           <tr>
   736             <td>
   737               <em>Computed value:</em>
   738             </td>
   739             <td>
   740               Same as specified value.
   741             </td>
   742           </tr>
   743         </tbody>
   744       </table><!-- ======================================================================================================= -->
   745       <h3 id="animation-direction-property"><a id="the-animation-direction-property-">
   746         The <code class="property">'animation-direction'</code> Property
   747       </a></h3>
   748       <p>
   749         The <code class="property">'animation-direction'</code> property defines whether or not the animation should play in reverse on some or all cycles.  When an animation is played in reverse the timing functions are also reversed. For example, when played in reverse an ease-in animation would appear to be an ease-out animation.
   750       </p>
   751       <table class="propdef">
   752         <tbody>
   753           <tr>
   754             <td>
   755               <em>Name:</em>
   756             </td>
   757             <td>
   758               <dfn id="animation-direction">animation-direction</dfn>
   759             </td>
   760           </tr>
   761           <tr>
   762             <td>
   763               <em>Value:</em>
   764             </td>
   765             <td>
   766               [ normal | reverse | alternate | alternate-reverse ] [, [ normal | reverse | alternate | alternate-reverse ] ]*
   767             </td>
   768           </tr>
   769           <tr>
   770             <td>
   771               <em>Initial:</em>
   772             </td>
   773             <td>
   774               normal
   775             </td>
   776           </tr>
   777           <tr>
   778             <td>
   779               <em>Applies&nbsp;to:</em>
   780             </td>
   781             <td>
   782               all elements, :before and :after pseudo elements
   783             </td>
   784           </tr>
   785           <tr>
   786             <td>
   787               <em>Inherited:</em>
   788             </td>
   789             <td>
   790               no
   791             </td>
   792           </tr>
   793           <tr>
   794             <td>
   795               <em>Percentages:</em>
   796             </td>
   797             <td>
   798               N/A
   799             </td>
   800           </tr>
   801           <tr>
   802             <td>
   803               <em>Media:</em>
   804             </td>
   805             <td>
   806               visual
   807             </td>
   808           </tr>
   809           <tr>
   810             <td>
   811               <em>Computed value:</em>
   812             </td>
   813             <td>
   814               Same as specified value.
   815             </td>
   816           </tr>
   817         </tbody>
   818       </table>
   819       <dl>
   820         <dt>normal</dt>
   821           <dd>All iterations of the animation are played as specified.</dd>
   822         <dt>reverse</dt>
   823           <dd>All iterations of the animation are played in the reverse direction from the way they were specified.</dd>
   824         <dt>alternate</dt>
   825           <dd>The animation cycle iterations that are odd counts are played in the normal direction, and the animation cycle iterations that are even counts are played in a reverse direction.</dd>
   826         <dt>alternate-reverse</dt>
   827           <dd>The animation cycle iterations that are odd counts are played in the reverse direction, and the animation cycle iterations that are even counts are played in a normal direction.</dd>
   828       </dl>
   829       <!-- ======================================================================================================= -->
   830       <h3 id="animation-play-state-property"><span id="the-animation-play-state-property-">
   831         The <code class="property">'animation-play-state'</code> Property
   832       </a></h3>
   834       <p>
   835         The <code class="property">'animation-play-state'</code> property defines whether the animation is running or paused. A running animation can be paused by setting this property to <code class="css">'paused'</code>. To continue running a paused animation this property can be set to <code class="css">'running'</code>. A paused animation will continue to display the current value of the animation in a static state, as if the time of the animation is constant. When a paused animation is resumed, it restarts from the current value, not necessarily from the beginning of the animation.
   836       </p>
   837       <table class="propdef">
   838         <tbody>
   839           <tr>
   840             <td>
   841               <em>Name:</em>
   842             </td>
   843             <td>
   844               <dfn id="animation-play-state">animation-play-state</dfn>
   845             </td>
   846           </tr>
   847           <tr>
   848             <td>
   849               <em>Value:</em>
   850             </td>
   851             <td>
   852               [ running | paused ] [, [ running | paused ] ]*
   853             </td>
   854           </tr>
   855           <tr>
   856             <td>
   857               <em>Initial:</em>
   858             </td>
   859             <td>
   860               running
   861             </td>
   862           </tr>
   863           <tr>
   864             <td>
   865               <em>Applies&nbsp;to:</em>
   866             </td>
   867             <td>
   868               all elements, :before and :after pseudo elements
   869             </td>
   870           </tr>
   871           <tr>
   872             <td>
   873               <em>Inherited:</em>
   874             </td>
   875             <td>
   876               no
   877             </td>
   878           </tr>
   879           <tr>
   880             <td>
   881               <em>Percentages:</em>
   882             </td>
   883             <td>
   884               N/A
   885             </td>
   886           </tr>
   887           <tr>
   888             <td>
   889               <em>Media:</em>
   890             </td>
   891             <td>
   892               visual
   893             </td>
   894           </tr>
   895           <tr>
   896             <td>
   897               <em>Computed value:</em>
   898             </td>
   899             <td>
   900               Same as specified value.
   901             </td>
   902           </tr>
   903         </tbody>
   904       </table><!-- ======================================================================================================= -->
   905       <h3 id="animation-delay-property"><a id="the-animation-delay-property-">
   906         The <code class="property">'animation-delay'</code> Property
   907       </a></h3>
   908       <p>
   909         The <code class="property">'animation-delay'</code> property defines
   910         when the animation will start. It allows an animation to begin
   911         execution some time after it is applied. An <code
   912         class="property">'animation-delay'</code> value of '0s' means the
   913         animation will execute as soon as it is applied. Otherwise, the value
   914         specifies an offset from the moment the animation is applied, and the
   915         animation will delay execution by that offset.
   916       </p>
   917       <p>
   918         If the value for <code class="property">'animation-delay'</code> is a
   919         negative time offset then the animation will execute the moment it is
   920         applied, but will appear to have begun execution at the specified
   921         offset. That is, the animation will appear to begin part-way through
   922         its play cycle. In the case where an animation has implied starting
   923         values and a negative <code class="property">'animation-delay'</code>,
   924         the starting values are taken from the moment the animation is applied.
   925       </p>
   926       <table class="propdef">
   927         <tbody>
   928           <tr>
   929             <td>
   930               <em>Name:</em>
   931             </td>
   932             <td>
   933               <dfn id="animation-delay">animation-delay</dfn>
   934             </td>
   935           </tr>
   936           <tr>
   937             <td>
   938               <em>Value:</em>
   939             </td>
   940             <td>
   941               &lt;time&gt; [, &lt;time&gt;]*
   942             </td>
   943           </tr>
   944           <tr>
   945             <td>
   946               <em>Initial:</em>
   947             </td>
   948             <td>
   949               0s
   950             </td>
   951           </tr>
   952           <tr>
   953             <td>
   954               <em>Applies&nbsp;to:</em>
   955             </td>
   956             <td>
   957               all elements, :before and :after pseudo elements
   958             </td>
   959           </tr>
   960           <tr>
   961             <td>
   962               <em>Inherited:</em>
   963             </td>
   964             <td>
   965               no
   966             </td>
   967           </tr>
   968           <tr>
   969             <td>
   970               <em>Percentages:</em>
   971             </td>
   972             <td>
   973               N/A
   974             </td>
   975           </tr>
   976           <tr>
   977             <td>
   978               <em>Media:</em>
   979             </td>
   980             <td>
   981               visual
   982             </td>
   983           </tr>
   984           <tr>
   985             <td>
   986               <em>Computed value:</em>
   987             </td>
   988             <td>
   989               Same as specified value.
   990             </td>
   991           </tr>
   992         </tbody>
   993       </table><!-- ======================================================================================================= -->
   994       <h3 id="animation-fill-mode-property"><a id="the-animation-fill-mode-property-">
   995         The <code class="property">'animation-fill-mode'</code> Property
   996       </a></h3>
   997       <p>
   998         The <code class="property">'animation-fill-mode'</code> property defines
   999         what values are applied by the animation outside the time it is executing.
  1000         By default, an animation will not affect property values between the
  1001         time it is applied (the <code class="property">'animation-name'</code> property is
  1002         set on an element) and the time it begins execution (which is determined by
  1003         the <code class="property">'animation-delay'</code> property). Also, by
  1004         default an animation does not affect property values after the animation
  1005         ends (determined by the <code class="property">'animation-duration'</code> property).
  1006         The value of <code class="property">'animation-fill-mode'</code> can
  1007         override this behavior.
  1008       </p>
  1009       <p>
  1010         If the value for <code class="property">'animation-fill-mode'</code> is
  1011         <code class="css">'backwards'</code>, then the animation will
  1012         apply the property values defined in its 0% or 'from' keyframe as soon
  1013         as the animation is applied, during the period defined by
  1014         <code class="property">'animation-delay'</code>.
  1015       </p>
  1016       <p>
  1017         If the value for <code class="property">'animation-fill-mode'</code>
  1018         is <code class="css">'forwards'</code>, then the animation will
  1019         apply the property values defined in its last executing keyframe after
  1020         the final iteration of the animation, until the animation style is
  1021         removed. The last executing keyframe is the 'to' or '100%' keyframe,
  1022         unless the animation has <code
  1023         class="property">'animation-direction'</code> set to <code
  1024         class="css">'alternate'</code> and both a finite and even
  1025         iteration count, in which case it is the 'from' or '0%' keyframe.
  1026       </p>
  1027       <p>
  1028         If the value for <code class="property">'animation-fill-mode'</code>
  1029         is <code class="css">'both'</code>, then the animation will
  1030         follow the rules for both 'forwards' and 'backwards'. That is, it will
  1031         extend the animation properties in both directions.
  1032       </p>
  1033       <table class="propdef">
  1034         <tbody>
  1035           <tr>
  1036             <td>
  1037               <em>Name:</em>
  1038             </td>
  1039             <td>
  1040               <dfn id="animation-fill-mode">animation-fill-mode</dfn>
  1041             </td>
  1042           </tr>
  1043           <tr>
  1044             <td>
  1045               <em>Value:</em>
  1046             </td>
  1047             <td>
  1048               [ none | forwards | backwards | both ] [, [ none | forwards | backwards | both ] ]*
  1049             </td>
  1050           </tr>
  1051           <tr>
  1052             <td>
  1053               <em>Initial:</em>
  1054             </td>
  1055             <td>
  1056               none
  1057             </td>
  1058           </tr>
  1059           <tr>
  1060             <td>
  1061               <em>Applies&nbsp;to:</em>
  1062             </td>
  1063             <td>
  1064               all elements, :before and :after pseudo elements
  1065             </td>
  1066           </tr>
  1067           <tr>
  1068             <td>
  1069               <em>Inherited:</em>
  1070             </td>
  1071             <td>
  1072               no
  1073             </td>
  1074           </tr>
  1075           <tr>
  1076             <td>
  1077               <em>Percentages:</em>
  1078             </td>
  1079             <td>
  1080               N/A
  1081             </td>
  1082           </tr>
  1083           <tr>
  1084             <td>
  1085               <em>Media:</em>
  1086             </td>
  1087             <td>
  1088               visual
  1089             </td>
  1090           </tr>
  1091           <tr>
  1092             <td>
  1093               <em>Computed value:</em>
  1094             </td>
  1095             <td>
  1096               Same as specified value.
  1097             </td>
  1098           </tr>
  1099         </tbody>
  1100       </table><!-- ======================================================================================================= -->
  1101       <h3 id="animation-shorthand-property"><a id="the-animation-shorthand-property-">
  1102         The <code class="property">'animation'</code> Shorthand Property
  1103       </a></h3>
  1104       <p>
  1105         The <code class="property">'animation'</code> shorthand property
  1106         combines seven of the animation properties into a single property.
  1107       </p>
  1108       <p>
  1109         Note that order is important in this property. The first value that can be
  1110         parsed as a time is assigned to the animation-duration. The second value that
  1111         can be parsed as a time is assigned to animation-delay.
  1112       </p>
  1113       <p class="issue">
  1114         An alternative proposal is to accept the font shorthand approach of
  1115         using a "/" character between the values of the same type. e.g. 2s/4s would
  1116         mean a duration of 2 seconds and a delay of 4 seconds.
  1117       </p>
  1118       <table class="propdef">
  1119         <tbody>
  1120           <tr>
  1121             <td>
  1122               <em>Name:</em>
  1123             </td>
  1124             <td>
  1125               <dfn id="animation">animation</dfn>
  1126             </td>
  1127           </tr>
  1128           <tr>
  1129             <td>
  1130               <em>Value:</em>
  1131             </td>
  1132             <td>
  1133               [&lt;'animation-name'&gt; || 
  1134               &lt;'animation-duration'&gt; ||
  1135               &lt;'animation-timing-function'&gt; ||
  1136               &lt;'animation-delay'&gt; ||
  1137               &lt;'animation-iteration-count'&gt; ||
  1138               &lt;'animation-direction'&gt; ||
  1139               &lt;'animation-fill-mode'&gt;]
  1140               [, [&lt;'animation-name'&gt; ||
  1141               &lt;'animation-duration'&gt; ||
  1142               &lt;'animation-timing-function'&gt; ||
  1143               &lt;'animation-delay'&gt; ||
  1144               &lt;'animation-iteration-count'&gt; ||
  1145               &lt;'animation-direction'&gt; ||
  1146               &lt;'animation-fill-mode'&gt;] ]*
  1147             </td>
  1148           </tr>
  1149           <tr>
  1150             <td>
  1151               <em>Initial:</em>
  1152             </td>
  1153             <td>
  1154               see individual properties
  1155             </td>
  1156           </tr>
  1157           <tr>
  1158             <td>
  1159               <em>Applies&nbsp;to:</em>
  1160             </td>
  1161             <td>
  1162               all elements, :before and :after pseudo elements
  1163             </td>
  1164           </tr>
  1165           <tr>
  1166             <td>
  1167               <em>Inherited:</em>
  1168             </td>
  1169             <td>
  1170               no
  1171             </td>
  1172           </tr>
  1173           <tr>
  1174             <td>
  1175               <em>Percentages:</em>
  1176             </td>
  1177             <td>
  1178               N/A
  1179             </td>
  1180           </tr>
  1181           <tr>
  1182             <td>
  1183               <em>Media:</em>
  1184             </td>
  1185             <td>
  1186               visual
  1187             </td>
  1188           </tr>
  1189           <tr>
  1190             <td>
  1191               <em>Computed value:</em>
  1192             </td>
  1193             <td>
  1194               Same as specified value.
  1195             </td>
  1196           </tr>
  1197         </tbody>
  1198       </table><!-- ======================================================================================================= -->
  1199       <h2 id="animation-events"><a id="animation-events-">
  1200         Animation Events
  1201       </a></h2>
  1202       <p>
  1203         Several animation related events are available through the <a
  1204         href="http://www.w3.org/TR/DOM-Level-2-Events/events.html">DOM Event
  1205         system</a>. The start and end of an animation, and the end of each
  1206         iteration of an animation all generate DOM events. An element can have
  1207         multiple properties being animated simultaneously. This can occur either
  1208         with a single <code class="property">animation-name</code> value with
  1209         keyframes containing multiple properties, or with multiple <code
  1210         class="property">animation-name</code> values. For the purposes of
  1211         events, each <code class="property">animation-name</code> specifies a
  1212         single animation. Therefore an event will be generated for each <code
  1213         class="property">animation-name</code> value and not necessarily for
  1214         each property being animated.
  1215       </p>
  1216       <p>
  1217         The time the animation has been running is sent with each event
  1218         generated. This allows the event handler to determine the current
  1219         iteration of a looping animation or the current position of an
  1220         alternating animation. This time does not include any time the animation
  1221         was in the <code>paused</code> play state.
  1222       </p>
  1223       <dl>
  1224         <dt>
  1225           <b>Interface <i><a id="Events-AnimationEvent" name='Events-AnimationEvent'>AnimationEvent</a></i></b>
  1226         </dt>
  1227         <dd>
  1228           <p>
  1229             The <code>AnimationEvent</code> interface provides specific contextual information associated with Animation events.
  1230           </p>
  1231           <dl>
  1232             <dt>
  1233               <br>
  1234               <b>IDL Definition</b>
  1235             </dt>
  1236             <dd>
  1237               <div class='idl-code'>
  1238                 <pre>
  1239   interface AnimationEvent : Event {
  1240     readonly attribute DOMString          animationName;
  1241     readonly attribute float              elapsedTime;
  1242     void               initAnimationEvent(in DOMString typeArg, 
  1243                                           in boolean canBubbleArg, 
  1244                                           in boolean cancelableArg, 
  1245                                           in DOMString animationNameArg,
  1246                                           in float elapsedTimeArg);
  1247   };
  1248   </pre>
  1249               </div>
  1250             </dd>
  1251             <dt>
  1252               <b>Attributes</b>
  1253             </dt>
  1254             <dd>
  1255               <dl>
  1256                 <dt>
  1257                   <code class='attribute-name'><a id="Events-AnimationEvent-animationName" name='Events-AnimationEvent-animationName'>animationName</a></code> of type <code>DOMString</code>, readonly
  1258                 </dt>
  1259                 <dd>
  1260                   The value of the <code class="property">animation-name</code> property of the
  1261                   animation that fired the event.
  1262                 </dd>
  1263               </dl>
  1264               <dl>
  1265                 <dt>
  1266                   <code class='attribute-name'><a id="Events-AnimationEvent-elapsedTime" name='Events-AnimationEvent-elapsedTime'>elapsedTime</a></code> of type <code>float</code>, readonly
  1267                 </dt>
  1268                 <dd>
  1269                   The amount of time the animation has been running, in
  1270                   seconds, when this event fired, excluding any time the
  1271                   animation was paused. For an "animationstart" event, the
  1272                   elapsedTime is zero unless there was a negative value for
  1273                   <code class="property">animation-delay</code>, in which
  1274                   case the event will be fired with an elapsedTime of (-1 *
  1275                   delay).
  1276                 </dd>
  1277               </dl>
  1278             </dd>
  1279             <dt>
  1280               <b>Methods</b>
  1281             </dt>
  1282             <dd>
  1283               <dl>
  1284                 <dt>
  1285                   <code class='method-name'><a id="Events-AnimationEvent-initAnimationEvent" name='Events-AnimtionEvent-initAnimationEvent'>initAnimationEvent</a></code>
  1286                 </dt>
  1287                 <dd>
  1288                   <div class='method'>
  1289                     The <code>initAnimationEvent</code> method is used to initialize the value of an <code>AnimationEvent</code> created through the <a href='http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-DocumentEvent'><code>DocumentEvent</code></a> interface. This method may only be called before the <code>AnimationEvent</code> has been dispatched via the <code>dispatchEvent</code> method, though it may be called multiple times during that phase if necessary. If called multiple times, the final invocation takes precedence.
  1290                     <div class='parameters'>
  1291                       <b>Parameters</b>
  1292                       <div class='paramtable'>
  1293                         <dl>
  1294                           <dt>
  1295                             <code class='parameter-name'>typeArg</code> of type <code>DOMString</code>
  1296                           </dt>
  1297                           <dd>
  1298                             Specifies the event type.<br>
  1299                           </dd>
  1300                           <dt>
  1301                             <code class='parameter-name'>canBubbleArg</code> of type <code>boolean</code>
  1302                           </dt>
  1303                           <dd>
  1304                             Specifies whether or not the event can bubble.<br>
  1305                           </dd>
  1306                           <dt>
  1307                             <code class='parameter-name'>cancelableArg</code> of type <code>boolean</code>
  1308                           </dt>
  1309                           <dd>
  1310                             Specifies whether or not the event's default action can be prevented.
  1311                           </dd>
  1312                           <dt>
  1313                             <code class='parameter-name'>animationNameArg</code> of type <code>DOMString</code>
  1314                           </dt>
  1315                           <dd>
  1316                             Specifies the <a href='http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-Event'><code>Event</code></a>'s animation name.<br>
  1317                           </dd>
  1318                           <dt>
  1319                             <code class='parameter-name'>elapsedTimeArg</code> of type <code>float</code>
  1320                           </dt>
  1321                           <dd>
  1322                             Specifies the amount of time, in seconds, the animation has been running at the time of initialization.
  1323                           </dd>
  1324                         </dl>
  1325                       </div>
  1326                     </div><!-- parameters -->
  1327                     <div>
  1328                       <b>No Return Value</b>
  1329                     </div>
  1330                     <div>
  1331                       <b>No Exceptions</b>
  1332                     </div>
  1333                   </div><!-- method -->
  1334                 </dd>
  1335               </dl>
  1336             </dd>
  1337           </dl>
  1338         </dd>
  1339       </dl>
  1340       <p>
  1341         The different types of Animation events that can occur are:
  1342       </p>
  1343       <dl>
  1344         <dt>
  1345           <b>animationstart</b>
  1346         </dt>
  1347         <dd>
  1348           The 'animationstart' event occurs at the start of the animation. If there is an
  1349           <code class="property">animation-delay</code> then this event will fire once the delay period
  1350           has expired. A negative delay will cause the event to fire with an elapsedTime equal to
  1351           the absolute value of the delay.
  1352           <ul>
  1353             <li>Bubbles: Yes
  1354             </li>
  1355             <li>Cancelable: No
  1356             </li>
  1357             <li>Context Info: animationName
  1358             </li>
  1359           </ul>
  1360         </dd>
  1361         <dt>
  1362           <b>animationend</b>
  1363         </dt>
  1364         <dd>
  1365           The 'animationend' event occurs when the animation finishes.
  1366           <ul>
  1367             <li>Bubbles: Yes
  1368             </li>
  1369             <li>Cancelable: No
  1370             </li>
  1371             <li>Context Info: animationName, elapsedTime
  1372             </li>
  1373           </ul>
  1374         </dd>
  1375         <dt>
  1376           <b>animationiteration</b>
  1377         </dt>
  1378         <dd>
  1379           The 'animationiteration' event occurs at the end of each iteration of an animation, except when an 'animationend' event would fire at the same time.  
  1380           This means that this event does not occur for animations with an iteration count of one or less.
  1381           <ul>
  1382             <li>Bubbles: Yes
  1383             </li>
  1384             <li>Cancelable: No
  1385             </li>
  1386             <li>Context Info: animationName, elapsedTime
  1387             </li>
  1388           </ul>
  1389         </dd>
  1390       </dl>
  1391       <!-- ======================================================================================================= -->
  1392         <h2 id="dom-interfaces"><a id="dom-interfaces-">
  1393           DOM Interfaces
  1394         </a></h2>
  1395         <p>
  1396           CSS animation is exposed to the CSSOM through a pair of new interfaces
  1397           describing the keyframes.
  1398         </p>
  1399         <dl>
  1400           <dt>
  1401             <b>Interface <i><a id="DOM-CSSRule" name='DOM-CSSRule'>CSSRule</a></i></b>
  1402           </dt>
  1403           <dd>
  1404             <p>
  1405               The following 2 rule types are added to the <code>CSSRule</code> interface. They provide identification for the new keyframe and keyframes rules.
  1406             </p>
  1407             <dl>
  1409               <dt>
  1410                 <b>IDL Definition</b>
  1411               </dt>
  1412               <dd>
  1413                 <div class='idl-code'>
  1414                   <pre>
  1415     interface CSSRule {
  1416       ...
  1417       const unsigned short KEYFRAMES_RULE = 7;
  1418       const unsigned short KEYFRAME_RULE = 8;
  1419       ...
  1420     };</pre>
  1421                 </div>
  1422               </dd> <!-- IDL -->
  1423             </dl>
  1424           </dd>
  1426           <dt>
  1427             <b>Interface <i><a id="DOM-CSSKeyframeRule" name='DOM-CSSKeyframeRule'>CSSKeyframeRule</a></i></b>
  1428           </dt>
  1429           <dd>
  1430             <p>
  1431               The <code>CSSKeyframeRule</code> interface represents the style rule for a single key.
  1432             </p>
  1433             <dl>
  1434               <dt>
  1435                 <br>
  1436                 <b>IDL Definition</b>
  1437               </dt>
  1438               <dd>
  1439                 <div class='idl-code'>
  1440                   <pre>
  1441     interface CSSKeyframeRule : CSSRule {
  1442         attribute DOMString keyText;
  1443         readonly attribute CSSStyleDeclaration style;
  1444     };
  1445     </pre>
  1446                 </div><br>
  1447               </dd>
  1448               <dt>
  1449                 <b>Attributes</b>
  1450               </dt>
  1451               <dd>
  1452                 <dl>
  1453                   <dt>
  1454                     <code class='attribute-name'><a id="DOM-CSSKeyframeRule-keyText" name='DOM-CSSKeyframeRule-keyText'>keyText</a></code> of type <code>DOMString</code>
  1455                   </dt>
  1456                   <dd>
  1457                     This attribute represents the key as the string representation of a floating point number between 0 and 1. If the value 
  1458                     in the CSS style is <code>from</code> this value will be 0, and if the value in the CSS style is <code>to</code> this 
  1459                     value will be 1.<br>
  1460                   </dd>
  1461                 </dl>
  1462               </dd>
  1463               <dd>
  1464                 <dl>
  1465                   <dt>
  1466                     <code class='attribute-name'><a id="DOM-CSSKeyframeRule-style" name='DOM-CSSKeyframeRule-style'>style</a></code> of type <code>CSSStyleDeclaration</code>
  1467                   </dt>
  1468                   <dd>
  1469                     This attribute represents the style associated with this keyframe.<br>
  1470                   </dd>
  1471                 </dl>
  1472               </dd>
  1473               <dt>
  1474                 <b>No Methods</b>
  1475               </dt>
  1476             </dl>
  1477           </dd>
  1478         </dl>
  1479         <dl>
  1480           <dt>
  1481             <b>Interface <i><a id="DOM-CSSKeyframesRule" name='DOM-CSSKeyframesRule'>CSSKeyframesRule</a></i></b>
  1482           </dt>
  1483           <dd>
  1484             <p>
  1485               The <code>CSSKeyframesRule</code> interface represents a complete set of keyframes for a single animation.
  1486             </p>
  1487             <dl>
  1488               <dt>
  1489                 <br>
  1490                 <b>IDL Definition</b>
  1491               </dt>
  1492               <dd>
  1493                 <div class='idl-code'>
  1494                   <pre>
  1495     interface CSSKeyframesRule : CSSRule {
  1496         attribute          DOMString   name;
  1497         readonly attribute CSSRuleList cssRules;
  1499         void               appendRule(in DOMString rule);
  1500         void               deleteRule(in DOMString key);
  1501         CSSKeyframeRule    findRule(in DOMString key);
  1502     };
  1503     </pre>
  1504                 </div><br>
  1505               </dd>
  1506               <dt>
  1507                 <b>Attributes</b>
  1508               </dt>
  1509               <dd>
  1510                 <dl>
  1511                   <dt>
  1512                     <code class='attribute-name'><a id="DOM-CSSKeyframesRule-name" name='DOM-CSSKeyframesRule-name'>name</a></code> of type <code>DOMString</code>
  1513                   </dt>
  1514                   <dd>
  1515                     This attribute is the name of the keyframes, used by the <code>animation-name</code> property.<br>
  1516                   </dd>
  1517                 </dl>
  1518               </dd>
  1519               <dd>
  1520                 <dl>
  1521                   <dt>
  1522                     <code class='attribute-name'><a id="DOM-CSSKeyframeRules-cssRules" name='DOM-CSSKeyframeRules-cssRules'>cssRules</a></code> of type <code>CSSRuleList</code>
  1523                   </dt>
  1524                   <dd>
  1525                     This attribute gives access to the keyframes in the list.<br>
  1526                   </dd>
  1527                 </dl>
  1528               </dd>
  1529               <dt>
  1530                 <b>Methods</b>
  1531               </dt>
  1532               <dd>
  1533                 <dl>
  1534                   <!-- ======================================================================================================= -->
  1535                   <dt>
  1536                     <code class='method-name'><a id="DOM-CSSKeyframesRule-appendRule" name='DOM-CSSKeyframesRule-appendRule'>appendRule</a></code>
  1537                   </dt>
  1538                   <dd>
  1539                     <div class='method'>
  1540                       The <code>appendRule</code> method appends the passed CSSKeyframeRule into the list at the passed key.
  1541                       <div class='parameters'>
  1542                         <b>Parameters</b>
  1543                         <div class='paramtable'>
  1544                           <dl>
  1545                              <dt>
  1546                               <code class='parameter-name'>rule</code> of type <code>DOMString</code>
  1547                             </dt>
  1548                             <dd>
  1549                               The rule to be appended, expressed in the same syntax as one entry in the
  1550                               <code>@keyframes</code> rule.
  1551                             </dd>
  1552                           </dl>
  1553                         </div>
  1554                       </div><!-- parameters -->
  1555                       <div class='return-value'>
  1556                         <b>No Return Value</b>
  1557                       </div>
  1558                       <div>
  1559                         <b>No Exceptions</b>
  1560                       </div>
  1561                     </div><!-- ======================================================================================================= -->
  1562                   </dd>
  1563                   <dt>
  1564                     <code class='method-name'><a id="DOM-CSSKeyframesRule-deleteRule" name='DOM-CSSKeyframesRule-deleteRule'>deleteRule</a></code>
  1565                   </dt>
  1566                   <dd>
  1567                     <div class='method'>
  1568                       The <code>deleteRule</code> method deletes the CSSKeyframeRule with the passed key. If a rule with this key
  1569                       does not exist, the method does nothing.
  1570                       <div class='parameters'>
  1571                         <b>Parameters</b>
  1572                         <div class='paramtable'>
  1573                           <dl>
  1574                             <dt>
  1575                               <code class='parameter-name'>key</code> of type <code>DOMString</code>
  1576                             </dt>
  1577                             <dd>
  1578                               The key which describes the rule to be deleted. The key must
  1579                               resolve to a number between 0 and 1, or the rule is ignored.<br>
  1580                             </dd>
  1581                           </dl>
  1582                         </div>
  1583                       </div><!-- parameters -->
  1584                       <div class='return-value'>
  1585                         <b>No Return Value</b>
  1586                       </div>
  1587                       <div>
  1588                         <b>No Exceptions</b>
  1589                       </div>
  1590                     </div><!-- ======================================================================================================= -->
  1591                   </dd>
  1592                   <dt>
  1593                     <code class='method-name'><a id="DOM-CSSKeyframesRule-findRule" name='DOM-CSSKeyframesRule-findRule'>findRule</a></code>
  1594                   </dt>
  1595                   <dd>
  1596                     <div class='method'>
  1597                       The <code>findRule</code> method returns the rule with a key matching the passed key. If no such rule
  1598                       exists, a null value is returned.
  1599                       <div class='parameters'>
  1600                         <b>Parameters</b>
  1601                         <div class='paramtable'>
  1602                           <dl>
  1603                             <dt>
  1604                               <code class='parameter-name'>key</code> of type <code>DOMString</code>
  1605                             </dt>
  1606                             <dd>
  1607                               The key which described the rule to find. The key must
  1608                               resolve to a number between 0 and 1, or the rule is ignored.<br>
  1609                             </dd>
  1610                           </dl>
  1611                         </div>
  1612                       </div><!-- parameters -->
  1613                       <div class='return-value'>
  1614                         <b>Return Value</b>
  1615                         <div class='returnvalue'>
  1616                           <dl>
  1617                             <dt>
  1618                               <code>CSSKeyframeRule</code>
  1619                             </dt>
  1620                             <dd>
  1621                               The found rule.<br>
  1622                             </dd>
  1623                           </dl>
  1624                         </div>
  1625                       </div>
  1626                       <div>
  1627                         <b>No Exceptions</b>
  1628                       </div>
  1629                     </div><!-- ======================================================================================================= -->
  1630                   </dd>
  1631                 </dl><!-- method -->
  1632               </dd>
  1633             </dl>
  1634           </dd>
  1635         </dl>
  1637 <h2 id="acknowledgments">Acknowledgments</h2>
  1639 <p>Thanks especially to the feedback from
  1640 Tab Atkins,
  1641 Estelle Weyl,
  1642 and all the rest of the
  1643 <a href="http://lists.w3.org/Archives/Public/www-style/">www-style</a> community.</p>
  1645 <h2>References</h2>
  1647 <h3 class="no-num">Normative references</h3>
  1648 <!--normative-->
  1650 <h3 class="no-num">Other references</h3>
  1651 <!--informative-->
  1655 <h2 class="no-num">Property index</h2>
  1656 <!-- properties -->
  1660 <h2 class="no-num" id="index">Index</h2>
  1661 <!--index-->
  1663 </body>
  1664 </html>
  1665 <!-- Keep this comment at the end of the file
  1666 Local variables:
  1667 mode: sgml
  1668 sgml-default-doctype-name:"html"
  1669 sgml-minimize-attributes:t
  1670 End:
  1671 -->

mercurial