css-transitions/Overview.bs

Fri, 23 Dec 2016 14:12:12 -0800

author
L. David Baron <dbaron@dbaron.org>
date
Fri, 23 Dec 2016 14:12:12 -0800
changeset 18576
b63d15c1c8f2
parent 18371
33e8db41720d
child 18691
61a574d3c7e5
permissions
-rw-r--r--

[css-transitions] Fix ambiguous reference for 'background-image', and link to latest css2 rather than css21.

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

mercurial