[翻译] MotionBlur

MotionBlur

https://github.com/fastred/MotionBlur

 

MotionBlur allows you to add motion blur effect to your animations (currently only position's change). See the accompanying blog post to learn how it's implemented.

MotionBlur允许你添加动态模糊特效(目前只支持位移变化).你可以看这篇博文来看看是怎么实现的.

 

Note how the text and icons on the menu get blurred when it slides in and out.

注意看,这个文字以及图片会在滑入或者滑出的时候变得模糊了.

 

Usage

First, import it with:

首先,导入头文件:

#import "UIView+MotionBlur.h"

then use it with:

然后这么用:

[yourView enableBlurWithAngle:M_PI_2 completion:^{
    [UIView animateWithDuration:0.5
                          delay:0 usingSpringWithDamping:0.8 initialSpringVelocity:0.3 options:UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionBeginFromCurrentState animations:^{ CGRect f = yourView.frame; f.origin = CGPointMake(0, 300); yourView.frame = f; } completion:^(BOOL finished) { [yourView disableBlur]; }]; }];

Snapshot and blur are computed before the animation, that's why the API is asynchronous. You should also see the example project and read comments in the header file:Classes/UIView+MotionBlur.h.

截图以及模糊会在动画执行前就计算好了.所以,这是这个API为什么是异步的.你可以查看头文件来了解详情.

 

Demo

To run the example project; clone the repo and open Example/MotionBlur.xcodeproj.

 

Requirements

  • iOS 8 and above

 

Installation

MotionBlur is available through CocoaPods. To install it, simply add the following line to your Podfile:

MotionBlur支持CocoaPods.

pod "MotionBlur"

 

Author

Arkadiusz Holko:

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值