Created
March 2, 2012 20:21
-
-
Save jeksys/1961023 to your computer and use it in GitHub Desktop.
Key Frame Animation
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
-(IBAction)buttonPress:(id)sender | |
{ | |
NSString *keyPath = @"anchorPoint.x"; | |
CAKeyframeAnimation *kfa = [CAKeyframeAnimation animationWithKeyPath:keyPath]; | |
[kfa setValues:[NSArray arrayWithObjects: | |
[NSNumber numberWithFloat:-.05], | |
[NSNumber numberWithFloat:.1], | |
[NSNumber numberWithFloat:-.1], | |
[NSNumber numberWithFloat:.1], | |
[NSNumber numberWithFloat:-.05], | |
nil]]; | |
[kfa setAdditive:YES]; | |
[kfa setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; | |
[kfa setDuration:.35]; | |
[button.layer addAnimation:kfa forKey:nil]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment