-(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 = 1000000; [cell.layer removeAllAnimations]; [cell.layer addAnimation:frame forKey:nil]; } }
时间: 2024-11-10 20:37:42