• 图片执行放大动画后,不能保持放大效果问题解决


        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"];


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

  • 相关阅读:
    空中楼阁 ( House )最短路
    [hdu4333]Revolving Digits
    vue element-ui el-table 选择框单选修改
    css 中间文字 两边横线
    uni-app计算scroll-view高度
    Swift Playgrounds Mac 编程学习入门
    vuecli vue.config.js 通用配置
    vuecli3 分环境打包的方案
    mysql 插入更新
    关闭进程
  • 原文地址:https://www.cnblogs.com/likwo/p/2474029.html
Copyright © 2020-2023  润新知