博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[翻译] CRPixellatedView-用CIPixellate滤镜动态渲染UIView
阅读量:6910 次
发布时间:2019-06-27

本文共 1665 字,大约阅读时间需要 5 分钟。

CRPixellatedView-用CIPixellate滤镜动态渲染UIView

https://github.com/chroman/CRPixellatedView

本人测试的效果:

Usage

To use CRPixellatedView, create a CRPixellatedView, configure and animate!

要使用CRPixellatedView的话,创建一个CRPixellatedView,配置以及做动画!

 

An example of making a CRPixellatedView:

以下是一个使用CRPixellatedView的例子:

CRPixellatedView *pixellatedView = [[CRPixellatedView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)]; pixellatedView.image = [UIImage imageNamed:@"Image"]; [self.view addSubview:pixellatedView]; // Add to your view [pixellatedView animate];

 

You can configure this settings, customizable example:

以下是配置设置,自定义的例子:

CRPixellatedView *pixellatedView = [[CRPixellatedView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)]; pixellatedView.image = [UIImage imageNamed:@"Image"]; pixellatedView.pixelScale = 20.0f; pixellatedView.animationDuration = 0.8f; [self.view addSubview:pixellatedView]; // Add to your view [pixellatedView animateWithCompletion:^(BOOL finished) { NSLog(@"completed"); }];

 

Also, you can customize the animation effect using the reverse property:

以下是你使用反转效果的例子:

CRPixellatedView *pixellatedView = [[CRPixellatedView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)]; pixellatedView.image = [UIImage imageNamed:@"Image"]; pixellatedView.pixelScale = 20.0f; pixellatedView.animationDuration = 0.8f; pixellatedView.reverse = YES; // Reverse effect [self.view addSubview:pixellatedView]; // Add to your view [pixellatedView animateWithCompletion:^(BOOL finished) { NSLog(@"completed"); }];

 

Examples

pixellatedView.reverse = YES; // Reverse effect

pixellatedView.reverse = NO; // (default) pixellatedView.pixelScale = 30.0f;

 

核心的地方:

使用了3个CoreImage的滤镜用来重绘View:)

 

转载地址:http://klycl.baihongyu.com/

你可能感兴趣的文章
一个非常好用的中文语音播报接口
查看>>
USB Host的上拉下拉电阻
查看>>
读书笔记系列之java性能优化权威指南 一 第一章
查看>>
结构体 typedef关键字
查看>>
Android设备连接Unity Profiler性能分析器
查看>>
PL/SQL中复制中文再粘贴出现乱码问题的解决【转】
查看>>
【分享】博客美化(8)让你的博客“推荐按钮”动起来
查看>>
javascript prototype
查看>>
Linux 上的基础网络设备详解
查看>>
到底是否应该重复造轮子
查看>>
c 从语言中的内存管理
查看>>
Linux中ping命令
查看>>
oracle数据库导入导出命令!
查看>>
zoj 1610 Count the Colors 线段树区间更新/暴力
查看>>
android解决内存溢出的问题(没有从根本上解决)
查看>>
我心中想念那位偷吃玉米的老朋友
查看>>
“Installation error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED”
查看>>
Kryo 为什么比 Hessian 快
查看>>
使用svn hooks 脚本post-commit时遇到的故障
查看>>
Android.mk 文件语法详解
查看>>