iOS 环绕动画 CAReplicatorLayer
来源:互联网 发布:谈大数据的重要性 编辑:程序博客网 时间:2024/04/29 21:43
@implementation ViewController{ CAReplicatorLayer *_replicatorLayer; UIView *_earthView;; }- (void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; UIBezierPath *bezierPath = [UIBezierPath bezierPath]; [bezierPath addArcWithCenter:CGPointMake(self.view.center.x, self.view.center.y) radius:150 startAngle:0 endAngle:M_PI * 2 clockwise:YES]; [bezierPath closePath]; CAKeyframeAnimation *animation = [CAKeyframeAnimation animation]; animation.keyPath = @"position"; animation.path = bezierPath.CGPath; animation.duration = 10; animation.repeatCount = MAXFLOAT; _replicatorLayer.instanceCount = 1; // 创建实例个数 _replicatorLayer.instanceDelay = 0; [self.view.layer addSublayer:_replicatorLayer]; [_earthView.layer addAnimation:animation forKey:nil];}- (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor grayColor]; _replicatorLayer = [[CAReplicatorLayer alloc] init]; _earthView = [[UIView alloc] initWithFrame:CGRectMake(50, 100, 50, 50)]; _earthView.backgroundColor = [UIColor greenColor]; _earthView.layer.masksToBounds = YES; _earthView.layer.cornerRadius = 25; [self.view addSubview:_earthView]; UIView *sunView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; sunView.layer.masksToBounds = YES; sunView.layer.cornerRadius = 50; sunView.backgroundColor = [UIColor redColor]; sunView.center = self.view.center; [self.view addSubview:sunView]; [_replicatorLayer addSublayer:_earthView.layer]; [_replicatorLayer addSublayer:sunView.layer]; }
话不多说直接代码
阅读全文
0 0
- iOS 环绕动画 CAReplicatorLayer
- ios 音乐跳动动画-CAReplicatorLayer
- iOS 环绕旋转动画实现
- iOS 动画Animation-4-4: CALayer子类:CAReplicatorLayer
- 用 CAReplicatorLayer 创建动画
- iOS CAReplicatorLayer简单笔记
- ios CAReplicatorLayer使用
- CAReplicatorLayer
- CAReplicatorLayer
- iOS开发之iOS中的动画实现,通过CAShapeLayer、CAShapeLayer,CAReplicatorLayer实现炫酷的动画、雷达效果,波纹效果,咻一咻效果。iOS核心动画实现。
- IOS使用CAReplicatorLayer重建动态的倒影
- iOS使用CAReplicatorLayer重建动态的倒影
- CALayer动画实践(二):CAReplicatorLayer的用法
- iOS quartzCore第六章—— CAReplicatorLayer的运用
- iOS CAReplicatorLayer复制图层 ---- 加载指示器制作
- WPF圆形环绕的Loading动画
- Winform圆形环绕的Loading动画
- UIView动画 防多星球环绕转动
- 集合(Collection)
- TypeScript 和 JavaScript 的区别?
- ajax方式选择部门获取部门中所有成员
- 【jQuery】jQuery 语法
- 什么是微信公众平台?
- iOS 环绕动画 CAReplicatorLayer
- 利用循环打印乘法小九九
- 深入理解DOM事件机制系列第三篇——事件对象
- OpenCV Mac 版 trackBar 不能显示数值,是否有解决办法?
- 一些名字的缩写
- 【jQuery】jQuery 选择器
- java基础-hashCode与equals的区别与联系
- 如何评价VS Code中的Monaco编辑器?
- 初识View-FIVE