iOS CoreAnimation 简单动画的使用

CAAnimationGroup 同时进行多个动画

_animateLayer.backgroundColor = [UIColor colorWithWhite:1.000 alpha:0.250].CGColor;
_animateLayer.borderWidth = 2;
_animateLayer.borderColor = [UIColor  grayColor].CGColor;
CAAnimationGroup *group = [CAAnimationGroup animation];
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"bounds"];
animation.fromValue = [NSValue valueWithCGRect:_animateLayer.bounds];
animation.toValue   = [NSValue valueWithCGRect: CGRectMake(0, 0, _animateLayer.bounds.size.width + 130,_animateLayer.bounds.size.height + 130)];

CABasicAnimation *bgAnimation = [CABasicAnimation animationWithKeyPath:@"backgroundColor"];
bgAnimation.fromValue = (__bridge id)([UIColor colorWithWhite:1.000 alpha:0.250].CGColor);
bgAnimation.toValue   = (__bridge id)([UIColor colorWithWhite:1.000 alpha:0].CGColor);

CABasicAnimation *borderAnimation = [CABasicAnimation animationWithKeyPath:@"borderColor"];
borderAnimation.fromValue = (__bridge  id)([UIColor grayColor].CGColor);
borderAnimation.toValue = (__bridge  id)([UIColor colorWithWhite:0.500 alpha:0.000].CGColor);

CABasicAnimation *cornerAnimation = [CABasicAnimation animationWithKeyPath:@"cornerRadius"];
cornerAnimation.fromValue = @(50);
cornerAnimation.toValue   = @(115);

group.animations = @[animation,bgAnimation,borderAnimation,cornerAnimation];
group.repeatCount = MAXFLOAT;
group.duration = 1;
[_animateLayer addAnimation:group forKey:nil];

水!!
我厂广招各路大神加入:job.koudaitong.com
可以发简历到 tianchi@qima-inc.com O(∩_∩)O~

    原文作者:EscapedDog
    原文地址: https://segmentfault.com/a/1190000000641173
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