POP-A click animation with a zoom-in and restoration effect, pop-zoom-in and restoration Animation
Principle
Listen to click events on the screen
-(Void) touchesBegan :( NSSet <UITouch *> *) touches withEvent :( nullable UIEvent *) event;
-(Void) touchesEnded :( NSSet <UITouch *> *) touches withEvent :( nullable UIEvent *) event;
-(Void) touchesCancelled :( nullable NSSet <UITouch *> *) touches withEvent :( nullable UIEvent *) event;
Animation
Pop animation, requires a pop Frame
Two animations are magnified and restored.
KPOPViewScaleXY: Zoom in width and height
Code
-(Void) touchesBegan :( NSSet *) touches withEvent :( UIEvent *) event {POPSpringAnimation * scaleAnimation = [POPSpringAnimation animation]; scaleAnimation. property = [POPAnimatableProperty propertyWithName: kPOPViewScaleXY]; // width and height change scaleAnimation. toValue = [NSValue valueWithCGSize: CGSizeMake (1.3, 1.3)]; // 1.3 times [self pop_addAnimation: scaleAnimation forKey: @ "scaleAnimationKey"]; // execute the animated scaleAnimation. completionBlock = ^ (POPAnimation * animation, BOOL finish) {// The animation callback POPSpringAnimation * scaleAnimation = [POPSpringAnimation animation]; scaleAnimation. springBounciness = 16; // value between 0-20 scaleAnimation. springSpeed = 14; // value between 0-20 scaleAnimation. property = [POPAnimatableProperty propertyWithName: kPOPViewScaleXY]; scaleAnimation. toValue = [NSValue valueWithCGSize: CGSizeMake (1.0, 1.0)]; [self pop_addAnimation: scaleAnimation forKey: @ "scaleAnimationKey"] ;};}