博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
UIView 添加闪烁的渐变光
阅读量:4562 次
发布时间:2019-06-08

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

CGRect gradientRect=CGRectMake(- imageView3.bounds.size.width*1.5, 0, 4 * imageView3.bounds.size.width, imageView3.bounds.size.height);    CAGradientLayer *gradientLayer = [CAGradientLayer layer];    gradientLayer.frame =gradientRect;    gradientLayer.colors = @[(id)hexColor(bb975e).CGColor,(id)[UIColor whiteColor].CGColor,(id)hexColor(bb975e).CGColor];    gradientLayer.locations = @[@(0.25),@(0.5),@(0.75)];    gradientLayer.startPoint = CGPointMake(0, 0.5);    gradientLayer.endPoint = CGPointMake(1, 0.5);    gradientLayer.position = CGPointMake(imageView3.bounds.size.width*0.5, imageView3.bounds.size.height/2.0);    [imageView3.layer addSublayer:gradientLayer];        CALayer *maskLayer = [CALayer layer];    maskLayer.frame =CGRectOffset(imageView3.bounds, imageView3.bounds.size.width*1.5, 0);    maskLayer.contents = (__bridge id)([UIImage imageNamed:@"launchImage3"].CGImage);    gradientLayer.mask = maskLayer;        CABasicAnimation* fadeAnim = [CABasicAnimation animationWithKeyPath:@"locations"];    fadeAnim.fromValue = @[@(0.0),@(0.0),@(0.25)];    fadeAnim.toValue = @[@(0.75),@(1.0),@(1.0)];    fadeAnim.duration=2;    fadeAnim.repeatCount = CGFLOAT_MAX;    [gradientLayer addAnimation:fadeAnim forKey:nil];

 

转载于:https://www.cnblogs.com/dhui69/p/6170059.html

你可能感兴趣的文章
【转】Python入门:Anaconda和Pycharm的安装和配置
查看>>
ArcGIS 中要素的查询与修改
查看>>
POJ1734【Floyd求最小环板子】
查看>>
linux环境下apache2与tomcat6的负载配置
查看>>
powerdesigner相关概念理解
查看>>
第八章 异常控制流
查看>>
maven在Idea建立工程,运行出现Server IPC version 9 cannot communicate with client version 4错误...
查看>>
【MediaKit】WPF项目中 调用摄像头拍照的开发包
查看>>
使用Pig对手机上网日志进行分析
查看>>
Linux trace使用入门
查看>>
Apache ab 单测 分布式
查看>>
《剑指offer》-链表的第一个公共节点
查看>>
求DNA序列中各个碱基的含量
查看>>
计算机网络课堂笔记3.15
查看>>
Learning Cpp----Comliling your first program
查看>>
Microsoft.Net框架程序设计学习笔记(5):延迟签名
查看>>
html5特性
查看>>
关于我在安装2.6.9版本bochs虚拟机时遇到的问题以及解决过程
查看>>
Linux系统克隆为iso镜像盘(类似win gost)
查看>>
2017 乌鲁木齐赛区网络赛 J Our Journey of Dalian Ends 费用流
查看>>