美文网首页
CAAnimation.h

CAAnimation.h

作者: ShenYj | 来源:发表于2016-09-25 13:13 被阅读27次
    
    #import <QuartzCore/CALayer.h>
    #import <Foundation/NSObject.h>
    
    @class NSArray, NSString, CAMediaTimingFunction, CAValueFunction;
    
    
    @interface CAAnimation : NSObject
        <NSCoding, NSCopying, CAMediaTiming, CAAction>
    {
    @private
      void *_attr;
      uint32_t _flags;
    }
    
    + (id)animation;    // 创建动画
    + (id)defaultValueForKey:(NSString *)key;
    - (BOOL)shouldArchiveValueForKey:(NSString *)key;
    
    @property(retain) CAMediaTimingFunction *timingFunction;
    @property(retain) id delegate;  // 代理
    @property(getter=isRemovedOnCompletion) BOOL removedOnCompletion; // 完成后是否回到原来的地方
    
    @end
    
    #pragma - mark - 代理方法
    @interface NSObject (CAAnimationDelegate)
    
    - (void)animationDidStart:(CAAnimation *)anim;
    - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag;
    
    @end
    
    
    #pragma - mark - 属性动画,修改属性
    @interface CAPropertyAnimation : CAAnimation
    
    + (id)animationWithKeyPath:(NSString *)path;
    @property(copy) NSString *keyPath; // KVC的键
    @property(getter=isAdditive) BOOL additive;
    @property(getter=isCumulative) BOOL cumulative;
    @property(retain) CAValueFunction *valueFunction;
    
    @end
    
    
    
    @interface CABasicAnimation : CAPropertyAnimation
    
    #pragma - mark toValue是最终的值,byValue是在原来基础上增加的值
    @property(retain) id fromValue, toValue, byValue;
    
    @end
    
    #pragma - mark - 关键帧动画,根据path一帧一帧的放动画
    @interface CAKeyframeAnimation : CAPropertyAnimation
    
    @property(copy) NSArray *values;    // 所有的取值
    @property CGPathRef path;           // 指定动画的路径,会忽略设置的values, 锚点始终在路径上
    @property(copy) NSArray *keyTimes;  // 时间数组
    @property(copy) NSArray *timingFunctions; // 时间函数
    @property(copy) NSString *calculationMode;
    @property(copy) NSArray *tensionValues, *continuityValues, *biasValues;
    @property(copy) NSString *rotationMode;
    
    @end
    
    
    CA_EXTERN NSString * const kCAAnimationLinear
        __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0);
    CA_EXTERN NSString * const kCAAnimationDiscrete
        __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0);
    CA_EXTERN NSString * const kCAAnimationPaced
        __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0);
    CA_EXTERN NSString * const kCAAnimationCubic
        __OSX_AVAILABLE_STARTING (__MAC_10_7, __IPHONE_4_0);
    CA_EXTERN NSString * const kCAAnimationCubicPaced
        __OSX_AVAILABLE_STARTING (__MAC_10_7, __IPHONE_4_0);
    
    
    CA_EXTERN NSString * const kCAAnimationRotateAuto
        __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0);
    CA_EXTERN NSString * const kCAAnimationRotateAutoReverse
        __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0);
    
    #pragma - mark - 转场动画
    @interface CATransition : CAAnimation
    
    @property(copy) NSString *type;         // 动画种类,主要是样式
    @property(copy) NSString *subtype;      // 子动画种类,主要是方向
    @property float startProgress, endProgress;
    @property(retain) id filter;
    
    @end
    
    
    CA_EXTERN NSString * const kCATransitionFade    
        __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0);
    CA_EXTERN NSString * const kCATransitionMoveIn
        __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0);
    CA_EXTERN NSString * const kCATransitionPush
        __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0);
    CA_EXTERN NSString * const kCATransitionReveal
        __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0);
    
    
    CA_EXTERN NSString * const kCATransitionFromRight
        __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0);
    CA_EXTERN NSString * const kCATransitionFromLeft
        __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0);
    CA_EXTERN NSString * const kCATransitionFromTop
        __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0);
    CA_EXTERN NSString * const kCATransitionFromBottom
        __OSX_AVAILABLE_STARTING (__MAC_10_5, __IPHONE_2_0);
    
    
    #pragma - mark -
    @interface CAAnimationGroup : CAAnimation
    
    @property(copy) NSArray *animations;
    
    @end
    
    
    

    相关文章

      网友评论

          本文标题:CAAnimation.h

          本文链接:https://www.haomeiwen.com/subject/kmdfyttx.html