[翻译] CRPixellatedView-用CIPixellate滤镜动态渲染UIView
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:)
[翻译] CRPixellatedView-用CIPixellate滤镜动态渲染UIView的更多相关文章
- iOS给图片添加滤镜&使用openGLES动态渲染图片
给图片增加滤镜有这两种方式: CoreImage / openGLES 下面先说明如何使用CoreImage给图片添加滤镜, 主要为以下步骤: #1.导入CIImage格式的原始图片 #2.创建CIF ...
- iOS CoreImage图片处理动态渲染(滤镜)
// // ViewController.m // CoreImageOfDong // // Created by Dong on 15/6/30. // Copyright (c) 201 ...
- Django动态渲染多层菜单
为后续给菜单设置权限管理方便,通过给页面模版菜单动态渲染,通过数据菜单表进行匹配需要渲染的菜单 #Django表结构 class Menus(models.Model): name = models. ...
- 使用MVVM框架时,如何处理在页面动态渲染完之后需要发生的事件呢?
在项目实践过程中,当我们使用如avalon这样的MVVM框架时,通常会发现一直会有个问题. 过往的经验告诉我们,想在页面加载完之后处理些事件我们可以绑定document的ready方法或者使用jque ...
- JS动态修改页面EasyUI datebox不生效、EasyUI动态添加Class、EasyUI动态渲染解析解决方案
这是个小菜在实际工作中遇到的问题,相信很多EasyUI新手很可能也遇到这样的问题,因此小菜觉得有必要拿出来分享一下. 这个问题要从EasyUI的datebox组件说起,小菜用这个组件的时候,发现用$( ...
- vue + element 动态渲染、移除表单并添加验证
博客地址:https://ainyi.com/66 又接到新需求了吧~~ 背景 在一个大表单里,有可能会出现这种需求,用户可以自己操作动态添加.移除表单,更加个性化的效果. 常见于填写个人信息.附加内 ...
- 动态渲染页面爬取-Selenium & Splash
模拟浏览器的动机 JS动态渲染的页面不止Ajax一种 很多网页的Ajax接口含有加密参数,分析其规律的成本过高 通过对浏览器运行方式的模拟,我们将做到:可见即可爬 Python中常用的模拟浏览器运行的 ...
- iview 动态渲染menu时active-name无效的问题
动态渲染menu时,如果需要active-name,那么name只能绑定index,动态渲染的数组初始必须有一个空对象.否则无法使用active-name属性.注:仅限3.0版本,不排除新版本修复的可 ...
- vue使用动态渲染v-model输入框无法输入内容
最近使用ElementUI框架,在动态渲染表单的时候,表单框无法输入内容,但是绑定model的数据是会发生变化 解决方法: 将动态生成的表单对象,深拷贝到 data 对象中 <el-date-p ...
随机推荐
- docker仓库--使用tenxcloud
上传镜像 1. 在本地 docker 环境中输入以下命令进行登录 sudo docker login index.tenxcloud.com 2. 然后,对本地需要 push 的 image 进行标记 ...
- struct in_addr 结构体
struct in_addr 结构体: struct in_addr { in_addr_t s_addr; }; 表示一个32位的IPv4地址. in_addr_t一般为32位的unsigned i ...
- redis实战笔记(5)-第5章 使用 Redis构建支持程序
本章主要内容 1.使用Redis记录日 志 2.使用Redis实现计数器并进行数据统计 3.查询IP地址所属的城市与国家 4.服务的发现与配置 这一章将介绍如何使用Redis来帮助和支持系统的其他 ...
- js判断手机是否安装了某一款app,有则打开,没有去下载
function openApp(){ if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) { var loadDateTime = new ...
- .Net4.5新特性:正则表达式超时介绍
“Regex” 在数据验证方面最受欢迎.考虑到您可能对“Regex”完全陌生的.请参考我介绍Regex如何运作的视频. But because of the typical parsing logic ...
- 【转】Stack Overflow研发副总裁:.NET技术并不差,合适自己就好
摘要:在QCon纽约大会上, Stack Exchange的工程部副总裁David Fullerton深入解析了如何使用C#.MS SQL等技术支撑Stack Overflow网站的单块应用架构,这个 ...
- swagger 集成asp.net Core2.1
首先通过nuget 安装 Swashbuckle.AspNetCore 1.在startup.cs 的configureService services.AddAutoMapper(); serv ...
- ZooKeeper 节点
ZNode zk 中的每一个数据节点称为 ZNode ,所有的 ZNode 按层次化结构进行组织,形成一棵树(与Linux文件系统相似).节点可以写入数据,也可以在节点下面创建子节点. 节点类型: 1 ...
- Yii查询count()
BsCapters::model()->findAllBySql("select count(*) as bookids from bs_capters where bookid = ...
- DOM节点树和元素树--深度遍历
我们在阅读JS高级程序设计的时候,提到了节点树的概念.比如说: elem.parentNode---找elem的父节点: elem.childNodes---找elem的所有的直接子节点: elem. ...