SVG
The SVGTransform interface reflects 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.
Static properties
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.
- : A
SVG_TRANSFORM_TRANSLATE(2)- : A
translate(…)transformation.
- : A
SVG_TRANSFORM_SCALE(3)- : A
scale(…)transformation.
- : A
SVG_TRANSFORM_ROTATE(4)- : A
rotate(…)transformation.
- : A
SVG_TRANSFORM_SKEWX(5)- : A
skewx(…)transformation.
- : A
SVG_TRANSFORM_SKEWY(6)- : A
skewy(…)transformation.
- : A
Instance properties
- SVGTransform.type
- : The type of the value as specified by one of the
SVG_TRANSFORM_*constants defined on this interface.
- : The type of the value as specified by one of the
- SVGTransform.angle
- : The angle as a floating point value. A convenience attribute for
SVG_TRANSFORM_ROTATE,SVG_TRANSFORM_SKEWXandSVG_TRANSFORM_SKEWY. ForSVG_TRANSFORM_MATRIX,SVG_TRANSFORM_TRANSLATEandSVG_TRANSFORM_SCALE,anglewill be zero.
- : The angle as a floating point value. A convenience attribute for
- SVGTransform.matrix
- : The matrix as a DOMMatrix that represents this transformation. The matrix object is live, meaning that any changes made to the
SVGTransformobject are immediately reflected in the matrix object and vice versa. In case the matrix object is changed directly (i.e., without using the methods on theSVGTransforminterface itself) then the type of theSVGTransformchanges toSVG_TRANSFORM_MATRIX.
- : The matrix as a DOMMatrix that represents this transformation. The matrix object is live, meaning that any changes made to the
Instance methods
- SVGTransform.setMatrix
- : Sets the transform type to
SVG_TRANSFORM_MATRIX, with parameter matrix defining the new transformation. Note that the values from the parametermatrixare copied.
- : Sets the transform type to
- SVGTransform.setTranslate
- : Sets the transform type to
SVG_TRANSFORM_TRANSLATE, with parameterstxandtydefining the translation amounts.
- : Sets the transform type to
- SVGTransform.setScale
- : Sets the transform type to
SVG_TRANSFORM_SCALE, with parameterssxandsydefining the scale amounts.
- : Sets the transform type to
- SVGTransform.setRotate
- : Sets the transform type to
SVG_TRANSFORM_ROTATE, with parameterangledefining the rotation angle and parameterscxandcydefining the optional center of rotation.
- : Sets the transform type to
- SVGTransform.setSkewX
- : Sets the transform type to
SVG_TRANSFORM_SKEWX, with parameterangledefining the amount of skew.
- : Sets the transform type to
- SVGTransform.setSkewY
- : Sets the transform type to
SVG_TRANSFORM_SKEWY, with parameterangledefining the amount of skew.
- : Sets the transform type to
Specifications
Browser compatibility
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
