iOS之CAReplicatorLayer属性简介和使用
1、CAReplicatorLayer简介
CAReplicatorLayer用于对图层进行复制,包括图层的动画也能复制!可以看着将某一段事务进行重复!
#import <QuartzCore/CALayer.h> NS_ASSUME_NONNULL_BEGIN
CA_CLASS_AVAILABLE (10.6, 3.0, 9.0, 2.0)
@interface CAReplicatorLayer : CALayer //指定图层重复制多少次
@property NSInteger instanceCount; //设置为YES,图层将保持于CATransformLayer类似的性质和相同的限制
@property BOOL preservesDepth; //复制延时,一般用在动画上
@property CFTimeInterval instanceDelay; //3D变换
@property CATransform3D instanceTransform; //设置多个复制图层的颜色,默认位白色
@property(nullable) CGColorRef instanceColor; //设置每个复制图层相对上一个复制图层的红色、绿色、蓝色、透明度偏移量
@property float instanceRedOffset;
@property float instanceGreenOffset;
@property float instanceBlueOffset;
@property float instanceAlphaOffset; @end NS_ASSUME_NONNULL_END
2、CAReplicatorLayer的简单使用
- (void)cirAction{
CAShapeLayer *sharLayer = [CAShapeLayer layer];
sharLayer.backgroundColor = [UIColor redColor].CGColor;
sharLayer.bounds = CGRectMake(, , , );
sharLayer.position = CGPointMake(CScreenWidth/, );
sharLayer.cornerRadius = ;
CABasicAnimation *ani = [CABasicAnimation animationWithKeyPath:@"transform"];
ani.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(, , )];
ani.duration = ;
CABasicAnimation *ani1 = [CABasicAnimation animationWithKeyPath:@"opacity"];
ani1.fromValue = @;
ani1.toValue = @;
ani1.duration = ;
CAAnimationGroup *group = [CAAnimationGroup animation];
group.animations = @[ani,ani1];
group.duration = ;
group.repeatCount = HUGE;
[sharLayer addAnimation:group forKey:nil];
CAReplicatorLayer *replayer =[CAReplicatorLayer layer];
[replayer addSublayer:sharLayer];
replayer.instanceCount = ;
replayer.instanceDelay = 0.5;
[self.showView.layer addSublayer:replayer];
}
效果图

- (void)alphaAction{
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.backgroundColor = [UIColor redColor].CGColor;
shapeLayer.bounds = CGRectMake(, , , );
shapeLayer.position = CGPointMake(CScreenWidth/, );
shapeLayer.borderColor = [UIColor whiteColor].CGColor;
shapeLayer.cornerRadius = ;
shapeLayer.borderWidth = ;
shapeLayer.transform = CATransform3DMakeScale(., ., .);
CABasicAnimation *ani = [CABasicAnimation animationWithKeyPath:@"transform"];
ani.duration = ;
ani.repeatCount = HUGE;
ani.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(, , )];
ani.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(., ., .)];
[shapeLayer addAnimation:ani forKey:nil];
CAReplicatorLayer *repLayer = [CAReplicatorLayer layer];
repLayer.frame = CGRectMake(, , CScreenWidth, );
[repLayer addSublayer:shapeLayer];
repLayer.instanceCount = ;
repLayer.instanceDelay = .;
repLayer.instanceTransform = CATransform3DMakeRotation(M_PI/, , , );
repLayer.instanceAlphaOffset = -0.05;
[self.showView.layer addSublayer:repLayer];
}
效果图

