Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multistage animation using blocks

I know you can perform a two-stage animataion using blocks like so:

[UIView animateWithDuration:25.0 delay:0.0 options:UIViewAnimationCurveLinear animations:
     ^{ 
         aView.alpha = 2.5;         
     } 
         completion:^(BOOL finished)
     {
         aView.hidden = YES; 
     }
 ];

..but how would I create a multistage (more than 2) animation using blocks?

like image 471
cannyboy Avatar asked Aug 10 '11 09:08

cannyboy


1 Answers

or you can make a recursive, multi-stage animation method:

-(void) multiStageAnimate{
[UIView animateWithDuration:0.5 
                      delay:0.0 
                    options:UIViewAnimationOptionBeginFromCurrentState 
                 animations:^{
                     //animation code
                 }
                 completion:^(BOOL finished){
                     if(/* If terminating condition not met*/)
                         [self multiStageAnimate];
                 }];
}
like image 66
tipycalFlow Avatar answered Nov 13 '22 23:11

tipycalFlow