开源项目:MMTweenAnimation

本文转载至 http://adad184.com/2015/04/14/opensource-mmtweenanimation/

前言


MMTweenAnimation其实酝酿了有一段时间了 起因是对POP重度使用后(POP上手教程) 感到的一丝不足

  • 首先 POP提供的自带动画类型太少(比如想实现如下图的物体落地的动画)
  • 其次 除了POPBasicAnimation之外 无法控制动画的duration

所以趁着休陪产假的空档 研究并做出了MMTweenAnimation的第一版

介绍


MMTweenAnimation 是基于Facebook的POP的动画扩展类 提供10种不同的函数动画

BackBounceCircCubicElastic
ExpoQuadQuartQuintSine

建议使用cocoapod安装

1
pod 'MMTweenAnimation'

 

使用方式如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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"];

小结


库中的动画函数部分借鉴自tweener, 同时有个很棒的网站对这些动画进行了展示

后续可能还会添加一些功能 比如

  • 提供更多类型的动画函数
  • 提供用户自定义的动画函数
  • 动画函数的系数可调节

转载于:https://www.cnblogs.com/Camier-myNiuer/p/4834465.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值