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;

  • 相关阅读:
    js绑定事件方法:addEventListener的兼容问题
    jQuery中$(function(){})与(function($){})(jQuery)、$(document).ready(function(){})等的区别讲解
    jQuery事件绑定函数:on()与bind()的差别
    click事件的累加绑定
    HTML标签marquee实现滚动效果
    原生js添加类名,删除类名
    CSS相邻兄弟选择器
    视差滚动
    纯js实现分页
    下拉加载更多内容(滚动加载)
  • 原文地址:https://www.cnblogs.com/jaesun/p/iOS-zhuan-chang-dong-hua.html
Copyright © 2011-2022 走看看