NSAnimationDelegate Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in OS X v10.6 and later.
Declared in
NSAnimation.h
Companion guides
Related sample code

Overview

The NSAnimationDelegate protocol defines the optional methods implemented by delegates of NSAnimation objects.

Tasks

Controlling and Monitoring an Animation

Managing Progress Marks

Instance Methods

animation:didReachProgressMark:

Sent to the delegate when an animation reaches a specific progress mark.

- (void)animation:(NSAnimation *)animation didReachProgressMark:(NSAnimationProgress)progress
Parameters
animation

A running NSAnimation object that has reached a progress mark.

progress

A float value (typed as NSAnimationProgress) that indicates a progress mark of animation.

Discussion

The delegate typically implements this method to perform some animation effect for the time slice indicated by progress, such as redrawing objects in a view with new coordinates or changing the frame location or size of a window or view. As an alternative to this delegation message, you may choose to observe the NSAnimationProgressMarkNotification notification.

Availability
  • Available in OS X v10.4 and later.
  • Available as part of an informal protocol prior to OS X v10.6.
Declared In
NSAnimation.h

animation:valueForProgress:

Requests a custom curve value for the current progress value.

- (float)animation:(NSAnimation *)animation valueForProgress:(NSAnimationProgress)progress
Parameters
animation

An NSAnimation object that is running.

progress

A float value (typed as NSAnimationProgress) that indicates a progress mark of animation. This value is always between 0.0 and 1.0.

Return Value

A float value representing a custom curve.

Discussion

The delegate can compute and return a custom curve value for the given progress value. If the delegate does not implement this method, NSAnimation computes the current curve value.

The animation:valueForProgress: message is sent to the delegate when an NSAnimation object receives a currentValue message. The value the delegate returns is used as the value of currentValue; if there is no delegate, or it doesn't implement animation:valueForProgress:, NSAnimation computes and returns the current value. NSAnimation does not invoke currentValueitself, but subclasses might.

See the description of currentValue for more information.

Availability
  • Available in OS X v10.4 and later.
  • Available as part of an informal protocol prior to OS X v10.6.
See Also
Declared In
NSAnimation.h

animationDidEnd:

Sent to the delegate when the specified animation completes its run.

- (void)animationDidEnd:(NSAnimation *)animation
Parameters
animation

The NSAnimation instance that completed its run.

Discussion

When an NSAnimation object reaches the end of its planned duration, it has a progress value of 1.0.

Availability
  • Available in OS X v10.4 and later.
  • Available as part of an informal protocol prior to OS X v10.6.
Declared In
NSAnimation.h

animationDidStop:

Sent to the delegate when the specified animation is stopped before it completes its run.

- (void)animationDidStop:(NSAnimation *)animation
Parameters
animation

The NSAnimation instance that was stopped.

Discussion

An NSAnimation object stops running when it receives a stopAnimation message.

Availability
  • Available in OS X v10.4 and later.
  • Available as part of an informal protocol prior to OS X v10.6.
Declared In
NSAnimation.h

animationShouldStart:

Sent to the delegate just after an animation is started.

- (BOOL)animationShouldStart:(NSAnimation *)animation
Parameters
animation

The NSAnimation object that was just started.

Return Value

NO to cancel the animation, YES to have the animation proceed.

Discussion

The delegate is sent this message just after animation receives a startAnimation message. The delegate can use this method to prepare objects and resources for the effect.

Availability
  • Available in OS X v10.4 and later.
  • Available as part of an informal protocol prior to OS X v10.6.
Declared In
NSAnimation.h