SVGTransform class

SVGTransform class

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 specification.

Inheritance: SVGTransformSVGValueTypeDOMObject

The SVGTransform type exposes the following members:

Properties

PropertyDescription
typeThe type of the value as specified by one of the SVG_TRANSFORM_* constants defined on this interface.
matrixThe matrix that represents this transformation. The matrix object is live, meaning that any changes made to the SVGTransform object 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 the SVGTransform interface itself) then the type of the SVGTransform changes to SVG_TRANSFORM_MATRIX.
For SVG_TRANSFORM_MATRIX, the matrix contains the a, b, c, d, e, f values supplied by the user.
For SVG_TRANSFORM_TRANSLATE, e and f represent the translation amounts(a= 1, b= 0, c= 0 and d = 1).
For SVG_TRANSFORM_SCALE, a and d represent the scale amounts(b= 0, c= 0, e= 0 and f = 0).
For SVG_TRANSFORM_SKEWX and SVG_TRANSFORM_SKEWY, a, b, c and d represent the matrix which will result in the given skew(e= 0 and f = 0).
For SVG_TRANSFORM_ROTATE, a, b, c, d, e and f together represent the matrix which will result in the given rotation.When the rotation is around the center point(0, 0), e and f will be zero.
angleA 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.
SVG_TRANSFORM_UNKNOWNThe unit type is not one of predefined 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_MATRIXA ‘matrix(…)’ transformation.
SVG_TRANSFORM_TRANSLATEA ’translate(…)’ transformation.
SVG_TRANSFORM_SCALEA ‘scale(…)’ transformation.
SVG_TRANSFORM_ROTATEA ‘rotate(…)’ transformation.
SVG_TRANSFORM_SKEWXA ‘skewX(…)’ transformation.
SVG_TRANSFORM_SKEWYA ‘skewY(…)’ transformation.

Methods

MethodDescription
get_platform_typeThis method is used to retrieve ECMAScript object Type.
set_matrixSets the transform type to SVG_TRANSFORM_MATRIX, with parameter matrix defining the new transformation. The values from the parameter matrix are copied, the matrix parameter does not replace SVGTransform::matrix.
set_translateSets the transform type to SVG_TRANSFORM_TRANSLATE, with parameters tx and ty defining the translation amounts.
set_scaleSets the transform type to SVG_TRANSFORM_SCALE, with parameters sx and sy defining the scale amounts.
set_rotateSets the transform type to SVG_TRANSFORM_ROTATE, with parameter angle defining the rotation angle and parameters cx and cy defining the optional center of rotation.
set_skew_xSets the transform type to SVG_TRANSFORM_SKEWX, with parameter angle defining the amount of skew.
set_skew_ySets the transform type to SVG_TRANSFORM_SKEWY, with parameter angle defining the amount of skew.

See Also