iOS 抖动动画

-(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];
    }
}
原文地址:https://www.cnblogs.com/niit-soft-518/p/5473304.html