https://blog.csdn.net/zhibudefeng/article/details/8691567/
https://blog.csdn.net/qq_32780047/article/details/51224602
//创建一个关键帧动画
CAKeyframeAnimation *keyAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"];
//设置关键帧
keyAnimation.values = @[@(-M_PI_4 * 0.1 * 1), @(M_PI_4 * 0.1 * 1), @(-M_PI_4 * 0.1 * 1)];
//设置重复
keyAnimation.repeatCount = CGFLOAT_MAX;
//把核心动画添加到layer上
[self.imageView.layer addAnimation:keyAnimation forKey:@"keyAnimation"];
[self.button.layer addAnimation:keyAnimation forKey:@"keyAnimation"];
网友评论