This blog includes zoom and bouncing In animation on view. If we want to present view like popUp alert then it include two animation-
first is zoom and second is bouncing.These two animation can be achieved by affinity transform.Scaling, rotation, and translation are the most commonly used manipulations supported by affine transforms.
Here is the code-
//Initialize a view with frmae or you can use any of the view
UIView *popUpView=[[UIView alloc]initWithFrame:CGRectMake(x, y, width, height)];
//set background color of view
[popUpView setBackgroundColor:[UIColor blueColor]];
//transform the popup in constant i.e identity
popUpView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001);
//add as a subview
[self.view addSubview:popUp];
[UIView animateWithDuration:0.3/1.5 animations:^{
popUpView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1);
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.3/2 animations:^{
popUpView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.3/2 animations:^{
popUpView.transform = CGAffineTransformIdentity;
}];
}];
}];
0 Comment(s)