css-transitions/Overview.bs

Fri, 21 Apr 2017 14:42:38 +0900

author
Simon Sapin <simon.sapin@exyr.org>
date
Fri, 21 Apr 2017 14:42:38 +0900
changeset 19183
12cf31ee527b
parent 18890
b8bb70aa7e3a
child 19383
68f652c3f1eb
permissions
-rw-r--r--

[all] Replace most occurrences DOMString with CSSOMString.

CSSWG resolution:
https://github.com/w3c/csswg-drafts/issues/1217#issuecomment-295053842

Fix #1217.

Each occurrence is one of:

* CSS syntax
* A name (for example a property name) that also occurs in CSS syntax
* `Stylesheet::type`, which is always `text/css`.

Not replaced:

* `Stylesheet::title`, which is set from the eponymous HTML content attribute
of [`<style>`](https://html.spec.whatwg.org/multipage/semantics.html#attr-style-title)
and [`<link>`](https://html.spec.whatwg.org/multipage/semantics.html#attr-link-title)
elements.
These contant attributes are reflected as `HTMLElement::title` DOM attributes,
where they are `DOMString`.

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

mercurial