Skip to content

Instantly share code, notes, and snippets.

@minsOne
Created June 11, 2014 04:16
Show Gist options
  • Save minsOne/347ded055e1044b1aca4 to your computer and use it in GitHub Desktop.
Save minsOne/347ded055e1044b1aca4 to your computer and use it in GitHub Desktop.
CABasicAnimation *shake = [CABasicAnimation animationWithKeyPath:@"position"];
[shake setDuration:0.1];
[shake setRepeatCount:2];
[shake setAutoreverses:YES];
[shake setFromValue:[NSValue valueWithCGPoint:
CGPointMake(view.center.x - 5,view.center.y)]];
[shake setToValue:[NSValue valueWithCGPoint:
CGPointMake(view.center.x + 5, view.center.y)]];
[view.layer addAnimation:shake forKey:@"position"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment