<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/AnimationResource/repeat(duration:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation17AnimationResourceC6repeat8durationACSd_tF"
  },
  "title" : "repeat(duration:)"
}
-->

# repeat(duration:)

Repeats an animation for the specified amount of time.

```
@MainActor @preconcurrency func `repeat`(duration: TimeInterval = .infinity) -> AnimationResource
```

## Parameters

`duration`

The amount of time that the animation should play. If you
omit this parameter, the animation loops indefinitely.

## Return Value

A new animation resource that you play on an entity by
calling the entity’s
[`playAnimation(_:transitionDuration:startsPaused:)`](/documentation/RealityKit/Entity/playAnimation(_:transitionDuration:startsPaused:)) method.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)