MotionBlur 0.2.0

MotionBlur 0.2.0

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最后发布2015年4月

Arkadiusz Holko 维护。



MotionBlur 允许您向动画添加运动模糊效果(目前仅支持位置的更改)。请参阅随附的博客文章了解其实现方式。(链接至文章)

Demo GIF

注意,当菜单滑动进出时,文字和图标会变得模糊。

用法

首先,使用以下方式导入:

#import "UIView+MotionBlur.h"

然后使用它:

[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];
    }];
}];

在动画之前计算快照和模糊,这就是为什么API是异步的。您还应查看示例项目和阅读头文件中的注释:Classes/UIView+MotionBlur.h

演示

要运行示例项目;克隆仓库,并打开Example/MotionBlur.xcodeproj

要求

  • iOS 8及以上版本

安装

作者

Arkadiusz Holko