音量振动条
CAReplicatorLayer *repL = [CAReplicatorLayer layer]
[_lightView
.layer addSublayer:repL]
CALayer *layer = [CALayer layer]
layer
.anchorPoint = CGPointMake(
0.5,
1)
layer
.position = CGPointMake(
15, _lightView
.frame.size.height)
layer
.bounds = CGRectMake(
0,
0,
30,
150)
layer
.backgroundColor = [UIColor whiteColor]
.CGColor
[repL addSublayer:layer]
CABasicAnimation *anim = [CABasicAnimation animation]
anim
.keyPath = @
"transform.scale.y"
anim
.toValue =
@0.1
anim
.duration =
0.5
anim
.repeatCount = MAXFLOAT
//设置动画反转
anim
.autoreverses = YES
[layer addAnimation:anim forKey:nil]
//instanceCount,表示复制层里有多少个子层,包括原始层
repL
.instanceCount =
5
//设置复制子层偏移量,不包括原始层,相对于原始层
x偏移
repL
.instanceTransform = CATransform3DMakeTranslation(
45,
0,
0)
//设置复制层动画延迟时间
repL
.instanceDelay =
0.1
repL
.instanceColor = [UIColor greenColor]
.CGColor
repL
.instanceGreenOffset = -
0.2
活动指示器
CAReplicatorLayer *repL = [CAReplicatorLayer layer]
repL
.frame = _lightView
.bounds
[_lightView
.layer addSublayer:repL]
CALayer *layer = [CALayer layer]
layer
.transform = CATransform3DMakeScale(
0,
0,
0)
layer
.position = CGPointMake(_lightView
.bounds.size.width /
2,
20)
layer
.bounds = CGRectMake(
0,
0,
10,
10)
layer
.backgroundColor = [UIColor greenColor]
.CGColor
[repL addSublayer:layer]
// 设置缩放动画
CABasicAnimation *anim = [CABasicAnimation animation]
anim
.keyPath = @
"transform.scale"
anim
.fromValue =
@1
anim
.toValue =
@0
anim
.repeatCount = MAXFLOAT
CGFloat duration =
1
anim
.duration = duration
[layer addAnimation:anim forKey:nil]
int count =
20
CGFloat angle = M_PI *
2 / count
// 设置子层总数
repL
.instanceCount = count
repL
.instanceTransform = CATransform3DMakeRotation(angle,
0,
0,
1)
repL
.instanceDelay = duration / count
转载请注明原文地址: https://ju.6miu.com/read-665088.html