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

  • 相关阅读:
    system函数
    如何:配置 ClickOnce 信任提示行为
    linux中shell变量$#,$@,$0,$1,$2的含义解释 (转载)
    C/C++中如何在main()函数之前执行一条语句?
    循环小数表示法
    struct/class等内存字节对齐问题详解
    malloc(0)
    C语言实现程序跳转到绝对地址0x100000处执行
    嵌入式程序设计中C/C++代码的优化
    backtrace和backtrace_symbols
  • 原文地址:https://www.cnblogs.com/hanzhuzi/p/3979329.html
Copyright © 2011-2022 走看看