<animateTransform>

Baseline 已廣泛支援

此特性已相當成熟,可在許多裝置和瀏覽器版本上使用。自 ⁨2020 年 1 月⁩ 起,所有主流瀏覽器均已支援。

<animateTransform> SVG 元素會為目標元素的一個變換屬性新增動畫,從而允許動畫控制平移、縮放、旋轉和/或傾斜。

使用語境

分類動畫元素
允許內容可包含任意數量、任意順序的下列元素
描述性元素

示例

html
<svg
  width="120"
  height="120"
  viewBox="0 0 120 120"
  xmlns="http://www.w3.org/2000/svg">
  <polygon points="60,30 90,90 30,90">
    <animateTransform
      attributeName="transform"
      attributeType="XML"
      type="rotate"
      from="0 60 70"
      to="360 60 70"
      dur="10s"
      repeatCount="indefinite" />
  </polygon>
</svg>

屬性

DOM 介面

此元素實現了 SVGAnimateTransformElement 介面。

規範

規範
SVG 動畫級別 2
# AnimateTransformElement

瀏覽器相容性