NSViewAnimation Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in OS X v10.4 and later. |
| Companion guide | |
| Declared in | NSAnimation.h |
Overview
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.
Instance Methods
initWithViewAnimations:
Returns an NSViewAnimation object initialized with the supplied information.
Parameters
- viewAnimations
An array of
NSDictionaryobjects. Each dictionary specifies a view or window to animate and the effect to apply. viewAnimations can benil, but you must later set the required array of dictionaries withsetViewAnimations:if you want to use the capabilities of theNSViewAnimationclass. See“View Animation Dictionary Keys” for a description of valid keys and values for dictionaries in viewAnimations.
Return Value
The created NSViewAnimation object or nil if there was a problem initializing the object.
Availability
- Available in OS X v10.4 and later.
Declared In
NSAnimation.hsetViewAnimations:
Sets the dictionaries defining the objects to animate.
Parameters
- viewAnimations
An array of
NSDictionaryobjects. Each dictionary specifies a view or window to animate and the effect to apply. Pass innilto remove the current list of dictionaries. See “View Animation Dictionary Keys” for a description of valid keys and values for dictionaries in viewAnimations.
Availability
- Available in OS X v10.4 and later.
See Also
Declared In
NSAnimation.hviewAnimations
Returns the array of dictionaries defining the objects to animate.
Discussion
Each dictionary in the returned array specifies a view or window to animate and the effect to apply.
Availability
- Available in OS X v10.4 and later.
See Also
Declared In
NSAnimation.hConstants
View Animation Dictionary Keys
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;
Constants
NSViewAnimationTargetKeyThe target of the animation.
The target can be either an
NSViewobject or anNSWindowobject. This property is required.Available in OS X v10.4 and later.
Declared in
NSAnimation.h.NSViewAnimationStartFrameKeyThe size and location of the window or view at the start of the animation.
The size and location are specified by an
NSRectstructure encoded in anNSValueobject. This property is optional. If it is not specified,NSViewAnimationuses the frame of the window or view at the start of the animation.Available in OS X v10.4 and later.
Declared in
NSAnimation.h.NSViewAnimationEndFrameKeyThe size and location of the window or view at the end of the animation.
The size and location are specified by an
NSRectstructure encoded in anNSValueobject. This property is optional. If it is not specified,NSViewAnimationuses 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 OS X v10.4 and later.
Declared in
NSAnimation.h.NSViewAnimationEffectKeyAn effect to apply to the animation.
Takes a string constant specifying fade-in or fade-out effects for the target:
NSViewAnimationFadeInEffectandNSViewAnimationFadeOutEffect. 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 OS X v10.4 and later.
Declared in
NSAnimation.h.
Declared In
NSAnimation.hValues for NSViewAnimationEffectKey
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;
Constants
NSViewAnimationFadeInEffectSpecifies a fade-in type of effect.
Available in OS X v10.4 and later.
Declared in
NSAnimation.h.NSViewAnimationFadeOutEffectSpecifies a fade-out type of effect.
Available in OS X v10.4 and later.
Declared in
NSAnimation.h.
Availability
- Available in OS X v10.4 and later
Declared In
NSAnimation.h© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)