Skip to content

Instantly share code, notes, and snippets.

Created January 6, 2013 16:53
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save anonymous/4468522 to your computer and use it in GitHub Desktop.
Save anonymous/4468522 to your computer and use it in GitHub Desktop.
+ (void)pulseView:(UIView *)view completion:(void (^)(void))block {
// No need for fancy keyframe animation, we can fake this good enough...
[UIView animateWithDuration:0.05 delay:0 options:UIViewAnimationCurveEaseInOut animations:^(void) {
view.layer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMakeScale(0.7, 0.7));
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.12 delay:0 options:UIViewAnimationCurveEaseInOut animations:^(void) {
view.layer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMakeScale(1.1, 1.1));
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.1 delay:0 options:UIViewAnimationCurveEaseInOut animations:^(void) {
view.layer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMakeScale(0.9, 0.9));
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.09 delay:0 options:UIViewAnimationCurveEaseInOut animations:^(void) {
view.layer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMakeScale(1.05, 1.05));
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.08 delay:0 options:UIViewAnimationCurveEaseInOut animations:^(void) {
view.layer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMakeScale(0.95, 0.95));
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.05 delay:0 options:UIViewAnimationCurveEaseInOut animations:^(void) {
view.layer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMakeScale(1.0, 1.0));
} completion:^(BOOL finished) {
if (block != NULL) {
block();
}
}];
}];
}];
}];
}];
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment