Objects of the
NSAnimation class manage the timing and progress of animations in the user interface. The class 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.
- macOS 10.4+
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.
The usual usage pattern for
NSAnimation is to make a subclass that overrides (at least) the
current property to invoke the superclass implementation and then perform whatever animation action is needed. The method implementation might use the
current property and then use that value to update some drawing; as a consequence of getting the current value, the method
animation(_: 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.