美文网首页
facebook-pop转场动画自定义

facebook-pop转场动画自定义

作者: Easy_VO | 来源:发表于2016-03-21 09:57 被阅读623次

先来看一下效果图

popAnimation.gif
最近脸书好像在极力的跟天朝交涉,估计不久的将来脸书即将进入中国,不扯犊子了,说正事。

准备开始新建一个iOS工程动手做起来吧

首先到github上facebook开放的动画库

https://github.com/facebook/pop

在新建的工程里用pod或者拖拽文件夹到工程都行,这个应该都会的不赘述-。-,然后在需要的地方导入

#import <pop/POP.h>
然后在storyboard中拖拽如图的UI
屏幕快照 2016-03-21 上午9.29.49.png

在ViewController中
- (IBAction)popButtonWasClick:(id)sender;
@property (weak, nonatomic) IBOutlet UIButton *popButton;

在popButtonWasClick:(id)sender方法里
POPSpringAnimation *sprintAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewScaleXY];

sprintAnimation.velocity = [NSValue valueWithCGPoint:CGPointMake(8, 8)];
sprintAnimation.springBounciness = 20.f;
[self.popButton pop_addAnimation:sprintAnimation forKey:@"sendAnimation"];

build效果图如下

popAnimationbtn.gif
还有一些效果,可以阅读facebook-pop的说明,都很酷很简单。

接下来我们要在点击按钮的事件中处理跳转,也就是自定义转场动画。

Demo目录结构如下
屏幕快照 2016-03-21 上午9.36.35.png

详细的参照github吧,看到给个发大财star-。-
https://github.com/Easyzhan/facebook-Pop-Demo
啊工作了-。~

相关文章

网友评论

      本文标题:facebook-pop转场动画自定义

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