CoreAnimation学习,学习总结,记录各种过程中遇到的坑

时间:2021-03-02 15:04:43

1.

CAAimation  的 duration = 0 的时候, 这个时候就相当于没有动画了.

2.

    CAKeyframeAnimation *rotateAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"];
rotateAnimation.duration = ; CAKeyframeAnimation *positionAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
positionAnimation.duration = ; CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
animationGroup.animations = @[positionAnimation, rotateAnimation];
animationGroup.duration = ;

因为用的是CAAnimationGroup, 所以它的duration会覆盖rotationAnimation和positionAnimation

即使是代码这样的顺序(注意对比上面的顺序)也是一样的:

    animationGroup.duration = ;
animationGroup.animations = @[positionAnimation, rotateAnimation];