index.html 44.5 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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html lang=en>
 <head>
  <title>CSS 2D 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-WD.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 2D Transforms</h1>

   <h2 class="no-num no-toc" id=longstatus-date>W3C Working Draft 15 December
    2011</h2>

   <dl>
    <dt>This version:

    <dd> <a
     href="http://www.w3.org/TR/2011/WD-css3-2d-transforms-20111215/"><!--http://dev.w3.org/csswg/css3-2d-transforms/-->
     http://www.w3.org/TR/2011/WD-css3-2d-transforms-20111215/</a>

    <dt>Latest version:

    <dd><a
     href="http://www.w3.org/TR/css3-2d-transforms/">http://www.w3.org/TR/css3-2d-transforms/</a>
     

    <dt>Previous version:

    <dd><a href="http://www.w3.org/TR/2009/WD-css3-2d-transforms-20091201/">
     http://www.w3.org/TR/2009/WD-css3-2d-transforms-20091201/</a>

    <dt id=editors-list>Editors:

    <dd>Simon Fraser (<a href="http://www.apple.com/">Apple Inc</a>)
     &lt;simon.fraser &#64;apple.com&gt;

    <dd>Dean Jackson (<a href="http://www.apple.com/">Apple Inc</a>) &lt;dino
     &#64;apple.com&gt;

    <dd>David Hyatt (<a href="http://www.apple.com/">Apple Inc</a>) &lt;hyatt
     &#64;apple.com&gt;

    <dd>Chris Marrin (<a href="http://www.apple.com/">Apple Inc</a>)
     &lt;cmarrin &#64;apple.com&gt;

    <dd>Edward O'Connor (<a href="http://www.apple.com/">Apple Inc</a>)
     &lt;eoconnor &#64;apple.com&gt;
   </dl>
   <!--begin-copyright-->
   <p class=copyright><a
    href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
    rel=license>Copyright</a> &copy; 2011 <a
    href="http://www.w3.org/"><acronym
    title="World Wide Web Consortium">W3C</acronym></a><sup>&reg;</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 2D Transforms allows elements rendered by CSS to be transformed in
   two-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><em>This section describes the status of this document at the time of
   its publication. Other documents may supersede this document. A list of
   current W3C publications and the latest revision of this technical report
   can be found in the <a href="http://www.w3.org/TR/">W3C technical reports
   index at http://www.w3.org/TR/.</a></em>

  <p>Publication as a Working Draft does not imply endorsement by the W3C
   Membership. This is a draft document and may be updated, replaced or
   obsoleted by other documents at any time. It is inappropriate to cite this
   document as other than 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 &#8220;css3-2d-transforms&#8221; in the subject, preferably like
   this: &#8220;[<!---->css3-2d-transforms<!---->] <em>&hellip;summary of
   comment&hellip;</em>&#8221;

  <p>This document was produced by the <a
   href="http://www.w3.org/Style/CSS/members">CSS Working Group</a> (part of
   the <a href="http://www.w3.org/Style/">Style Activity</a>).

  <p>This document was produced by a group operating under the <a
   href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February
   2004 W3C Patent Policy</a>. W3C maintains a <a
   href="http://www.w3.org/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="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
   Claim(s)</a> must disclose the information in accordance with <a
   href="http://www.w3.org/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> is
   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>&lsquo;<code
    class=property>transform</code>&rsquo;</span> Property </a>

   <li><a href="#transform-origin-property"><span class=secno>3. </span> The
    <span class=prop-name>&lsquo;<code
    class=property>transform-origin</code>&rsquo;</span> Property </a>

   <li><a href="#transform-functions"><span class=secno>4. </span> The
    Transformation Functions </a>

   <li><a href="#transform-values"><span class=secno>5. </span> Transform
    Values and Lists </a>

   <li><a href="#animation"><span class=secno>6. </span> Transitions and
    animations between transform values </a>

   <li><a href="#matrix-decomposition"><span class=secno>7. </span> Matrix
    decomposition for animation </a>
    <ul class=toc>
     <li><a href="#unmatrix"><span class=secno>7.1. </span>Unmatrix</a>

     <li><a href="#animating-the-components"><span class=secno>7.2.
      </span>Animating the components</a>

     <li><a href="#recomposing-the-matrix"><span class=secno>7.3.
      </span>Recomposing the matrix</a>
    </ul>

   <li><a href="#dom-interfaces"><span class=secno>8. </span> DOM Interfaces
    </a>
    <ul class=toc>
     <li><a href="#cssmatrix-interface"><span class=secno>8.1. </span>
      CSSMatrix </a>
    </ul>

   <li><a href="#references"><span class=secno>9. </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> The CSS <a href="http://www.w3.org/TR/CSS2/visuren.html">visual
   formatting model</a> describes a coordinate system within which each
   element is positioned. Positions and sizes in this coordinate space can be
   thought of as being expressed in pixels, starting in the upper left corner
   of the parent with positive values proceeding to the right and down.

  <p> This coordinate space can be modified with the <span
   class=prop-name>&lsquo;<a href="#effects"><code
   class=property>transform</code></a>&rsquo;</span> property. Using
   transform, elements can be translated, rotated and scaled in two
   dimensional space. The coordinate space behaves as described in the <a
   href="http://www.w3.org/TR/SVG/coords.html#EstablishingANewUserSpace">coordinate
   system transformations</a> section of the SVG 1.1 specification. This is a
   coordinate system with two axes: the X axis increases horizontally to the
   right; the Y axis increases vertically downwards.

  <p> Transforms apply to block-level and atomic inline-level elements, but
   do not apply to elements which may be split into multiple inline-level
   boxes.

  <p> Specifying a value other than &lsquo;<code
   class=property>none</code>&rsquo; for the <span class=prop-name>&lsquo;<a
   href="#effects"><code class=property>transform</code></a>&rsquo;</span>
   property establishes a new <em>local coordinate system</em> at the element
   that it is applied to. Transformations are cumulative. That is, elements
   establish their local coordinate system within the coordinate system of
   their parent. From the perspective of the user, an element effectively
   accumulates all the <span class=prop-name>&lsquo;<a href="#effects"><code
   class=property>transform</code></a>&rsquo;</span> properties of its
   ancestors as well as any local transform applied to it. The accumulation
   of these transforms defines a <em>current transformation matrix (CTM)</em>
   for the element.

  <p> The transform property does not affect the flow of the content
   surrounding the transformed element. However, the value of the overflow
   area takes into account transformed elements. This behavior is similar to
   what happens when elements are translated via relative positioning.
   Therefore, if the value of the <span class=prop-name>&lsquo;<code
   class=property>overflow</code>&rsquo;</span> property is <span
   class=prop-value>&lsquo;<code class=property>scroll</code>&rsquo;</span>
   or <span class=prop-value>&lsquo;<code
   class=property>auto</code>&rsquo;</span>, scrollbars will appear as needed
   to see content that is transformed outside the visible area.

  <p> Any value other than &lsquo;<code class=property>none</code>&rsquo; for
   the transform results in the creation of both a stacking context and a
   containing block. The object acts as a containing block for fixed
   positioned descendants.

  <div class=issue> There are two roles for transformations in layout: (1)
   transformations that adjust the position of the affected content without
   changing the normal layout of that content (much like relative
   positioning) and (2) transformation of the content prior to layout that
   affects the layout of that content. See <a
   href="http://lists.w3.org/Archives/Public/www-style/2007Oct/0209">http://lists.w3.org/Archives/Public/www-style/2007Oct/0209</a>
   for examples of both cases. The "transform" property (as defined in this
   document) is equally useful for both roles. This document is focused on
   satisfying the first role. There is, however, an architectural question
   that arises because there needs to be a way to distinguish which role an
   author of a stylesheet wants. The key question is which is the default
   behavior/role for the "transform" property and how is the other
   behavior/role indicated by a stylesheet author. If you have an opinion on
   this topic, please send feedback.</div>

  <div class=issue> What do fixed backgrounds do in transforms? They should
   probably ignore the transform completely, since - even transformed - the
   object should be acting as "porthole" through which the fixed background
   can be viewed in its original form.</div>

  <div class=issue> This property should also be applicable to SVG elements.</div>

  <div class=issue> We also need to specify that SVG transforms *do* combine
   with this transform, e.g., if a &lt;foreignObject&gt; is inside
   transformed SVG and then defines a transform of its own. This means we may
   potentially have to examine the current SVG transform and combine with it
   to set the correct transform.</div>
  <!-- ======================================================================================================= -->

  <h2 id=transform-property><span class=secno>2. </span> The <span
   class=prop-name>&lsquo;<a href="#effects"><code
   class=property>transform</code></a>&rsquo;</span> Property</h2>

  <p> A two-dimensional transformation is applied to the coordinate system an
   element renders in through the <span class=prop-name>&lsquo;<a
   href="#effects"><code class=property>transform</code></a>&rsquo;</span>
   property. This property contains a list of <a
   href="#transform-functions">transform functions</a>. The final
   transformation value for a coordinate system is obtained by converting
   each function in the list to its corresponding matrix (either defined in
   this specification or by reference to the SVG specification), then
   multiplying the matrices.

  <table class=propdef>
   <tbody>
    <tr>
     <td> <em>Name:</em>

     <td> <dfn id=effects>transform</dfn>

    <tr>
     <td> <em>Value:</em>

     <td> none | &lt;transform-function&gt; [ &lt;transform-function&gt; ]*

    <tr>
     <td> <em>Initial:</em>

     <td> none

    <tr>
     <td> <em>Applies&nbsp;to:</em>

     <td> block-level and atomic inline-level elements

    <tr>
     <td> <em>Inherited:</em>

     <td> no

    <tr>
     <td> <em>Percentages:</em>

     <td> refer to the size of the element's border 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>&lsquo;<a href="#transform-origin"><code
   class=property>transform-origin</code></a>&rsquo;</span> Property</h2>

  <p> The <span class=prop-name>&lsquo;<a href="#transform-origin"><code
   class=property>transform-origin</code></a>&rsquo;</span> property
   establishes the origin of transformation for a coordinate system. This
   property is applied by first translating the element's coordinate system
   by the negated value of the property, then applying the local transform,
   then translating by the property value. This effectively moves the desired
   transformation origin of the element to (0,0) in the local coordinate
   system, then applies the local transform, then moves the element back to
   its original position.

  <p>If only one value is specified, the second value is assumed to be
   &lsquo;<code class=property>center</code>&rsquo;. If two values are given
   and at least one value is not a keyword, then the first value represents
   the horizontal position (or offset) and the second represents the vertical
   position (or offset). <var>&lt;percentage&gt;</var> and
   <var>&lt;length&gt;</var> values here represent an offset of the transform
   origin from the top left corner of the element's border box.

  <p>If three or four values are given, then each
   <var>&lt;percentage&gt;</var> or<var>&lt;length&gt;</var> represents an
   offset and must be preceded by a keyword, which specifies from which edge
   the offset is given. For example, &lsquo;<code class=css>transform-origin:
   bottom 10px right 20px</code>&rsquo; represents a &lsquo;<code
   class=css>10px</code>&rsquo; vertical offset up from the bottom edge and a
   &lsquo;<code class=css>20px</code>&rsquo; horizontal offset leftward from
   the right edge. If three values are given, the missing offset is assumed
   to be zero.

  <p>Positive values represent an offset <em>inward</em> from the edge of the
   border box. Negative values represent an offset <em>outward</em> from the
   edge of the border box.

  <table class=propdef>
   <tbody>
    <tr>
     <td> <em>Name:</em>

     <td> <dfn id=transform-origin>transform-origin</dfn>

    <tr>
     <td> <em>Value:</em>

     <td> [ top | bottom ] |<br>
      [ &lt;percentage> | &lt;length&gt; | left | center | right ] [
      &lt;percentage> | &lt;length&gt; | top | center | bottom ]? |<br>
      [ center | [ left | right ] [ &lt;percentage> | &lt;length&gt; ]? ]
      &amp;&amp; [ center | [ top | bottom ] [ &lt;percentage> |
      &lt;length&gt; ]? ]<br>

    <tr>
     <td> <em>Initial:</em>

     <td> 50% 50%

    <tr>
     <td> <em>Applies&nbsp;to:</em>

     <td> block-level and atomic inline-level elements

    <tr>
     <td> <em>Inherited:</em>

     <td> no

    <tr>
     <td> <em>Percentages:</em>

     <td> refer to the size of the element's border box

    <tr>
     <td> <em>Media:</em>

     <td> visual

    <tr>
     <td> <em>Computed value:</em>

     <td> For &lt;length&gt; the absolute value, otherwise a percentage
  </table>
  <!-- ======================================================================================================= -->

  <h2 id=transform-functions><span class=secno>4. </span> The Transformation
   Functions</h2>

  <p> The value of the <a class=prop-name href="#effects">transform</a>
   property is a list of &lt;transform-functions&gt; applied in the order
   provided. The individual transform functions are separated by whitespace.
   The set of allowed transform functions is given below. In this list the
   type &lt;translation-value&gt; is defined as a &lt;length&gt; or
   &lt;percentage&gt; value, and the &lt;angle&gt; 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(&lt;number&gt;, &lt;number&gt;,
    &lt;number&gt;, &lt;number&gt;, &lt;number&gt;, &lt;number&gt;)</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 applying the
    transformation matrix <strong>[a b c d e f]</strong>.

   <dt> <span class=prop-value>translate(&lt;translation-value&gt;[,
    &lt;translation-value&gt;])</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>&lt;ty&gt;</em> is not provided, ty
    has zero as a value.

   <dt> <span class=prop-value>translateX(&lt;translation-value&gt;)</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(&lt;translation-value&gt;)</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>scale(&lt;number&gt;[, &lt;number&gt;])</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. For example, scale(1, 1) would leave an element unchanged, while
    scale(2, 2) would cause it to appear twice as long in both the X and Y
    axes, or four times its typical geometric size.

   <dt> <span class=prop-value>scaleX(&lt;number&gt;)</span>

   <dd> specifies a scale operation using the [sx,1] scaling vector, where sx
    is given as the parameter.

   <dt> <span class=prop-value>scaleY(&lt;number&gt;)</span>

   <dd> specifies a scale operation using the [1,sy] scaling vector, where sy
    is given as the parameter.

   <dt> <span class=prop-value>rotate(&lt;angle&gt;)</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. For
    example, rotate(90deg) would cause elements to appear rotated one-quarter
    of a turn in the clockwise direction.

   <dt> <span class=prop-value>skewX(&lt;angle&gt;)</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(&lt;angle&gt;)</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.
  </dl>

  <h2 id=transform-values><span class=secno>5. </span> Transform Values and
   Lists</h2>

  <p> The &lt;translation-value&gt; values are defined as [&lt;percentage&gt;
   | &lt;length&gt;]. All other value types are described <a
   href="http://www.w3.org/TR/CSS2/syndata.html#values">as CSS types</a>. If
   a list of transforms is provided, then the net effect is as if each
   transform had been specified separately in the order provided. For
   example,

  <pre>
  &lt;div style="transform:translate(-10px,-20px) scale(2) rotate(45deg) translate(5px,10px)"/&gt;
  </pre>

  <p> is functionally equivalent to:

  <pre>
  &lt;div style="transform:translate(-10px,-20px)"&gt;
    &lt;div style="transform:scale(2)"&gt;
      &lt;div style="transform:rotate(45deg)"&gt;
        &lt;div style="transform:translate(5px,10px)"&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </pre>

  <p> That is, in the absence of other styling that affects position and
   dimensions, a nested set of transforms is equivalent to a single list of
   transform functions, applied from the outside in. The resulting transform
   is the matrix multiplication of the list of transforms.

  <div class=example>
   <pre>
  div {
      transform: translate(100px, 100px);
  }
  </pre>
   Move the element by 100 pixels in both the X and Y directions.
   <div class=figure> <img alt="The 100px translation in X and Y"
    src=transform1.png></div>
  </div>

  <div class=example>
   <pre>
  div {
      height: 100px; width: 100px;
      transform: translate(80px, 80px) scale(1.5, 1.5) rotate(45deg);
  }
  </pre>
   Move the element by 80 pixels in both the X and Y directions, then scale
   the element by 150%, then rotate it 45 degrees clockwise about the Z axis.
   Note that the scale and rotate operate about the center of the element,
   since the element has the default transform-origin of 50% 50%.
   <div class=figure> <img alt="The transform specified above"
    src="compound_transform.png"></div>
  </div>
  <!-- ======================================================================================================= -->

  <h2 id=animation><span class=secno>6. </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 &lsquo;<code
   class=property>from</code>&rsquo; transform is the transform at the start
   of the transition or current keyframe. The &lsquo;<code
   class=property>end</code>&rsquo; transform is the transform at the end of
   the transition or current keyframe.

  <p class=note> See <a
   href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=14715">the currently
   open issue</a> on what "of the same type" means.

  <ul>
   <li> If the &lsquo;<code class=property>from</code>&rsquo; and
    &lsquo;<code class=property>to</code>&rsquo; transforms are both single
    functions of the same type:
    <ul>
     <li> For translate, translateX, translateY, scale, scaleX, scaleY,
      rotate, skew, skewX and skewY functions:
      <ul>
       <li> the individual components of the function are interpolated
        numerically.
      </ul>

     <li> For matrix:
      <ul>
       <li> the matrix is decomposed using <a
        href="http://tog.acm.org/resources/GraphicsGems/gemsii/unmatrix.c">the
        method described by unmatrix</a> into separate translation, scale,
        rotation and skew matrices, then each decomposed matrix is
        interpolated numerically, and finally combined in order to produce a
        resulting 3x2 matrix.
      </ul>
    </ul>

   <li> If both the &lsquo;<code class=property>from</code>&rsquo; and
    &lsquo;<code class=property>to</code>&rsquo; transforms are "none":
    <ul>
     <li> There is no interpolation necessary
    </ul>

   <li> If one of the &lsquo;<code class=property>from</code>&rsquo; or
    &lsquo;<code class=property>to</code>&rsquo; transforms is "none":
    <ul>
     <li> The &lsquo;<code class=property>none</code>&rsquo; is replaced by
      an equivalent identity function list for the corresponding transform
      function list.
      <p> For example, if the &lsquo;<code class=property>from</code>&rsquo;
       transform is "scale(2)" and the &lsquo;<code
       class=property>to</code>&rsquo; transform is "none" then the value
       "scale(1)" will be used as the &lsquo;<code
       class=property>to</code>&rsquo; value, and animation will proceed
       using the rule above. Similarly, if the &lsquo;<code
       class=property>from</code>&rsquo; transform is "none" and the
       &lsquo;<code class=property>to</code>&rsquo; transform is "scale(2)
       rotate(50deg)" then the animation will execute as if the &lsquo;<code
       class=property>from</code>&rsquo; value is "scale(1) rotate(0)".</p>

      <p> The identity functions are translate(0), translateX(0),
       translateY(0), scale(1), scaleX(1), scaleY(1), rotate(0), skewX(0),
       skewY(0) and matrix(1, 0, 0, 1, 0, 0).</p>
    </ul>

   <li> If both the &lsquo;<code class=property>from</code>&rsquo; and
    &lsquo;<code class=property>to</code>&rsquo; 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
      matrix value and animation proceeds using the rule for a single
      function above.
    </ul>
  </ul>

  <p> In some cases, an animation might cause a transformation matrix to be
   singular or non-invertible. For example, an animation in which scale moves
   from 1 to -1. At the time when the matrix is in such a state, the
   transformed element is not rendered.

  <h2 id=matrix-decomposition><span class=secno>7. </span> Matrix
   decomposition for animation</h2>

  <p> When interpolating between 2 matrices, each is decomposed into the
   corresponding translation, rotation, scale and skew values. Not all
   matrices can be accurately described by these values. Those that can't are
   decomposed into the most accurate representation possible, using the
   technique below. This technique is taken from The "unmatrix" method in
   "Graphics Gems II, edited by Jim Arvo", simplified for the 2D case.

  <h3 id=unmatrix><span class=secno>7.1. </span>Unmatrix</h3>

  <pre>
  Input:  a, b, c, d ; 2x2 matrix (rotate, scale, shear) components
          tx, ty     ; translation components
  Output: translate  ; a 2 component vector
          rotate     ; an angle
          scale      ; a 2 component vector
          skew       ; skew factor
  Returns false if the matrix cannot be decomposed, true if it can
  
  Supporting functions (point is a 2 component vector):
    float  length(point)                returns the length of the passed vector
    point  normalize(point)             normalizes the length of the passed point to 1
    float  dot(point, point)            returns the dot product of the passed points
    float  atan2(float y, float x)      returns the principal value of the arc tangent of 
                                        y/x, using the signs of both arguments to determine 
                                        the quadrant of the return value

  Decomposition also makes use of the following function:
    point combine(point a, point b, float ascl, float bscl)
        result[0] = (ascl * a[0]) + (bscl * b[0])
        result[1] = (ascl * a[1]) + (bscl * b[1])
        return result

  // Make sure the matrix is invertible
  if ((a * d - b * c) == 0)
    return false
    
  // Take care of translation
  translate[0] = tx
  translate[1] = matrix[3][1]
  
  // Put the components into a 2x2 matrix 'mat'
  mat[0][0] = a
  mat[0][1] = b
  mat[1][0] = c
  mat[1][1] = d

  // Compute X scale factor and normalize first row.
  scale[0] = length(row[0])
  row[0] = normalize(row[0])

  // Compute shear factor and make 2nd row orthogonal to 1st.
  skew = dot(row[0], row[1])
  row[1] = combine(row[1], row[0], 1.0, -skew)

  // Now, compute Y scale and normalize 2nd row.
  scale[1] = length(row[1])
  row[1] = normalize(row[1])
  skew /= scale[1];

  // Now, get the rotation out
  rotate = atan2(mat[0][1], mat[0][0])

  return true;</pre>

  <h3 id=animating-the-components><span class=secno>7.2. </span>Animating the
   components</h3>

  <p> Once decomposed, each component of each returned value of the source
   matrix is linearly interpolated with the corresponding component of the
   destination matrix. For instance, the translate[0] and translate[1] values
   are interpolated numerically, and the result is used to set the
   translation of the animating element.

  <h3 id=recomposing-the-matrix><span class=secno>7.3. </span>Recomposing the
   matrix</h3>

  <p><em>This section is not normative.</em>

  <p> After interpolation the resulting values are used to position the
   element. One way to use these values is to recompose them into a 3x2
   matrix. This can be done using the Transformation Functions of the <a
   href="#effects"><em>transform</em></a> property. The following JavaScript
   example produces a string for this purpose. The values passed in are the
   output of the Unmatrix function above:

  <pre>
