Skip to content

Commit a903bf1

Browse files
committed
2011-07-24 dino@apple.com
- Boris feedback from 26 May 2011 - Transforms are composed matrix multiplications of the functions - Transforms apply to coordinate systems, not to elements - Elika feedback from 12 May - examples for scale and rotate - Boris feedback from 15 April - typo in matrix recomposition
1 parent ef12040 commit a903bf1

File tree

3 files changed

+86
-57
lines changed

3 files changed

+86
-57
lines changed

css3-2d-transforms/ChangeLog

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
1+
2011-07-24 dino@apple.com
2+
3+
- Boris feedback from 26 May 2011
4+
- Transforms are composed matrix multiplications of the functions
5+
- Transforms apply to coordinate systems, not to elements
6+
- Elika feedback from 12 May
7+
- examples for scale and rotate
8+
- Boris feedback from 15 April
9+
- typo in matrix recomposition
10+
111
2011-04-14 eoconnor@apple.com
2-
- Added myself to authors
3-
- Removed rotateX(0) & rotateY(0) from list of identity functions (thanks
4-
to Boris Zbarsky for catching this)
12+
13+
- Added myself to authors
14+
- Removed rotateX(0) & rotateY(0) from list of identity functions (thanks
15+
to Boris Zbarsky for catching this)
516

617
2011-04-01 eoconnor@apple.com
7-
- Clarified that tranforms do not apply to inlines which may be split
8-
into multiple boxes.
18+
19+
- Clarified that tranforms do not apply to inlines which may be split
20+
into multiple boxes.
921

1022
2011-03-21 simon.fraser@apple.com
11-
- Removed "Module Level 3" from the title.
23+
24+
- Removed "Module Level 3" from the title.
1225

13-
2010-05-3 simon.fraser@apple.com
26+
2010-05-03 simon.fraser@apple.com
1427

1528
- Added myself to authors
1629
- Obfuscated email addresses slightly to reduce spam.

css3-2d-transforms/Overview.html

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121

2222
<h1>CSS 2D Transforms</h1>
2323

24-
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 14 April 2011</h2>
24+
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 24 July 2011</h2>
2525

2626
<dl>
2727
<dt>This version:
2828

2929
<dd> <a
30-
href="http://www.w3.org/TR/2011/ED-css3-2d-transforms-20110414">http://dev.w3.org/csswg/css3-2d-transforms/</a>
31-
<!--http://www.w3.org/TR/2011/WD-css3-2d-transforms-20110414-->
30+
href="http://www.w3.org/TR/2011/ED-css3-2d-transforms-20110724/">http://dev.w3.org/csswg/css3-2d-transforms/</a>
31+
<!--http://www.w3.org/TR/2011/WD-css3-2d-transforms-20110724-->
3232

3333
<dt>Latest version:
3434

@@ -211,12 +211,12 @@ <h2 id=introduction><span class=secno>1. </span>Introduction</h2>
211211
property establishes a new <em>local coordinate system</em> at the element
212212
that it is applied to. Transformations are cumulative. That is, elements
213213
establish their local coordinate system within the coordinate system of
214-
their parent. In this way, a <span class=prop-name>&lsquo;<a
215-
href="#effects"><code class=property>transform</code></a>&rsquo;</span>
216-
property effectively accumulates all the <span class=prop-name>&lsquo;<a
217-
href="#effects"><code class=property>transform</code></a>&rsquo;</span>
218-
properties of its ancestors. The accumulation of these transforms defines
219-
a <em>current transformation matrix (CTM)</em> for the element.
214+
their parent. From the perspective of the user, an element effectively
215+
accumulates all the <span class=prop-name>&lsquo;<a href="#effects"><code
216+
class=property>transform</code></a>&rsquo;</span> properties of its
217+
ancestors as well as any local transform applied to it. The accumulation
218+
of these transforms defines a <em>current transformation matrix (CTM)</em>
219+
for the element.
220220

221221
<p> The transform property does not affect the flow of the content
222222
surrounding the transformed element. However, the value of the overflow
@@ -271,13 +271,15 @@ <h2 id=transform-property><span class=secno>2. </span> The <span
271271
class=prop-name>&lsquo;<a href="#effects"><code
272272
class=property>transform</code></a>&rsquo;</span> Property</h2>
273273

