Mac Developer Library

Developer

AppKit Framework Reference NSAnimationDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

NSAnimationDelegate

Inheritance


Not Applicable

Conforms To


Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

Availability


Available in OS X v10.6 and later.

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

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

    Declaration

    Swift

    optional func animationDidEnd(_ animation: NSAnimation)

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    Available as part of an informal protocol prior to OS X v10.6.

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

    Declaration

    Swift

    optional func animationDidStop(_ animation: NSAnimation)

    Objective-C

    - (void)animationDidStop:(NSAnimation *)animation

    Parameters

    animation

    The NSAnimation instance that was stopped.

    Discussion

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

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    Available as part of an informal protocol prior to OS X v10.6.

  • Sent to the delegate just after an animation is started.

    Declaration

    Swift

    optional func animationShouldStart(_ animation: NSAnimation) -> Bool

    Objective-C

    - (BOOL)animationShouldStart:(NSAnimation *)animation

    Parameters

    animation

    The NSAnimation object that was just started.

    Return Value

    NOfalse to cancel the animation, YEStrue 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.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    Available as part of an informal protocol prior to OS X v10.6.

  • Requests a custom curve value for the current progress value.

    Declaration

    Swift

    optional func animation(_ animation: NSAnimation, valueForProgress progress: NSAnimationProgress) -> Float

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    Available as part of an informal protocol prior to OS X v10.6.

    See Also

    – currentValue (NSAnimation)

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

    Declaration

    Swift

    optional func animation(_ animation: NSAnimation, didReachProgressMark progress: NSAnimationProgress)

    Objective-C

    - (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.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.4 and later.

    Available as part of an informal protocol prior to OS X v10.6.