Created
October 7, 2014 18:56
-
-
Save BenBarahona/b22ad97bc094e71458db to your computer and use it in GitHub Desktop.
Wiggle Effect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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