开源动画框架Facebook的Pop

来源:互联网 发布:淘宝大卖家物流 编辑:程序博客网 时间:2024/05/16 19:23

一提到动画,首先想到的应该是pop,应用非常广泛!

接下来分享一些我所知道的,

首先导入pop,   用cocoapod可以轻松导入      pod ‘pop‘  ;

还不会cocoapod 的盆友自行百度。

 

上最基础的使用方法

1.  #import "pop/POP.h"

2.

//弹出动画

- (void)showPopWithPopButton:(UIButton *)aButton showPosition:(CGRect)aRect

{

    POPSpringAnimation *positionAnimation = [POPSpringAnimationanimationWithPropertyNamed:kPOPViewFrame];

    positionAnimation.fromValue = [NSValuevalueWithCGRect:aButton.frame];

    positionAnimation.toValue = [NSValuevalueWithCGRect:aRect];

    positionAnimation.springBounciness =6.0f;

    positionAnimation.springSpeed =0.3f;

    [aButton pop_addAnimation:positionAnimationforKey:@"frameAnimation"];

}

当你有一个控件需要动画时,先设置它的初始位置,然后调用上面的方法传入控件和新的位置就可以。

springBounciness 是振幅

springSpeed 是速度

其他参数可自行查看并调节。


1 0
原创粉丝点击