iOS之CAReplicatorLayer属性简介和使用的更多相关文章
- iOS之CAGradientLayer属性简介和使用
1.CAGradientLayer简介 CAGradientLayer用于制作背景图层的颜色渐变,也就是颜色梯度!相关属性简介: #import <QuartzCore/CALayer.h> ...
- iOS之CAScrollLayer属性简介和使用
1.CAScrollLayer的简介 CAScrollLayer用于显示一个滑动图层的一部分,可以确定滑动方向和可视区域面积,限制不滑出区域外!相关属性如下:其中 /* Scroll the cont ...
- iOS之CALayer属性简介
/* CoreAnimation - CALayer.h Copyright (c) 2006-2017, Apple Inc. All rights reserved. */ #import < ...
- iOS之CATextLayer属性简介
1.CATextLayer简介 CATextLayer快速高效简单地来渲染纯文本.NSAttributedString /* The text layer provides simple text l ...
- iOS之CAShapeLayer属性简介
1.CAShapeLayer需要和贝塞尔曲线一块使用! #import <QuartzCore/CALayer.h> NS_ASSUME_NONNULL_BEGIN CA_CLASS_AV ...
- iOS开发-automaticallyAdjustsScrollViewInsets属性
iOS开发-automaticallyAdjustsScrollViewInsets属性 Available in iOS 7.0 and later. 简单点说就是automaticallyAdju ...
- HTML5 Audio and Video 的新属性简介
前言:HTML5 中 Audio and Video的使用方法比较简单,但就是比较复杂,方法属性多.如果不常用的几乎难以记住,甚至有些人难以区分不同属性和方法的作用,更别说应用了.以下对Audio a ...
- IOS UITableView NSIndexPath属性讲解
IOS UITableView NSIndexPath属性讲解 查看UITableView的帮助文档我们会注意到UITableView有两个Delegate分别为:dataSource和deleg ...
- IOS学习5——属性与成员变量
[转]iOS中属性与成员变量的区别 ios中属性修饰符的作用 1. 属性用property声明 2. 简而言之,对于目前的ios开发,属性和成员变量的区别,完全可以不管. 3. 这个是历史原因造成的. ...
随机推荐
- Asp.Net Core 第06局:中间件
总目录 前言 本文介绍Asp.Net Core 中间件. 环境 1.Visual Studio 2017 2.Asp.Net Core 2.2 开局 第一手:中间件概述 1.中间件:添加到应用 ...
- vim可视模式
参考: http://xw2423.byr.edu.cn/blog/archives/232 http://www.pythonclub.org/linux/vim/visual-mode Vim的多 ...
- Selenium:八种元素定位方法
前言: 我们在做WEB自动化时,最根本的就是操作页面上的元素,首先我们要能找到这些元素,然后才能操作这些元素.工具或代码无法像我们测试人员一样用肉眼来分辨页面上的元素.那么我们怎么来定位他们呢? 在学 ...
- Cocos2d 之FlyBird开发---GameData类
| 版权声明:本文为博主原创文章,未经博主允许不得转载. 现在是大数据的时代,绝大多数的游戏也都离不开游戏数据的控制,简单的就是一般记录游戏的得分情况,高端大气上档次一点的就是记录和保存各方面的游 ...
- javaIO流(三)--IO深入操作
一.字符编码 在计算机的世界中,本质上只认识0,1的字节数据,如果要想描述一些文字的编码就需要对这些二进制的数据进行组合,就需要对二进制的数据进行组合,所以才有了现在可看见的中文显示,但是在进行编码的 ...
- 搭建 webpack、react 开发环境(一)
基本介绍 Webpack 是一个前端资源加载/打包工具.它将根据模块的依赖关系进行静态分析,然后将这些模块按照指定的规则生成对应的静态资源,它可以将多种静态资源 JavaScript.css.le ...
- 后台执行循环(done &)
- go语言从例子开始之Example24.通道同步
我们可以使用通道来同步 Go 协程间的执行状态.这里是一个使用阻塞的接受方式来等待一个 Go 协程的运行结束. Example: package main import "fmt" ...
- WTSEnumerateSessions 枚举session信息
http://dwbpriarie.lofter.com/post/1cd339fc_8cf728c https://www.cnblogs.com/priarieNew/p/9755655.html ...
- case when使用的总结
https://blog.csdn.net/changxiangyangy/article/details/86718551 前几天,为了给产品分析当前用户数据结构,写sql的时候使用到了case w ...