动画组合(uber启动时的等待效果)
by 伍雪颖
- (void)startAnimation
{
self.layer.masksToBounds
=
0;
self.layer.cornerRadius
=
50;
if (self.layer.sublayers
==
nil) {
[self
setUpAnimation];
}
self.layer.speed
=
1;
}
- (void)setUpAnimation {
CABasicAnimation *posAnim = [CABasicAnimation
animationWithKeyPath:@"transform.scale"];
posAnim.fromValue
=
@(0.01);
posAnim.toValue
=
@(1);
posAnim.duration
=
1;
posAnim.timingFunction
= [CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
CABasicAnimation *opacity = [CABasicAnimation
animationWithKeyPath:@"opacity"];
opacity.fromValue
=
@(1);
opacity.toValue
=
@(0);
opacity.duration
=
1;
opacity.timingFunction
= [CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
CAAnimationGroup *animGroup = [CAAnimationGroup
animation];
animGroup.animations
= [NSArray
arrayWithObjects:posAnim, opacity,
nil];
animGroup.duration
=
1;
animGroup.repeatCount
=
HUGE;
[self.layer
addAnimation:animGroup
forKey:nil];
}
版权声明:本文为博主原创文章,未经博主允许不得转载。