-
Notifications
You must be signed in to change notification settings - Fork 596
Expand file tree
/
Copy pathCPTAnimationOperation.m
More file actions
124 lines (100 loc) · 3.8 KB
/
Copy pathCPTAnimationOperation.m
File metadata and controls
124 lines (100 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#import "CPTAnimationOperation.h"
#import "CPTAnimationPeriod.h"
/** @brief Describes all aspects of an animation operation, including the value range, duration, animation curve, property to update, and the delegate.
**/
@implementation CPTAnimationOperation
/** @property nonnull CPTAnimationPeriod *period
* @brief The start value, end value, and duration of this animation operation.
**/
@synthesize period;
/** @property CPTAnimationCurve animationCurve
* @brief The animation curve used to animate this operation.
**/
@synthesize animationCurve;
/** @property nonnull id boundObject
* @brief The object to update for each animation frame.
**/
@synthesize boundObject;
/** @property SEL boundGetter
* @brief The @ref boundObject getter method for the property to update for each animation frame.
**/
@synthesize boundGetter;
/** @property SEL boundSetter
* @brief The @ref boundObject setter method for the property to update for each animation frame.
**/
@synthesize boundSetter;
/** @property nullable id<CPTAnimationDelegate>delegate
* @brief The animation delegate.
**/
@synthesize delegate;
/** @property BOOL canceled
* @brief If @YES, this animation operation has been canceled and will no longer post updates.
**/
@synthesize canceled;
/** @property nullable id<NSCopying, NSObject> identifier
* @brief An object used to identify the animation operation in collections.
**/
@synthesize identifier;
/** @property nullable NSDictionary *userInfo
* @brief Application-specific user info that can be attached to the operation.
**/
@synthesize userInfo;
/// @name Initialization
/// @{
/** @brief Initializes a newly allocated CPTAnimationOperation object.
*
* This is the designated initializer. The initialized object will have the following properties:
* - @ref period = @par{animationPeriod}
* - @ref animationCurve = @par{curve}
* - @ref boundObject = @par{object}
* - @ref boundGetter = @par{getter}
* - @ref boundSetter = @par{setter}
* - @ref delegate = @nil
* - @ref canceled = @NO
* - @ref identifier = @nil
* - @ref userInfo = @nil
*
* @param animationPeriod The animation period.
* @param curve The animation curve.
* @param object The object to update for each animation frame.
* @param getter The @ref boundObject getter method for the property to update for each animation frame.
* @param setter The @ref boundObject setter method for the property to update for each animation frame.
*
* @return The initialized object.
**/
-(nonnull instancetype)initWithAnimationPeriod:(nonnull CPTAnimationPeriod *)animationPeriod animationCurve:(CPTAnimationCurve)curve object:(nonnull id)object getter:(nonnull SEL)getter setter:(nonnull SEL)setter
{
if ((self = [super init])) {
period = animationPeriod;
animationCurve = curve;
boundObject = object;
boundGetter = getter;
boundSetter = setter;
delegate = nil;
canceled = NO;
identifier = nil;
userInfo = nil;
}
return self;
}
/// @}
/// @cond
-(nonnull instancetype)init
{
NSAssert(NO, @"Must call -initWithAnimationPeriod:animationCurve:object:getter:setter: to initialize a CPTAnimationOperation.");
return [self initWithAnimationPeriod:[[CPTAnimationPeriod alloc] init]
animationCurve:CPTAnimationCurveDefault
object:[[NSObject alloc] init]
getter:@selector(init)
setter:@selector(init)];
}
/// @endcond
#pragma mark -
#pragma mark Description
/// @cond
-(nullable NSString *)description
{
return [NSString stringWithFormat:@"<%@ animate %@ %@ with period %@>", super.description, self.boundObject, NSStringFromSelector(self.boundGetter), self.period];
}
/// @endcond
@end