CAAnimation 继承自 NSObject,比较重要的方法我列到下面:
CAAnimation
/* Creates a new animation object. */
+ (id)animation; //工厂方法
/* Animations implement the same property model as defined by CALayer. See CALayer.h for more details. */
+ (id)defaultValueForKey:(NSString *)key; //(CALayer中的可以被动画的属性,凡是带animatable 均可)
* A timing function defining the pacing of the animation. Defaults to nil indicating linear pacing. */
@property(retain)CAMediaTimingFunction *timingFunction; // 抽象理解就是插值方法
@property(retain) id delegate; //动画开始和结束的delegate,可以设置此属性,进行相应的操作。
其中,delegate 定义如下:
@interface NSObject (CAAnimationDelegate)
/* Called when the animation begins its active duration. */
- (void)animationDidStart:(CAAnimation *)anim;
- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag;
@end
属性动画 CAPropertyAnimation 继承 自 CAAnimation,CALayer的属性动画
/** Subclass for property-based animations. **/
@interface CAPropertyAnimation : CAAnimation
/* Creates a new animation object with its `keyPath' property set to 'path'. */
+ (id)animationWithKeyPath:(NSString *)path; // 创建并返回一个基于keyPath的 CAPropertyAnimation对象
/* The key-path describing the property to be animated. */
@property(copy) NSString *keyPath;
@property(getter=isAdditive)BOOL additive;
/* The `cumulative' property affects how repeating animations produce
* their result. If true then the current value of the animation is the
* value at the end of the previous repeat cycle, plus the value of the
* current repeat cycle. If false, the value is simply the value
* calculated for the current repeat cycle. Defaults to NO. */
@property(getter=isCumulative)BOOL cumulative;
/* If non-nil a function that is applied to interpolated values before they are set as the new presentation value of the animation's target property. Defaults to nil. */
@property(retain) CAValueFunction *valueFunction;
@end
CABasicAnimation 继承自 CAPropertyAnimation
/** Subclass for basic (single-keyframe) animations. **/
@interface CABasicAnimation : CAPropertyAnimation
/* The objects defining the property values being interpolated between.
* All are optional, and no more than two should be non-nil. The object
* type should match the type of the property being animated (using the
* standard rules described in CALayer.h). The supported modes of
* animation are:
*
* - both `fromValue' and `toValue' non-nil. Interpolates between
* `fromValue' and `toValue'.
*
* - `fromValue' and `byValue' non-nil. Interpolates between
* `fromValue' and `fromValue' plus `byValue'.
*
* - `byValue' and `toValue' non-nil. Interpolates between `toValue'
* minus `byValue' and `toValue'.
*
* - `fromValue' non-nil. Interpolates between `fromValue' and the
* current presentation value of the property.
*
* - `toValue' non-nil. Interpolates between the layer's current value
* of the property in the render tree and `toValue'.
*
* - `byValue' non-nil. Interpolates between the layer's current value
* of the property in the render tree and that plus `byValue'. */
@property(retain) id fromValue, toValue, byValue;
@end
CAKeyframeAnimation继承自 CAPropertyAnimation
/** General keyframe animation class. **/
@interface CAKeyframeAnimation : CAPropertyAnimation
/* An array of objects providing the value of the animation function for
* each keyframe. */
@property(copy) NSArray *values;
/* An optional path object defining the behavior of the animation
* function. When non-nil overrides the `values' property. Each point
* in the path except for `moveto' points defines a single keyframe for
* the purpose of timing and interpolation. Defaults to nil. For
* constant velocity animation along the path, `calculationMode' should
* be set to `paced'. */
@property CGPathRef path;
/* An optional array of `NSNumber' objects defining the pacing of the
* animation. Each time corresponds to one value in the `values' array,
* and defines when the value should be used in the animation function.
* Each value in the array is a floating point number in the range
* [0,1]. */
@property(copy) NSArray *keyTimes;
/* An optional array of CAMediaTimingFunction objects. If the `values' array
* defines n keyframes, there should be n-1 objects in the
* `timingFunctions' array. Each function describes the pacing of one
* keyframe to keyframe segment. */
@property(copy) NSArray *timingFunctions;
/* The "calculation mode". Possible values are `discrete', `linear',
* `paced', `cubic' and `cubicPaced'. Defaults to `linear'. When set to
* `paced' or `cubicPaced' the `keyTimes' and `timingFunctions'
* properties of the animation are ignored and calculated implicitly. */
@property(copy) NSString *calculationMode;
/* For animations with the cubic calculation modes, these properties
* provide control over the interpolation scheme. Each keyframe may
* have a tension, continuity and bias value associated with it, each
* in the range [-1, 1] (this defines a Kochanek-Bartels spline, see
* http://en.wikipedia.org/wiki/Kochanek-Bartels_spline).
*
* The tension value controls the "tightness" of the curve (positive
* values are tighter, negative values are rounder). The continuity
* value controls how segments are joined (positive values give sharp
* corners, negative values give inverted corners). The bias value
* defines where the curve occurs (positive values move the curve before
* the control point, negative values move it after the control point).
*
* The first value in each array defines the behavior of the tangent to
* the first control point, the second value controls the second
* point's tangents, and so on. Any unspecified values default to zero
* (giving a Catmull-Rom spline if all are unspecified). */
@property(copy) NSArray *tensionValues, *continuityValues, *biasValues;
/* Defines whether or objects animating along paths rotate to match the
* path tangent. Possible values are `auto' and `autoReverse'. Defaults
* to nil. The effect of setting this property to a non-nil value when
* no path object is supplied is undefined. `autoReverse' rotates to
* match the tangent plus 180 degrees. */
@property(copy) NSString *rotationMode;
@end