博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
自定义转场动画库
阅读量:6975 次
发布时间:2019-06-27

本文共 1531 字,大约阅读时间需要 5 分钟。

自定义转场动画库

 

#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

转载于:https://www.cnblogs.com/hanzhuzi/p/3979329.html

你可能感兴趣的文章
linux实战考试题:批量创建用户和密码(不能使用循环)
查看>>
一个基于J2EE的web应用程序运行起来需要什么?
查看>>
Docker配置指南系列(二):指令集(二)
查看>>
nginx 开发一个简单的 HTTP 模块
查看>>
linux运维如何月薪过万?(收藏自用)
查看>>
DIY强大的虚拟化环境-技术可行性部分
查看>>
linxu 下安装mysql5.7.19
查看>>
SpringMVC + Hibernate-Validator 参数校验
查看>>
android开发之动画的详解 整理资料 Android开发程序小冰整理
查看>>
生产环境主从数据同步不了?
查看>>
SQL故障转移集群操作方法
查看>>
红旗Linux认证简介
查看>>
BGP详解
查看>>
我的友情链接
查看>>
我的友情链接
查看>>
Go基础知识学习(6) 接口
查看>>
基础语法
查看>>
jq轮播
查看>>
开源应用程序结构
查看>>
实验LVS+keepalived
查看>>