首页 > 代码库 > 一个简单的果冻弹动动画

一个简单的果冻弹动动画

代码:
1
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"]; 2 [animation setDuration:.6]; 3 NSMutableArray *values = [NSMutableArray array]; 4 [values addObject:[NSNumber numberWithFloat:1.0]]; 5 [values addObject:[NSNumber numberWithFloat:1.2]]; 6 [values addObject:[NSNumber numberWithFloat:1.0]]; 7 [values addObject:[NSNumber numberWithFloat:1.1]]; 8 [values addObject:[NSNumber numberWithFloat:1.0]]; 9 [animation setValues:values];10 [animation setRemovedOnCompletion:YES];11 [animation setAutoreverses:NO];12 animation.timingFunction =[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];13 [_animationView.layer addAnimation:animation forKey:@"transform.scale"];

使用CAKeyframeAnimation实现动画

其中_animationView就是要实现动画view

一个简单的果冻弹动动画