このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

repeatCount

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2020年1月.

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

この値は、アニメーションが無限に繰り返されることを示します(つまり、文書の表示が終わるまで繰り返されます)。

仕様書

Specification
SVG Animations Level 2
# RepeatCountAttribute

ブラウザーの互換性