-
Notifications
You must be signed in to change notification settings - Fork 790
Expand file tree
/
Copy pathOverview.html
More file actions
1333 lines (930 loc) · 35.2 KB
/
Overview.html
File metadata and controls
1333 lines (930 loc) · 35.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang=en>
<head>
<title>CSS Transitions Module Level 3</title>
<link href=default.css rel=stylesheet type="text/css">
<style type="text/css">
.rhs { white-space: pre-wrap; }
code { font-size: inherit; }
#box-shadow-samples td { background: white; color: black; }
table {
border-collapse: collapse;
}
td {
padding: 0.2em 1em;
border: 1px solid black;
}
</style>
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" rel=stylesheet
type="text/css">
<body>
<div class=head> <!--begin-logo-->
<p><a href="http://www.w3.org/"><img alt=W3C height=48
src="http://www.w3.org/Icons/w3c_home" width=72></a> <!--end-logo-->
<h1>CSS Transitions Module Level 3</h1>
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 10 February
2009</h2>
<dl>
<dt>This version:
<dd> <a
href="http://dev.w3.org/csswg/css3-transitions/">http://dev.w3.org/csswg/css3-transitions/</a>
<dt>Latest version:
<dd><a
href="http://www.w3.org/TR/css3-transitions/">http://www.w3.org/TR/unknown-shortname</a>
<dt>Previous versions:
<dt id=editors-list>Editors:
<dd><a href="mailto:dino@apple.com">Dean Jackson</a> (<a
href="http://www.apple.com/">Apple Inc</a>)
<dd><a href="mailto:hyatt@apple.com">David Hyatt</a> (<a
href="http://www.apple.com/">Apple Inc</a>)
<dd><a href="mailto:cmarrin@apple.com">Chris Marrin</a> (<a
href="http://www.apple.com/">Apple Inc</a>)
</dl>
<!--begin-copyright-->
<p class=copyright><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
rel=license>Copyright</a> © 2009 <a
href="http://www.w3.org/"><acronym title="World Wide Web
Consortium">W3C</acronym></a><sup>®</sup> (<a
href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute
of Technology">MIT</acronym></a>, <a
href="http://www.ercim.org/"><acronym title="European Research Consortium
for Informatics and Mathematics">ERCIM</acronym></a>, <a
href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a
href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a
href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
<!--end-copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc" id=abstract>Abstract</h2>
<p>CSS Transitions allows property changes in CSS values to occur smoothly
over a specified duration.
<h2 class="no-num no-toc" id=status>Status of this document</h2>
<!--begin-status-->
<p>This is a public copy of the editors' draft. It is provided for
discussion only and may change at any moment. Its publication here does
not imply endorsement of its contents by W3C. Don't cite this document
other than as work in progress.
<p>The (<a
href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public
mailing list <a href="mailto:www-style@w3.org">www-style@w3.org</a> (see
<a href="http://www.w3.org/Mail/Request">instructions</a>) is preferred
for discussion of this specification. When sending e-mail, please put the
text “unknown-shortname” in the subject, preferably like this:
“[<!---->unknown-shortname<!---->] <em>…summary of
comment…</em>”
<p>This document was produced by the <a href="/Style/CSS/members">CSS
Working Group</a> (part of the <a href="/Style/">Style Activity</a>).
<p>This document was produced by a group operating under the <a
href="/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent
Policy</a>. W3C maintains a <a href="/2004/01/pp-impl/32061/status"
rel=disclosure>public list of any patent disclosures</a> made in
connection with the deliverables of the group; that page also includes
instructions for disclosing a patent. An individual who has actual
knowledge of a patent which the individual believes contains <a
href="/Consortium/Patent-Policy-20040205/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with <a
href="/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the
W3C Patent Policy</a>.</p>
<!--end-status-->
<h2 class="no-num no-toc" id=contents>Table of contents</h2>
<!--begin-toc-->
<ul class=toc>
<li><a href="#introduction"><span class=secno>1 </span>Introduction</a>
<li><a href="#transitions-"><span class=secno>2 </span> Transitions </a>
<ul class=toc>
<li><a href="#the-transition-property-property-"><span class=secno>2.1
</span> The <span class=prop-name>‘<code
class=property>transition-property</code>’</span> Property </a>
<li><a href="#the-transition-duration-property-"><span class=secno>2.2
</span> The <span class=prop-name>‘<code
class=property>transition-duration</code>’</span> Property </a>
<li><a href="#transition-timing-function_tag"><span class=secno>2.3
</span> The <span class=prop-name>‘<code
class=property>transition-timing-function</code>’</span> Property
</a>
<li><a href="#the-transition-delay-property-"><span class=secno>2.4
</span> The <span class=prop-name>‘<code
class=property>transition-delay</code>’</span> Property </a>
<li><a href="#the-transition-shorthand-property-"><span class=secno>2.5
</span> The <span class=prop-name>‘<code
class=property>transition</code>’</span> Shorthand Property </a>
</ul>
<li><a href="#transition-events-"><span class=secno>3 </span> Transition
Events </a>
<li><a href="#animation-of-property-types-"><span class=secno>4 </span>
Animation of property types </a>
<li><a href="#animatable-properties-"><span class=secno>5 </span>
Animatable properties </a>
<ul class=toc>
<li><a href="#properties-from-css-"><span class=secno>5.1 </span>
Properties from CSS </a>
<li><a href="#properties-from-svg-"><span class=secno>5.2 </span>
Properties from SVG </a>
</ul>
<li><a href="#references"><span class=secno>6 </span>References</a>
<ul class=toc>
<li class=no-num><a href="#normative-references">Normative
references</a>
<li class=no-num><a href="#other-references">Other references</a>
</ul>
<li class=no-num><a href="#property-index">Property index</a>
<li class=no-num><a href="#index">Index</a>
</ul>
<!--end-toc-->
<h2 id=introduction><span class=secno>1 </span>Introduction</h2>
<p><em>This section is not normative.</em>
<p> 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.
<h2 id=transitions-><span class=secno>2 </span> Transitions</h2>
<p> 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.
<p> For example, suppose that transitions of one second have been defined
on the <span class=prop-name>‘<code
class=property>left</code>’</span> and <span
class=prop-name>‘<code
class=property>background-color</code>’</span> 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.
<div class=figure> <img alt="" src=transition1.png></div>
<p class=caption> Transitions of <span class=prop-name>‘<code
class=property>left</code>’</span> and <span
class=prop-name>‘<code
class=property>background-color</code>’</span>
<p> 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.
<p> Only animatable CSS properties can be transitioned. See the table at
the end of this document for a list of properties that are animatable.
<p> The transition for a property is defined using a number of new
properties. For example:
<div class=example>
<p style=display:none> Example(s):</p>
<pre>
div {
transition-property: opacity;
transition-duration: 2s;
}
</pre>
The above example defines a transition on the <span
class=prop-name>‘<code class=property>opacity</code>’</span>
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.</div>
<p> 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:
<div class=example>
<p style=display:none> Example(s):</p>
<pre>
div {
transition-property: opacity, left;
transition-duration: 2s, 4s;
}
</pre>
This will cause the <span class=prop-name>‘<code
class=property>opacity</code>’</span> property to transition over a
period of two seconds and the left property to transition over a period of
four seconds.</div>
<!-- ======================================================================================================= -->
<h3 id=the-transition-property-property-><span class=secno>2.1 </span> The
<span class=prop-name>‘<code class=property><a
href="#transition-property">transition-property</a></code>’</span>
Property</h3>
<p> The <span class=prop-name>‘<code class=property><a
href="#transition-property">transition-property</a></code>’</span>
property specifies the name of the CSS property to which the transition is
applied.
<div class=issue> 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.</div>
<table class=propdef>
<tbody>
<tr>
<td> <em>Name:</em>
<td> <dfn id=transition-property>transition-property</dfn>
<tr>
<td> <em>Value:</em>
<td> none | all | [ <IDENT> ] [ ‘<code
class=css>,</code>’ <IDENT> ]*
<tr>
<td> <em>Initial:</em>
<td> all
<tr>
<td> <em>Applies to:</em>
<td> block-level and inline-level elements
<tr>
<td> <em>Inherited:</em>
<td> no
<tr>
<td> <em>Percentages:</em>
<td> N/A
<tr>
<td> <em>Media:</em>
<td> visual
<tr>
<td> <em>Computed value:</em>
<td> Same as specified value.
</table>
<p> A value of ‘<code class=property>none</code>’ means that no
property will transition. A value of ‘<code
class=property>all</code>’ means that every property that is able to
undergo a transition will do so. Otherwise, a list of properties to be
transitioned is given.
<div class=issue> We need to generate a list of properties that can be
transitioned.</div>
<div class=issue> Is "none" even a useful value if the initial value is
"all"? The syntax is more elegant if transition-duration defaults to 0 and
this property defaults to "all", but another option is to default this
property to "none" and duration to something reasonable, e.g., 250ms. This
would force an author to specify transition-property in the shorthand all
the time though.</div>
<!-- ======================================================================================================= -->
<h3 id=the-transition-duration-property-><span class=secno>2.2 </span> The
<span class=prop-name>‘<code class=property><a
href="#transition-duration">transition-duration</a></code>’</span>
Property</h3>
<p> The <span class=prop-name>‘<code class=property><a
href="#transition-duration">transition-duration</a></code>’</span>
property defines the length of time that a transition takes.
<table class=propdef>
<tbody>
<tr>
<td> <em>Name:</em>
<td> <dfn id=transition-duration>transition-duration</dfn>
<tr>
<td> <em>Value:</em>
<td> <time> [, <time>]*
<tr>
<td> <em>Initial:</em>
<td> 0
<tr>
<td> <em>Applies to:</em>
<td> block-level and inline-level elements
<tr>
<td> <em>Inherited:</em>
<td> no
<tr>
<td> <em>Percentages:</em>
<td> N/A
<tr>
<td> <em>Media:</em>
<td> visual
<tr>
<td> <em>Computed value:</em>
<td> Same as specified value.
</table>
<p> This property specifies how long the transition from the old value to
the new value should take. By default the value is ‘<code
class=css>0</code>’, meaning that the transition is immediate (i.e.
there will be no animation). A negative value for <a class=prop-name
href="#transition-duration">transition-duration</a> is treated as
‘<code class=css>0</code>’.</p>
<!-- =======================================================================================================
-->
<h3 id=transition-timing-function_tag><span class=secno>2.3 </span> The
<span class=prop-name>‘<code class=property><a
href="#transition-timing-function">transition-timing-function</a></code>’</span>
Property</h3>
<p> The <span class=prop-name>‘<code class=property><a
href="#transition-timing-function">transition-timing-function</a></code>’</span>
property describes how the intermediate values used during a transition
will be calculated. It allows for a transition to change speed over its
duration. These effects are commonly called <em>easing</em> functions. In
either case, a mathematical function that provides a smooth curve is used.
<p> The timing function is specified using a <a
href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B.C3.A9zier_curves">cubic
bezier curve</a>, which is defined by four control points, P<sub>0</sub>
through P<sub>3</sub> (see Figure 1). P<sub>0</sub> and P<sub>3</sub> are
always set to (0,0) and (1,1). The <span class=prop-name>‘<code
class=property><a
href="#transition-timing-function">transition-timing-function</a></code>’</span>
property is used to specify the values for points P<sub>1</sub> and
P<sub>2</sub>. These can be set to preset values using the keywords listed
below, or can be set to specific values using the <span
class=prop-value>‘<code
class=property>cubic-bezier</code>’</span> function. In the <span
class=prop-value>‘<code
class=property>cubic-bezier</code>’</span> function, P<sub>1</sub>
and P<sub>2</sub> are each specified by both an X and Y value.
<div class=figure> <img src=TimingFunction.png></div>
<p class=caption> Timing Function Control Points
<p> The timing function takes as its input the current elapsed percentage
of the transition duration and outputs a percentage that determines how
close the transition is to its goal state.
<table class=propdef>
<tbody>
<tr>
<td> <em>Name:</em>
<td> <dfn id=transition-timing-function>transition-timing-function</dfn>
<tr>
<td> <em>Value:</em>
<td> ease | linear | ease-in | ease-out | ease-in-out |
cubic-bezier(<number>, <number>, <number>,
<number>) [, ease | linear | ease-in | ease-out | ease-in-out |
cubic-bezier(<number>, <number>, <number>,
<number>)]*
<tr>
<td> <em>Initial:</em>
<td> ease
<tr>
<td> <em>Applies to:</em>
<td> block-level and inline-level elements
<tr>
<td> <em>Inherited:</em>
<td> no
<tr>
<td> <em>Percentages:</em>
<td> N/A
<tr>
<td> <em>Media:</em>
<td> visual
<tr>
<td> <em>Computed value:</em>
<td> Same as specified value.
</table>
<p> The timing functions have the following definitions.
<dl>
<dt> ease
<dd> The ease function is equivalent to cubic-bezier(0.25, 0.1, 0.25,
1.0).
<dt> linear
<dd> The linear function is equivalent to cubic-bezier(0.0, 0.0, 1.0,
1.0).
<dt> ease-in
<dd> The ease-in function is equivalent to cubic-bezier(0.42, 0, 1.0,
1.0).
<dt> ease-out
<dd> The ease-out function is equivalent to cubic-bezier(0, 0, 0.58, 1.0).
<dt> ease-in-out
<dd> The ease-in-out function is equivalent to cubic-bezier(0.42, 0, 0.58,
1.0)
<dt> cubic-bezier
<dd> Specifies a <a
href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve">cubic-bezier
curve</a>. The four values specify points P<sub>1</sub> and P<sub>2</sub>
of the curve as (x1, y1, x2, y2). All values must be in the range [0, 1]
or the definition is invalid.
</dl>
<!-- ======================================================================================================= -->
<h3 id=the-transition-delay-property-><span class=secno>2.4 </span> The
<span class=prop-name>‘<code class=property><a
href="#transition-delay">transition-delay</a></code>’</span>
Property</h3>
<p> The <span class=prop-name>‘<code class=property><a
href="#transition-delay">transition-delay</a></code>’</span>
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 <span
class=prop-name>‘<code class=property><a
href="#transition-delay">transition-delay</a></code>’</span> value
of ‘<code class=css>0</code>’ 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.
<p> If the value for <span class=prop-name>‘<code class=property><a
href="#transition-delay">transition-delay</a></code>’</span> 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 <span class=prop-name>‘<code
class=property><a
href="#transition-delay">transition-delay</a></code>’</span>, the
starting values are taken from the moment the property is changed.
<table class=propdef>
<tbody>
<tr>
<td> <em>Name:</em>
<td> <dfn id=transition-delay>transition-delay</dfn>
<tr>
<td> <em>Value:</em>
<td> <time> [, <time>]*
<tr>
<td> <em>Initial:</em>
<td> 0
<tr>
<td> <em>Applies to:</em>
<td> block-level and inline-level elements
<tr>
<td> <em>Inherited:</em>
<td> no
<tr>
<td> <em>Percentages:</em>
<td> N/A
<tr>
<td> <em>Media:</em>
<td> visual
<tr>
<td> <em>Computed value:</em>
<td> Same as specified value.
</table>
<!-- ======================================================================================================= -->
<h3 id=the-transition-shorthand-property-><span class=secno>2.5 </span> The
<span class=prop-name>‘<code class=property><a
href="#transition">transition</a></code>’</span> Shorthand Property</h3>
<p> The <span class=prop-name>‘<code class=property><a
href="#transition">transition</a></code>’</span> shorthand property
combines the four properties described above into a single property.
<table class=propdef>
<tbody>
<tr>
<td> <em>Name:</em>
<td> <dfn id=transition>transition</dfn>
<tr>
<td> <em>Value:</em>
<td> [<transition-property> || <transition-duration> ||
<transition-timing-function> || <transition-delay> [,
[<transition-property> || <transition-duration> ||
<transition-timing-function> || <transition-delay>]]*
<tr>
<td> <em>Initial:</em>
<td> see individual properties
<tr>
<td> <em>Applies to:</em>
<td> block-level and inline-level elements
<tr>
<td> <em>Inherited:</em>
<td> no
<tr>
<td> <em>Percentages:</em>
<td> N/A
<tr>
<td> <em>Media:</em>
<td> visual
<tr>
<td> <em>Computed value:</em>
<td> Same as specified value.
</table>
<div class=issue> What should happen when a value is changed midway through
a transition? One option is to simply begin a new transition from the
current position. However things get interesting when from/to values are
being flipped. For example you'd like symmetry on fade-in/fade-out hover
effects if the user rolls over the object and rolls out before the
animation finishes. This implies that there needs to be a convenient and
straightforward rule for running transitions in reverse under certain
circumstances. This could be controlled via a new property, or could
perhaps be done simply by detecting when the from/to values are flipped.</div>
<h2 id=transition-events-><span class=secno>3 </span> Transition Events</h2>
<p> 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>.
An event is fired for each property that undergoes a transition. This
allows a content developer to perform actions that synchronize with the
completion of a transition.
<p> Each event provides the name of the property the transition is
associated with as well as the duration of the transition.
<dl>
<dt> <b>Interface <i><a id=Events-TransitionEvent
name=Events-TransitionEvent>TransitionEvent</a></i></b>
<dd>
<p> The <code>TransitionEvent</code> interface provides specific
contextual information associated with transitions.</p>
<dl>
<dt> <b>IDL Definition</b>
<dd>
<div class=idl-code>
<pre>
interface TransitionEvent : Event {
readonly attribute DOMString propertyName;
readonly attribute float elapsedTime;
void initTransitionEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in DOMString propertyNameArg,
in float elapsedTimeArg);
};
</pre>
</div>
<dt> <b>Attributes</b>
<dd>
<dl>
<dt> <code class=attribute-name><a
id=Events-TransitionEvent-propertyName
name=Events-TransitionEvent-propertyName>propertyName</a></code> of
type <code>DOMString</code>, readonly
<dd> The name of the CSS property associated with the transition.
</dl>
<dl>
<dt> <code class=attribute-name><a
id=Events-TransitionEvent-elapsedTime
name=Events-TransitionEvent-elapsedTime>elapsedTime</a></code> of
type <code>float</code>, readonly
<dd> 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 <a class=prop-name
href="#transition-delay">transition-delay</a>.
</dl>
<dt> <b>Methods</b>
<dd>
<dl>
<dt> <code class=method-name><a
id=Events-TransitionEvent-initTransitionEvent
name=Events-TransitionEvent-initTransitionEvent>initTransitionEvent</a></code>
<dd>
<div class=method> The <code>initTransitionEvent</code> method is
used to initialize the value of a <code>TransitionEvent</code>
created through the <a
href="events.html#Events-DocumentEvent"><code>DocumentEvent</code></a>
interface. This method may only be called before the
<code>TransitionEvent</code> has been dispatched via the
<code>dispatchEvent</code> method, though it may be called multiple
times during that phase if necessary. If called multiple times, the
final invocation takes precedence.
<div class=parameters> <b>Parameters</b>
<div class=paramtable>
<dl>
<dt> <code class=parameter-name>typeArg</code> of type
<code>DOMString</code>
<dd> Specifies the event type.<br>
<dt> <code class=parameter-name>canBubbleArg</code> of type
<code>boolean</code>
<dd> Specifies whether or not the event can bubble.<br>
<dt> <code class=parameter-name>cancelableArg</code> of type
<code>boolean</code>
<dd> Specifies whether or not the event's default action can be
prevented.<br>
<dt> <code class=parameter-name>propertyNameArg</code> of type
<code>DOMString</code>
<dd> Specifies the name of the property associated with the <a
href="events.html#Events-Event"><code>Event</code></a>
<dt> <code class=parameter-name>elapsedTimeArg</code> of type
<code>float</code>
<dd> Specifies the amount of time, in seconds, the transition has
been running at the time of initialization.
</dl>
</div>
</div>
<!-- parameters -->
<div> <b>No Return Value</b></div>
<div> <b>No Exceptions</b></div>
</div>
<!-- method -->
</dl>
</dl>
</dl>
<p> There is one type of transition event available.
<dl>
<dt> <b>transitionend</b>
<dd> The ‘<code class=property>transitionend</code>’ event
occurs at the completion of the transition
<ul>
<li>Bubbles: Yes
<li>Cancelable: Yes
<li>Context Info: propertyName
</ul>
</dl>
<h2 id=animation-of-property-types-><span class=secno>4 </span> Animation
of property types</h2>
<p> The following describes how each property type undergoes transition or
animation.
<ul>
<li> <strong>color</strong>: interpolated via red, green, blue and alpha
components (treating each as a number, see below).
<li> <strong>length</strong>: interpolated as real numbers.
<li> <strong>percentage</strong>: interpolated as real numbers.
<li> <strong>integer</strong>: interpolated via discrete steps (whole
numbers). The interpolation happens in real number space and is converted
to an integer using <code>floor()</code>.
<li> <strong>number</strong>: interpolated as real (floating point)
numbers.
<li> <strong>transform list</strong>: see <a href=CSSTransforms.html> CSS
Transforms specification</a>.
<li> <strong>rectangle</strong>: interpolated via the x, y, width and
height components (treating each as a number).
<li> <strong>visibility</strong>: interpolated via a discrete step. The
interpolation happens in real number space between 0 and 1, where 1 is
"visible" and all other values are "hidden".
<li> <strong>shadow</strong>: interpolated via the color, x, y and blur
components (treating them as color and numbers where appropriate).
<li> <strong>gradient</strong>: interpolated via the positions and colors
of each stop. They must have the same type (radial or linear) and same
number of stops in order to be animated.
<li> <strong>paint server</strong> (SVG): interpolation is only supported
between: gradient to gradient and color to color. They then work as
above.
<li> <strong>space-separated list of above</strong>: each item in the list
is interpolated using the rules above.
</ul>
<h2 id=animatable-properties-><span class=secno>5 </span> Animatable
properties</h2>
<h3 id=properties-from-css-><span class=secno>5.1 </span> Properties from
CSS</h3>
<table>
<tbody>
<tr>
<th>Property Name
<th>Type
<tr>
<td>background-color
<td>color
<tr>
<td>background-image
<td>only gradients
<tr>
<td>background-position
<td>percentage, length
<tr>
<td>border-bottom-color
<td>color
<tr>
<td>border-bottom-width
<td>length
<tr>
<td>border-color
<td>color
<tr>
<td>border-left-color
<td>color
<tr>
<td>border-left-width
<td>length
<tr>
<td>border-right-color
<td>color
<tr>
<td>border-right-width
<td>length
<tr>
<td>border-spacing
<td>length
<tr>
<td>border-top-color
<td>color
<tr>
<td>border-top-width
<td>length
<tr>
<td>border-width
<td>length
<tr>
<td>bottom
<td>length, percentage
<tr>
<td>color
<td>color
<tr>
<td>crop
<td>rectangle
<tr>
<td>font-size
<td>length, percentage
<tr>
<td>font-weight
<td>number
<tr>
<td>grid-*
<td>various
<tr>
<td>height
<td>length, percentage
<tr>
<td>left
<td>length, percentage
<tr>
<td>letter-spacing
<td>length
<tr>
<td>line-height
<td>number, length, percentage
<tr>
<td>margin-bottom
<td>length
<tr>
<td>margin-left
<td>length
<tr>
<td>margin-right
<td>length
<tr>
<td>margin-top
<td>length
<tr>
<td>max-height
<td>length, percentage
<tr>
<td>max-width