-
Notifications
You must be signed in to change notification settings - Fork 791
Expand file tree
/
Copy pathOverview.html
More file actions
executable file
·1462 lines (1109 loc) · 50.2 KB
/
Overview.html
File metadata and controls
executable file
·1462 lines (1109 loc) · 50.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 3D Transforms</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; }
</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 3D Transforms</h1>
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 28 January
2012</h2>
<dl>
<dt>This version:
<dd> <a
href="http://www.w3.org/TR/2012/ED-css3-3d-transforms-20120128/">http://dev.w3.org/csswg/css3-3d-transforms/</a>
<!--http://www.w3.org/TR/2012/WD-css3-3d-transforms-20120128-->
<dt>Latest version:
<dd><a
href="http://www.w3.org/TR/css3-3d-transforms/">http://www.w3.org/TR/css3-3d-transforms/</a>
<dt>Previous version:
<dd><a href="http://www.w3.org/TR/2009/WD-css3-3d-transforms-20090320/">
http://www.w3.org/TR/2009/WD-css3-3d-transforms-20090320/</a>
<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> © 2012 <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.eu/"><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 3D Transforms extends CSS Transforms to allow elements rendered by
CSS to be transformed in three-dimensional space.
<h2 class="no-num no-toc" id=status>Status of this document</h2>
<p class=note> This will be the last published Working Draft of this
specification. Work will continue with a combined CSS and SVG Transforms
specification operating under the FX Taskforce. The latest <a
href="http://dev.w3.org/csswg/css3-transforms/"> Editors' Draft</a> of the
new specification is available.</p>
<!--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?Subject=%5Bcss3-3d-transforms%5D%20PUT%20SUBJECT%20HERE">
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
“css3-3d-transforms” in the subject, preferably like this:
“[<!---->css3-3d-transforms<!---->] <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-->
<p> The <a href=ChangeLog>list of changes made to this specification</a>
are available.
<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="#transform-property"><span class=secno>2. </span> The <span
class=prop-name>‘<code
class=property>transform</code>’</span> Property </a>
<li><a href="#transform-origin-property"><span class=secno>3. </span> The
<span class=prop-name>‘<code
class=property>transform-origin</code>’</span> Property </a>
<li><a href="#transform-style-property"><span class=secno>4. </span> The
<span class=prop-name>‘<code
class=property>transform-style</code>’</span> Property </a>
<li><a href="#perspective-property"><span class=secno>5. </span> The <span
class=prop-name>‘<code
class=property>perspective</code>’</span> Property </a>
<li><a href="#perspective-origin-property"><span class=secno>6. </span>
The <span class=prop-name>‘<code
class=property>perspective-origin</code>’</span> Property </a>
<li><a href="#backface-visibility-property"><span class=secno>7. </span>
The <span class=prop-name>‘<code
class=property>backface-visibility</code>’</span> Property </a>
<li><a href="#transform-functions"><span class=secno>8. </span> The
Transformation Functions </a>
<li><a href="#animation"><span class=secno>9. </span> Transitions and
animations between transform values </a>
<li><a href="#rendering-3d"><span class=secno>10. </span> Rendering in 3d
</a>
<li><a href="#dom-interfaces"><span class=secno>11. </span> DOM Interfaces
</a>
<ul class=toc>
<li><a href="#cssmatrix-interface"><span class=secno>11.1. </span>
Extensions to CSSMatrix </a>
<li><a href="#csstransformvalue-interface"><span class=secno>11.2.
</span> CSSTransformValue </a>
</ul>
<li><a href="#references"><span class=secno>12. </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 is an enhancement to the CSS Transforms specification which
provides transforms in three dimensions. It should be read in conjunction
with that specification.
<p> This coordinate space can be modified with the <span
class=prop-name>‘<a href="#effects"><code
class=property>transform</code></a>’</span> property. Using
transform, elements can be translated, rotated and scaled in two or three
dimensional space. A perspective transform can also be applied to give a
sense of depth to the way elements are displayed. In three dimensions, a Z
axis is added, with positive z values conceptually rising perpendicularly
out of the window toward the user and negative z values falling into the
window away from the user.
<p> Any value other than ‘<code class=property>none</code>’ for
the transform results in the creation of both a stacking context and a
containing block. The object acts as though position: relative has been
specified, but also acts as a containing block for fixed positioned
descendants. The position on the Z axis of a transformed element does not
affect the order within a stacking context. With elements at the same
z-index, objects are drawn in order of increasing z position.
<p> Note that while <span class=prop-name>‘<a href="#effects"><code
class=property>transform</code></a>’</span> uses a three-dimensional
coordinate system, the elements themselves are not three-dimensional
objects. Instead, they exist on a two-dimensional plane (a flat surface)
and have no depth.
<h2 id=transform-property><span class=secno>2. </span> The <span
class=prop-name>‘<a href="#effects"><code
class=property>transform</code></a>’</span> Property</h2>
<p> A 2D or 3D transformation is applied to an element through the <span
class=prop-name>‘<a href="#effects"><code
class=property>transform</code></a>’</span> property. This property
contains a list of <a href="#transform-functions">transform functions</a>.
The final transformation value for an element is obtained by performing a
matrix concatenation of each entry in the list. The set of transform
functions is similar to those allowed by SVG. There are additional
functions to support 3D transformations.
<table class=propdef>
<tbody>
<tr>
<td> <em>Name:</em>
<td> <dfn id=effects>transform</dfn>
<tr>
<td> <em>Value:</em>
<td> none | <transform-function> [ <transform-function> ]*
<tr>
<td> <em>Initial:</em>
<td> none
<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> refer to the size of the element's box
<tr>
<td> <em>Media:</em>
<td> visual
<tr>
<td> <em>Computed value:</em>
<td> Same as specified value.
</table>
<!-- ======================================================================================================= -->
<h2 id=transform-origin-property><span class=secno>3. </span> The <span
class=prop-name>‘<a href="#transform-origin"><code
class=property>transform-origin</code></a>’</span> Property</h2>
<p> The <span class=prop-name>‘<a href="#transform-origin"><code
class=property>transform-origin</code></a>’</span> property
establishes the origin of transformation for an element. This property is
applied by first translating the element by the negated value of the
property, then applying the element's transform, then translating by the
property value. This effectively moves the desired transformation origin
of the element to (0,0,0) in the local coordinate system, then applies the
element's transform, then moves the element back to its original position.
Note that percentage values are not allowed in the z value.
<table class=propdef>
<tbody>
<tr>
<td> <em>Name:</em>
<td> <dfn id=transform-origin>transform-origin</dfn>
<tr>
<td> <em>Value:</em>
<td> [ [ [ <percentage> | <length> | left | center | right ]
[ <percentage> | <length> | top | center | bottom ]? ]
<length> ] | [ [ [ left | center | right ] || [ top | center |
bottom ] ] <length> ]
<tr>
<td> <em>Initial:</em>
<td> 50% 50% 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> refer to the size of the element's box
<tr>
<td> <em>Media:</em>
<td> visual
<tr>
<td> <em>Computed value:</em>
<td> For <length> the absolute value, otherwise a percentage
</table>
<!-- ======================================================================================================= -->
<h2 id=transform-style-property><span class=secno>4. </span> The <span
class=prop-name>‘<a href="#transform-style"><code
class=property>transform-style</code></a>’</span> Property</h2>
<p> The <span class=prop-name>‘<a href="#transform-style"><code
class=property>transform-style</code></a>’</span> property defines
how nested elements are rendered in 3D space. If the <span
class=prop-name>‘<a href="#transform-style"><code
class=property>transform-style</code></a>’</span> is <span
class=prop-value>‘<code class=property>flat</code>’</span>,
all children of this element are rendered flattened into the 2D plane of
the element. Therefore, rotating the element about the X or Y axes will
cause children positioned at positive or negative Z positions to appear on
the element's plane, rather than in front of or behind it. If the <span
class=prop-name>‘<a href="#transform-style"><code
class=property>transform-style</code></a>’</span> is <span
class=prop-value>‘<code class=css>preserve-3d</code>’</span>,
this flattening is not performed, so children maintain their position in
3D space.
<p> This flattening takes place at each element, so preserving a hierarchy
of elements in 3D space requires that each ancestor in the hierarchy have
the value <span class=prop-value>‘<code
class=css>preserve-3d</code>’</span> for <span
class=prop-name>‘<a href="#transform-style"><code
class=property>transform-style</code></a>’</span>. But since <span
class=prop-name>‘<a href="#transform-style"><code
class=property>transform-style</code></a>’</span> affects only an
element's children, the leaf nodes in a hierarchy do not require the
perspective style.
<table class=propdef>
<tbody>
<tr>
<td> <em>Name:</em>
<td> <dfn id=transform-style>transform-style</dfn>
<tr>
<td> <em>Value:</em>
<td> flat | preserve-3d
<tr>
<td> <em>Initial:</em>
<td> flat
<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> For some effects, the author will have to ensure that an ancestor
element to a subtree using <span class=prop-value>‘<code
class=css>preserve-3d</code>’</span> has a <span
class=prop-name>‘<a href="#transform-style"><code
class=property>transform-style</code></a>’</span> of <span
class=prop-value>‘<code class=property>flat</code>’</span> (or
the default). Otherwise, the elements in the 3D tree may be located behind
ancestor elements and, thus, invisible (hidden behind an ancestor's
background).
<p> Note that while ‘<code class=css>preserve-3d</code>’ can be
specified on an element, the effect may not be possible. Elements that
have <span class=prop-name>‘<code
class=property>overflow</code>’</span> set to <span
class=prop-value>‘<code class=property>hidden</code>’</span>
are unable to keep their children in 3D. In this case the element will
behave as if the property was set to <span class=prop-value>‘<code
class=property>flat</code>’</span>.
<div class=issue> Does transform-style: preserve-3d need to establish a
stacking context and containing block like transform does?</div>
<!-- ======================================================================================================= -->
<h2 id=perspective-property><span class=secno>5. </span> The <span
class=prop-name>‘<a href="#perspective"><code
class=property>perspective</code></a>’</span> Property</h2>
<p> The <span class=prop-name>‘<a href="#perspective"><code
class=property>perspective</code></a>’</span> property applies the
same transform as the <span
class=prop-value>perspective(<length>)</span> transform function,
except that it applies only to the positioned or transformed children of
the element, not to the transform on the element itself.
<p> If the value is <span class=prop-value>‘<code
class=property>none</code>’</span>, less than or equal to 0 no
perspective transform is applied.
<p> The use of this property with any value other than ‘<code
class=property>none</code>’ establishes a stacking context. It also
establishes a containing block (somewhat similar to position:relative),
just like the ‘<a href="#effects"><code
class=property>transform</code></a>’ property does.
<table class=propdef>
<tbody>
<tr>
<td> <em>Name:</em>
<td> <dfn id=perspective>perspective</dfn>
<tr>
<td> <em>Value:</em>
<td> none | <length>
<tr>
<td> <em>Initial:</em>
<td> none
<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>
<!-- ======================================================================================================= -->
<h2 id=perspective-origin-property><span class=secno>6. </span> The <span
class=prop-name>‘<a href="#perspective-origin"><code
class=property>perspective-origin</code></a>’</span> Property</h2>
<p> The <span class=prop-name>‘<a href="#perspective-origin"><code
class=property>perspective-origin</code></a>’</span> property
establishes the origin for the <a
href="#perspective"><em>perspective</em></a> property. It effectively sets
the X and Y position at which the viewer appears to be looking at the
children of the element.
<table class=propdef>
<tbody>
<tr>
<td> <em>Name:</em>
<td> <dfn id=perspective-origin>perspective-origin</dfn>
<tr>
<td> <em>Value:</em>
<td> [ [ <percentage> | <length> | left | center | right ] [
<percentage> | <length> | top | center | bottom ]? ] | [ [
left | center | right ] || [ top | center | bottom ] ]
<tr>
<td> <em>Initial:</em>
<td> 50% 50%
<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> refer to the size of the elemen's box
<tr>
<td> <em>Media:</em>
<td> visual
<tr>
<td> <em>Computed value:</em>
<td> Same as specified value.
</table>
<!-- ======================================================================================================= -->
<h2 id=backface-visibility-property><span class=secno>7. </span> The <span
class=prop-name>‘<a href="#backface-visibility"><code
class=property>backface-visibility</code></a>’</span> Property</h2>
<p> The <span class=prop-name>‘<a href="#backface-visibility"><code
class=property>backface-visibility</code></a>’</span> property
determines whether or not the "back" side of a transformed element is
visible when facing the viewer. With an identity transform, the front side
of an element faces the viewer. Applying a rotation about Y of 180 degrees
(for instance) would cause the back side of the element to face the
viewer.
<p> This property is useful when you place two elements back-to-back, as
you would to create a playing card. Without this property, the front and
back elements could switch places at times during an animation to flip the
card. Another example is creating a box out of 6 elements, but where you
want to see the inside faces of the box. This is useful when creating the
backdrop for a 3 dimensional stage.
<table class=propdef>
<tbody>
<tr>
<td> <em>Name:</em>
<td> <dfn id=backface-visibility>backface-visibility</dfn>
<tr>
<td> <em>Value:</em>
<td> visible | hidden
<tr>
<td> <em>Initial:</em>
<td> visible
<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>
<!-- ======================================================================================================= -->
<h2 id=transform-functions><span class=secno>8. </span> The Transformation
Functions</h2>
<p> The value of the <a class=prop-name href="#effects">transform</a>
property is a list of <transform-functions>, applied in the order
provided. The individual transform functions are separated by whitespace.
The following is a list of allowed transform functions. In this list the
type <translation-value> is defined as a <length> or
<percentage> value, and the <angle> type is defined by <a
href="http://www.w3.org/TR/css3-values/">CSS Values and Units.</a>
<dl>
<dt> <span class=prop-value>matrix(<number>, <number>,
<number>, <number>, <number>, <number>)</span>
<dd> specifies a 2D transformation in the form of a <a
href="http://www.w3.org/TR/SVG/coords.html#TransformMatrixDefined">transformation
matrix</a> of six values. <span
class=prop-value>matrix(a,b,c,d,e,f)</span> is equivalent to matrix3d(a,
b, 0, 0, c, d, 0, 0, 0, 0, 1, 0, e, f, 0, 1).
<dt> <span class=prop-value>matrix3d(<number>, <number>,
<number>, <number>, <number>, <number>,
<number>, <number>, <number>, <number>,
<number>, <number>, <number>, <number>,
<number>, <number>)</span>
<dd> specifies a 3D transformation as a 4x4 homogeneous matrix of 16
values in column-major order.
<dt> <span class=prop-value>translate(<translation-value>[,
<translation-value>])</span>
<dd> specifies a <a
href="http://www.w3.org/TR/SVG/coords.html#TranslationDefined">2D
translation</a> by the vector [tx, ty], where tx is the first
translation-value parameter and ty is the optional second
translation-value parameter. If <em><ty></em> is not provided, ty
has zero as a value.
<dt> <span class=prop-value>translate3d(<translation-value>,
<translation-value>, <translation-value>)</span>
<dd> specifies a 3D translation by the vector [tx,ty,tz], with tx, ty and
tz being the first, second and third translation-value parameters
respectively. Note that <percentage> values are not allowed in the
tz translation-value, and if present will cause the propery value to be
invalid.
<dt> <span class=prop-value>translateX(<translation-value>)</span>
<dd> specifies a <a
href="http://www.w3.org/TR/SVG/coords.html#TranslationDefined">translation</a>
by the given amount in the X direction.
<dt> <span class=prop-value>translateY(<translation-value>)</span>
<dd> specifies a <a
href="http://www.w3.org/TR/SVG/coords.html#TranslationDefined">translation</a>
by the given amount in the Y direction.
<dt> <span class=prop-value>translateZ(<translation-value>)</span>
<dd> specifies a <a
href="http://www.w3.org/TR/SVG/coords.html#TranslationDefined">translation</a>
by the given amount in the Z direction. Note that <percentage>
values are not allowed in the translateZ translation-value, and if
present will cause the propery value to be invalid.
<dt> <span class=prop-value>scale(<number>[, <number>])</span>
<dd> specifies a <a
href="http://www.w3.org/TR/SVG/coords.html#ScalingDefined">2D scale</a>
operation by the [sx,sy] scaling vector described by the 2 parameters. If
the second parameter is not provided, it is takes a value equal to the
first.
<dt> <span class=prop-value>scale3d(<number>, <number>,
<number>)</span>
<dd> specifies a 3D scale operation by the [sx,sy,sz] scaling vector
described by the 3 parameters.
<dt> <span class=prop-value>scaleX(<number>)</span>
<dd> specifies a scale operation using the [sx,1,1] scaling vector, where
sx is given as the parameter.
<dt> <span class=prop-value>scaleY(<number>)</span>
<dd> specifies a scale operation using the [1,sy,1] scaling vector, where
sy is given as the parameter.
<dt> <span class=prop-value>scaleZ(<number>)</span>
<dd> specifies a scale operation using the [1,1,sz] scaling vector, where
sz is given as the parameter.
<dt> <span class=prop-value>rotate(<angle>)</span>
<dd> specifies a <a
href="http://www.w3.org/TR/SVG/coords.html#RotationDefined">2D
rotation</a> by the angle specified in the parameter about the origin of
the element, as defined by the <a
href="#transform-origin"><em>transform-origin</em></a> property.
<dt> <span class=prop-value>rotate3d(<number>, <number>,
<number>, <angle>)</span>
<dd> specifies a clockwise 3D rotation by the angle specified in last
parameter about the [x,y,z] direction vector described by the first 3
parameters. If the direction vector is not of unit length, it will be
normalized. A direction vector that cannot be normalized, such as [0, 0,
0], will cause the rotation to not be applied. This function is
equivalent to <code>matrix3d(1 + (1-cos(angle))*(x*x-1),
-z*sin(angle)+(1-cos(angle))*x*y, y*sin(angle)+(1-cos(angle))*x*z, 0,
z*sin(angle)+(1-cos(angle))*x*y, 1 + (1-cos(angle))*(y*y-1),
-x*sin(angle)+(1-cos(angle))*y*z, 0, -y*sin(angle)+(1-cos(angle))*x*z,
x*sin(angle)+(1-cos(angle))*y*z, 1 + (1-cos(angle))*(z*z-1), 0, 0, 0, 0,
1)</code>.
<dt> <span class=prop-value>rotateX(<angle>)</span>
<dd> specifies a clockwise rotation by the given angle about the X axis.
<dt> <span class=prop-value>rotateY(<angle>)</span>
<dd> specifies a clockwise rotation by the given angle about the Y axis.
<dt> <span class=prop-value>rotateZ(<angle>)</span>
<dd> specifies a clockwise rotation by the given angle about the Z axis.
<dt> <span class=prop-value>skewX(<angle>)</span>
<dd> specifies a <a
href="http://www.w3.org/TR/SVG/coords.html#SkewXDefined">skew
transformation along the X axis</a> by the given angle.
<dt> <span class=prop-value>skewY(<angle>)</span>
<dd> specifies a <a
href="http://www.w3.org/TR/SVG/coords.html#SkewYDefined">skew
transformation along the Y axis</a> by the given angle.
<dt> <span class=prop-value>skew(<angle> [, <angle>])</span>
<dd> specifies a <a
href="http://www.w3.org/TR/SVG/coords.html#SkewXDefined">skew
transformation along the X and Y axes</a>. The first angle parameter
specifies the skew on the X axis. The second angle parameter specifies
the skew on the Y axis. If the second parameter is not given then a value
of 0 is used for the Y angle (ie. no skew on the Y axis).
<dt> <span class=prop-value>perspective(<length>)</span>
<dd> specifies a perspective projection matrix. This matrix maps a
<em>viewing cube</em> onto a pyramid whose base is infinitely far away
from the viewer and whose peak represents the viewer's position. The
viewable area is the region bounded by the four edges of the viewport
(the portion of the browser window used for rendering the webpage between
the viewer's position and a point at a distance of infinity from the
viewer). The <em>depth</em>, given as the parameter to the function,
represents the distance of the z=0 plane from the viewer. Lower values
give a more flattened pyramid and therefore a more pronounced perspective
effect. For example, a value of 1000px gives a moderate amount of
foreshortening and a value of 200px gives an extreme amount. The matrix
is computed by starting with an identity matrix and replacing the value
at row 3, column 4 with the value -1/depth. The value for depth must be
greater than zero, otherwise the function is invalid.
</dl>
<!-- ======================================================================================================= -->
<h2 id=animation><span class=secno>9. </span> Transitions and animations
between transform values</h2>
<p> When animating or transitioning the value of a transform property the
rules described below are applied. The ‘<code
class=property>from</code>’ transform is the transform at the start
of the transition or current keyframe. The ‘<code
class=property>end</code>’ transform is the transform at the end of
the transition or current keyframe.
<ul>
<li> If the ‘<code class=property>from</code>’ and
‘<code class=property>to</code>’ transforms are both single
functions of the same type:
<ul>
<li> For translate, translate3d, translateX, translateY, translateZ,
scale, scale3d, scaleX, scaleY, scaleZ, rotate, rotateX, rotateY,
rotateZ, skewX and skewY functions:
<ul>
<li> the individual components of the function are interpolated
numerically.
</ul>
<li> For perspective, matrix, matrix3d and rotate3d:
<ul>
<li> the values are first converted to a 4x4 matrix, then decomposed
using <a href="http://tog.acm.org/GraphicsGems/gemsii/unmatrix.c">the
method described by unmatrix</a> into separate translation, scale,
rotation, skew and perspective matrices, then each decomposed matrix
is interpolated numerically, and finally combined in order to produce
a resulting 4x4 matrix.
</ul>
</ul>
<li> If both the ‘<code class=property>from</code>’ and
‘<code class=property>to</code>’ transforms are "none":
<ul>
<li> There is no interpolation necessary
</ul>
<li> If one of the ‘<code class=property>from</code>’ or
‘<code class=property>to</code>’ transforms is "none":
<ul>
<li> The ‘<code class=property>none</code>’ is replaced by
an equivalent identity function list for the corresponding transform
function list.
<p> For example, if the ‘<code class=property>from</code>’
transform is "scale(2)" and the ‘<code
class=property>to</code>’ transform is "none" then the value
"scale(1)" will be used as the ‘<code
class=property>to</code>’ value, and animation will proceed
using the rule above. Similarly, if the ‘<code
class=property>from</code>’ transform is "none" and the
‘<code class=property>to</code>’ transform is "scale(2)
rotate(50deg)" then the animation will execute as if the ‘<code
class=property>from</code>’ value is "scale(1) rotate(0)".</p>
<p> The identity functions are translate(0), translate3d(0, 0, 0),
translateX(0), translateY(0), translateZ(0), scale(1), scale3d(1, 1,
1), scaleX(1), scaleY(1), scaleZ(1), rotate(0), rotate3d(1, 1, 1, 0),
rotateX(0), rotateY(0), rotateZ(0), skewX(0), skewY(0), matrix(1, 0,
0, 1, 0, 0) and matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0,
1).</p>
</ul>
<li> If both the ‘<code class=property>from</code>’ and
‘<code class=property>to</code>’ transforms have the same
number of transform functions and corresponding functions in each
transform list are of the same type:
<ul>
<li> Each transform function is animated with its corresponding
destination function in isolation using the rules described above. The
individual values are then applied as a list to produce resulting
transform value.
</ul>
<li> Otherwise:
<ul>
<li> The transform function lists are each converted into the equivalent
matrix3d value and animation proceeds using the rule for a single
function above.
</ul>
</ul>
<!-- ======================================================================================================= -->
<h2 id=rendering-3d><span class=secno>10. </span> Rendering in 3d</h2>
<p> Since CSS only describes a flat rendering model, without perspective,
and where everything faces the viewer front on, once three-dimensional
transforms are supported it is necessary to describe how an element should
be drawn in different orientations.
<p> While CSS specifies a rendering order for properties, such as
background, border and content, this rendering order does not imply any
three-dimensional structure. That is, if an element is rotated so that its
back face is facing the user, it will appear like a mirrored version of
the front face. In other words, the transforms are applied to the rendered
version of the elements, as if the element is rendered into an offscreen
buffer, and that buffer is transformed and composited onto the page.</p>
<!-- ======================================================================================================= -->
<h2 id=dom-interfaces><span class=secno>11. </span> DOM Interfaces</h2>
<p> This section describes the interfaces and functionality added to the
DOM to support runtime access to the functionality described above.</p>
<!-- ============================================================ -->
<h3 id=cssmatrix-interface><span class=secno>11.1. </span> Extensions to
CSSMatrix</h3>
<dl>
<dt> <b>Interface <i><a id=DOM-CSSMatrix
name=DOM-CSSMatrix>CSSMatrix</a></i></b>
<dd>
<p> The following extends the <code>CSSMatrix</code> interface definition
specified in the CSS3 2D Transforms Module.</p>
<dl>
<dt> <b>IDL Definition</b>
<dd>
<div class=idl-code>
<pre>
[Supplemental] interface CSSMatrix {
attribute float m11;
attribute float m12;
attribute float m13;
attribute float m14;
attribute float m21;
attribute float m22;
attribute float m23;
attribute float m24;
attribute float m31;
attribute float m32;
attribute float m33;
attribute float m34;
attribute float m41;
attribute float m42;
attribute float m43;
attribute float m44;
CSSMatrix translate(in float x, in float y, optional in float z);
CSSMatrix scale(in float scaleX, optional in float scaleY, optional in float scaleZ);
CSSMatrix rotate(in float rotX, optional in float rotY, optional in float rotZ);
CSSMatrix rotateAxisAngle(in float x, in float y, in float z, in float angle);
};</pre>
</div>
<br>
</dd>
<!-- IDL -->
<dt> <b>Attributes</b>
<dd>
<dl>
<dt> <code class=attribute-name><a id=DOM-CSSMatrix-matrix
name=DOM-CSSMatrix-matrix>m11-m44</a></code> of type
<code>float</code>
<dd> Each of these attributes represents one of the values in the 4x4
matrix. For instance m12 represents the value in the 2nd column of
the first row.<br>
</dl>
</dd>
<!-- Attributes -->
<dt> <b>Methods</b>
<dd>
<dl><!-- ===================================================== -->
<dt> <code class=method-name><a id=DOM-CSSMatrix-translate
name=DOM-CSSMatrix-translate>translate</a></code>
<dd>
<div class=method> The <code>translate</code> method returns a new
matrix which is this matrix post multiplied by a translation matrix
containing the passed values. If the z component is undefined, a 0
value is used in its place. This matrix is not modified.
<div class=parameters> <b>Parameters</b>
<div class=paramtable>
<dl>
<dt> <code class=parameter-name>x</code> of type
<code>float</code>
<dd> The X component of the translation value.<br>
<dt> <code class=parameter-name>y</code> of type
<code>float</code>
<dd> The Y component of the translation value.<br>
<dt> <code class=parameter-name>z</code> of type
<code>float</code>
<dd> The (optional) Z component of the translation value.<br>
</dl>
</div>
</div>
<!-- parameters -->
<div class=return-value> <b>Return Value</b>
<div class=returnvalue>
<dl>
<dt> <code>CSSMatrix</code>