iOS开发之左右抖动效果

CAKeyframeAnimation *shakeAnim = [CAKeyframeAnimation animation];

shakeAnim.keyPath = @"transform.translation.x";

shakeAnim.duration = 0.15;

CGFloat delta = 10;

shakeAnim.values = @[@0, @(-delta), @(delta), @0];

shakeAnim.repeatCount = 2;

[self.myView.layer addAnimation:shakeAnim forKey:nil];

posted @ 2015-08-31 20:34  Ray_hok  阅读(724)  评论(0编辑  收藏  举报