---
title: trimDuration
framework: realitykit
role: symbol
role_heading: Instance Property
path: realitykit/sampledanimation/trimduration
---

# trimDuration

An optional duration that overrides the calculated duration.

## Declaration

```swift
var trimDuration: TimeInterval? { get set }
```

## Discussion

Discussion This property is nil by default, which indicates that the animation stops after one play that spans duration. If you set a non-zero value for this property and both trimStart and trimEnd are nil, the animation observes this property as an edited duration. When you set repeatMode to make the animation repeat: If this property is nil, the animation repeats forever. If set to a value greater than duration, the animation repeats for the specified duration.

## See Also

### Timing the animation

- [frameInterval](realitykit/sampledanimation/frameinterval.md)
- [start](realitykit/sampledanimation/start.md)
- [end](realitykit/sampledanimation/end.md)
- [speed](realitykit/sampledanimation/speed.md)
- [delay](realitykit/sampledanimation/delay.md)
- [duration](realitykit/sampledanimation/duration.md)
- [offset](realitykit/sampledanimation/offset.md)
- [trimStart](realitykit/sampledanimation/trimstart.md)
- [trimEnd](realitykit/sampledanimation/trimend.md)
