CAKeyframeAnimation *shakeAnim = [CAKeyframeAnimation animation];
shakeAnim.keyPath = @"transform.translation.x";
shakeAnim.duration = 0.15;
CGFloat delta = 10;
shakeAnim.values = @[[@0](http://my.oschina.net/chenmarfun) , @(-delta), @(delta), @0];
shakeAnim.repeatCount = 2;
[self.myView.layer addAnimation:shakeAnim forKey:nil];
网友评论