POP-A click animation with a zoom-in and restoration effect, pop-zoom-in and restoration Animation

Source: Internet
Author: User

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"] ;};}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.