• 自定义转场动画库


    自定义转场动画库

    #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

  • 相关阅读:
    密码学基础(三)
    密码学基础(二)
    密码学基础(一)
    Lambda代数
    恢复系统
    11.22面试例题
    js中级复习
    11.12
    11.13
    定时器
  • 原文地址:https://www.cnblogs.com/hanzhuzi/p/3979329.html
Copyright © 2020-2023  润新知