Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS - Animation effects - Image pop-in

I'd like to have an image in my iphone app "pop-in" on screen rather than just appearing. By "pop-in" I mean that it would grow from a small dot to its actual size. For reference, this is exactly the same as the "pop" animation effect in Keynote. I'm completely new to iOS animations, so if someone could point me in the direction on the animation effects I would need to use, it would be greatly appreciated.

Thanks

Brian

UPDATE I've added this code from the suggestions below. This works but it scales my image down, rather than up. I know that is because I have 0.01 as the transform scale size, but I would like to know how I can start out with an image of size 0.0 and scale up to 1. Is it just a matter to setting the size of my image to 0? Thanks

[UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration: 0.2]; image.transform = CGAffineTransformMakeScale(0.01, 0.01); [UIView setAnimationDelegate:self]; [UIView commitAnimations]; 
like image 290
Brian Boyle Avatar asked Mar 30 '12 17:03

Brian Boyle


1 Answers

The effect you’re looking for is something like this:

// instantaneously make the image view small (scaled to 1% of its actual size) view.transform = CGAffineTransformMakeScale(0.01, 0.01); [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{     // animate it to the identity transform (100% scale)     view.transform = CGAffineTransformIdentity; } completion:^(BOOL finished){     // if you want to do something once the animation finishes, put it here }]; 
like image 106
Noah Witherspoon Avatar answered Sep 25 '22 02:09

Noah Witherspoon