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];
    }
}

 

posted @ 2016-05-09 11:16  爱生活爱代码  阅读(298)  评论(0编辑  收藏  举报