Skip to content

Commit 9dc1a1f

Browse files
committed
[css-transforms-1] Re-add math forumlas for translate, scale and rotate. #4077
1 parent b90ae6c commit 9dc1a1f

File tree

6 files changed

+4185
-5
lines changed

6 files changed

+4185
-5
lines changed

css-transforms-1/Overview.bs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,23 +1479,26 @@ One translation unit on a matrix is equivalent to 1 pixel in the local coordinat
14791479

14801480
<li id="TranslateDefined">
14811481
<p>
1482-
<!-- FIXME -->
14831482
A 2D translation with the parameters <em>tx</em> and <em>ty</em> is equivalent to a 3D translation where <em>tz</em> has zero as a value.
14841483

1484+
<img src="images/translate3d.png" alt="\begin{bmatrix} 1 & 0 & 0 & tx \\ 0 & 1 & 0 & ty \\ 0 & 0 & 1 & tz \\ 0 & 0 & 0 & 1 \end{bmatrix}" width="114" height="106">
14851485

14861486
<li id="ScaleDefined">
14871487
<p>
1488-
<!-- FIXME -->
14891488
A 2D scaling with the parameters <em>sx</em> and <em>sy</em> is equivalent to a 3D scale where <em>sz</em> has one as a value.
14901489

1490+
<img src="images/scale3d.png" alt="\begin{bmatrix} sx & 0 & 0 & 0 \\ 0 & sy & 0 & 0 \\ 0 & 0 & sz & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}" width="137" height="106">
14911491

14921492
<li id="RotateDefined">
14931493
<p>
1494-
<!-- FIXME -->
14951494
A 2D rotation with the parameter <em>alpha</em> is
1496-
equivalent to a 3D rotation
1497-
with vector [0,0,1] and parameter <em>alpha</em>.
1495+
equivalent to a 3D rotation with the vector [x,y,z] where <em>x</em> has zero as a value, <em>y</em> has zero as a value, <em>z</em> has one as a value, and the parameter <em>alpha</em>.
14981496

1497+
<img src="images/rotate3dmatrix.png" alt="\begin{bmatrix} 1 - 2 \cdot (y^2 + z^2) \cdot sq & 2 \cdot (x \cdot y \cdot sq - z \cdot sc) & 2 \cdot (x \cdot z \cdot sq + y \cdot sc) & 0 \\ 2 \cdot (x \cdot y \cdot sq + z \cdot sc) & 1 - 2 \cdot (x^2 + z^2) \cdot sq & 2 \cdot (y \cdot z \cdot sq - x \cdot sc) & 0 \\ 2 \cdot (x \cdot z \cdot sq - y \cdot sc) & 2 \cdot (y \cdot z \cdot sq + x \cdot sc) & 1 - 2 \cdot (x^2 + y^2) \cdot sq & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}" width="647" height="106">
1498+
1499+
where:
1500+
1501+
<img src="images/rotate3dvariables.png" alt="\newline sc = \sin (\alpha/2) \cdot \cos (\alpha/2) \newline sq = \sin^2 (\alpha/2)" width="221" height="50">
14991502

15001503
<li id="SkewDefined">
15011504
<p>
2.69 KB
Loading
1.07 KB
Loading

css-transforms-1/images/scale3d.png

883 Bytes
Loading
856 Bytes
Loading

0 commit comments

Comments
 (0)