Skip to content

Commit 09ed056

Browse files
committed
[css-transforms-2] Add x/y/z keywords to rotate, and allow axis/angle to be specified in either order. Elaborate on when it's a 2d vs 3d transform officially, and add a note making it clearer.
1 parent 1735ee0 commit 09ed056

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

css-transforms-2/Overview.bs

+21-6
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ Unspecified translations default to ''0px''.
559559

560560
<pre class="propdef">
561561
Name: rotate
562-
Value: none | <<number>>{3}? <<angle>>
562+
Value: none | [ x | y | z | <<number>>{3} ]? && <<angle>>
563563
Initial: none
564564
Applies to: <a>transformable elements</a>
565565
Inherited: no
@@ -568,11 +568,26 @@ Animatable: as SLERP
568568
</pre>
569569

570570
The 'rotate' property accepts an angle to rotate an element,
571-
and optionally an axis to rotate it around,
572-
specified as the X, Y, and Z lengths of an origin-anchored vector.
573-
If the axis is unspecified,
574-
it defaults to ''0 0 1'',
575-
causing a "2d rotation" in the plane of the screen.
571+
and optionally an axis to rotate it around.
572+
573+
If the axis is omitted, this specifies a 2d rotation,
574+
equivalent to the ''rotate()'' function.
575+
576+
Otherwise, it specifies a 3d rotation:
577+
if <dfn value for=rotate>x</dfn>,
578+
<dfn value for=rotate>y</dfn>,
579+
or <dfn value for=rotate>z</dfn> is given,
580+
it specifies a rotation around that axis,
581+
equivalent to the ''rotateX()''/etc 3d transform functions.
582+
Alternately, the axis can be specified explicitly
583+
by giving three numbers
584+
representing the x, y, and z components of an origin-centered vector,
585+
equivalent to the ''rotate3d()'' function.
586+
587+
Note: While ''rotate: 30deg;'' and ''rotate: z 30deg;'' technically specify the same rotation,
588+
the first declaration is a 2d transform equivalent to ''transform: rotate(30deg);'',
589+
while the second is a 3d transform equivalent to ''transform: rotateZ(30deg);'',
590+
which can have additional side-effects in UAs.
576591

577592
<pre class="propdef">
578593
Name: scale

0 commit comments

Comments
 (0)