大网数据广告活动
Web 标准与前端开发

SVGTransform

· 52CE 我爱测

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.

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

Instance properties

  • SVGTransform.type
    • : The type of the value as specified by one of the SVG_TRANSFORM_* constants defined on this interface.
  • SVGTransform.angle
    • : The angle as a floating point value. A convenience attribute for SVG_TRANSFORM_ROTATE, SVG_TRANSFORM_SKEWX and SVG_TRANSFORM_SKEWY. For SVG_TRANSFORM_MATRIX, SVG_TRANSFORM_TRANSLATE and SVG_TRANSFORM_SCALE, angle will be zero.
  • SVGTransform.matrix
    • : The matrix as a DOMMatrix 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.

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 parameter matrix are copied.
  • SVGTransform.setTranslate
    • : Sets the transform type to SVG_TRANSFORM_TRANSLATE, with parameters tx and ty defining the translation amounts.
  • SVGTransform.setScale
    • : Sets the transform type to SVG_TRANSFORM_SCALE, with parameters sx and sy defining the scale amounts.
  • SVGTransform.setRotate
    • : Sets 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.
  • SVGTransform.setSkewX
    • : Sets the transform type to SVG_TRANSFORM_SKEWX, with parameter angle defining the amount of skew.
  • SVGTransform.setSkewY
    • : Sets the transform type to SVG_TRANSFORM_SKEWY, with parameter angle defining the amount of skew.

Specifications

Browser compatibility

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。