<svg width="340" height="350" version="1.1" xmlns="http://www.w3.org/2000/svg" style="border-style:solid;"> <rect x="50" y="50" width="100" height="100" stroke="#000" fill="red" /> <rect x="50" y="50" width="100" height="100" stroke="#000" fill="green" transform="scale(0.5)" /> <rect x="50" y="50" width="100" height="100" stroke="#000" fill="blue" transform="scale(2)" /> <rect x="50" y="50" width="100" height="100" stroke="#000" fill="yellow" transform="scale(0.5 2)" /> </svg>
The scale transform changes the size of an element. The syntax of the scale transform is shown below.
transform="scale(x, y)"
scale takes two parameters, the factor by which to scale the element on the x axis, and the factor by which to scale the element on the y axis. If one parameter is omitted, then both axis will be scaled by the single factor provided. The factors are interpreted as the ratio of the transformed dimension to the original. For example, 0.5 shrinks the axis by 50%.
In the example shown above, all squares have the same x and y axis locations and the same width and height dimensions. The red square has no transform applied. The green square uses the scale transform with a single parameter of 0.5. Note that not only does the scale parameter scale the element, it also scales the position of the element. In other words, the green square can be considered to be on its own layer with axis scaled to 0.5.
The blue square uses the scale transform with a single parameter of 2. Note again that the scale parameter scales the position of the element. The yellow square uses the scale transform with a parameter of 0.5 for the x axis and 2 for the y axis. Note that not only is the location of the element scaled, but the width's of the borders are also scaled.
More Graphics Design Tips:
• How to Trace an Image Using Inkscape
• What is the Pantone Color System?
• Image Processing Filters - How to Sharpen a Photograph
• Example Code for X3Dom Basic Primitive Shapes: Box, Sphere, Cylinder, Cone, and Torus
• The Browser Safe Palette
• Find Free Stock Photos You'll Actually Want to Use For Your Website or Blog
• Coding Color for the Web
• Inkscape - How to Add a New Node
• CSS Button Designer
• Coding a Matrice in MathML
