zl程序教程

您现在的位置是:首页 >  其它

当前栏目

MotionBlur

2023-09-14 08:57:16 时间

MotionBlur

https://github.com/fastred/MotionBlur

 

MotionBlur allows you to add motion blur effect to your animations (currently only positions change). See the accompanying blog post to learn how its 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, thats 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:

Blog @arekholko on Twitter
这一篇让你彻底搞懂贝塞尔曲线 贝塞尔曲线不懂画?不知道怎么回事?看这一篇就够了!用图形,点曲线运动图和公式推导,让你彻底搞懂贝塞尔曲线的运行原理!
从源码解析ERROR 1129 (HY000):Host is blocked because of many connection errors 原创水平有限,有错请指出 源码版本5.7.14 今天群里一个朋友出现如下错误: ERROR 1129 (HY000): Host 10.0.0.8 is blocked because of many connection errors; unblock w...
解析MYSQL BINLOG 二进制格式(6)--UPDATE_ROW_EVENT/DELETE_ROW_EVENT 原创:转载请说明出处谢谢! http://blog.itpub.net/7728585/viewspace-2133188/ 解析MYSQL BINLOG 二进制格式(1)--准备工作  http://blog.
本工具为采集show global status 实时输出的一个监控工具,工具源码大约1000行代码 本文主要为说明文档,并且带有核心源码。 一、此工具展示方式:      工具将show global status中一些重要的值按照用户输入的描述和次数不断的打印到前台或者打印到 指定文件中,用于帮助DBA进行性能诊断或者瓶颈判断。
关于LINUX FILE命令是如何判断文件字符集的 今天在使用file -i 查看MYSQLDUMP文件的时候其输出为 charset=us-ascii with very long lines 我导出的文件应该是utf8的,为什么会显示ASCII呢,我们知道ASCII并没有中文编码,那么真的有问题吗? 然后用如...
C99 flexible array number 伸缩型数组成员 这种特性用来射你那个结构体中最后一个成员是特殊成员,它是不存在的 它包含如下规则: 1、必须是最后一个数组成员 2、结构体中至少有一个其他成员 3、使用[]进行定义 /********************************************...