您的位置:首页 > 移动开发 > IOS开发

iOS CoreAnimation 简单动画的使用

2015-01-05 03:02 281 查看

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~
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: