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~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值