- #define CONST_animation_time 0.5
- #define CONST_enlarge_proportion 15.0
- CGPoint UpPointOfView(UIView *view)
- {
- return (CGPoint){view.center.x, 200+2+55/2};
- };
- - (void) circleAnimate:(UIImageView*)view
- {
- CGContextRef context = UIGraphicsGetCurrentContext();
- [UIView beginAnimations:nil context:context];
- [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
- [UIView setAnimationDuration:CONST_animation_time];
- [view setCenter:UpPointOfView(view)];
- CABasicAnimation *scalingAnimation = (CABasicAnimation *)[view.layer animationForKey:@"scaling"];
- if (!scalingAnimation)
- {
- scalingAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
- scalingAnimation.repeatCount=1;
- scalingAnimation.duration=CONST_animation_time;
- scalingAnimation.autoreverses=NO;
- scalingAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
- scalingAnimation.fromValue=[NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0, 1.0)];
- scalingAnimation.toValue=[NSValue valueWithCATransform3D:CATransform3DMakeScale(CONST_enlarge_proportion, CONST_enlarge_proportion, 1.0)];
- }
- [view.layer addAnimation:scalingAnimation forKey:@"scaling"];
- view.layer.transform = CATransform3DMakeScale(CONST_enlarge_proportion, CONST_enlarge_proportion, 1.0);
- [UIView commitAnimations];
- }
- //该片段来自于http://www.codesnippet.cn/detail/070120148452.html
来源: http://www.codesnippet.cn/detail/070120148452.html