API 0.9.5
AppKit/CoreAnimation/CAAnimation.j
Go to the documentation of this file.
00001 /*
00002  * CAAnimation.j
00003  * AppKit
00004  *
00005  * Created by Francisco Tolmasky.
00006  * Copyright 2008, 280 North, Inc.
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Lesser General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2.1 of the License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00021  */
00022 
00023 
00024 
00025 /*
00026     This is an animation class.
00027 */
00028 @implementation CAAnimation : CPObject
00029 {
00030     BOOL    _isRemovedOnCompletion;
00031     id      _delegate;
00032 }
00033 
00038 + (id)animation
00039 {
00040     return [[self alloc] init];
00041 }
00042 
00043 - (id)init
00044 {
00045     self = [super init];
00046 
00047     if (self)
00048         _isRemovedOnCompletion = YES;
00049 
00050     return self;
00051 }
00052 
00057 - (void)shouldArchiveValueForKey:(CPString)aKey
00058 {
00059     return YES;
00060 }
00061 
00066 + (id)defaultValueForKey:(CPString)aKey
00067 {
00068     return nil;
00069 }
00070 
00075 - (void)setRemovedOnCompletion:(BOOL)isRemovedOnCompletion
00076 {
00077     _isRemovedOnCompletion = isRemovedOnCompletion;
00078 }
00079 
00083 - (BOOL)removedOnCompletion
00084 {
00085     return _isRemovedOnCompletion;
00086 }
00087 
00091 - (BOOL)isRemovedOnCompletion
00092 {
00093     return _isRemovedOnCompletion;
00094 }
00095 
00099 - (CAMediaTimingFunction)timingFunction
00100 {
00101     // Linear Pacing
00102     return nil;
00103 }
00104 
00109 - (void)setDelegate:(id)aDelegate
00110 {
00111     _delegate = aDelegate;
00112 }
00113 
00117 - (id)delegate
00118 {
00119     return _delegate;
00120 }
00121 
00122 - (void)runActionForKey:(CPString)aKey object:(id)anObject arguments:(CPDictionary)arguments
00123 {
00124     [anObject addAnimation:self forKey:aKey];
00125 }
00126 
00127 @end
00128 
00129 /*
00130 
00131 */
00132 @implementation CAPropertyAnimation : CAAnimation
00133 {
00134     CPString    _keyPath;
00135 
00136     BOOL        _isCumulative;
00137     BOOL        _isAdditive;
00138 }
00139 
00140 + (id)animationWithKeyPath:(CPString)aKeyPath
00141 {
00142     var animation = [self animation];
00143 
00144     [animation setKeyPath:aKeyPath];
00145 
00146     return animation;
00147 }
00148 
00149 - (void)setKeyPath:(CPString)aKeyPath
00150 {
00151     _keyPath = aKeyPath;
00152 }
00153 
00154 - (CPString)keyPath
00155 {
00156     return _keyPath;
00157 }
00158 
00159 - (void)setCumulative:(BOOL)isCumulative
00160 {
00161     _isCumulative = isCumulative;
00162 }
00163 
00164 - (BOOL)cumulative
00165 {
00166     return _isCumulative;
00167 }
00168 
00169 - (BOOL)isCumulative
00170 {
00171     return _isCumulative;
00172 }
00173 
00174 - (void)setAdditive:(BOOL)isAdditive
00175 {
00176     _isAdditive = isAdditive;
00177 }
00178 
00179 - (BOOL)additive
00180 {
00181     return _isAdditive;
00182 }
00183 
00184 - (BOOL)isAdditive
00185 {
00186     return _isAdditive;
00187 }
00188 
00189 @end
00190 
00196 @implementation CABasicAnimation : CAPropertyAnimation
00197 {
00198     id  _fromValue;
00199     id  _toValue;
00200     id  _byValue;
00201 }
00202 
00207 - (void)setFromValue:(id)aValue
00208 {
00209     _fromValue = aValue;
00210 }
00211 
00215 - (id)fromValue
00216 {
00217     return _fromValue;
00218 }
00219 
00224 - (void)setToValue:(id)aValue
00225 {
00226     _toValue = aValue;
00227 }
00228 
00232 - (id)toValue
00233 {
00234     return _toValue;
00235 }
00236 
00241 - (void)setByValue:(id)aValue
00242 {
00243     _byValue = aValue;
00244 }
00245 
00249 - (id)byValue
00250 {
00251     return _byValue;
00252 }
00253 
00254 @end
 All Classes Files Functions Variables Defines