• POP-一个点击带有放大还原的动画效果


    原理

    监听屏幕的点击事件

    - (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;

    动画

    pop动画,需要pop框架

    两个动画一个放大,一个还原

    kPOPViewScaleXY:放大宽高

    代码

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
        POPSpringAnimation *scaleAnimation = [POPSpringAnimation animation];
        scaleAnimation.property = [POPAnimatableProperty propertyWithName:kPOPViewScaleXY];//宽高改变
        scaleAnimation.toValue = [NSValue valueWithCGSize:CGSizeMake(1.3, 1.3)];//1.3倍
        [self pop_addAnimation:scaleAnimation forKey:@"scaleAnimationKey"];//执行动画
        scaleAnimation.completionBlock = ^(POPAnimation *animation,BOOL finish) { //动画回调
            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"];
        };
    }

    效果图

  • 相关阅读:
    前台提交数据到后台还回错误提示并且把新增页面关掉的问题
    combox二级联动带不出来问题
    数据库设计字段如果首字母是大写
    带图片的修改后台出现的问题
    weblogic启动报错
    强制删除文件夹
    jQuery常用方法
    json数据的转换
    SQL DEFAULT 约束
    SQL CHECK 约束
  • 原文地址:https://www.cnblogs.com/hxwj/p/5033600.html
Copyright © 2020-2023  润新知