css3-transitions/Overview.src.html

Thu, 29 Mar 2012 11:56:13 -0700

author
L. David Baron <dbaron@dbaron.org>
date
Thu, 29 Mar 2012 11:56:13 -0700
changeset 5312
f2453d922d28
parent 5303
083f80ca0535
child 5316
cd3920d7b157
permissions
-rw-r--r--

Even more pairs of [] are needed for the grammar to be correct.

Thanks to Tab for pointing this out in
http://lists.w3.org/Archives/Public/www-style/2012Mar/0679.html .

dino@936 1 <!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN'
dino@936 2 'http://www.w3.org/TR/html4/strict.dtd'>
dino@936 3
dino@936 4 <html lang="en">
dino@936 5 <head>
simon@2533 6 <title>CSS Transitions</title>
fantasai@4174 7 <link rel="stylesheet" type="text/css" href="../default.css">
dino@936 8 <style type="text/css">
simon@4394 9 table.animatable-properties {
dino@936 10 border-collapse: collapse;
dino@936 11 }
simon@4394 12 table.animatable-properties td {
dino@936 13 padding: 0.2em 1em;
dino@936 14 border: 1px solid black;
dino@936 15 }
dino@936 16 </style>
simon@4394 17 <link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-ED.css">
dino@936 18 </head>
dino@936 19
dino@936 20 <body>
dino@936 21
dino@936 22 <div class="head">
dino@936 23 <!--logo-->
dino@936 24
simon@2533 25 <h1>CSS Transitions</h1>
dino@936 26
dino@936 27 <h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2>
dino@936 28 <dl>
dino@936 29 <dt>This version:
dino@936 30 <dd>
bert@1102 31 <a href="[VERSION]">
bert@1102 32 http://dev.w3.org/csswg/css3-transitions/</a>
bert@1102 33 <!--http://www.w3.org/TR/[YEAR]/WD-[SHORTNAME]-[CDATE]-->
dino@936 34 <dt>Latest version:
bert@1102 35 <dd><a href="http://www.w3.org/TR/css3-transitions">
bert@1102 36 [LATEST]</a>
dbaron@4580 37 <dt>Editor's draft:
dbaron@4580 38 <dd><a href="http://dev.w3.org/csswg/[SHORTNAME]/">http://dev.w3.org/csswg/[SHORTNAME]/</a>
bert@1102 39 <dt>Previous version:
dbaron@5227 40 <dd><a href="http://www.w3.org/TR/2009/WD-css3-transitions-20091201/">
dbaron@5227 41 http://www.w3.org/TR/2009/WD-css3-transitions-20091201/</a>
dino@936 42 <dt id="editors-list">Editors:
dino@936 43 <dd><a href="mailto:dino@apple.com">Dean Jackson</a> (<a
dino@936 44 href="http://www.apple.com/">Apple Inc</a>)
dino@936 45 <dd><a href="mailto:hyatt@apple.com">David Hyatt</a> (<a
dino@936 46 href="http://www.apple.com/">Apple Inc</a>)
dino@936 47 <dd><a href="mailto:cmarrin@apple.com">Chris Marrin</a> (<a
dino@936 48 href="http://www.apple.com/">Apple Inc</a>)
dbaron@4580 49 <dd class=vcard><a class=fn href="http://dbaron.org/">L. David Baron</a> (<a
dbaron@4580 50 class=org href="http://www.mozilla.com/">Mozilla</a>)
dbaron@4528 51
dbaron@4528 52 <dt>Issues list:
dbaron@4528 53 <dd><a href="https://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&amp;product=CSS&amp;component=Transitions&amp;resolution=---&amp;cmdtype=doit">in Bugzilla</a>
dbaron@4528 54
dbaron@5229 55 <dt>Discussion:</dt>
dbaron@5229 56 <dd><a href="http://lists.w3.org/Archives/Public/www-style/">www-style@w3.org</a> with subject line &ldquo;<kbd>[[SHORTNAME]] <var>&hellip; message topic &hellip;</var></kbd>&rdquo;
dbaron@5229 57
dbaron@4528 58 <dt>Test suite:
dbaron@4528 59 <dd>none yet
dino@936 60 </dl>
dino@936 61
dino@936 62 <!--copyright-->
dino@936 63
dino@936 64 <hr title="Separator for header">
dino@936 65 </div>
dino@936 66
dino@936 67 <h2 class="no-num no-toc" id="abstract">Abstract</h2>
dino@936 68
dino@936 69 <p>CSS Transitions allows property changes in CSS values to occur smoothly
dino@936 70 over a specified duration.
dino@936 71
dino@936 72 <h2 class="no-num no-toc" id="status">Status of this document</h2>
dino@936 73 <!--status-->
dino@936 74
dino@1531 75 <p>
dino@1531 76 The <a href="ChangeLog">list of changes made to this specification</a> is
dino@1531 77 available.
dino@1531 78 </p>
dino@936 79
dino@936 80 <h2 class="no-num no-toc" id="contents">Table of contents</h2>
dino@936 81 <!--toc-->
dino@936 82
dino@936 83
dino@936 84 <h2 id="introduction">Introduction</h2>
dino@936 85
simon@1766 86 <p><em>This section is not normative.</em>
dino@936 87 <p>
dino@936 88 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 89 </p>
simon@1766 90
simon@1766 91 <h2 id="transitions">Transitions</h2>
dino@936 92 <p>
dino@936 93 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 94 </p>
dino@936 95 <p>
simon@4370 96 For example, suppose that transitions of one second have been defined on the <code class="property">'left'</code> and
simon@4370 97 <code class="property">'background-color'</code> 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 98 </p>
dino@936 99 <div class="figure">
dino@936 100 <img src="transition1.png" alt="">
dino@936 101 </div>
dino@936 102 <p class="caption">
simon@4370 103 Transitions of <code class="property">'left'</code> and <code class="property">'background-color'</code>
dino@936 104 </p>
dino@936 105 <p>
dino@936 106 Transitions are a presentational effect. The computed value of a property transitions over time from the old value to the new value. Therefore if a script queries the computed style of a property as it is transitioning, it will see an intermediate value that represents the current animated value of the property.
dino@936 107 </p>
dino@936 108 <p>
dino@936 109 Only animatable CSS properties can be transitioned. See the table at the end of this document for a list
dino@936 110 of properties that are animatable.
dino@936 111 </p>
dino@936 112 <p>
dino@936 113 The transition for a property is defined using a number of new properties. For example:
dino@936 114 </p>
dino@936 115 <div class="example">
dino@936 116 <p style="display:none">
dino@936 117 Example(s):
dino@936 118 </p>
dino@936 119 <pre>
dino@936 120 div {
dino@936 121 transition-property: opacity;
dino@936 122 transition-duration: 2s;
dino@936 123 }
simon@4370 124 </pre>The above example defines a transition on the <code class="property">'opacity'</code> 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 125 </div>
dino@936 126 <p>
dino@936 127 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 128 </p>
dino@936 129 <div class="example">
dino@936 130 <p style="display:none">
dino@936 131 Example(s):
dino@936 132 </p>
dino@936 133 <pre>
dino@936 134 div {
dino@936 135 transition-property: opacity, left;
dino@936 136 transition-duration: 2s, 4s;
dino@936 137 }
dino@936 138
simon@4370 139 </pre>This will cause the <code class="property">'opacity'</code> property to transition over a period of two seconds and the left property to transition over a period of four seconds.
dino@1469 140 </div>
dbaron@5231 141
dbaron@5247 142 <p id="list-matching">
dbaron@5231 143 In the case where the lists of values in transition properties
dbaron@5231 144 do not have the same length, the length of the
dbaron@5231 145 'transition-property' list determines the number of items in
dbaron@5231 146 each list examined when starting transitions. The lists are
dbaron@5231 147 matched up from the first value: excess values at the end are
dbaron@5231 148 not used. If one of the other properties doesn't have enough
dbaron@5231 149 comma-separated values to match the number of values of
dbaron@5231 150 'transition-property', the UA must calculate its used value by
dbaron@5231 151 repeating the list of values until there are enough. This
dbaron@5231 152 truncation or repetition does not affect the computed value.
dbaron@5231 153 <span class="note">
dbaron@5231 154 Note: This is analogous to the behavior of the 'background-*'
dbaron@5231 155 properties, with 'background-image' analogous to
dbaron@5231 156 'transition-property'.
dbaron@5231 157 </span>
dbaron@1542 158 </p>
dbaron@5231 159
dino@1469 160 <div class="example">
dino@1469 161 <p style="display:none">
dino@1469 162 Example(s):
dino@1469 163 </p>
dino@1469 164 <pre>
dino@1469 165 div {
dino@1469 166 transition-property: opacity, left, top, width;
dino@1469 167 transition-duration: 2s, 1s;
dino@1469 168 }
simon@4370 169 </pre>The above example defines a transition on the <code class="property">'opacity'</code> property of 2 seconds duration, a
simon@4370 170 transition on the <code class="property">'left'</code> property of 1
simon@4370 171 second duration, a transition on the <code class="property">'top'</code> property of 2 seconds duration and a
simon@4370 172 transition on the <code class="property">'width'</code> property of 1
dino@1469 173 second duration.
dino@1469 174
dino@1469 175 </div>
dino@1469 176
dino@1469 177 <!-- ======================================================================================================= -->
dino@936 178 <h3>
simon@4370 179 The <code class="property">'transition-property'</code> Property
dino@936 180 </h3>
dino@936 181 <p>
simon@4370 182 The <code class="property">'transition-property'</code> property specifies the name of the CSS property to which the transition is applied.
dino@936 183 </p>
dino@936 184 <div class="issue">
dino@936 185 We may ultimately want to support a keypath syntax for this property. A keypath syntax would enable different transitions to be specified for components of a property. For example the blur of a shadow could have a different transition than the color of a shadow.
dino@936 186 </div>
dino@936 187 <table class="propdef">
dino@936 188 <tbody>
dino@936 189 <tr>
dino@936 190 <td>
dino@936 191 <em>Name:</em>
dino@936 192 </td>
dino@936 193 <td>
dino@936 194 <dfn id="transition-property">transition-property</dfn>
dino@936 195 </td>
dino@936 196 </tr>
dino@936 197 <tr>
dino@936 198 <td>
dino@936 199 <em>Value:</em>
dino@936 200 </td>
dino@936 201 <td>
dbaron@5298 202 none | [ all | &lt;IDENT&gt; ] [ ',' [ all | &lt;IDENT&gt; ] ]*
dino@936 203 </td>
dino@936 204 </tr>
dino@936 205 <tr>
dino@936 206 <td>
dino@936 207 <em>Initial:</em>
dino@936 208 </td>
dino@936 209 <td>
dino@936 210 all
dino@936 211 </td>
dino@936 212 </tr>
dino@936 213 <tr>
dino@936 214 <td>
dino@936 215 <em>Applies&nbsp;to:</em>
dino@936 216 </td>
dino@936 217 <td>
dino@1469 218 all elements, :before and :after pseudo elements
dino@936 219 </td>
dino@936 220 </tr>
dino@936 221 <tr>
dino@936 222 <td>
dino@936 223 <em>Inherited:</em>
dino@936 224 </td>
dino@936 225 <td>
dino@936 226 no
dino@936 227 </td>
dino@936 228 </tr>
dino@936 229 <tr>
dino@936 230 <td>
dino@936 231 <em>Percentages:</em>
dino@936 232 </td>
dino@936 233 <td>
dino@936 234 N/A
dino@936 235 </td>
dino@936 236 </tr>
dino@936 237 <tr>
dino@936 238 <td>
dino@936 239 <em>Media:</em>
dino@936 240 </td>
dino@936 241 <td>
dino@936 242 visual
dino@936 243 </td>
dino@936 244 </tr>
dino@936 245 <tr>
dino@936 246 <td>
dino@936 247 <em>Computed value:</em>
dino@936 248 </td>
dino@936 249 <td>
dino@936 250 Same as specified value.
dino@936 251 </td>
dino@936 252 </tr>
dino@936 253 </tbody>
dino@936 254 </table>
dino@936 255
dino@936 256 <p>
dbaron@4537 257 A value of 'none' means that no property will transition.
dbaron@4537 258 Otherwise, a list of properties to be transitioned, or the
dbaron@4537 259 keyword 'all' which indicates that all properties are to be
dbaron@4537 260 transitioned, is given.
dino@936 261 </p>
dino@936 262
dbaron@1543 263 <p>
dbaron@1543 264 If one of the identifiers listed is not a recognized property
dbaron@1543 265 name or is not an animatable property, the implementation must
dbaron@1543 266 still start transitions on the animatable properties in the
dbaron@1543 267 list using the duration, delay, and timing function at their
dbaron@1543 268 respective indices in the lists for 'transition-duration',
dbaron@1543 269 'transition-delay', and 'transition-timing-function'. In other
dbaron@1543 270 words, unrecognized or non-animatable properties must be kept in
dbaron@1543 271 the list to preserve the matching of indices.
dbaron@1543 272 </p>
dbaron@1543 273 <p class="issue">
dbaron@4537 274 Are 'none', 'inherit', and 'initial' allowed as items in
dbaron@1543 275 a list of identifiers (of length greater than one)?
dbaron@1543 276 </p>
dbaron@1543 277 <p>
dbaron@4537 278 For the keyword 'all', or if one of the identifiers listed is a
dbaron@4537 279 shorthand property, implementations must start transitions for
dbaron@4537 280 any of its longhand sub-properties that are animatable (or, for
dbaron@4537 281 'all', all animatable properties), using the duration, delay,
dbaron@1543 282 and timing function at the index corresponding to the shorthand.
dbaron@1543 283 </p>
dbaron@1543 284 <p>
dbaron@1543 285 If a property is specified multiple times in the value of
dbaron@4537 286 'transition-property' (either on its own, via a shorthand that
dbaron@4537 287 contains it, or via the 'all' value), then the transition that
dbaron@4537 288 starts uses the duration, delay, and timing function at the
dbaron@4537 289 index corresponding to the <em>last</em> item in the value of
dbaron@4543 290 'transition-property' that calls for animating that property.
dbaron@4537 291 </p>
dbaron@4537 292 <p class="note">
dbaron@4537 293 Note: The <code class="property">all</code> value and shorthand
dbaron@4537 294 properties work in similar ways, so the <code
dbaron@4537 295 class="property">all</code> value is just like a shorthand that
dbaron@4537 296 covers all properties.
dbaron@1543 297 </p>
dbaron@1543 298
dbaron@1543 299 <!-- ======================================================================================================= -->
dino@936 300 <h3>
simon@4370 301 The <code class="property">'transition-duration'</code> Property
dino@936 302 </h3>
dino@936 303 <p>
simon@4370 304 The <code class="property">'transition-duration'</code> property defines the length of time that a transition takes.
dino@936 305 </p>
dino@936 306 <table class="propdef">
dino@936 307 <tbody>
dino@936 308 <tr>
dino@936 309 <td>
dino@936 310 <em>Name:</em>
dino@936 311 </td>
dino@936 312 <td>
dino@936 313 <dfn id="transition-duration">transition-duration</dfn>
dino@936 314 </td>
dino@936 315 </tr>
dino@936 316 <tr>
dino@936 317 <td>
dino@936 318 <em>Value:</em>
dino@936 319 </td>
dino@936 320 <td>
dino@936 321 &lt;time&gt; [, &lt;time&gt;]*
dino@936 322 </td>
dino@936 323 </tr>
dino@936 324 <tr>
dino@936 325 <td>
dino@936 326 <em>Initial:</em>
dino@936 327 </td>
dino@936 328 <td>
dino@3189 329 0s
dino@936 330 </td>
dino@936 331 </tr>
dino@936 332 <tr>
dino@936 333 <td>
dino@936 334 <em>Applies&nbsp;to:</em>
dino@936 335 </td>
dino@936 336 <td>
dino@1469 337 all elements, :before and :after pseudo elements
dino@936 338 </td>
dino@936 339 </tr>
dino@936 340 <tr>
dino@936 341 <td>
dino@936 342 <em>Inherited:</em>
dino@936 343 </td>
dino@936 344 <td>
dino@936 345 no
dino@936 346 </td>
dino@936 347 </tr>
dino@936 348 <tr>
dino@936 349 <td>
dino@936 350 <em>Percentages:</em>
dino@936 351 </td>
dino@936 352 <td>
dino@936 353 N/A
dino@936 354 </td>
dino@936 355 </tr>
dino@936 356 <tr>
dino@936 357 <td>
dino@936 358 <em>Media:</em>
dino@936 359 </td>
dino@936 360 <td>
dino@1469 361 interactive
dino@936 362 </td>
dino@936 363 </tr>
dino@936 364 <tr>
dino@936 365 <td>
dino@936 366 <em>Computed value:</em>
dino@936 367 </td>
dino@936 368 <td>
dino@936 369 Same as specified value.
dino@936 370 </td>
dino@936 371 </tr>
dino@936 372 </tbody>
dino@936 373 </table>
dino@936 374 <p>
simon@4370 375 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 <code class="property">transition-duration</code> is treated as '0s'.
dino@936 376 </p>
dino@936 377
dino@936 378 <!-- =======================================================================================================
dino@936 379 -->
dino@936 380
dino@936 381 <h3 id="transition-timing-function_tag">
simon@4370 382 The <code class="property">'transition-timing-function'</code> Property
dino@936 383 </h3>
dino@936 384 <p>
simon@4370 385 The <code class="property">'transition-timing-function'</code> property
dino@936 386 describes how the intermediate values used during a transition will be
dino@936 387 calculated. It allows for a transition to change speed over its
dino@936 388 duration. These effects are commonly called <em>easing</em> functions.
dino@936 389 In either case, a mathematical function that provides a smooth curve is
dino@936 390 used.
dino@936 391 </p>
dino@936 392 <p>
dino@1907 393 Timing functions are either defined as a stepping function or
dino@1907 394 a <a
dino@936 395 href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B.C3.A9zier_curves">cubic
dbaron@4550 396 B&eacute;zier curve</a>.
dino@1907 397 The timing function takes as its input the current elapsed percentage of
dino@1907 398 the transition duration and outputs a percentage that determines how
dino@1907 399 close the transition is to its goal state.
dino@1907 400 </p>
dino@1907 401 <p>
dino@1907 402 A <a href="http://en.wikipedia.org/wiki/Step_function">stepping</a>
dino@1907 403 function is defined by a number that divides the domain of operation
dino@1907 404 into equally sized intervals. Each subsequent interval is a equal step
dino@1907 405 closer to the goal state. The function also specifies whether the
dino@1907 406 change in output percentage happens at the start or end of the
dino@1907 407 interval (in other words, if 0% on the input percentage is the point
dino@1907 408 of initial change).
dino@1907 409 </p>
dino@1907 410 <div class="figure">
dino@1907 411 <img src="step.png" alt="The step timing function splits
dino@1907 412 the function domain into a number of disjoint straight line
dino@1907 413 segments. steps(1, start) is a function whose
dino@1907 414 output value is 1 for all input values. steps(1, end) is a function whose
dino@1907 415 output value is 0 for all input values less than 1, and output
dino@1907 416 is 1 for the input value of 1. steps(3, start) is a function that
dino@1907 417 divides the input domain into three segments, each 1/3 in length,
dino@1907 418 and 1/3 above the previous segment, with the first segment starting
dino@1907 419 at 1/3. steps(3, end) is a function that
dino@1907 420 divides the input domain into three segments, each 1/3 in length,
dino@1907 421 and 1/3 above the previous segment, with the first segment starting
dino@1907 422 at 0.">
dino@1907 423 </div>
dino@1907 424 <p class="caption">
dino@1907 425 Step timing functions
dino@1907 426 </p>
dino@1907 427 <p>
dino@1907 428 A <a
dino@1907 429 href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B.C3.A9zier_curves">cubic
dbaron@4550 430 B&eacute;zier curve</a> is defined by four control points, P<sub>0</sub>
dino@936 431 through P<sub>3</sub> (see Figure 1). P<sub>0</sub> and P<sub>3</sub>
simon@4370 432 are always set to (0,0) and (1,1). The <code class="property">'transition-timing-function'</code> property is used
dino@936 433 to specify the values for points P<sub>1</sub> and P<sub>2</sub>. These
dino@936 434 can be set to preset values using the keywords listed below, or can be
simon@4370 435 set to specific values using the <code class="css">'cubic-bezier'</code> function.
simon@4370 436 In the <code class="css">'cubic-bezier'</code> function, P<sub>1</sub> and
dino@936 437 P<sub>2</sub> are each specified by both an X and Y value.
dino@936 438 </p>
dino@936 439 <div class="figure">
dbaron@4550 440 <img src="TimingFunction.png" alt="The B&eacute;zier timing function is a
dino@1907 441 smooth curve from point P0 = (0,0) to point P3 = (1,1). The
dino@1907 442 length and orientation of the line segment P0-P1 determines
dino@1907 443 the tangent and the curvature of the curve at P0 and the
dino@1907 444 line segment P2-P3 does the same at P3.">
dino@936 445 </div>
dino@936 446 <p class="caption">
dbaron@4550 447 B&eacute;zier Timing Function Control Points
dino@936 448 </p>
dino@936 449 <table class="propdef">
dino@936 450 <tbody>
dino@936 451 <tr>
dino@936 452 <td>
dino@936 453 <em>Name:</em>
dino@936 454 </td>
dino@936 455 <td>
dino@936 456 <dfn id="transition-timing-function">transition-timing-function</dfn>
dino@936 457 </td>
dino@936 458 </tr>
dino@936 459 <tr>
dino@936 460 <td>
dino@936 461 <em>Value:</em>
dino@936 462 </td>
dino@936 463 <td>
dbaron@5312 464 [ ease | linear | ease-in | ease-out | ease-in-out | step-start | step-end | steps(&lt;integer&gt;[, [ start | end ] ]?) | cubic-bezier(&lt;number&gt;, &lt;number&gt;, &lt;number&gt;, &lt;number&gt;) ] [, [ ease | linear | ease-in | ease-out | ease-in-out | step-start | step-end | steps(&lt;number&gt;[, [ start | end ] ]?) | cubic-bezier(&lt;number&gt;, &lt;number&gt;, &lt;number&gt;, &lt;number&gt;) ] ]*
dino@936 465 </td>
dino@936 466 </tr>
dino@936 467 <tr>
dino@936 468 <td>
dino@936 469 <em>Initial:</em>
dino@936 470 </td>
dino@936 471 <td>
dino@936 472 ease
dino@936 473 </td>
dino@936 474 </tr>
dino@936 475 <tr>
dino@936 476 <td>
dino@936 477 <em>Applies&nbsp;to:</em>
dino@936 478 </td>
dino@936 479 <td>
dino@1469 480 all elements, :before and :after pseudo elements
dino@936 481 </td>
dino@936 482 </tr>
dino@936 483 <tr>
dino@936 484 <td>
dino@936 485 <em>Inherited:</em>
dino@936 486 </td>
dino@936 487 <td>
dino@936 488 no
dino@936 489 </td>
dino@936 490 </tr>
dino@936 491 <tr>
dino@936 492 <td>
dino@936 493 <em>Percentages:</em>
dino@936 494 </td>
dino@936 495 <td>
dino@936 496 N/A
dino@936 497 </td>
dino@936 498 </tr>
dino@936 499 <tr>
dino@936 500 <td>
dino@936 501 <em>Media:</em>
dino@936 502 </td>
dino@936 503 <td>
dino@1469 504 interactive
dino@936 505 </td>
dino@936 506 </tr>
dino@936 507 <tr>
dino@936 508 <td>
dino@936 509 <em>Computed value:</em>
dino@936 510 </td>
dino@936 511 <td>
dino@936 512 Same as specified value.
dino@936 513 </td>
dino@936 514 </tr>
dino@936 515 </tbody>
dino@936 516 </table>
dino@936 517 <p>
dino@936 518 The timing functions have the following definitions.
dino@936 519 </p>
dino@936 520 <dl>
dino@936 521 <dt>
dino@936 522 ease
dino@936 523 </dt>
dino@936 524 <dd>
dino@936 525 The ease function is equivalent to cubic-bezier(0.25, 0.1, 0.25, 1.0).
dino@936 526 </dd>
dino@936 527 <dt>
dino@936 528 linear
dino@936 529 </dt>
dino@936 530 <dd>
dino@936 531 The linear function is equivalent to cubic-bezier(0.0, 0.0, 1.0, 1.0).
dino@936 532 </dd>
dino@936 533 <dt>
dino@936 534 ease-in
dino@936 535 </dt>
dino@936 536 <dd>
dino@936 537 The ease-in function is equivalent to cubic-bezier(0.42, 0, 1.0, 1.0).
dino@936 538 </dd>
dino@936 539 <dt>
dino@936 540 ease-out
dino@936 541 </dt>
dino@936 542 <dd>
dino@936 543 The ease-out function is equivalent to cubic-bezier(0, 0, 0.58, 1.0).
dino@936 544 </dd>
dino@936 545 <dt>
dino@936 546 ease-in-out
dino@936 547 </dt>
dino@936 548 <dd>
dino@936 549 The ease-in-out function is equivalent to cubic-bezier(0.42, 0, 0.58, 1.0)
dino@936 550 </dd>
dino@936 551 <dt>
dino@1907 552 step-start
dino@1907 553 </dt>
dino@1907 554 <dd>
dino@1907 555 The step-start function is equivalent to steps(1, start).
dino@1907 556 </dd>
dino@1907 557 <dt>
dino@1907 558 step-end
dino@1907 559 </dt>
dino@1907 560 <dd>
dino@1907 561 The step-end function is equivalent to steps(1, end).
dino@1907 562 </dd>
dino@1907 563 <dt>
dino@1907 564 steps
dino@1907 565 </dt>
dino@1907 566 <dd>
dino@1907 567 Specifies a stepping function, described above, taking two
dino@1907 568 parameters. The first parameter specifies the number of intervals
dino@2615 569 in the function. It must be a positive integer (greater than 0).
dino@2615 570 The second parameter, which is optional, is
dino@1907 571 either the value 'start' or 'end', and specifies the point
dino@1907 572 at which the change of values occur within the interval.
dino@1907 573 If the second parameter is omitted, it is given the value 'end'.
dino@1907 574 </dd>
dino@1907 575 <dt>
dino@936 576 cubic-bezier
dino@936 577 </dt>
dino@936 578 <dd>
dino@936 579 Specifies a <a
dino@936 580 href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve">cubic-bezier
dino@936 581 curve</a>. The four values specify points P<sub>1</sub> and
dino@2615 582 P<sub>2</sub> of the curve as (x1, y1, x2, y2). Both x values must be
dino@2615 583 in the range [0, 1] or the definition is invalid. The y values can
dino@2615 584 exceed this range.
dino@936 585 </dd>
dino@936 586 </dl><!-- ======================================================================================================= -->
dino@936 587 <h3>
simon@4370 588 The <code class="property">'transition-delay'</code> Property
dino@936 589 </h3>
dino@936 590 <p>
simon@4370 591 The <code class="property">'transition-delay'</code> 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 <code class="property">'transition-delay'</code> 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 592 </p>
dino@936 593 <p>
simon@4370 594 If the value for <code class="property">'transition-delay'</code> 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 <code class="property">'transition-delay'</code>, the starting values are taken from the moment the property is changed.
dino@936 595 </p>
dino@936 596 <table class="propdef">
dino@936 597 <tbody>
dino@936 598 <tr>
dino@936 599 <td>
dino@936 600 <em>Name:</em>
dino@936 601 </td>
dino@936 602 <td>
dino@936 603 <dfn id="transition-delay">transition-delay</dfn>
dino@936 604 </td>
dino@936 605 </tr>
dino@936 606 <tr>
dino@936 607 <td>
dino@936 608 <em>Value:</em>
dino@936 609 </td>
dino@936 610 <td>
dino@936 611 &lt;time&gt; [, &lt;time&gt;]*
dino@936 612 </td>
dino@936 613 </tr>
dino@936 614 <tr>
dino@936 615 <td>
dino@936 616 <em>Initial:</em>
dino@936 617 </td>
dino@936 618 <td>
dino@3189 619 0s
dino@936 620 </td>
dino@936 621 </tr>
dino@936 622 <tr>
dino@936 623 <td>
dino@936 624 <em>Applies&nbsp;to:</em>
dino@936 625 </td>
dino@936 626 <td>
dino@1469 627 all elements, :before and :after pseudo elements
dino@936 628 </td>
dino@936 629 </tr>
dino@936 630 <tr>
dino@936 631 <td>
dino@936 632 <em>Inherited:</em>
dino@936 633 </td>
dino@936 634 <td>
dino@936 635 no
dino@936 636 </td>
dino@936 637 </tr>
dino@936 638 <tr>
dino@936 639 <td>
dino@936 640 <em>Percentages:</em>
dino@936 641 </td>
dino@936 642 <td>
dino@936 643 N/A
dino@936 644 </td>
dino@936 645 </tr>
dino@936 646 <tr>
dino@936 647 <td>
dino@936 648 <em>Media:</em>
dino@936 649 </td>
dino@936 650 <td>
dino@1469 651 interactive
dino@936 652 </td>
dino@936 653 </tr>
dino@936 654 <tr>
dino@936 655 <td>
dino@936 656 <em>Computed value:</em>
dino@936 657 </td>
dino@936 658 <td>
dino@936 659 Same as specified value.
dino@936 660 </td>
dino@936 661 </tr>
dino@936 662 </tbody>
dino@936 663 </table><!-- ======================================================================================================= -->
dino@936 664 <h3>
simon@4370 665 The <code class="property">'transition'</code> Shorthand Property
dino@936 666 </h3>
dino@936 667 <p>
simon@4370 668 The <code class="property">'transition'</code> shorthand property combines the four properties described above into a single property.
dino@936 669 </p>
dino@1469 670 <p>
dino@1469 671 Note that order is important in this property. The first value that can be
dino@1469 672 parsed as a time is assigned to the transition-duration. The second value that
dino@1469 673 can be parsed as a time is assigned to transition-delay.
dino@1469 674 </p>
dino@1469 675 <p class="issue">
dino@1469 676 An alternative proposal is to accept the font shorthand approach of
dbaron@4550 677 using a "/" character between the values of the same type. e.g. 2s/4s would
dino@1469 678 mean a duration of 2 seconds and a delay of 4 seconds.
dino@1469 679 </p>
dino@936 680 <table class="propdef">
dino@936 681 <tbody>
dino@936 682 <tr>
dino@936 683 <td>
dino@936 684 <em>Name:</em>
dino@936 685 </td>
dino@936 686 <td>
dino@936 687 <dfn id="transition">transition</dfn>
dino@936 688 </td>
dino@936 689 </tr>
dino@936 690 <tr>
dino@936 691 <td>
dino@936 692 <em>Value:</em>
dino@936 693 </td>
dino@936 694 <td>
dino@1469 695 [&lt;'transition-property'&gt; || &lt;'transition-duration'&gt; || &lt;'transition-timing-function'&gt; || &lt;'transition-delay'&gt; [, [&lt;'transition-property'&gt; || &lt;'transition-duration'&gt; || &lt;'transition-timing-function'&gt; || &lt;'transition-delay'&gt;]]*
dino@936 696 </td>
dino@936 697 </tr>
dino@936 698 <tr>
dino@936 699 <td>
dino@936 700 <em>Initial:</em>
dino@936 701 </td>
dino@936 702 <td>
dino@936 703 see individual properties
dino@936 704 </td>
dino@936 705 </tr>
dino@936 706 <tr>
dino@936 707 <td>
dino@936 708 <em>Applies&nbsp;to:</em>
dino@936 709 </td>
dino@936 710 <td>
dino@1469 711 all elements, :before and :after pseudo elements
dino@936 712 </td>
dino@936 713 </tr>
dino@936 714 <tr>
dino@936 715 <td>
dino@936 716 <em>Inherited:</em>
dino@936 717 </td>
dino@936 718 <td>
dino@936 719 no
dino@936 720 </td>
dino@936 721 </tr>
dino@936 722 <tr>
dino@936 723 <td>
dino@936 724 <em>Percentages:</em>
dino@936 725 </td>
dino@936 726 <td>
dino@936 727 N/A
dino@936 728 </td>
dino@936 729 </tr>
dino@936 730 <tr>
dino@936 731 <td>
dino@936 732 <em>Media:</em>
dino@936 733 </td>
dino@936 734 <td>
dino@1469 735 interactive
dino@936 736 </td>
dino@936 737 </tr>
dino@936 738 <tr>
dino@936 739 <td>
dino@936 740 <em>Computed value:</em>
dino@936 741 </td>
dino@936 742 <td>
dino@936 743 Same as specified value.
dino@936 744 </td>
dino@936 745 </tr>
dino@936 746 </tbody>
dino@936 747 </table>
dino@1531 748
dbaron@1540 749 <h2 id="starting">
dbaron@1540 750 Starting of transitions
dbaron@1540 751 </h2>
dbaron@1540 752
dbaron@1540 753 <p>
dbaron@2569 754 When the computed value of an animatable property changes,
dbaron@1548 755 implementations must decide what transitions to start based on
dbaron@1548 756 the values of the 'transition-property', 'transition-duration',
dbaron@1548 757 'transition-timing-function', and 'transition-delay' properties
dbaron@2569 758 at the time the animatable property would first have its new
dbaron@2570 759 computed value.
dbaron@2570 760 </p>
dbaron@5243 761 <div class="example" id="manual-reversing-example">
dbaron@2570 762 <p style="display:none">
dbaron@2570 763 Example(s):
dbaron@2570 764 </p>
dbaron@5243 765 <p>This provides a way for authors to specify different values
dbaron@5243 766 of the 'transition-*' properties for the &ldquo;forward&rdquo;
dbaron@5243 767 and &ldquo;reverse&rdquo; transitions (but see <a
dbaron@5243 768 href="#reversing">below</a> for special reversing behavior when
dbaron@5243 769 an <em>incomplete</em> transition is interrupted). Authors can
dbaron@5243 770 specify the value of 'transition-duration',
dbaron@5243 771 'transition-timing-function', or 'transition-delay' in the same
dbaron@5243 772 rule where they specify the value that triggers the transition,
dbaron@5243 773 or can change these properties at the same time as they change
dbaron@5243 774 the property that triggers the transition. Since it's the new
dbaron@5243 775 values of these 'transition-*' properties that affect the
dbaron@5243 776 transition, these values will be used for the transitions
dbaron@5243 777 <em>to</em> the associated transitioning values. For example:
dbaron@5243 778 </p>
dbaron@5243 779 <pre>li {
dbaron@5243 780 transition: background-color linear 1s;
dbaron@5243 781 background: blue;
dbaron@5243 782 }
dbaron@5243 783 li:hover {
dbaron@5243 784 background-color: green;
dbaron@5243 785 transition-duration: 2s; /* applies to the transition *to* the :hover state */
dbaron@5243 786 }</pre>
dbaron@2570 787 <p>
dbaron@2570 788 When a list item with these style rules enters the :hover
dbaron@2570 789 state, the computed 'transition-duration' at the time that
dbaron@2570 790 'background-color' would have its new value ('green') is '2s',
dbaron@2570 791 so the transition from 'blue' to 'green' takes 2 seconds.
dbaron@2570 792 However, when the list item leaves the :hover state, the
dbaron@2570 793 transition from 'green' to 'blue' takes 1 second.
dbaron@2570 794 </p>
dbaron@2570 795 </div>
dbaron@5247 796
dbaron@5247 797 <p>
dbaron@5247 798 When the computed value of a property changes, implementations
dbaron@5247 799 must start transitions based on the relevant item (see <a
dbaron@5248 800 href="#transition-property">the definition of
dbaron@5247 801 'transition-property'</a>) in the computed value of
dbaron@5252 802 'transition-property'. Corresponding to this item there are
dbaron@5253 803 values of 'transition-duration' and 'transition-delay' (see <a
dbaron@5252 804 href="#list-matching">the rules on matching lists</a>). Define
dbaron@5252 805 the <dfn>combined duration</dfn> of the transition as the sum of
dbaron@5252 806 max('transition-duration', '0s') and 'transition-delay'. When
dbaron@5252 807 the combined duration is greater than '0s', then a transition
dbaron@5252 808 starts based on the values of 'transition-duration',
dbaron@5252 809 'transition-delay', and 'transition-timing-function'; in other
dbaron@5252 810 cases transitions do not occur.
dbaron@5247 811 </p>
dbaron@5247 812
dbaron@2570 813 <p>
dbaron@2570 814 Since this specification does not define
dbaron@2569 815 when computed values change, and thus what changes to
dbaron@2569 816 computed values are considered simultaneous,
dbaron@1548 817 authors should be aware that changing any of the transition
dbaron@1548 818 properties a small amount of time after making a change that
dbaron@1548 819 might transition can result in behavior that varies between
dbaron@1548 820 implementations, since the changes might be considered
dbaron@1548 821 simultaneous in some implementations but not others.
dbaron@1540 822 </p>
dbaron@4550 823 <p class="note">Say something about simultaneity</p>
dbaron@1540 824
dbaron@1540 825 <p>
dbaron@1548 826 Once the transition of a property has started, it must continue
dbaron@1548 827 running based on the original timing function, duration, and
dbaron@1548 828 delay, even if the 'transition-timing-function',
dbaron@1548 829 'transition-duration', or 'transition-delay' property changes
dbaron@1548 830 before the transition is complete. However, if the
dbaron@1548 831 'transition-property' property changes such that the transition
dbaron@1548 832 would not have started, the transition must stop (and the
dbaron@1548 833 property must immediately change to its final value).
dbaron@1540 834 </p>
dbaron@1540 835
dbaron@1540 836 <p>
dbaron@1548 837 Implementations must not start a transition when the computed
dbaron@1548 838 value of a property changes as a result of declarative animation
dbaron@1548 839 (as opposed to scripted animation).
dbaron@1540 840 </p>
dbaron@1540 841
dbaron@1540 842 <p>
dbaron@1548 843 Implementations also must not start a transition when the
dbaron@1548 844 computed value changes because it is inherited (directly or
dbaron@1548 845 indirectly) from another element that is transitioning the same
dbaron@1548 846 property.
dbaron@1540 847 </p>
dbaron@1540 848
dino@1531 849 <h2 id="reversing">
dbaron@5243 850 Automatically reversing interrupted transitions
dino@1531 851 </h2>
dino@1531 852 <p>
dino@1531 853 A common type of transition effect is when a running transition is
dino@1531 854 interrupted and the property is reset to its original value. An
dino@1531 855 example is a hover effect on an element, where the pointer enters and
dino@1531 856 exits the element before the effect has completed. If the outgoing and
dino@1531 857 incoming transitions are executed using their specified durations and
dino@1531 858 timing functions, the resulting effect can be distractingly
dino@1531 859 asymmetric. Instead, the expected behavior is that the new transition
dino@1531 860 should be the reverse of what has already executed.
dino@1531 861 </p>
dino@1532 862
dino@1531 863 <p>
dino@1532 864 If a running transition with duration T, executing so far for duration TE,
dino@1532 865 from state A, to state B, is interrupted by
dino@1532 866 a property change that would start a new transition back to state A, and
dino@1532 867 all the transition attributes are the same (duration, delay and timing function),
dino@1532 868 then the new transition must reverse the effect. The new transition must:
dino@1531 869 </p>
dino@1532 870
dino@1532 871 <ol>
dino@1532 872 <li>
dino@1532 873 Use the B and A states as its "from" and "to" states respectively. It
dino@1532 874 does not use the current value as its from state, due to the rules below.
dino@1532 875 </li>
dino@1532 876 <li>
dino@1532 877 Execute with the same duration T, but starting as if the transition had
dino@1532 878 already begun, without any transition delay, at the moment which would
dino@1532 879 cause the new transition to finish in TE from the moment of interruption. In other
dino@1532 880 words, the new transition will execute as if it started T-TE in the past.
dino@1532 881 </li>
dino@1532 882 <li>
dino@1532 883 Use a timing function that is the portion of the curve traversed up
dino@1532 884 to the moment of interruption, followed in the opposite direction (towards
dino@1532 885 the starting point). This will make the transition appear as if it
dino@1532 886 is playing backwards.
dino@1532 887 </li>
dino@1532 888 <li>
dino@1532 889 Ignore any transition delay.
dino@1532 890 </li>
dino@1532 891 </ol>
dino@1532 892
dino@1531 893 <p>
dino@1531 894 For example, suppose there is a transition with a duration of two
dino@1531 895 seconds. If this transition is interrupted after 0.5 seconds and the
dino@1531 896 property value assigned to the original value, then the new transition
dino@1531 897 effect will be the reverse of the original, as if it had begun
dino@1531 898 1.5 seconds in the past.
dino@1531 899 </p>
dino@936 900
dino@1532 901 <p>
dino@1532 902 Note that by using the defined from and to states for the reversing
dino@1532 903 transition, it is also possible that it may reverse again, if
dino@1532 904 interrupted; for example, if the transition reversing to state A was
dino@1532 905 again interrupted by a property change to state B.
dino@1532 906 </p>
dino@1532 907
dbaron@2568 908 <p class="issue">Issue:
dbaron@2568 909 This introduces the concept of reversing a timing function,
dbaron@2568 910 which the spec has otherwise resisted doing, and also introduces
dbaron@2568 911 a discontinuity between transitions that have
dbaron@2568 912 almost completed (which get automatically reversed and thus have
dbaron@2568 913 their timing function reversed) and transitions that have fully
dbaron@2568 914 completed (where the reversal doesn't lead to the timing
dbaron@2568 915 function being reversed). An alternative proposal that avoids
dbaron@2568 916 this is to follow the normal timing function algorithm, except
dbaron@2568 917 multiply the duration (and also shorten any negative delay) by
dbaron@2568 918 the (output) value of the transition timing function of the
dbaron@2568 919 incomplete transition at the time it was interrupted, and, to
dbaron@2568 920 account for multiple reverses in sequence, to divide by the
dbaron@2568 921 shortening applied to the transition being interrupted. For
dbaron@2568 922 more details see this thread:
dbaron@2568 923 <a href="http://lists.w3.org/Archives/Public/www-style/2009Nov/thread.html#msg302">November 2009 part</a>,
dbaron@2568 924 <a href="http://lists.w3.org/Archives/Public/www-style/2009Dec/thread.html#msg319">December 2009 part</a>,
dbaron@2568 925 <a href="http://lists.w3.org/Archives/Public/www-style/2010Jan/thread.html#msg136">January 2010 part</a>.
dbaron@2568 926 </p>
dbaron@2568 927
dino@936 928 <h2>
dino@936 929 Transition Events
dino@936 930 </h2>
dino@936 931 <p>
dino@936 932 The completion of a CSS Transition generates a corresponding <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html">DOM Event</a>.
dino@936 933 An event is fired for each property that undergoes a transition.
dino@936 934 This allows a content developer to perform actions that synchronize
dino@936 935 with the completion of a transition.
dino@936 936 </p>
dino@936 937 <p>
dino@936 938 Each event provides the name of the property the transition is
dino@936 939 associated with as well as the duration of the transition.
dino@936 940 </p>
dino@936 941 <dl>
dino@936 942 <dt>
dino@936 943 <b>Interface <i><a id="Events-TransitionEvent" name='Events-TransitionEvent'>TransitionEvent</a></i></b>
dino@936 944 </dt>
dino@936 945 <dd>
dino@936 946 <p>
dino@936 947 The <code>TransitionEvent</code> interface provides specific contextual information associated with transitions.
dino@936 948 </p>
dino@936 949 <dl>
dino@936 950 <dt>
dino@936 951 <b>IDL Definition</b>
dino@936 952 </dt>
dino@936 953 <dd>
dino@936 954 <div class='idl-code'>
dino@936 955 <pre>
dino@936 956 interface TransitionEvent : Event {
dino@936 957 readonly attribute DOMString propertyName;
dino@936 958 readonly attribute float elapsedTime;
dbaron@5259 959 readonly attribute DOMString pseudoElement;
dino@936 960 void initTransitionEvent(in DOMString typeArg,
dino@936 961 in boolean canBubbleArg,
dino@936 962 in boolean cancelableArg,
dino@936 963 in DOMString propertyNameArg,
dbaron@5259 964 in float elapsedTimeArg,
dbaron@5259 965 in DOMString pseudoElementArg);
dino@936 966 };
dino@936 967 </pre>
dino@936 968 </div>
dino@936 969 </dd>
dino@936 970 <dt>
dino@936 971 <b>Attributes</b>
dino@936 972 </dt>
dino@936 973 <dd>
dino@936 974 <dl>
dino@936 975 <dt>
dino@936 976 <code class='attribute-name'><a id="Events-TransitionEvent-propertyName" name='Events-TransitionEvent-propertyName'>propertyName</a></code> of type <code>DOMString</code>, readonly
dino@936 977 </dt>
dino@936 978 <dd>
dino@936 979 The name of the CSS property associated with the transition.
dino@936 980 </dd>
dino@936 981 </dl>
dino@936 982 <dl>
dino@936 983 <dt>
dino@936 984 <code class='attribute-name'><a id="Events-TransitionEvent-elapsedTime" name='Events-TransitionEvent-elapsedTime'>elapsedTime</a></code> of type <code>float</code>, readonly
dino@936 985 </dt>
dino@936 986 <dd>
simon@4370 987 The amount of time the transition has been running, in seconds, when this event fired. Note that this value is not affected by the value of <code class="property">transition-delay</code>.
dino@936 988 </dd>
dino@936 989 </dl>
dbaron@5259 990 <dl>
dbaron@5259 991 <dt>
dbaron@5259 992 <code class='attribute-name'><a id="Events-TransitionEvent-pseudoElement" name='Events-TransitionEvent-pseudoElement'>pseudoElement</a></code> of type <code>DOMString</code>, readonly
dbaron@5259 993 </dt>
dbaron@5259 994 <dd>
dbaron@5259 995 The name (beginning with two colons) of the CSS
dbaron@5259 996 pseudo-element on which the transition occured (in
dbaron@5259 997 which case the target of the event is that
dbaron@5259 998 pseudo-element's corresponding element), or the empty
dbaron@5259 999 string if the transition occurred on an element (which
dbaron@5259 1000 means the target of the event is that element).
dbaron@5259 1001 </dd>
dbaron@5259 1002 </dl>
dino@936 1003 </dd>
dino@936 1004 <dt>
dino@936 1005 <b>Methods</b>
dino@936 1006 </dt>
dino@936 1007 <dd>
dino@936 1008 <dl>
dino@936 1009 <dt>
dino@936 1010 <code class='method-name'><a id="Events-TransitionEvent-initTransitionEvent" name='Events-TransitionEvent-initTransitionEvent'>initTransitionEvent</a></code>
dino@936 1011 </dt>
dino@936 1012 <dd>
dino@936 1013 <div class='method'>
dino@1469 1014 The <code>initTransitionEvent</code> method is used to
dino@1469 1015 initialize the value of a <code>TransitionEvent</code>
dino@1469 1016 created through the <a
dino@1469 1017 href='http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-DocumentEvent'><code>DocumentEvent</code></a>
dino@1469 1018 interface. This method may only be called before the
dino@1469 1019 <code>TransitionEvent</code> has been dispatched via the
dino@1469 1020 <code>dispatchEvent</code> method, though it may be called
dino@1469 1021 multiple times during that phase if necessary. If called
dino@1469 1022 multiple times, the final invocation takes precedence.
dbaron@5287 1023 <p class="issue">Should new events being created still
dbaron@5287 1024 have init*Event methods?</p>
dino@936 1025 <div class='parameters'>
dino@936 1026 <b>Parameters</b>
dino@936 1027 <div class='paramtable'>
dino@936 1028 <dl>
dino@936 1029 <dt>
dino@936 1030 <code class='parameter-name'>typeArg</code> of type <code>DOMString</code>
dino@936 1031 </dt>
dino@936 1032 <dd>
dino@936 1033 Specifies the event type.<br>
dino@936 1034 </dd>
dino@936 1035 <dt>
dino@936 1036 <code class='parameter-name'>canBubbleArg</code> of type <code>boolean</code>
dino@936 1037 </dt>
dino@936 1038 <dd>
dino@936 1039 Specifies whether or not the event can bubble.<br>
dino@936 1040 </dd>
dino@936 1041 <dt>
dino@936 1042 <code class='parameter-name'>cancelableArg</code> of type <code>boolean</code>
dino@936 1043 </dt>
dino@936 1044 <dd>
dino@1469 1045 Specifies whether or not the event's default action can be prevented. Since a TransitionEvent
dino@1469 1046 is purely for notification, there is no default action.<br>
dino@936 1047 </dd>
dino@936 1048 <dt>
dino@936 1049 <code class='parameter-name'>propertyNameArg</code> of type <code>DOMString</code>
dino@936 1050 </dt>
dino@936 1051 <dd>
dbaron@5259 1052 Specifies the name of the property associated with the <a href='http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-Event'><code>Event</code></a>.
dbaron@5259 1053 (See the <a href="#Events-TransitionEvent-propertyName">propertyName</a> attribute.)
dino@936 1054 </dd>
dino@936 1055 <dt>
dino@936 1056 <code class='parameter-name'>elapsedTimeArg</code> of type <code>float</code>
dino@936 1057 </dt>
dino@936 1058 <dd>
dino@936 1059 Specifies the amount of time, in seconds, the transition has been running at the time of initialization.
dbaron@5259 1060 (See the <a href="#Events-TransitionEvent-elapsedTime">elapsedTime</a> attribute.)
dbaron@5259 1061 </dd>
dbaron@5259 1062 <dt>
dbaron@5259 1063 <code class='parameter-name'>pseudoElementArg</code> of type <code>DOMString</code>
dbaron@5259 1064 </dt>
dbaron@5259 1065 <dd>
dbaron@5259 1066 Specifies the pseudo-element on which the
dbaron@5259 1067 transition occurred.
dbaron@5259 1068 (See the <a href="#Events-TransitionEvent-pseudoElement">pseudoElement</a> attribute.)
dbaron@5259 1069 <span class="issue">Does adding this additional argument create any compatibility problems?</span>
dino@936 1070 </dd>
dino@936 1071 </dl>
dino@936 1072 </div>
dino@936 1073 </div><!-- parameters -->
dino@936 1074 <div>
dino@936 1075 <b>No Return Value</b>
dino@936 1076 </div>
dino@936 1077 <div>
dino@936 1078 <b>No Exceptions</b>
dino@936 1079 </div>
dino@936 1080 </div><!-- method -->
dino@936 1081 </dd>
dino@936 1082 </dl>
dino@936 1083 </dd>
dino@936 1084 </dl>
dino@936 1085 </dd>
dino@936 1086 </dl>
dino@936 1087 <p>
dino@936 1088 There is one type of transition event available.
dino@936 1089 </p>
dino@936 1090 <dl>
dino@936 1091 <dt>
dino@936 1092 <b>transitionend</b>
dino@936 1093 </dt>
dino@936 1094 <dd>
dino@1469 1095 The 'transitionend' event occurs at the completion of the transition. In the
dino@1469 1096 case where a transition is removed before completion, such as if the
dino@1469 1097 transition-property is removed, then the event will not fire.
dino@936 1098 <ul>
dino@936 1099 <li>Bubbles: Yes
dino@936 1100 </li>
dino@936 1101 <li>Cancelable: Yes
dino@936 1102 </li>
dino@1469 1103 <li>Context Info: propertyName, elapsedTime
dino@936 1104 </li>
dino@936 1105 </ul>
dino@936 1106 </dd>
dino@936 1107 </dl>
dino@936 1108
dbaron@4128 1109 <h2 id="animation-of-property-types-">
dino@936 1110 Animation of property types
dino@936 1111 </h2>
dino@936 1112
dino@936 1113 <p>
dino@936 1114 The following describes how each property type undergoes transition or
dino@936 1115 animation.
dino@936 1116 </p>
dino@936 1117
dino@936 1118 <ul>
dino@936 1119 <li>
dino@936 1120 <strong>color</strong>: interpolated via red, green, blue and alpha
dino@936 1121 components (treating each as a number, see below).
dino@3189 1122 <div class="issue">Issue: Are the colors interpolated in
dbaron@1541 1123 premultiplied space or non-premultiplied space?</div>
dino@936 1124 </li>
dino@936 1125 <li>
dino@936 1126 <strong>length</strong>: interpolated as real numbers.
dino@936 1127 </li>
dino@936 1128 <li>
dino@936 1129 <strong>percentage</strong>: interpolated as real numbers.
dino@936 1130 </li>
dino@936 1131 <li>
dino@936 1132 <strong>integer</strong>: interpolated via discrete steps (whole
dino@936 1133 numbers). The interpolation happens in real number space and is
dino@936 1134 converted to an integer using <code>floor()</code>.
dbaron@5286 1135 <span class="issue">
dbaron@5286 1136 This floor behavior is inconsistent with SMIL Animation /
dbaron@5286 1137 SVG Animation.
dbaron@5286 1138 </span>
dino@936 1139 </li>
dino@936 1140 <li>
dbaron@5257 1141 <strong>font weight</strong>: interpolated via discrete steps
dbaron@5257 1142 (multiples of 100). The interpolation happens in real number
dbaron@5286 1143 space and is converted to an integer by rounding to the
dbaron@5286 1144 nearest multiple of 100.
dbaron@5286 1145 <span class="issue">
dbaron@5286 1146 This round-to-nearest behavior is inconsistent with the
dbaron@5286 1147 floor behavior used for integer types, but probably should
dbaron@5286 1148 be consistent (one way or the other).
dbaron@5286 1149 </span>
dbaron@5257 1150 </li>
dbaron@5257 1151 <li>
dino@936 1152 <strong>number</strong>: interpolated as real (floating point)
dino@936 1153 numbers.
dino@936 1154 </li>
dino@936 1155 <li>
bert@1102 1156 <strong>transform list</strong>: see
dbaron@5220 1157 CSS Transforms specification [[!CSS3-TRANSFORMS]].
dino@936 1158 </li>
dino@936 1159 <li>
dino@936 1160 <strong>rectangle</strong>: interpolated via the x, y,
dino@936 1161 width and height components (treating each as a number).
dino@936 1162 </li>
dino@936 1163 <li>
dbaron@5258 1164 <strong>visibility</strong>: if one of the values is
dbaron@5258 1165 'visible', interpolated as a discrete step where values of the
dbaron@5258 1166 timing function between 0 and 1 map to 'visible' and other
dbaron@5258 1167 values of the timing function (which occur only at the
dbaron@5258 1168 start/end of the transition or as a result of 'cubic-bezier()'
dbaron@5258 1169 functions with Y values outside of [0, 1]) map to the closer
dbaron@5258 1170 endpoint; if neither value is 'visible' then not interpolable.
dbaron@5258 1171 </span>
dino@936 1172 </li>
dino@936 1173 <li>
dino@936 1174 <strong>shadow</strong>: interpolated via the color, x, y
dino@936 1175 and blur components (treating them as color and numbers where
dbaron@1539 1176 appropriate). In the case where there are lists of shadows,
dbaron@1539 1177 the shorter list is padded at the end with shadows whose
dbaron@1539 1178 color is transparent and all lengths (x, y, blur) are 0.
dino@936 1179 </li>
dino@936 1180 <li>
dino@936 1181 <strong>gradient</strong>: interpolated via the
dino@936 1182 positions and colors of each stop. They must have the same type
dino@936 1183 (radial or linear) and same number of stops in order to be animated.
dbaron@2964 1184 <span class="note">Note: [[CSS3-IMAGES]] may extend this
dbaron@2964 1185 definition.</span>
dino@936 1186 </li>
dino@936 1187 <li>
dino@936 1188 <strong>paint server</strong> (SVG): interpolation is only supported
dino@936 1189 between</strong>: gradient to gradient and color to color. They then
dino@936 1190 work as above.
dino@936 1191 </li>
dino@936 1192 <li>
dino@3189 1193 <strong>list of above types</strong>: If the lists have the
dino@3189 1194 same number of items, each item in the list is interpolated using the
dino@3189 1195 rules above. Otherwise the interpolation is determined by the property
dino@3189 1196 rules. If the property extends its list by repeating values, then this
simon@4370 1197 repeated form will be used in the interpolation (<code class="property">'background-position'</code>
simon@4370 1198 is an example of a property that would transition between lists of different lengths). If
dino@3189 1199 the property does not allow extending its list, then no interpolation
dino@3189 1200 will occur.
dino@1469 1201 </li>
dino@1469 1202 <li>
dino@2615 1203 <strong>a shorthand property</strong>: If any part of a
dino@1469 1204 shorthand can be animated, then interpolation is performed as
dino@2615 1205 if those animatable properties were individually specified.
dino@936 1206 </li>
dino@936 1207 </ul>
dino@936 1208
dbaron@2965 1209 <p class="issue">Issue: Need to describe handling of out-of-range
dbaron@2965 1210 values that can result from cubic-bezier(). Clamping values to the
dbaron@2965 1211 allowed range is probably the best solution.</p>
dbaron@2965 1212
dino@936 1213 <h2>
dino@936 1214 Animatable properties
dino@936 1215 </h2>
dino@936 1216
dbaron@4128 1217 <!--
dbaron@4128 1218 As resolved in
dbaron@4128 1219 http://lists.w3.org/Archives/Public/www-style/2011Sep/0497.html
dbaron@4128 1220 -->
dbaron@4128 1221 <p>For properties that exist at the time this specification was
dbaron@4128 1222 developed, this specification defines whether and how they are
dbaron@4128 1223 animated. However, future CSS specifications may define
dbaron@4128 1224 additional properties, additional values for existing properties,
dbaron@4128 1225 or additional animation behavior of existing values. In order to
dbaron@4128 1226 describe new animation behaviors and to have the definition of
dbaron@4128 1227 animation behavior in a more appropriate location, future CSS
dbaron@4128 1228 specifications should include an "Animatable:" line in the summary
dbaron@4128 1229 of the property's definition (in addition to the other lines
dbaron@4128 1230 described in [[CSS21]], <a
dbaron@4128 1231 href="http://www.w3.org/TR/CSS21/about.html#property-defs">section
dbaron@4128 1232 1.4.2</a>). This line should say "no" to indicate that a property
dbaron@4128 1233 cannot be animated or should reference an animation behavior
dbaron@4128 1234 (which may be one of the behaviors in the <a
dbaron@4128 1235 href="#animation-of-property-types-">Animation of property
dbaron@4128 1236 types</a> section above, or may be a new behavior) to define how
dbaron@4128 1237 the property animates. Such definitions override those given in
dbaron@4128 1238 this specification.</p>
dbaron@4128 1239
dino@936 1240 <h3>
dino@936 1241 Properties from CSS
dino@936 1242 </h3>
dino@936 1243
simon@4394 1244 <table class="animatable-properties">
dino@936 1245 <tr>
dino@936 1246 <th>Property Name</th>
dino@936 1247 <th>Type</th>
dino@936 1248 </tr>
dino@936 1249 <tr>
dino@936 1250 <td>background-color</td><td>color</tr>
dino@936 1251 <tr>
dino@936 1252 <td>background-position</td><td>percentage, length</td>
dino@936 1253 </tr>
dino@936 1254 <tr>
dino@936 1255 <td>border-bottom-color</td><td>color</td>
dino@936 1256 </tr>
dino@936 1257 <tr>
dino@936 1258 <td>border-bottom-width</td><td>length</td>
dino@936 1259 </tr>
dino@936 1260 <tr>
dino@936 1261 <td>border-left-color</td><td>color</td>
dino@936 1262 </tr>
dino@936 1263 <tr>
dino@936 1264 <td>border-left-width</td><td>length</td>
dino@936 1265 </tr>
dino@936 1266 <tr>
dino@936 1267 <td>border-right-color</td><td>color</td>
dino@936 1268 </tr>
dino@936 1269 <tr>
dino@936 1270 <td>border-right-width</td><td>length</td>
dino@936 1271 </tr>
dino@936 1272 <tr>
dino@936 1273 <td>border-spacing</td><td>length</td>
dino@936 1274 </tr>
dino@936 1275 <tr>
dino@936 1276 <td>border-top-color</td><td>color</td>
dino@936 1277 </tr>
dino@936 1278 <tr>
dino@936 1279 <td>border-top-width</td><td>length</td>
dino@936 1280 </tr>
dino@936 1281 <tr>
dino@936 1282 <td>bottom</td><td>length, percentage</td>
dino@936 1283 </tr>
dino@936 1284 <tr>
simon@1766 1285 <td>clip</td><td>rectangle</td>
simon@1766 1286 </tr>
simon@1766 1287 <tr>
dino@936 1288 <td>color</td><td>color</td>
dino@936 1289 </tr>
dino@936 1290 <tr>
dbaron@5256 1291 <td>crop <span class="issue">css3-content will likely advance slower than this specification, in which case this definition should move there</span></td><td>rectangle</td>
dino@936 1292 </tr>
dino@936 1293 <tr>
dino@936 1294 <td>font-size</td><td>length, percentage</td>
dino@936 1295 </tr>
dino@936 1296 <tr>
dbaron@5257 1297 <td>font-weight</td><td>font weight</td>
dino@936 1298 </tr>
dino@936 1299 <tr>
dino@936 1300 <td>height</td><td>length, percentage</td>
dino@936 1301 </tr>
dino@936 1302 <tr>
dino@936 1303 <td>left</td><td>length, percentage</td>
dino@936 1304 </tr>
dino@936 1305 <tr>
dino@936 1306 <td>letter-spacing</td><td>length</td>
dino@936 1307 </tr>
dino@936 1308 <tr>
dino@936 1309 <td>line-height</td><td>number, length, percentage</td>
dino@936 1310 </tr>
dino@936 1311 <tr>
dino@936 1312 <td>margin-bottom</td><td>length</td>
dino@936 1313 </tr>
dino@936 1314 <tr>
dino@936 1315 <td>margin-left</td><td>length</td>
dino@936 1316 </tr>
dino@936 1317 <tr>
dino@936 1318 <td>margin-right</td><td>length</td>
dino@936 1319 </tr>
dino@936 1320 <tr>
dino@936 1321 <td>margin-top</td><td>length</td>
dino@936 1322 </tr>
dino@936 1323 <tr>
dino@936 1324 <td>max-height</td><td>length, percentage</td>
dino@936 1325 </tr>
dino@936 1326 <tr>
dino@936 1327 <td>max-width</td><td>length, percentage </td>
dino@936 1328 </tr>
dino@936 1329 <tr>
dino@936 1330 <td>min-height</td><td>length, percentage</td>
dino@936 1331 </tr>
dino@936 1332 <tr>
dino@936 1333 <td>min-width</td><td>length, percentage</td>
dino@936 1334 </tr>
dino@936 1335 <tr>
dino@936 1336 <td>opacity</td><td>number</td>
dino@936 1337 </tr>
dino@936 1338 <tr>
dino@936 1339 <td>outline-color</td><td>color</td>
dino@936 1340 </tr>
dino@936 1341 <tr>
dino@936 1342 <td>outline-offset</td><td>integer</td>
dino@936 1343 </tr>
dino@936 1344 <tr>
dino@936 1345 <td>outline-width</td><td>length</td>
dino@936 1346 </tr>
dino@936 1347 <tr>
dino@936 1348 <td>padding-bottom</td><td>length</td>
dino@936 1349 </tr>
dino@936 1350 <tr>
dino@936 1351 <td>padding-left</td><td>length</td>
dino@936 1352 </tr>
dino@936 1353 <tr>
dino@936 1354 <td>padding-right</td><td>length</td>
dino@936 1355 </tr>
dino@936 1356 <tr>
dino@936 1357 <td>padding-top</td><td>length</td>
dino@936 1358 </tr>
dino@936 1359 <tr>
dino@936 1360 <td>right</td><td>length, percentage</td>
dino@936 1361 </tr>
dino@936 1362 <tr>
dino@936 1363 <td>text-indent</td><td>length, percentage</td>
dino@936 1364 </tr>
dino@936 1365 <tr>
dino@936 1366 <td>text-shadow</td><td>shadow</td>
dino@936 1367 </tr>
dino@936 1368 <tr>
dino@936 1369 <td>top</td><td>length, percentage</td>
dino@936 1370 </tr>
dino@936 1371 <tr>
dbaron@5245 1372 <td>vertical-align</td><td>length, percentage</td>
dino@936 1373 </tr>
dino@936 1374 <tr>
dino@936 1375 <td>visibility</td><td>visibility</td>
dino@936 1376 </tr>
dino@936 1377 <tr>
dino@936 1378 <td>width</td><td>length, percentage</td>
dino@936 1379 </tr>
dino@936 1380 <tr>
dino@936 1381 <td>word-spacing</td><td>length, percentage</td>
dino@936 1382 </tr>
dino@936 1383 <tr>
dino@936 1384 <td>z-index</td><td>integer</td>
dino@936 1385 </tr>
dino@936 1386 </table>
dino@936 1387
dbaron@2963 1388 <p class="issue">
dbaron@2963 1389 This list omits the following properties that Gecko can animate, and
dbaron@2963 1390 which likely should be included:
dbaron@2963 1391 background-size,
dbaron@2963 1392 border-*-radius,
dbaron@2963 1393 box-shadow,
dbaron@2963 1394 column-count,
dbaron@2963 1395 column-gap,
dbaron@2963 1396 column-rule-color,
dbaron@2963 1397 column-rule-width,
dbaron@2963 1398 column-width,
dbaron@2963 1399 font-size-adjust,
dbaron@2963 1400 font-stretch,
dbaron@2963 1401 marker-offset,
dbaron@2963 1402 text-decoration-color,
dbaron@4124 1403 transform,
dbaron@4124 1404 transform-origin.
dbaron@2963 1405 </p>
dbaron@2963 1406
dino@936 1407 <h3>
dino@936 1408 Properties from SVG
dino@936 1409 </h3>
dino@936 1410
dino@1469 1411 <p>
dino@1469 1412 All properties defined as animatable in the SVG specification, provided
dino@1469 1413 they are one of the property types listed above.
dino@1469 1414 </p>
dino@1469 1415
dino@1469 1416 <!-- <table>
dino@936 1417 <tr>
dino@936 1418 <th>Property Name</th><th>Type</th>
dino@936 1419 </tr>
dino@936 1420 <tr>
dino@936 1421 <td>stop-color</td><td>color</td>
dino@936 1422 </tr>
dino@936 1423 <tr>
dino@936 1424 <td>stop-opacity</td><td>float</td>
dino@936 1425 </tr>
dino@936 1426 <tr>
dino@936 1427 <td>fill</td><td>paint server</td>
dino@936 1428 </tr>
dino@936 1429 <tr>
dino@936 1430 <td>fill-opacity</td><td>float</td>
dino@936 1431 </tr>
dino@936 1432 <tr>
dino@936 1433 <td>stroke</td><td>paint server</td>
dino@936 1434 </tr>
dino@936 1435 <tr>
dino@936 1436 <td>stroke-dasharray</td><td>list of numbers</td>
dino@936 1437 </tr>
dino@936 1438 <tr>
dino@936 1439 <td>stroke-dashoffset</td><td>number</td>
dino@936 1440 </tr>
dino@936 1441 <tr>
dino@936 1442 <td>stroke-miterlimit</td><td>number</td>
dino@936 1443 </tr>
dino@936 1444 <tr>
dino@936 1445 <td>stroke-opacity</td><td>float</td>
dino@936 1446 </tr>
dino@936 1447 <tr>
dino@936 1448 <td>stroke-width</td><td>float</td>
dino@936 1449 </tr>
dino@936 1450 <tr>
dino@936 1451 <td>viewport-fill</td><td>color</td>
dino@936 1452 </tr>
dino@936 1453 <tr>
dino@936 1454 <td>viewport-fill-opacity</td><td>color</td>
dino@936 1455 </tr>
dino@1469 1456 </table> -->
dino@936 1457
dbaron@5312 1458 <h2 id="acknowledgments">Acknowledgments</h2>
dbaron@5312 1459
dbaron@5312 1460 <p>Thanks especially to the feedback from
dbaron@5312 1461 Tab Atkins,
dbaron@5312 1462 and all the rest of the
dbaron@5312 1463 <a href="http://lists.w3.org/Archives/Public/www-style/">www-style</a> community.</p>
dino@936 1464
dino@936 1465 <h2>References</h2>
dino@936 1466
dino@936 1467 <h3 class="no-num">Normative references</h3>
dino@936 1468 <!--normative-->
dino@936 1469
dino@936 1470 <h3 class="no-num">Other references</h3>
dino@936 1471 <!--informative-->
dino@936 1472
dino@936 1473
dino@936 1474
dino@936 1475 <h2 class="no-num">Property index</h2>
dino@936 1476 <!-- properties -->
dino@936 1477
dino@936 1478
dino@936 1479
dino@936 1480 <h2 class="no-num" id="index">Index</h2>
dino@936 1481 <!--index-->
dino@936 1482
dino@936 1483 </body>
dino@936 1484 </html>
dino@936 1485 <!-- Keep this comment at the end of the file
dino@936 1486 Local variables:
dino@936 1487 mode: sgml
dino@936 1488 sgml-default-doctype-name:"html"
dino@936 1489 sgml-minimize-attributes:t
dino@936 1490 End:
dino@936 1491 -->

mercurial