Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/AppKit.framework |
Availability | Available in Mac OS X v10.4 and later. |
Companion guide | |
Declared in | NSAnimation.h |
Related sample code |
The NSViewAnimation
class, a public subclass of NSAnimation
, offers a convenient way to animate multiple views and windows. The animation effects you can achieve are limited to changes in frame location and size, and to fade-in and fade-out effects.
An NSViewAnimation
object takes an array of dictionaries from which it determines the objects to animate and the effects to apply to them. Each dictionary must have a target object and, optionally, properties that specify beginning and ending frame and whether to fade in or fade out. (See “View Animation Dictionary Keys” for further information.) Animations with NSViewAnimation
are, by default, in non-blocking mode over a duration of 0.5 seconds using the ease in-out animation curve. But you can configure the animation to have any duration, curve, frame rate, and blocking mode. You may also set progress marks, assign a delegate, and implement delegation methods in order to animate view and windows concurrent with the ones specified as targets in the view-animation dictionary.
Invoking the NSAnimation
stopAnimation
method on a running NSViewAnimation
object moves the animation to the end frame.
Returns an NSViewAnimation
object initialized with the supplied information.
- (id)initWithViewAnimations:(NSArray *)viewAnimations
An array of NSDictionary
objects. Each dictionary specifies a view or window to animate and the effect to apply. viewAnimations can be nil
, but you must later set the required array of dictionaries with setViewAnimations:
if you want to use the capabilities of the NSViewAnimation
class. See“View Animation Dictionary Keys” for a description of valid keys and values for dictionaries in viewAnimations.
The created NSViewAnimation
object or nil
if there was a problem initializing the object.
NSAnimation.h
Sets the dictionaries defining the objects to animate.
- (void)setViewAnimations:(NSArray *)viewAnimations
An array of NSDictionary
objects. Each dictionary specifies a view or window to animate and the effect to apply. Pass in nil
to remove the current list of dictionaries. See “View Animation Dictionary Keys” for a description of valid keys and values for dictionaries in viewAnimations.
NSAnimation.h
Returns the array of dictionaries defining the objects to animate.
- (NSArray *)viewAnimations
Each dictionary in the returned array specifies a view or window to animate and the effect to apply.
NSAnimation.h
The following string constants are keys for the dictionaries in the array passed into initWithViewAnimations:
and setViewAnimations:
.
NSString *NSViewAnimationTargetKey; NSString *NSViewAnimationStartFrameKey; NSString *NSViewAnimationEndFrameKey; NSString *NSViewAnimationEffectKey;
NSViewAnimationTargetKey
The target of the animation.
The target can be either an NSView
object or an NSWindow
object. This property is required.
Available in Mac OS X v10.4 and later.
Declared in NSAnimation.h
.
NSViewAnimationStartFrameKey
The size and location of the window or view at the start of the animation.
The size and location are specified by an NSRect
structure encoded in an NSValue
object. This property is optional. If it is not specified, NSViewAnimation
uses the frame of the window or view at the start of the animation.
Available in Mac OS X v10.4 and later.
Declared in NSAnimation.h
.
NSViewAnimationEndFrameKey
The size and location of the window or view at the end of the animation.
The size and location are specified by an NSRect
structure encoded in an NSValue
object. This property is optional. If it is not specified, NSViewAnimation
uses the frame of the window or view at the start of the animation. If the target is a view and the end frame is empty, the view is hidden at the end.
Available in Mac OS X v10.4 and later.
Declared in NSAnimation.h
.
NSViewAnimationEffectKey
An effect to apply to the animation.
Takes a string constant specifying fade-in or fade-out effects for the target: NSViewAnimationFadeInEffect
and NSViewAnimationFadeOutEffect
. If the target is a view and the effect is to fade out, the view is hidden at the end. If the effect is to fade in an initially hidden view and the end frame is non-empty, the view is unhidden at the end. If the target is a window, the window is ordered in or out as appropriate to the effect. This property is optional.
Available in Mac OS X v10.4 and later.
Declared in NSAnimation.h
.
NSAnimation.h
The following constants specify the animation effect to apply and are used as values for the animation effect property of the animation view. See the description of NSViewAnimationEffectKey
for usage details.
NSString *NSViewAnimationFadeInEffect; NSString *NSViewAnimationFadeOutEffect;
NSViewAnimationFadeInEffect
Specifies a fade-in type of effect.
Available in Mac OS X v10.4 and later.
Declared in NSAnimation.h
.
NSViewAnimationFadeOutEffect
Specifies a fade-out type of effect.
Available in Mac OS X v10.4 and later.
Declared in NSAnimation.h
.
NSAnimation.h
© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)