POP(來自非死book)自定義動畫的一個擴展:MMTweenAnimation

jopen 9年前發布 | 16K 次閱讀 iOS開發 移動開發 MMTweenAnimation
POP(來自非死book)自定義動畫的一個擴展。源于 tweaner(https://code.google.com/p/tweaner), MMTweanerAnimation 提供了10種不同的自定義動畫。
Back Bounce Circ Cubic Elastic
Expo Quad Quart Quint Sine

To apply a MMTweenAnimation, you must configure it by:

@property (nonatomic, copy)   MMTweenAnimationBlock  animationBlock;

@property (nonatomic, assign) double fromValue;
@property (nonatomic, assign) double toValue;
@property (nonatomic, assign) double duration;  //default: 0.3

@property (nonatomic, assign) MMTweenFunctionType functionType; //default: MMTweenFunctionBounce
@property (nonatomic, assign) MMTweenEasingType   easingType;   //default: MMTweenEasingOut

for example:

MMTweenAnimation *anim = [MMTweenAnimation animation];
anim.functionType   = MMTweenFunctionBounce;
anim.easingType     = MMTweenEasingOut;
anim.duration       = 2.0f;
anim.fromValue      = 0;
anim.toValue        = 200;
anim.animationBlock = ^(double c,double d,double v,id target,MMTweenAnimation *animation)
{
    //c: current time, from the beginning of animation
    //d: duration, always bigger than c
    //v: value, after the change at current time

    UIView *t = (UIView*)target;
    t.center = CGPointMake(t.x, v);
};

[targetView pop_addAnimation:anim forKey:@"center.y"];

項目主頁:http://www.baiduhome.net/lib/view/home/1428455804932

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!