function compose(translate, rotate, scale, skew, elementID)
{
    var s = " translate(" + translate[0] + ", " + translate[1] + ")";
    s += " rotate(" + rotate + ")";
    s += " skewX(" + skew + ")";
    s += " scale(" + scale[0] + ", " + scale[1] + ")";
    document.getElementById(elementID).style.transform = s;
}</pre>

  <h2 id=dom-interfaces><span class=secno>8. </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.

  <h3 id=cssmatrix-interface><span class=secno>8.1. </span> CSSMatrix</h3>

  <dl>
   <dt> <b>Interface <i><a id=DOM-CSSMatrix
    name=DOM-CSSMatrix>CSSMatrix</a></i></b>

   <dd>
    <p> The <code>CSSMatrix</code> interface represents a 3x2 homogeneous
     matrix.</p>

    <div class=issue> We actually describe a 3x2 matrix here, similar to <a
     href="http://www.w3.org/TR/SVG/coords.html#InterfaceSVGMatrix">SVGMatrix</a>.
     </div>

    <dl>
     <dt> <b>IDL Definition</b>

     <dd>
      <div class=idl-code>
       <pre>
  interface CSSMatrix {
      attribute float a;
      attribute float b;
      attribute float c;
      attribute float d;
      attribute float e;
      attribute float f;

      void        setMatrixValue(in DOMString string) raises(DOMException);
      CSSMatrix   multiply(in CSSMatrix secondMatrix);
      CSSMatrix   inverse() raises(DOMException);
      CSSMatrix   translate(in float x, in float y);
      CSSMatrix   scale(in float scaleX, in float scaleY);
      CSSMatrix   skewX(in float angle);
      CSSMatrix   skewY(in float angle);
      CSSMatrix   rotate(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>a-f</a></code> of type <code>float</code>

       <dd> Each of these attributes represents one of the values in the 3x2
        matrix.<br>
      </dl>
     </dd>
     <!-- Attributes -->

     <dt> <b>Methods</b>

     <dd>
      <dl><!-- ===================================================== -->

       <dt> <code class=method-name><a id=DOM-CSSMatrix-setMatrixValue
        name=DOM-CSSMatrix-setMatrixValue>setMatrixValue</a></code>

       <dd>
        <div class=method> The <code>setMatrixValue</code> method replaces
         the existing matrix with one computed from parsing the passed string
         as though it had been assigned to the transform property in a CSS
         style rule.
         <div class=parameters> <b>Parameters</b>
          <div class=paramtable>
           <dl>
            <dt> <code class=parameter-name>string</code> of type
             <code>DOMString</code>

            <dd> The string to parse.<br>
           </dl>
          </div>
         </div>
         <!-- parameters -->
         <div class=return-value> <b>No Return Value</b></div>

         <div> <b>Exceptions</b>
          <div class=returnvalue>
           <dl>
            <dt> <code>DOMException SYNTAX_ERR</code>

            <dd> Thrown when the provided string can not be parsed into a
             CSSMatrix.
           </dl>
          </div>
         </div>
        </div>
       </dd>
       <!-- setMatrixValue -->
       <!-- ===================================================== -->

       <dt> <code class=method-name><a id=DOM-CSSMatrix-multiply
        name=DOM-CSSMatrix-multiply>multiply</a></code>

       <dd>
        <div class=method> The <code>multiply</code> method returns a new
         CSSMatrix which is the result of this matrix multiplied by the
         passed matrix, with the passed matrix to the right. This matrix is
         not modified.
         <div class=parameters> <b>Parameters</b>
          <div class=paramtable>
           <dl>
            <dt> <code class=parameter-name>secondMatrix</code> of type
             <code>CSSMatrix</code>

            <dd> The matrix to multiply.<br>
           </dl>
          </div>
         </div>
         <!-- parameters -->
         <div class=return-value> <b>Return Value</b>
          <div class=returnvalue>
           <dl>
            <dt> <code>CSSMatrix</code>

            <dd> The result matrix.<br>
           </dl>
          </div>
         </div>

         <div> <b>No Exceptions</b></div>
        </div>
       </dd>
       <!-- multiply() -->
       <!-- ===================================================== -->

       <dt> <code class=method-name><a id=DOM-CSSMatrix-inverse
        name=DOM-CSSMatrix-inverse>inverse</a></code>

       <dd>
        <div class=method> The <code>inverse</code> method returns a new
         matrix which is the inverse of this matrix. This matrix is not
         modified.
         <div class=parameters> <b>No Parameters</b></div>
         <!-- parameters -->
         <div class=return-value> <b>Return Value</b>
          <div class=returnvalue>
           <dl>
            <dt> <code>CSSMatrix</code>

            <dd> The inverted matrix.<br>
           </dl>
          </div>
         </div>

         <div> <b>Exceptions</b>
          <div class=returnvalue>
           <dl>
            <dt> <code>DOMException NOT_SUPPORTED_ERR</code>

            <dd> Thrown when the CSSMatrix can not be inverted.
           </dl>
          </div>
         </div>
        </div>
        <!-- ======================================================================================================= -->
        </dd>
       <!-- inverse() -->
       <!-- ===================================================== -->

       <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 multiplied by a translation matrix
         containing the passed values. 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>
           </dl>
          </div>
         </div>
         <!-- parameters -->
         <div class=return-value> <b>Return Value</b>
          <div class=returnvalue>
           <dl>
            <dt> <code>CSSMatrix</code>

            <dd> The result matrix.<br>
           </dl>
          </div>
         </div>

         <div> <b>No Exceptions</b></div>
        </div>
        <!-- ======================================================================================================= -->
        </dd>
       <!-- translate() -->
       <!-- ===================================================== -->

       <dt> <code class=method-name><a id=DOM-CSSMatrix-scale
        name=DOM-CSSMatrix-scale>scale</a></code>

       <dd>
        <div class=method> The <code>scale</code> method returns a new matrix
         which is this matrix multiplied by a scale matrix containing the
         passed values. If the y component is undefined, the x component
         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>scaleX</code> of type
             <code>float</code>

            <dd> The X component of the scale value.<br>

            <dt> <code class=parameter-name>scaleY</code> of type
             <code>float</code>

            <dd> The (optional) Y component of the scale value.<br>
           </dl>
          </div>
         </div>
         <!-- parameters -->
         <div class=return-value> <b>Return Value</b>
          <div class=returnvalue>
           <dl>
            <dt> <code>CSSMatrix</code>

            <dd> The result matrix.<br>
           </dl>
          </div>
         </div>

         <div> <b>No Exceptions</b></div>
        </div>
        <!-- ======================================================================================================= -->
        </dd>
       <!-- scale() -->
       <!-- ===================================================== -->

       <dt> <code class=method-name><a id=DOM-CSSMatrix-rotate
        name=DOM-CSSMatrix-rotate>rotate</a></code>

       <dd>
        <div class=method> The <code>rotate</code> method returns a new
         matrix which is this matrix multiplied by a <a
         href="http://www.w3.org/TR/SVG/coords.html#RotationDefined">rotation
         matrix</a>. The rotation value is in degrees. This matrix is not
         modified.
         <div class=parameters> <b>Parameters</b>
          <div class=paramtable>
           <dl>
            <dt> <code class=parameter-name>angle</code> of type
             <code>float</code>

            <dd> The angle of rotation.<br>
           </dl>
          </div>
         </div>
         <!-- parameters -->
         <div class=return-value> <b>Return Value</b>
          <div class=returnvalue>
           <dl>
            <dt> <code>CSSMatrix</code>

            <dd> The result matrix.<br>
           </dl>
          </div>
         </div>

         <div> <b>No Exceptions</b></div>
        </div>
        <!-- ======================================================================================================= -->
        </dd>
       <!-- rotate() -->
       <!-- ===================================================== -->

       <dt> <code class=method-name><a id=DOM-CSSMatrix-skew-x
        name=DOM-CSSMatrix-skew-x>skewX</a></code>

       <dd>
        <div class=method> The <code>skewX</code> method returns a new matrix
         which is this matrix multiplied by a matrix representing a <a
         href="http://www.w3.org/TR/SVG/coords.html#SkewXDefined">skew along
         the x-axis</a>. The rotation value is in degrees. This matrix is not
         modified.
         <div class=parameters> <b>Parameters</b>
          <div class=paramtable>
           <dl>
            <dt> <code class=parameter-name>angle</code> of type
             <code>float</code>

            <dd> The angle of skew along the X axis.<br>
           </dl>
          </div>
         </div>
         <!-- parameters -->
         <div class=return-value> <b>Return Value</b>
          <div class=returnvalue>
           <dl>
            <dt> <code>CSSMatrix</code>

            <dd> The result matrix.<br>
           </dl>
          </div>
         </div>

         <div> <b>No Exceptions</b></div>
        </div>
        <!-- ======================================================================================================= -->
        </dd>
       <!-- skewX() -->
       <!-- ===================================================== -->

       <dt> <code class=method-name><a id=DOM-CSSMatrix-skew-y
        name=DOM-CSSMatrix-skew-y>skewY</a></code>

       <dd>
        <div class=method> The <code>skewX</code> method returns a new matrix
         which is this matrix multiplied by a matrix representing a <a
         href="http://www.w3.org/TR/SVG/coords.html#SkewYDefined">skew along
         the y-axis</a>. The rotation value is in degrees. This matrix is not
         modified.
         <div class=parameters> <b>Parameters</b>
          <div class=paramtable>
           <dl>
            <dt> <code class=parameter-name>angle</code> of type
             <code>float</code>

            <dd> The angle of skew along the Y axis.<br>
           </dl>
          </div>
         </div>
         <!-- parameters -->
         <div class=return-value> <b>Return Value</b>
          <div class=returnvalue>
           <dl>
            <dt> <code>CSSMatrix</code>

            <dd> The result matrix.<br>
           </dl>
          </div>
         </div>

         <div> <b>No Exceptions</b></div>
        </div>
        <!-- ======================================================================================================= -->
        </dd>
       <!-- skewY() -->
      </dl>
      <!-- methods -->
    </dl>
   </dd>
   <!-- Interface CSSMatrix -->
  </dl>

  <p> In addition to the interface listed above, the
   <code>getComputedStyle</code> method of the <code>Window</code> object has
   been updated. The <a href="#effects"><code>transform</code></a> property
   of the style object returned by <code>getComputedStyle</code> contains a
   DOMString of the form "matrix(a, b, c, d, e, f)" representing the 3x2
   matrix that is the result of applying the individual functions listed in
   the <a href="#effects"><code>transform</code></a> property.

  <h2 id=references><span class=secno>9. </span>References</h2>

  <h3 class=no-num id=normative-references>Normative references</h3>
  <!--begin-normative-->
  <!-- Sorted by label -->

  <dl class=bibliography>
   <dt style="display: none"><!-- keeps the doc valid if the DL is empty -->
    <!---->
  </dl>
  <!--end-normative-->

  <h3 class=no-num id=other-references>Other references</h3>
  <!--begin-informative-->
  <!-- Sorted by label -->

  <dl class=bibliography>
   <dt style="display: none"><!-- keeps the doc valid if the DL is empty -->
    <!---->
  </dl>
  <!--end-informative-->

  <h2 class=no-num id=property-index>Property index</h2>
  <!--begin-properties-->

  <table class=proptable>
   <thead>
    <tr>
     <th>Property

     <th>Values

     <th>Initial

     <th>Applies&nbsp;to

     <th>Inh.

     <th>Percentages

     <th>Media

   <tbody>
    <tr>
     <th><a class=property href="#effects">transform</a>

     <td>none | &lt;transform-function&gt; [ &lt;transform-function&gt; ]*

     <td>none

     <td>block-level and atomic inline-level elements

     <td>no

     <td>refer to the size of the element's border box

     <td>visual

    <tr>
     <th><a class=property href="#transform-origin">transform-origin</a>

     <td>[ top | bottom ] | [ &lt;percentage> | &lt;length&gt; | left |
      center | right ] [ &lt;percentage> | &lt;length&gt; | top | center |
      bottom ]? | [ center | [ left | right ] [ &lt;percentage> |
      &lt;length&gt; ]? ] &amp;&amp; [ center | [ top | bottom ] [
      &lt;percentage> | &lt;length&gt; ]? ]

     <td>50% 50%

     <td>block-level and atomic inline-level elements

     <td>no

     <td>refer to the size of the element's border box

     <td>visual
  </table>
  <!--end-properties-->

  <h2 class=no-num id=index>Index</h2>
  <!--begin-index-->

  <ul class=indexlist>
   <li>transform, <a href="#effects" title=transform><strong>2.</strong></a>

   <li>transform-origin, <a href="#transform-origin"
    title=transform-origin><strong>3.</strong></a>
  </ul>
  <!--end-index-->
</html>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-default-doctype-name:"html"
sgml-minimize-attributes:t
End:
-->