zoukankan      html  css  js  c++  java
  • 自定义转场动画库

    自定义转场动画库

    #import <QuartzCore/QuartzCore.h>

    @interface MyCATransition : CATransition

    // 参数说明:

    /********************type**************/

    // `fade', 渐变

    // `moveIn' 进入, 

    // `push' 推出 

    // `reveal'. 展现 

    // cube 立方 

    // suckEffect 吸收 

    // oglFlip 上下翻转 

    // rippleEffect 水滴 

    // pageCurl 卷页

    // pageUnCurl 后翻页

    // cameraIrisHollowOpen 开相机 

    // cameraIrisHollowClose 关相机

    /********************subtype**************/

    // fromLeft', 

    // `fromRight', 

    // `fromTop'

    // `fromBottom'

     /********************timingFunction**************/

    // timingFunction:

    // linear', 

    // `easeIn', 

    // `easeOut'

    // `easeInEaseOut'

    //

    // 自定义转场动画

    + (MyCATransition *)catransitionWithType:(NSString *)type subType:(NSString *)subType duration:(double)duration timingFunction:(NSString *)timingName;

    @end

    #import "MyCATransition.h"

    @implementation MyCATransition

    + (MyCATransition *)catransitionWithType:(NSString *)type subType:(NSString *)subType duration:(double)duration timingFunction:(NSString *)timingName {

        // 转场动画

        MyCATransition * animation = [MyCATransition animation];

        animation.type = type;

        animation.subtype = subType;

        animation.duration = duration;

        animation.timingFunction = [CAMediaTimingFunction functionWithName:timingName];

        

        

        return animation;

    }

    @end

     实例:

        将自定义动画对象加到需要进行转场的layer层 就会实现动画的炫酷效果哦

        MyCATransition * animation = [MyCATransition catransitionWithType:@"push" subType:@"fromBottom" duration:0.7 timingFunction:@"easeInEaseOut"];

        [self.navigationController.view.layer addAnimation:animation forKey:@"animation"];

    END

  • 相关阅读:
    centos6和centos7网卡修改
    centos7.4编译安装LNMP
    centos7yum安装LNMP
    jira搭建
    centos6.9编译安装LNMP
    监控命令命令
    linux设置命令历史的时间戳
    zabbix3.0安装
    Mysql(centos7) 主从搭建
    Android 利用剪切板(clipboardManager )实现数据传递
  • 原文地址:https://www.cnblogs.com/hanzhuzi/p/3979329.html
Copyright © 2011-2022 走看看