css-transitions/Overview.bs

Mon, 25 Jul 2016 10:23:20 +0900

author
Brian Birtles <birtles@gmail.com>
date
Mon, 25 Jul 2016 10:23:20 +0900
changeset 18065
bd1aa522f628
parent 17079
5dff007796f9
child 18066
1c5516e75938
permissions
-rw-r--r--

[css-transitions] Specify serialization for timing functions

See thread starting:
https://lists.w3.org/Archives/Public/www-style/2016Apr/0107.html

In particular, notice that Edge/Blink/Gecko all serialize 'steps(1)'
differently and at least Gecko and Blink differ with regards to how they
handle the optional 'end' / 'start' value.

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

mercurial