---
title: duration
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nsanimation/duration
---

# duration

The duration of the animation, in seconds.

## Declaration

```swift
var duration: TimeInterval { get set }
```

## Discussion

Discussion The value of this property must be greater than or equal to 0. Setting the duration to a negative value raises an exception. You can change the duration of an animation while it is running. Setting the duration to a value that is less than the current progress value ends an in-progress animation.

## See Also

### Configuring an Animation

- [animationBlockingMode](appkit/nsanimation/animationblockingmode.md)
- [runLoopModesForAnimating](appkit/nsanimation/runloopmodesforanimating.md)
- [animationCurve](appkit/nsanimation/animationcurve.md)
- [frameRate](appkit/nsanimation/framerate.md)
