API  0.9.7
 All Classes Files Functions Variables Macros Groups Pages
CAAnimation.j
Go to the documentation of this file.
1 /*
2  * CAAnimation.j
3  * AppKit
4  *
5  * Created by Francisco Tolmasky.
6  * Copyright 2008, 280 North, Inc.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 
24 
25 /*
26  This is an animation class.
27 */
28 @implementation CAAnimation : CPObject
29 {
30  BOOL _isRemovedOnCompletion;
31  id _delegate;
32 }
33 
38 + (id)animation
39 {
40  return [[self alloc] init];
41 }
42 
43 - (id)init
44 {
45  self = [super init];
46 
47  if (self)
48  _isRemovedOnCompletion = YES;
49 
50  return self;
51 }
52 
57 - (void)shouldArchiveValueForKey:(CPString)aKey
58 {
59  return YES;
60 }
61 
66 + (id)defaultValueForKey:(CPString)aKey
67 {
68  return nil;
69 }
70 
75 - (void)setRemovedOnCompletion:(BOOL)isRemovedOnCompletion
76 {
77  _isRemovedOnCompletion = isRemovedOnCompletion;
78 }
79 
83 - (BOOL)removedOnCompletion
84 {
85  return _isRemovedOnCompletion;
86 }
87 
91 - (BOOL)isRemovedOnCompletion
92 {
93  return _isRemovedOnCompletion;
94 }
95 
99 - (CAMediaTimingFunction)timingFunction
100 {
101  // Linear Pacing
102  return nil;
103 }
104 
109 - (void)setDelegate:(id)aDelegate
110 {
111  _delegate = aDelegate;
112 }
113 
117 - (id)delegate
118 {
119  return _delegate;
120 }
121 
122 - (void)runActionForKey:(CPString)aKey object:(id)anObject arguments:(CPDictionary)arguments
123 {
124  [anObject addAnimation:self forKey:aKey];
125 }
126 
127 @end
128 
129 /*
130 
131 */
133 {
134  CPString _keyPath;
135 
136  BOOL _isCumulative;
137  BOOL _isAdditive;
138 }
139 
140 + (id)animationWithKeyPath:(CPString)aKeyPath
141 {
142  var animation = [self animation];
143 
144  [animation setKeyPath:aKeyPath];
145 
146  return animation;
147 }
148 
149 - (void)setKeyPath:(CPString)aKeyPath
150 {
151  _keyPath = aKeyPath;
152 }
153 
154 - (CPString)keyPath
155 {
156  return _keyPath;
157 }
158 
159 - (void)setCumulative:(BOOL)isCumulative
160 {
161  _isCumulative = isCumulative;
162 }
163 
164 - (BOOL)cumulative
165 {
166  return _isCumulative;
167 }
168 
169 - (BOOL)isCumulative
170 {
171  return _isCumulative;
172 }
173 
174 - (void)setAdditive:(BOOL)isAdditive
175 {
176  _isAdditive = isAdditive;
177 }
178 
179 - (BOOL)additive
180 {
181  return _isAdditive;
182 }
183 
184 - (BOOL)isAdditive
185 {
186  return _isAdditive;
187 }
188 
189 @end
190 
197 {
198  id _fromValue;
199  id _toValue;
200  id _byValue;
201 }
202 
207 - (void)setFromValue:(id)aValue
208 {
209  _fromValue = aValue;
210 }
211 
215 - (id)fromValue
216 {
217  return _fromValue;
218 }
219 
224 - (void)setToValue:(id)aValue
225 {
226  _toValue = aValue;
227 }
228 
232 - (id)toValue
233 {
234  return _toValue;
235 }
236 
241 - (void)setByValue:(id)aValue
242 {
243  _byValue = aValue;
244 }
245 
249 - (id)byValue
250 {
251  return _byValue;
252 }
253 
254 @end