【iOS开发】---- 转场动画 CATransition

        

Inherits from
Conforms to
Framework
/System/Library/Frameworks/ QuartzCore.framework
Availability
Available in iOS 2.0 and later.
Declared in
CAAnimation.h

       CATransition类实现层的转场动画。你可以从一组预定义的转换或者通过提供定制的CIFilter实例来指定转场效果。

      //定义个转场动画
    CATransition *animation = [CATransition animation];
    //转场动画持续时间
    animation.duration = 0.2f;
    //计时函数,从头到尾的流畅度???
    animation.timingFunction=UIViewAnimationCurveEaseInOut;
    //转场动画类型
    animation.type = kCATransitionReveal;
    //转场动画将去的方向
    animation.subtype = kCATransitionFromBottom;
    //动画时你需要的实现
    self.tabBarController.tabBar.hidden = YES;
      //添加动画 (转场动画是添加在层上的动画)
  	[self.tabBarController.tabBar.layer addAnimation:animation forKey:@"animation"];


说明:

duration:动画持续的时长。


timingFunction:没明白(谁明白的说明一下吧)


type:转场动画的类型。如果在一个自定义的转场动画中指定的过滤器属性,此属性将被忽略。

type共有四种类型:

NSString * const kCATransitionFade;//逐渐消失
NSString * const kCATransitionMoveIn;//移入
NSString * const kCATransitionPush;//平移(暂且这么称呼吧)
NSString * const kCATransitionReveal;//显露

默认类型为kCATransitionFade


subtype:转场动画将要去往的方向。

subtpye有四种类型:

NSString * const kCATransitionFromRight;
NSString * const kCATransitionFromLeft;
NSString * const kCATransitionFromTop;
NSString * const kCATransitionFromBottom;
默认方向是nil。


[self.tabBarController.tabBar.layer addAnimation:animation forKey:@"animation"];

转场动画是添加给layer的!

以下几种转场动画调用的苹果的私有API,注意咯,小心用了之后被苹果打回来。

switch (btn.tag) {
case 0:
animation.type = @"cube";//---立方体
break;
case 1:
animation.type = @"suckEffect";//103 吸走的效果
break;
case 2://前后翻转效果
animation.type = @"oglFlip";//When subType is "fromLeft" or "fromRight", it's the official one.
break;
case 3:
animation.type = @"rippleEffect";//110波纹效果
break;
case 4:
animation.type = @"pageCurl";//101翻页起来
break;
case 5:
animation.type = @"pageUnCurl";//102翻页下来
break;
case 6:
animation.type = @"cameraIrisHollowOpen ";//107//镜头开
break;
case 7:
animation.type = @"cameraIrisHollowClose ";//106镜头关
break;
default:
break;
}




  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值