File:Transform example.svg

Description

Simple example for viewBox="tx ty w2 h2" and retransforming it

<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="-8 -8 16 16" fill="none">

<path stroke="black" stroke-width="1" d="m-7,0h14M0-7v14"/>
<circle stroke="red" stroke-width="1" r="7"/>
<path stroke="blue" stroke-width="16" d="m0,0h256v256H0z" transform="translate(-8 -8)scale(.0625)"/>

</svg>

The transformation can as well be coded by the matrix 
  transform="matrix(.0625 0 0 .0625 -8 -8)"
Explanation

The real size (w1 × h1) is 256 × 256, the viewBox sets it to (w2 × h2) 16 × 16 with a translation tx = -8 and ty = -8.
In this system a black cross and a red circle are drawn.

By the transform="translate(tx ty)scale(w2/w1 h2/h1)" the real size 256 × 256 is temporary restored.
From the blue square only half of the stroke-width is visible, the other half is outside of the visible area.


Date
Source Own work
Author Sarang
SVG development
InfoField
 
The SVG code is valid.
Category:Valid SVG created with Text Editor:Geometrics
 
This geometry was created with a text editor.
Category:SVG simplified geometrics●Zero#♦
 
Please do not replace the simplified code of this file with a version created with Inkscape or any other vector graphics editor
Public domain This image of simple geometry is ineligible for copyright and therefore in the public domain, because it consists entirely of information that is common property and contains no original authorship.
Heptagon
Heptagon
Category:PD shape#Transform%20example.svgCategory:PD-shape missing SDC copyright status Category:Examples representing SVG
Category:Examples representing SVG Category:PD shape Category:SVG simplified geometrics●Zero Category:Valid SVG created with Text Editor:Geometrics