ios - Transition with alpha mask -
i'd create transition between 2 view controllers method:
-(void)animate { uiimage *maskingimage = [uiimage imagenamed:@"mask.png"]; calayer *masklayer =[calayer layer]; masklayer.anchorpoint=cgpointmake(0.5, 0.5); masklayer.frame=self.view.superview.frame; masklayer.contents=(id)self.maskingimage.cgimage; self.view.layer.mask=masklayer; cabasicanimation* anim = [cabasicanimation animationwithkeypath:@"transform.scale"]; anim.duration = 2.5; anim.tovalue=[nsnumber numberwithint:self.view.bounds.size.height/8]; anim.fillmode=kcafillmodeboth; anim.removedoncompletion=no; anim.delegate = self; [self.view.layer.mask addanimation:anim forkey:nil]; }
where mistake? i've tried other transition , it's works:
-(void)animate { cabasicanimation* anim = [cabasicanimation animationwithkeypath:@"transform.scale"]; anim.tovalue = [nsnumber numberwithdouble:0.9]; anim.duration = 0.5; anim.delegate = self; [self.view.layer addanimation:anim forkey:nil]; }
mask.png black rectangle centered white circle
Comments
Post a Comment