美文网首页
iOS_动画_POP_POPPropertyAnimation.

iOS_动画_POP_POPPropertyAnimation.

作者: 丶纳凉 | 来源:发表于2017-04-12 13:01 被阅读118次

    一丶原文

    
    
    #import <pop/POPAnimatableProperty.h>
    #import <pop/POPAnimation.h>
    
    /**
     @abstract Flags for clamping animation values.
     @discussion Animation values can optionally be clamped to avoid overshoot. kPOPAnimationClampStart ensures values are more than fromValue and kPOPAnimationClampEnd ensures values are less than toValue.
     */
    typedef NS_OPTIONS(NSUInteger, POPAnimationClampFlags)
    {
      kPOPAnimationClampNone        = 0,
      kPOPAnimationClampStart       = 1UL << 0,
      kPOPAnimationClampEnd         = 1UL << 1,
      kPOPAnimationClampBoth = kPOPAnimationClampStart | kPOPAnimationClampEnd,
    };
    
    /**
        semi-concrete 属性动画子类
     */
    @interface POPPropertyAnimation : POPAnimation
    
    /**
    做动画的属性
     */
    @property (strong, nonatomic) POPAnimatableProperty *property;
    
    /**
    做动画的初始值;
    如果未设置,则在动画启动的时候,按照对象当前的值作为初始值;
     */
    @property (copy, nonatomic) id fromValue;
    
    /**
    做动画的值
    如果未设置,则在动画启动的时候,按照对象当前的值作为初始值;
     */
    @property (copy, nonatomic) id toValue;
    
    /**
     四舍五入系数;
     作用让动画变得更圆滑; 默认0; 取1.0和取整值之间;
     */
    @property (assign, nonatomic) CGFloat roundingFactor;
    
    /**
     就是让动画保证在fromValue和tovalue之间,不会越界;
     */
    @property (assign, nonatomic) NSUInteger clampMode;
    
    /**
    动画的值是叠加,而不是设置;
    默认NO;
     */
    @property (assign, nonatomic, getter = isAdditive) BOOL additive;
    
    @end
    
    

    二问题

    1.@property (assign, nonatomic) CGFloat roundingFactor; 使用;

    先看看源码;

    默认为0
     roundingFactor(0),
    

    继续翻


    Paste_Image.png Paste_Image.png Paste_Image.png Paste_Image.png

    四舍五入;

    就是让每一帧动画变得更滑一点;

    @property (assign, nonatomic) NSUInteger clampMode;

    庆幸是开源的,不然压根不懂它干嘛的;

    Paste_Image.png

    让动画保证在fromValue和tovalue之间,不会越界
    看枚举

      kPOPAnimationClampNone        = 0,
      kPOPAnimationClampStart       = 1UL << 0, //保证fromValue开始
      kPOPAnimationClampEnd         = 1UL << 1,//保证toValue开始
      kPOPAnimationClampBoth = kPOPAnimationClampStart | kPOPAnimationClampEnd,
    

    @property (assign, nonatomic, getter = isAdditive) BOOL additive;

    叠加,不是设置;

    图片来源:http://www.tuicool.com/articles/v22QVfq

    1.gif

    三丶其他:

    翻译有问题,留言告诉我下,谢谢;
    以及有使用问题也可以留言,一起探讨探讨;

    相关文章

      网友评论

          本文标题:iOS_动画_POP_POPPropertyAnimation.

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