274-
<p> A two-dimensional transformation is applied to an element through the
275-
<span class=prop-name>&lsquo;<a href="#effects"><code
276-
class=property>transform</code></a>&rsquo;</span> property. This property
277-
contains a list of <a href="#transform-functions">transform functions</a>.
278-
The final transformation value for an element is obtained by performing a
279-
matrix concatenation of each entry in the list. The set of transform
280-
functions is similar to those allowed by SVG.
274+
<p> A two-dimensional transformation is applied to the coordinate system an
275+
element renders in through the <span class=prop-name>&lsquo;<a
276+
href="#effects"><code class=property>transform</code></a>&rsquo;</span>
277+
property. This property contains a list of <a
278+
href="#transform-functions">transform functions</a>. The final
279+
transformation value for a coordinate system is obtained by converting
280+
each function in the list to its corresponding matrix (either defined in
281+
this specification or by reference to the SVG specification), then
282+
multiplying the matrices.
281283

282284
<table class=propdef>
283285
<tbody>
@@ -329,13 +331,13 @@ <h2 id=transform-origin-property><span class=secno>3. </span> The <span
329331

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

340342
<p>If only one value is specified, the second value is assumed to be
341343
&lsquo;<code class=property>center</code>&rsquo;. If two values are given
@@ -458,7 +460,9 @@ <h2 id=transform-functions><span class=secno>4. </span> The Transformation
458460
href="http://www.w3.org/TR/SVG/coords.html#ScalingDefined">2D scale</a>
459461
operation by the [sx,sy] scaling vector described by the 2 parameters. If
460462
the second parameter is not provided, it is takes a value equal to the
461-
first.
463+
first. For example, scale(1, 1) would leave an element unchanged, while
464+
scale(2, 2) would cause it to appear twice as long in both the X and Y
465+
axes, or four times its typical geometric size.
462466

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

@@ -476,7 +480,9 @@ <h2 id=transform-functions><span class=secno>4. </span> The Transformation
476480
href="http://www.w3.org/TR/SVG/coords.html#RotationDefined">2D
477481
rotation</a> by the angle specified in the parameter about the origin of
478482
the element, as defined by the <a
479-
href="#transform-origin"><em>transform-origin</em></a> property.
483+
href="#transform-origin"><em>transform-origin</em></a> property. For
484+
example, rotate(90deg) would cause elements to appear rotated one-quarter
485+
of a turn in the clockwise direction.
480486

481487
<dt> <span class=prop-value>skewX(&lt;angle&gt;)</span>
482488

@@ -518,6 +524,11 @@ <h2 id=transform-values><span class=secno>5. </span> Transform Values and
518524
&lt;/div&gt;
519525
</pre>
520526

