zoukankan      html  css  js  c++  java
  • iOS 转场动画

    效果图:


    转场动画

    源码地址(点击跳转)

    UIView 转场动画

    实现代码:

       UIViewAnimationTransition animationTranstion = transition;
       [UIView animateWithDuration:1 animations:^{
       [UIView setAnimationCurve:curve];
       [UIView setAnimationTransition:animationTranstion forView:self cache:YES];
       }];
       
    

    UIView 基础转场动画 ,UIViewAnimationTransition包含4种:

    typedef NS_ENUM(NSInteger, UIViewAnimationTransition) {
    UIViewAnimationTransitionNone,
    UIViewAnimationTransitionFlipFromLeft, // 从左翻页
    UIViewAnimationTransitionFlipFromRight, // 从右翻页
    UIViewAnimationTransitionCurlUp, // 向上翻书特效
    UIViewAnimationTransitionCurlDown, // 向下翻书特效
    };

     UIViewAnimationCurve 也有4种

    typedef NS_ENUM(NSInteger, UIViewAnimationCurve) {
    UIViewAnimationCurveEaseInOut, // slow at beginning and end
    UIViewAnimationCurveEaseIn, // slow at beginning
    UIViewAnimationCurveEaseOut, // slow at end
    UIViewAnimationCurveLinear
    };

    CALayer 转场动画

    实现代码:

        CATransition *transition = [CATransition animation];
        transition.duration = 1;
        transition.type = @"fade"; // 过渡效果
        transition.subtype = @"fromRight"; // 过渡方向
        [view.layer addAnimation:transition forKey:@"transition"];
        
    

    过渡效果 type

    fade //交叉淡化过渡(不支持过渡方向)
    push //新视图把旧视图推出去
    moveIn //新视图移到旧视图上面
    reveal //将旧视图移开,显示下面的新视图
    cube //立方体翻滚效果
    oglFlip //上下左右翻转效果
    suckEffect //收缩效果,如一块布被抽走(不支持过渡方向)
    rippleEffect //滴水效果(不支持过渡方向)
    pageCurl //向上翻页效果
    pageUnCurl //向下翻页效果
    cameraIrisHollowOpen //相机镜头打开效果(不支持过渡方向)
    cameraIrisHollowClose //相机镜头关上效果(不支持过渡方向)

    过渡方向 subtype

    fromRight;
    fromLeft;
    fromTop;
    fromBottom;

  • 相关阅读:
    推荐6款极具个性化的在线生成logo的网站
    网站图标制作
    关于域名如何指向WordPress homepage问题的解决
    WordPress 博客文章中google adsense广告展示方法之一
    WordPress网站搬家经验总结
    WordPress网站搬家的问题
    Linux RAID卡优化
    说说JSON和JSONP,也许你会豁然开朗
    可以嵌入程序的chrome
    maven jetty指定端口启动
  • 原文地址:https://www.cnblogs.com/jaesun/p/iOS-zhuan-chang-dong-hua.html
Copyright © 2011-2022 走看看