---
title: "repeat(duration:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/animationresource/repeat(duration:)"
---

# repeat(duration:)

Repeats an animation for the specified amount of time.

## Declaration

```swift
@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

Return Value A new animation resource that you play on an entity by calling the entity’s playAnimation(_:transitionDuration:startsPaused:) method.

## See Also

### Creating an animation resource

- [generate(with:)](realitykit/animationresource/generate(with:).md)
- [sequence(with:)](realitykit/animationresource/sequence(with:).md)
- [group(with:)](realitykit/animationresource/group(with:).md)
- [repeat(count:)](realitykit/animationresource/repeat(count:).md)
