zoukankan      html  css  js  c++  java
  • 图片执行放大动画后,不能保持放大效果问题解决

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


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

  • 相关阅读:
    推荐书单
    图解Android
    图解Android
    图解Android
    图解Android
    图解Android
    图解Android
    个人博客平台 http://craft6.cn 上线
    数据库设计教程系列——相关知识点整理
    O2O研究系列——O2O知识思维导图整理
  • 原文地址:https://www.cnblogs.com/likwo/p/2474029.html
Copyright © 2011-2022 走看看