ios - How to make a uibutton zoomout and then crossblur? -


i have got uibutton animation implemented, zooms want cross fade uibutton while disappears.

this sample code button animation.

(void)centerbuttonanimation{     cakeyframeanimation *centerzoom = [cakeyframeanimation animationwithkeypath:@"transform"];     centerzoom.duration = 1.5f;     centerzoom.values = @[[nsvalue valuewithcatransform3d:catransform3dmakescale(1, 1, 1)],[nsvalue valuewithcatransform3d:catransform3dmakescale(1.5, 1.5, 1.5)],[nsvalue valuewithcatransform3d:catransform3dmakescale(4, 4, 4)],[nsvalue valuewithcatransform3d:catransform3dmakescale(5, 5, 5)]];     centerzoom.timingfunction = [camediatimingfunction functionwithname:kcamediatimingfunctioneaseout];     centerbutton.transform = cgaffinetransformmakescale(5, 5);     [centerbutton.layer addanimation:centerzoom forkey:@"buttonscale"];     [centerbutton setuserinteractionenabled:no]; } 

to chain animations, can set class delegate animation.

@property cakeyframeanimation *centerzoom;  - (void) centerbuttonanimation {     self.centerzoom = [cakeyframeanimation animationwithkeypath:@"transform"];      // set delegate instance.     centerzoom.delegate=self;      centerzoom.duration = 1.5f;     centerzoom.values = @[[nsvalue valuewithcatransform3d:catransform3dmakescale(1, 1, 1)],[nsvalue valuewithcatransform3d:catransform3dmakescale(1.5, 1.5, 1.5)],[nsvalue valuewithcatransform3d:catransform3dmakescale(4, 4, 4)],[nsvalue valuewithcatransform3d:catransform3dmakescale(5, 5, 5)]];     centerzoom.timingfunction = [camediatimingfunction functionwithname:kcamediatimingfunctioneaseout];     centerbutton.transform = cgaffinetransformmakescale(5, 5);     [centerbutton.layer addanimation:centerzoom forkey:@"buttonscale"];     [centerbutton setuserinteractionenabled:no]; }  - (void) crossfadeanimation {    // insert animation code cross fade. } 

then implement delegate function detect end of animation. if end of zoom, start cross fade.

- (void)animationdidstop:(caanimation *)theanimation finished:(bool)flag {    if ((theanimation == self.centerzoom) && flag){      [self crossfadeanimation];    } } 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -