CGPoint fromPoint = imageView.center;
//路径曲线
UIBezierPath *movePath = [UIBezierPath bezierPath];
[movePath moveToPoint:fromPoint];
CGPoint toPoint = view.center;
[movePath addLineToPoint:toPoint];
//关键帧
CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
moveAnim.path = movePath.CGPath;
moveAnim.removedOnCompletion = YES;
//旋转变化
CABasicAnimation *scaleAnim = [CABasicAnimation animationWithKeyPath:@"transform"];
scaleAnim.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
//x,y轴放大,Z 轴不变
scaleAnim.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(4.0,4.0, 1.0)];
scaleAnim.removedOnCompletion = YES;
imageView.layer.transform = CATransform3DMakeScale(4.0,4.0, 1.0);
//关键帧,旋转,组合起来执行
CAAnimationGroup *animGroup = [CAAnimationGroup animation];
animGroup.animations = [NSArray arrayWithObjects:moveAnim,scaleAnim,nil];
animGroup.duration = 1;
[imageView.layer addAnimation:animGroup forKey:@"transform"];
//路径曲线
UIBezierPath *movePath = [UIBezierPath bezierPath];
[movePath moveToPoint:fromPoint];
CGPoint toPoint = view.center;
[movePath addLineToPoint:toPoint];
//关键帧
CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
moveAnim.path = movePath.CGPath;
moveAnim.removedOnCompletion = YES;
//旋转变化
CABasicAnimation *scaleAnim = [CABasicAnimation animationWithKeyPath:@"transform"];
scaleAnim.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
//x,y轴放大,Z 轴不变
scaleAnim.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(4.0,4.0, 1.0)];
scaleAnim.removedOnCompletion = YES;
imageView.layer.transform = CATransform3DMakeScale(4.0,4.0, 1.0);
//关键帧,旋转,组合起来执行
CAAnimationGroup *animGroup = [CAAnimationGroup animation];
animGroup.animations = [NSArray arrayWithObjects:moveAnim,scaleAnim,nil];
animGroup.duration = 1;
[imageView.layer addAnimation:animGroup forKey:@"transform"];
注意上面红色 部分代码,直接修改图片动画后的效果,这样就能保持动画的效果了。