<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSAnimation",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSAnimation"
  },
  "title" : "NSAnimation"
}
-->

# NSAnimation

An object that manages the timing and progress of animations in the user interface.

```
class NSAnimation
```

## Overview

[`NSAnimation`](/documentation/AppKit/NSAnimation) also lets you link together multiple animations so that when one animation ends another one starts. It does not provide any drawing support for animation and does not directly deal with views, targets, or actions.

> Note:
> For simple tasks requiring a timing mechanism, consider using <doc://com.apple.documentation/documentation/Foundation/Timer>.

[`NSAnimation`](/documentation/AppKit/NSAnimation) objects have several characteristics, including duration, frame rate, and animation curve, which describes the relative speed of the animation over its course. You can set progress marks in an animation, each of which specifies a percentage of the animation completed; when an animation reaches a progress mark, it notifies its delegate and posts a notification to any observers. Animations execute in one of three blocking modes: blocking, non-blocking on the main thread, and non-blocking on a separate thread. The non-blocking modes permit the handling of user events while the animation is running.

### Subclassing Notes

The usual usage pattern for `NSAnimation` is to make a subclass that overrides (at least) the [`currentProgress`](/documentation/AppKit/NSAnimation/currentProgress) property to invoke the superclass implementation and then perform whatever animation action is needed. The method implementation might use the [`currentValue`](/documentation/AppKit/NSAnimation/currentValue) property and then use that value to update some drawing; as a consequence of getting the current value, the method [`animation(_:valueForProgress:)`](/documentation/AppKit/NSAnimationDelegate/animation(_:valueForProgress:)) is sent to the delegate (if there is a delegate that implements the method). For more information on subclassing `NSAnimation`, see [Animation Programming Guide for Cocoa](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/AnimationGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40003592).

## Topics

### Initializing an NSAnimation Object

[`-  initWithDuration:animationCurve:`](/documentation/AppKit/NSAnimation/init(duration:animationCurve:))

Returns an `NSAnimation` object initialized with the specified duration and animation-curve values.

### Configuring an Animation

[`animationBlockingMode`](/documentation/AppKit/NSAnimation/animationBlockingMode)

The blocking mode of the animation.

[`runLoopModesForAnimating`](/documentation/AppKit/NSAnimation/runLoopModesForAnimating)

An array of strings representing the run loop modes in which the animation can run.

[`animationCurve`](/documentation/AppKit/NSAnimation/animationCurve)

The timing curve for the animation.

[`duration`](/documentation/AppKit/NSAnimation/duration)

The duration of the animation, in seconds.

[`frameRate`](/documentation/AppKit/NSAnimation/frameRate)

The number of frame updates per second to generate for the animation.

### Managing the Delegate

[`delegate`](/documentation/AppKit/NSAnimation/delegate)

The animation delegate.

### Controlling and Monitoring an Animation

[`-  startAnimation`](/documentation/AppKit/NSAnimation/start())

Starts the animation represented by the receiver.

[`-  stopAnimation`](/documentation/AppKit/NSAnimation/stop())

Stops the animation represented by the receiver.

[`animating`](/documentation/AppKit/NSAnimation/isAnimating)

A Boolean value indicating whether the animation is in progress.

[`currentProgress`](/documentation/AppKit/NSAnimation/currentProgress)

The current progress of the animation.

[`currentValue`](/documentation/AppKit/NSAnimation/currentValue)

The current value of the animation effect, based on the current progress

### Managing Progress Marks

[`-  addProgressMark:`](/documentation/AppKit/NSAnimation/addProgressMark(_:))

Adds the progress mark to the receiver.

[`-  removeProgressMark:`](/documentation/AppKit/NSAnimation/removeProgressMark(_:))

Removes progress mark from the receiver.

[`progressMarks`](/documentation/AppKit/NSAnimation/progressMarks)

An array of floating-point numbers representing current progress marks.

### Linking Animations Together

[`-  startWhenAnimation:reachesProgress:`](/documentation/AppKit/NSAnimation/start(when:reachesProgress:))

Starts running the animation represented by the receiver when another animation reaches a specific progress mark.

[`-  stopWhenAnimation:reachesProgress:`](/documentation/AppKit/NSAnimation/stop(when:reachesProgress:))

Stops running the animation represented by the receiver when another animation reaches a specific progress mark.

[`-  clearStartAnimation`](/documentation/AppKit/NSAnimation/clearStart())

Clears linkage to another animation that causes the receiver to start.

[`-  clearStopAnimation`](/documentation/AppKit/NSAnimation/clearStop())

Clears linkage to another animation that causes the receiver to stop.

### Constants

[`Curve`](/documentation/AppKit/NSAnimation/Curve)

These constants describe the curve of an animation—that is, the relative speed of an animation from start to finish.

[`BlockingMode`](/documentation/AppKit/NSAnimation/BlockingMode)

These constants indicate the blocking mode of an `NSAnimation` object when it is running.

[`Progress`](/documentation/AppKit/NSAnimation/Progress)

The animation progress, as a floating-point number between `0.0` and `1.0`.

[NSAnimationProgressMark Notification Key](/documentation/AppKit/nsanimationprogressmark-notification-key)

This constant is returned in the userInfo dictionary of the [`progressMarkNotification`](/documentation/AppKit/NSAnimation/progressMarkNotification) notification.

### Notifications

[`NSAnimationProgressMarkNotification`](/documentation/AppKit/NSAnimation/progressMarkNotification)

Posted when the current progress of a running animation reaches one of its progress marks.

### Initializers

[`-  initWithCoder:`](/documentation/AppKit/NSAnimation/init(coder:))

## Relationships

### Inherited By

[`NSViewAnimation`](/documentation/AppKit/NSViewAnimation)

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

[`NSCoding`](/documentation/Foundation/NSCoding)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)