repeatCount

repeatCount 屬性指示動畫執行的次數。

您可以將此屬性與以下 SVG 元素一起使用

示例

html
<svg viewBox="0 0 220 150" xmlns="http://www.w3.org/2000/svg">
  <rect x="0" y="0" width="100" height="100">
    <animate
      attributeType="XML"
      attributeName="y"
      from="0"
      to="50"
      dur="1s"
      repeatCount="5" />
  </rect>
  <rect x="120" y="0" width="100" height="100">
    <animate
      attributeType="XML"
      attributeName="y"
      from="0"
      to="50"
      dur="1s"
      repeatCount="indefinite" />
  </rect>
</svg>

使用說明

<number> | indefinite
預設值
可動畫
<number>

此值指定迭代次數。它可以包含表示小數部分的迭代次數,表示為分數值。分數值表示簡單持續時間的某個部分。值必須大於0

indefinite

此值表示動畫將無限期地重複(即,直到文件結束)。

規範

規範
SVG 動畫級別 2
# RepeatCountAttribute

瀏覽器相容性

BCD 表格僅在瀏覽器中載入