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.01.0)];
    scaleAnim.removedOnCompletion = YES;
    
    imageView.layer.transform = CATransform3DMakeScale(4.0,4.01.0);
    
    //关键帧,旋转,组合起来执行
    CAAnimationGroup *animGroup = [CAAnimationGroup animation];
    animGroup.animations = [NSArray arrayWithObjects:moveAnim,scaleAnim,nil];
    animGroup.duration = 1;
    [imageView.layer addAnimation:animGroup forKey:@"transform"];


注意上面红色 部分代码,直接修改图片动画后的效果,这样就能保持动画的效果了。

相关文章:

  • 2021-08-17
  • 2021-10-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-03
  • 2021-11-18
  • 2021-08-15
  • 2022-01-13
  • 2021-06-15
相关资源
相似解决方案