zl程序教程

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

当前栏目

[翻译] CRPixellatedView-用CIPixellate滤镜动态渲染UIView

动态 渲染 翻译 滤镜 uiview
2023-09-14 08:57:17 时间

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:)


将 WebGL 动画作为背景 大家好我是FLy哥,又到了周末了, 这次分享的文章不是很长,如果你正在或者将来会涉及到你的博客,就是如何在正常的网页中加入酷炫的3D效果: webgl 动画 上面的3D动画 其实就是整个网页的背景,然后你的html 页面 还是正常写的,互不干涉,其实还就是一个字, 让自己的页面看着更加花里胡哨的 我们看看如何解决吧??? 有 2 种方法: 将画布的 CSS 属性 position 设置成 fixed #canvas { position: fixed; left: 0; top: 0; z-index: -1; ...} 并将 z-index 设置成 -
OpenGL图像渲染以及渲染问题解决方案 在绘制3D场景的时候,我们需要决定哪些部分是对观察者可见的,或者哪些部分是对观察者不可见的,对于不可见的部分,应该及早丢弃。例如在一个不透明的墙壁后,就不应该有渲染,这种情况叫做隐藏面消除(Hidden surface elimination).
【Unity3D Shader】学习笔记-图片滤镜① 效果和上面的比较相似,Photoshop CS图像黑白调整功能的计算公式为: gray= (max - mid) * ratio_max + (mid - min) * ratio_max_mid + min 公式中:gray为像素灰度值,max、mid和min分别为图像像素R、G、B分量颜色的最大值、中间值和最小值,ratio_max为max所代表的分量颜色(单色)比率,ratio_max_mid则为max与mid两种分量颜色所形成的复色比率。 默认的单色及复色比率为:
一种动画框架Lottie的解析(一)—— 基本介绍(一)一种动画框架Lottie的解析(二)—— 基本介绍(二)一种动画框架Lottie的解析(三)—— 框架结构