Skip to content

Commit 7b5fc29

Browse files
authored
Merge pull request #4316 from w3c/transform-math-desc
[css-transforms-1] Re-add math formulae for translate, scale and rota…
2 parents 97cf85c + 9dc1a1f commit 7b5fc29

File tree

6 files changed

+4185
-5
lines changed

6 files changed

+4185
-5
lines changed

css-transforms-1/Overview.bs

+8-5
Original file line numberDiff line numberDiff line change
@@ -1388,23 +1388,26 @@ One translation unit on a matrix is equivalent to 1 pixel in the local coordinat
13881388

13891389
<li id="TranslateDefined">
13901390
<p>
1391-
<!-- FIXME -->
13921391
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.
13931392

1393+
<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">
13941394

13951395
<li id="ScaleDefined">
13961396
<p>
1397-
<!-- FIXME -->
13981397
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.
13991398

1399+
<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">
14001400

14011401
<li id="RotateDefined">
14021402
<p>
1403-
<!-- FIXME -->
14041403
A 2D rotation with the parameter <em>alpha</em> is
1405-
equivalent to a 3D rotation
1406-
with vector [0,0,1] and parameter <em>alpha</em>.
1404+
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>.
14071405

1406+
<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">
1407+
1408+
where:
1409+
1410+
<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">
14081411

14091412
<li id="SkewDefined">
14101413
<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)