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 |
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 SVGMatrix matrix)
|
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
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
SVGTransform
|
Chrome
Full support Yes |
Edge
Full support ≤18 |
Firefox
Full support Yes |
IE
? |
Opera
Full support Yes |
Safari
Full support Yes |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown
SVGTransform by Mozilla Contributors is licensed under CC-BY-SA 2.5.