SVGTransform
SVG transform interface
SVGTransform
is the interface for one of the component transformations within an SVGTransformList
; thus, an SVGTransform
object corresponds to a single component (e.g., scale(…)
or matrix(…)
) within a transform
attribute.
An SVGTransform
object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown.
Interface overview
Also implement | None |
---|---|
Methods |
|
Properties |
|
Constants |
|
Normative document | SVG 1.1 (2nd Edition) |
Constants
Name | Value | Description |
---|---|---|
SVG_TRANSFORM_UNKNOWN | 0 | The unit type is not one of predefined unit types. It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. |
SVG_TRANSFORM_MATRIX | 1 | A matrix(…) transformation |
SVG_TRANSFORM_TRANSLATE | 2 | A translate(…) transformation |
SVG_TRANSFORM_SCALE | 3 | A scale(…) transformation |
SVG_TRANSFORM_ROTATE | 4 | A rotate(…) transformation |
SVG_TRANSFORM_SKEWX | 5 | A skewx(…) transformation |
SVG_TRANSFORM_SKEWY | 6 | A skewy(…) transformation |
Properties
Name | Type | Description |
---|---|---|
type | unsigned short | The type of the value as specified by one of the SVG_TRANSFORM_* constants defined on this interface. |
angle | float | A convenience attribute for SVG_TRANSFORM_ROTATE , SVG_TRANSFORM_SKEWX and SVG_TRANSFORM_SKEWY . It holds the angle that was specified.For SVG_TRANSFORM_MATRIX , SVG_TRANSFORM_TRANSLATE and SVG_TRANSFORM_SCALE , angle will be zero. |
matrix | SVGMatrix | The matrix that represents this transformation. The matrix object is live, meaning that any changes made to the
|
Methods
Name & Arguments | Return | Description |
---|---|---|
setMatrix(in | void | Sets the transform type to Exceptions:
|
setTranslate(in float tx , in float
ty) | void | Sets the transform type to Exceptions:
|
setScale(in float sx , in float
sy) | void | Sets the transform type to Exceptions:
|
setRotate(in float angle, in float
cx , in float cy) | void | Sets the transform type to Exceptions:
|
setSkewX(in float angle) | void | Sets the transform type to Exceptions:
|
setSkewY(in float angle) | void | Sets the transform type to Exceptions:
|
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
SVGTransform |
1 |
12 |
1.5 |
9 |
≤12.1 |
4 |
≤37 |
18 |
4 |
≤12.1 |
3.2 |
1.0 |
angle |
1 |
12 |
1.5 |
9 |
≤12.1 |
4 |
≤37 |
18 |
4 |
≤12.1 |
3.2 |
1.0 |
matrix |
1 |
12 |
1.5 |
9 |
≤12.1 |
4 |
≤37 |
18 |
4 |
≤12.1 |
3.2 |
1.0 |
setMatrix |
1 |
12 |
1.5 |
9 |
≤12.1 |
4 |
≤37 |
18 |
4 |
≤12.1 |
3.2 |
1.0 |
setRotate |
1 |
12 |
1.5 |
9 |
≤12.1 |
4 |
≤37 |
18 |
4 |
≤12.1 |
3.2 |
1.0 |
setScale |
1 |
12 |
1.5 |
9 |
≤12.1 |
4 |
≤37 |
18 |
4 |
≤12.1 |
3.2 |
1.0 |
setSkewX |
1 |
12 |
1.5 |
9 |
≤12.1 |
4 |
≤37 |
18 |
4 |
≤12.1 |
3.2 |
1.0 |
setSkewY |
1 |
12 |
1.5 |
9 |
≤12.1 |
4 |
≤37 |
18 |
4 |
≤12.1 |
3.2 |
1.0 |
setTranslate |
1 |
12 |
1.5 |
9 |
≤12.1 |
4 |
≤37 |
18 |
4 |
≤12.1 |
3.2 |
1.0 |
type |
1 |
12 |
1.5 |
9 |
≤12.1 |
4 |
≤37 |
18 |
4 |
≤12.1 |
3.2 |
1.0 |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/SVGTransform