iOS 抖动动画

时间:2022-05-03 05:49:25
-(void)animationWithCell:(WaterLevelCollectionCell *)cell{
// 添加摇晃动画
{
CAKeyframeAnimation *frame=[CAKeyframeAnimation animation];
CGFloat left=-M_PI_2*0.125;
CGFloat right=M_PI_2*0.125; frame.keyPath=@"postion";
frame.keyPath=@"transform.rotation"; frame.values=@[@(left),@(right),@(left)];
frame.duration = 0.5;
frame.repeatCount = ;
[cell.layer removeAllAnimations];
[cell.layer addAnimation:frame forKey:nil];
}
}