HTML Diff
0 added 0 removed
Original 2026-01-01
Modified 2026-03-09
1 <p>Transforms also create their own coordinate system. To apply a transform to all content, wrap it in a group (&lt;g&gt; element):</p>
1 <p>Transforms also create their own coordinate system. To apply a transform to all content, wrap it in a group (&lt;g&gt; element):</p>
2 &lt;svg width="350" height="200"&gt; &lt;g&gt; … &lt;/g&gt; &lt;/svg&gt;<p>And add a transform:</p>
2 &lt;svg width="350" height="200"&gt; &lt;g&gt; … &lt;/g&gt; &lt;/svg&gt;<p>And add a transform:</p>
3 &lt;svg width="350" height="200"&gt; &lt;g transform="translate(50, 50)"&gt; … &lt;/g&gt; &lt;/svg&gt;<p>All content has now shifted by 50 pixels vertically and horizontally together with the coordinate system, and if we now add another transform, it will be calculated using the new coordinate system:</p>
3 &lt;svg width="350" height="200"&gt; &lt;g transform="translate(50, 50)"&gt; … &lt;/g&gt; &lt;/svg&gt;<p>All content has now shifted by 50 pixels vertically and horizontally together with the coordinate system, and if we now add another transform, it will be calculated using the new coordinate system:</p>
4 &lt;svg width="350" height="200"&gt; &lt;g transform="translate(50, 50) rotate(15)"&gt; … &lt;/g&gt; &lt;/svg&gt;<p>In SVG, the default pivot point is 0,0. Before the first transform, it was the upper left corner of the viewport, but after the transform, it has become the upper left corner of the transformable content. The second transform will again change the coordinate system for the group.</p>
4 &lt;svg width="350" height="200"&gt; &lt;g transform="translate(50, 50) rotate(15)"&gt; … &lt;/g&gt; &lt;/svg&gt;<p>In SVG, the default pivot point is 0,0. Before the first transform, it was the upper left corner of the viewport, but after the transform, it has become the upper left corner of the transformable content. The second transform will again change the coordinate system for the group.</p>
5 <p>This assignment uses SVG transforms. Of course, you can learn a lot about CSS transforms in the “<a>2D Transforms</a>” section.</p>
5 <p>This assignment uses SVG transforms. Of course, you can learn a lot about CSS transforms in the “<a>2D Transforms</a>” section.</p>