527+
<p> That is, in the absence of other styling that affects position and
528+
dimensions, a nested set of transforms is equivalent to a single list of
529+
transform functions, applied from the outside in. The resulting transform
530+
is the matrix multiplication of the list of transforms.
531+
521532
<div class=example>
522533
<pre>
523534
div {
@@ -850,8 +861,8 @@ <h3 id=recomposing-the-matrix><span class=secno>7.4. </span>Recomposing the
850861
s += " translate3d(" + translate[0] + ", " + translate[1] + ", " + translate[2] + ")";
851862

852863
s += " rotateX(" + rotate[0] + ")";
853-
s += " rotateY(" + rotate[0] + ")";
854-
s += " rotateZ(" + rotate[0] + ")";
864+
s += " rotateY(" + rotate[1] + ")";
865+
s += " rotateZ(" + rotate[2] + ")";
855866

856867
s += " matrix3d(1,0,0,0, 0,1,0,0, 0," + skew[2] + ",1,0, 0,0,0,1)";
857868
s += " matrix3d(1,0,0,0, 0,1,0,0, " + skew[1] + ",0,1,0, 0,0,0,1)";
@@ -1280,7 +1291,7 @@ <h2 class=no-num id=property-index>Property index</h2>
12801291
<th>Media
12811292

12821293
<tbody>
1283-
<tr valign=baseline>
1294+
<tr>
12841295
<td><a class=property href="#effects">transform</a>
12851296

12861297
<td>none | &lt;transform-function&gt; [ &lt;transform-function&gt; ]*
@@ -1295,7 +1306,7 @@ <h2 class=no-num id=property-index>Property index</h2>
12951306

12961307
<td>visual
12971308

1298-
<tr valign=baseline>
1309+
<tr>
12991310
<td><a class=property href="#transform-origin">transform-origin</a>
13001311

13011312
<td>[ top | bottom ] | [ &lt;percentage> | &lt;length&gt; | left |

css3-2d-transforms/Overview.src.html

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,13 @@ <h2>Introduction</h2>
9393
multiple inline-level boxes.
9494
</p>
9595
<p>
96-
Specifying a value other than 'none' for the <span
97-
class="prop-name">'transform'</span> property establishes a new
98-
<em>local coordinate system</em> at the element that it is applied to.
99-
Transformations are cumulative. That is, elements establish their local
100-
coordinate system within the coordinate system of their parent. In this
101-
way, a <span class="prop-name">'transform'</span> property effectively
102-
accumulates all the <span class="prop-name">'transform'</span>
103-
properties of its ancestors. The accumulation of these transforms
104-
defines a <em>current transformation matrix (CTM)</em> for the element.
96+
Specifying a value other than 'none' for the <span class="prop-name">'transform'</span>
97+
property establishes a new <em>local coordinate system</em> at the element that it is
98+
applied to. Transformations are cumulative. That is, elements establish their local
99+
coordinate system within the coordinate system of their parent. From the perspective of the
100+
user, an element effectively accumulates all the <span class="prop-name">'transform'</span>
101+
properties of its ancestors as well as any local transform applied to it. The accumulation
102+
of these transforms defines a <em>current transformation matrix (CTM)</em> for the element.
105103
</p>
106104
<p>
107105
The transform property does not affect the flow of the content
@@ -159,12 +157,14 @@ <h2 id="transform-property">
159157
The <span class="prop-name">'transform'</span> Property
160158
</h2>
161159
<p>
162-
A two-dimensional transformation is applied to an element through the <span
160+
A two-dimensional transformation is applied to the coordinate system an element
161+
renders in through the <span
163162
class="prop-name">'transform'</span> property. This property contains a
164163
list of <a href="#transform-functions">transform functions</a>. The
165-
final transformation value for an element is obtained by performing a
166-
matrix concatenation of each entry in the list. The set of transform
167-
functions is similar to those allowed by SVG.
164+
final transformation value for a coordinate system is obtained by converting
165+
each function in the list to its corresponding matrix (either defined in
166+
this specification or by reference to the SVG specification), then multiplying
167+
the matrices.
168168
</p>
169169
<table class="propdef">
170170
<tbody>
@@ -239,12 +239,12 @@ <h2 id="transform-origin-property">
239239
</h2>
240240
<p>
241241
The <span class="prop-name">'transform-origin'</span> property
242-
establishes the origin of transformation for an element. This property
243-
is applied by first translating the element by the negated value of the
244-
property, then applying the element's transform, then translating by the
242+
establishes the origin of transformation for a coordinate system. This property
243+
is applied by first translating the element's coordinate system by the negated value of the
244+
property, then applying the local transform, then translating by the
245245
property value. This effectively moves the desired transformation origin
246246
of the element to (0,0) in the local coordinate system, then applies
247-
the element's transform, then moves the element back to its original
247+
the local transform, then moves the element back to its original
248248
position.
249249
</p>
250250

@@ -386,7 +386,8 @@ <h2 id="transform-functions">
386386
<span class="prop-value">scale(&lt;number&gt;[, &lt;number&gt;])</span>
387387
</dt>
388388
<dd>
389-
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.
389+
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
390+
and Y axes, or four times its typical geometric size.
390391
</dd>
391392
<dt>
392393
<span class="prop-value">scaleX(&lt;number&gt;)</span>
@@ -404,7 +405,8 @@ <h2 id="transform-functions">
404405
<span class="prop-value">rotate(&lt;angle&gt;)</span>
405406
</dt>
406407
<dd>
407-
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 <em>transform-origin</em> property.
408+
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 <em>transform-origin</em> property. For example, rotate(90deg) would cause elements to appear
409+
rotated one-quarter of a turn in the clockwise direction.
408410
</dd>
409411
<dt>
410412
<span class="prop-value">skewX(&lt;angle&gt;)</span>
@@ -441,6 +443,9 @@ <h2 id="transform-values">
441443
&lt;/div&gt;
442444
&lt;/div&gt;
443445
</pre>
446+
<p>
447+
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.
448+
</p>
444449
<div class="example">
445450
<pre>
446451
div {
@@ -785,8 +790,8 @@ <h3>Recomposing the matrix</h3>
785790
s += " translate3d(" + translate[0] + ", " + translate[1] + ", " + translate[2] + ")";
786791

787792
s += " rotateX(" + rotate[0] + ")";
788-
s += " rotateY(" + rotate[0] + ")";
789-
s += " rotateZ(" + rotate[0] + ")";
793+
s += " rotateY(" + rotate[1] + ")";
794+
s += " rotateZ(" + rotate[2] + ")";
790795

791796
s += " matrix3d(1,0,0,0, 0,1,0,0, 0," + skew[2] + ",1,0, 0,0,0,1)";
792797
s += " matrix3d(1,0,0,0, 0,1,0,0, " + skew[1] + ",0,1,0, 0,0,0,1)";

0 commit comments

Comments
 (0)