SVG transform Attribute
The transform attribute states the list of transform definitions that are applied to an element and its children. In SVG 1.1, only these elements are allowed to use transform attribute <a>, <circle>, <clipPath>, <defs>, <ellipse>, <foreignObject>, <g>, <image>, <line>, <path>, <polygon>, <polyline>, <rect>, <switch>, <text>, and <use>.
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.
transform = scale() | translate() | rotate() | matrix() | skewX() | skewY()
Attribute Values: The transform attribute accepts the transform function mentioned above and described below.
- skewX(): It enumerates a skew transformation along the x-axis by a degree.
- skewY(): It enumerates a skew transformation along the y-axis by a degree.
- scale(): It enumerates a scale operation by x and y. It is assumed to be equal to x if y is not provided.
- rotate(): It enumerates a rotation by a degree about a given point.
- translate(): It moves the object by x and y. It is assumed to be 0 if y is not provided.
- matrix(): It enumerates a transformation in the form of a transformation matrix of six values.
Example 1: Below is the example that illustrated the use of the transform attribute using rotate(), translate(), skewX(), and scale() transform function.
Example 2: Below is the example that illustrated the use of the transform attribute using scale transform function.