repeatCount

Baseline Widely available

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

Thuộc tính repeatCount cho biết số lần một animation sẽ diễn ra.

Bạn có thể dùng thuộc tính này với các phần tử SVG sau:

Example

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>

Usage notes

Value <number> | indefinite
Default value None
Animatable No
<number>

Giá trị này chỉ định số lần lặp. Nó có thể bao gồm các lần lặp một phần được biểu diễn bằng giá trị phân số. Một giá trị phân số mô tả một phần của simple duration. Giá trị phải lớn hơn 0.

indefinite

Giá trị này cho biết animation sẽ được lặp vô thời hạn (tức là cho đến khi tài liệu kết thúc).

Specifications

Specification
SVG Animations Level 2
# RepeatCountAttribute

Browser compatibility