Skip to content

Commit 8357b7b

Browse files
dirkschulzesvgeesus
authored andcommitted
'rotate' and 'rotateBy' should be pure 2D operations
1 parent 2027ddc commit 8357b7b

2 files changed

Lines changed: 27 additions & 5 deletions

File tree

matrix/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1+
2013-03-07 Dirk Schulze <dschulze@adobe.com>
2+
'rotate' and 'rotateBy' should be pure 2D operations.
3+
More detailed example for passing DOM string and stringifier.
4+
15
2013-03-07 Dirk Schulze <dschulze@adobe.com>
26
Fixed typos in defitnions.

matrix/index.html

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,18 @@ <h3>The constructors</h3>
149149
</dl>
150150
The DOMString must consist of a transform function list as specified by CSS Transforms.
151151
<div class='example'>
152+
<p>In the following example a CSS Transform string is passed to the Matrix constructor.</p>
152153
<pre><code>var matrix = new Matrix("translate(20px,20px), scale(2,3), rotate(45deg)"</code></pre>
154+
<p>The resulting matrix is equal to the following sequence of method calls:</p>
155+
<pre><code>
156+
var matrix = new Matrix();
157+
matrix.translateBy(20,20);
158+
matrix.scaleNonUniformBy(2,3);
159+
matrix.rotateBy(45);
160+
</code></pre>
153161
</div>
154162
<p class='issue'>Should it be postponed to avoid CSS3 Transforms dependency?</p>
163+
<p class='issue'>Should unit-less values (like for SVG transform presentation attribute) be allowed too? <code>"translate(20,20)"</code></p>
155164
</dd>
156165
<dt>Constructor()</dt>
157166
<dd>
@@ -412,8 +421,6 @@ <h3>Immutable transformation methods</h3>
412421
<dd>Transformation origin on the x-axis. Defaulting to 0.</dd>
413422
<dt>optional double y</dt>
414423
<dd>Transformation origin on the y-axis. Defaulting to 0.</dd>
415-
<dt>optional double z</dt>
416-
<dd>Transformation origin on the z-axis. Defaulting to 0.</dd>
417424
</dl>
418425
Post-multiplies a rotation transformation on the current matrix with the given origin and returns the resulting matrix. The current matrix is not modified.
419426
</dd>
@@ -579,8 +586,6 @@ <h3>Mutable transformation methods</h3>
579586
<dd>Transformation origin on the x-axis. Defaulting to 0.</dd>
580587
<dt>optional double y</dt>
581588
<dd>Transformation origin on the y-axis. Defaulting to 0.</dd>
582-
<dt>optional double z</dt>
583-
<dd>Transformation origin on the z-axis. Defaulting to 0.</dd>
584589
</dl>
585590
Post-multiplies a rotation transformation on the current matrix with the given origin.
586591
</dd>
@@ -675,8 +680,21 @@ <h3>Helper methods</h3>
675680
</dd>
676681
<dt>void stringifier()</dt>
677682
<dd>
678-
Returns a string in the form of a CSS Transforms <code>matrix</code> function if the current matrix is a 2D transform or a CSS Transforms <code>matrix3d</code> else.
683+
Returns a string in the form of a CSS Transforms <code>matrix</code> function if the current matrix is a 2D transform or a CSS Transforms <code>matrix3d</code> else. The syntax is as specified in CSS Transforms [[!CSS3-TRANSFORMS]].
679684
<p class='issue'>Should be <code>stringifier;</code>. Bug in old respec tool.</p>
685+
<div class='example'>
686+
<p>In this example a matrix is created and several methods with 2D transformations are called.</p>
687+
<pre><code>var matrix = new Matrix();
688+
matrix.scaleBy(2);
689+
matrix.translateBy(20,20);</code></pre>
690+
<p>The <code>matrix.toString()</code> returns the DOM string:</p>
691+
<pre><code>"matrix(2,0,0,2,20,20)"</code></pre>
692+
<p>For 3D operations, the <var>stringifier</var> returns DOM string representing a 3D matrix.</p>
693+
<pre><code>var matrix = new Matrix();
694+
matrix.scale3dBy(2);</code></pre>
695+
<p>Calling <code>matrix.toString()</code> after the snippet above returns the DOM string:</p>
696+
<pre><code>"matrix3d(2,0,0,0,0,2,0,0,0,0,2,0,0,0,0,1)"</code></pre>
697+
</div>
680698
</dd>
681699
</dl>
682700
</section>

0 commit comments

Comments
 (0)