Skip to content

Instantly share code, notes, and snippets.

@BenBarahona
Created October 7, 2014 18:56
Show Gist options
  • Save BenBarahona/b22ad97bc094e71458db to your computer and use it in GitHub Desktop.
Save BenBarahona/b22ad97bc094e71458db to your computer and use it in GitHub Desktop.
Wiggle Effect
- (void) wiggleEffect
{
CGFloat angle = 5.0 * M_PI / 180;
CGAffineTransform leftWiggle = CGAffineTransformRotate(CGAffineTransformIdentity, -angle);
CGAffineTransform rightWiggle = CGAffineTransformRotate(CGAffineTransformIdentity, angle);
self.image.transform = leftWiggle;
[UIView beginAnimations:@"wiggle" context:(__bridge void *)(self.image)];
[UIView setAnimationDuration:0.2];
[UIView setAnimationRepeatAutoreverses:YES];
[UIView setAnimationRepeatCount:CGFLOAT_MAX];
self.image.transform = rightWiggle;
[UIView commitAnimations];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment