Harikrishnan R
Harikrishnan R

Reputation: 150

How to do zoom in and transform animation?

It is clear how to do a zoom in/scaling animation and how to animate an image changing to another. But I need an image to zoom in and midway transform to another. How can it be done?

Upvotes: 1

Views: 482

Answers (2)

Jignesh Mayani
Jignesh Mayani

Reputation: 7213

This code will work for you.

[UIView animateWithDuration:2.0 animations:^{
    imgView.transform = CGAffineTransformMakeScale(1.5, 1.5);
}
                 completion:^(BOOL finished){
                     [UIView transitionWithView:self.view
                                       duration:2.0f
                                        options:UIViewAnimationOptionTransitionCrossDissolve
                                     animations:^{
                                         [imgView setImage:[UIImage imageNamed:@"default_avatar"]];
                                         imgView.transform = CGAffineTransformMakeScale(2.0, 2.0);
                                     } completion:nil];
                        }];

Upvotes: 1

Arun
Arun

Reputation: 2281

Try this code :

 [UIView animateWithDuration:2.0 animations:^{
        self.imgView.transform = CGAffineTransformMakeScale(1.5, 1.5);
    }
                     completion:^(BOOL finished){

                         _imgView.image = [UIImage imageNamed:@"3D_search"];
                         [UIView animateWithDuration:2.0 animations:^{

                             self.imgView.transform = CGAffineTransformMakeScale(2.0, 2.0);
                         }];
                     }];

Upvotes: 0

Related Questions