CATransition炫一点的动画

1.导入库和头文件
QuartzCore.framework
#import <QuartzCore/QuartzCore.h>
 CATransition 提供了一个图层变化的过渡效果,它能影响图层的整个内容。 动画进行的时候淡入淡出(fade)、推(push)、显露(reveal)图层的内容。这些过渡效 果可以扩展到你自己定制的 Core Image 滤镜。
    //CAAnimation图层动画的基类  这些都是图层动画
    CATransition *animation = [CATransition animation];
    animation.delegate = self;
    //动画时间
    animation.duration = 0.7;
    //速度类型
    animation.timingFunction = UIViewAnimationCurveEaseInOut;
    //动画效果
    animation.type = kCATransitionFade;
    //动画方向
    animation.subtype = kCATransitionFromLeft;
    //交换两个view的层
    NSUInteger green = [[self.view subviews] indexOfObject:self.greenView];
    NSUInteger blue = [[self.view subviews] indexOfObject:self.blueView];
    [self.view exchangeSubviewAtIndex:green withSubviewAtIndex:blue];
    //向当前view添加动画
     [self.view.layer addAnimation:animation forKey:@"animation"];
            //淡化
            animation.type = kCATransitionFade;
            //推挤
            animation.type = kCATransitionPush;
            //揭开
            animation.type = kCATransitionReveal;
            //覆盖
            animation.type = kCATransitionMoveIn;
            //立方体
            animation.type = @"cube";
            //吸收
            animation.type = @"suckEffect";
            //翻转
            animation.type = @"oglFlip";
            //波纹
            animation.type = @"rippleEffect";
            //翻页
            animation.type = @"pageCurl";
            //反翻页
            animation.type = @"pageUnCurl";
            //镜头开
            animation.type = @"cameraIrisHollowOpen";
            //镜头关
            animation.type = @"cameraIrisHollowClose";



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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值