<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/AnimationGroup/trimDuration",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation14AnimationGroupV12trimDurationSdSgvp"
  },
  "title" : "trimDuration"
}
-->

# trimDuration

An optional duration that overrides the calculated duration.

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

## Discussion

The framework calculates [`duration`](/documentation/RealityKit/FromToByAnimation/duration), but you can set
this property to override it. This property is `nil` by default, which
indicates that the animation stops after one play that spans
[`duration`](/documentation/RealityKit/AnimationGroup/duration).

If you set a non-zero value for this property and both
[`trimStart`](/documentation/RealityKit/AnimationGroup/trimStart) and [`trimEnd`](/documentation/RealityKit/AnimationGroup/trimEnd) are `nil`,
the animation observes this property as an edited duration.

When you set [`repeatMode`](/documentation/RealityKit/AnimationGroup/repeatMode) to make the animation repeat:

- If this property is `nil`, the animation repeats forever.
- If set to a value greater than [`duration`](/documentation/RealityKit/AnimationGroup/duration), the animation repeats
  for the specified duration.

---

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)