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;

  • 相关阅读:
    python——协程
    解读python中SocketServer源码
    python——初识socket
    python的类和对象——类的静态字段番外篇
    python的类和对象——类成员番外篇
    python的类和对象——进阶篇
    初识python中的类与对象
    python中lambda表达式应用
    python——挖装饰器祖坟事件
    python的基础类源码解析——collection类
  • 原文地址:https://www.cnblogs.com/jaesun/p/iOS-zhuan-chang-dong-hua.html
Copyright © 2011-2022 走看看