栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > Web开发 > Html/CSS > CSS教程

css3 animation loading 动画 Demo

CSS教程 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

css3 animation loading 动画 Demo

  • 源码

  • 演示

animation有几个属性 :
 duration | timing-function | delay | iteration-count | direction | fill-mode | play-state | name 
 animation: 3s ease-in 1s 2 reverse both paused slidein
  1. duration---------------持续时间 3秒

  2. timing-function------运动速度(http://www.w3school.com.cn/cssref/pr_animation-timing-function.asp)

  3. delay-------------------延时时间 1秒

  4. teration-count--------重复次数 2次

  5. direction---------------播放方式反向(http://www.runoob.com/cssref/css3-pr-animation-direction.html)

  6. both---------------------为元素规定填充模式(http://www.w3school.com.cn/cssref/pr_animation-fill-mode.asp)

  7. play-state--------------暂停或播放动画(paused 或者 running)

  8. name-------------------为@keyframes 动画规定一个名称

HTML

搭建页面结构

        Loading
        
            
            
            
            
        

CSS样式

关键点都在CSS里面

    .wrap {        width: 100%;        height: 1000px;        background: linear-gradient(45deg, #6fc7b5 0%, #13bdce, 20%, #0094d9 40%, #5a3694 60%, #ee4d74 80%, #f58c58 100%);        background-size: 400%;        background-position: 0 100%;        position: relative;        animation: BjLoop 2s ease-in-out infinite;  
    }    
    .wrap * {        left: 50%;        top: 50%;        position: fixed;        transform: translate3d(-50%, -50%, 0) rotate(0deg);
    }    
    .Loading {        color: #fff;        text-shadow: 1px 1px 1px #ccc,        0 0 10px #fff,            0 0 20px #fff,            0 0 30px #fff,            0 0 40px #ff00de,            0 0 70px #ff00de,            0 0 80px #ff00de,            0 0 100px #ff00de,            0 0 150px #ff00de;            animation: run ease-in-out 3s infinite; 
            font-size: 50px;
      
    }    
    .rorateBox div {        width: 300px;        height: 300px;        animation: loadingLoop 3s ease-in-out infinite;  
    }    
    .rorateBox div::after {        content: '';        display: inline-block;        width: 60px;        height: 60px;        background-color: #fff;        border-radius: 50%;        position: absolute;        transform: scale(0.17);        animation: loading-dot 3s ease-in-out infinite; 
    }    

    .rorateBox div:nth-child(1) {        top: 114px;        left: -147px;        animation-delay:0s;
    }    .rorateBox div:nth-child(1)::after {        right: 0px;
    }    .rorateBox div:nth-child(2) {        top: -118px;        left: -116px;        animation-delay: 0.25s;
    }    .rorateBox div:nth-child(2)::after {        right: 0px;        bottom: 0;        animation-delay: 0.25s;
    }    .rorateBox div:nth-child(3) {        top: -125px;        left: 160px;        
    }    .rorateBox div:nth-child(3)::after {        left: 0px;        bottom: 0;        animation-delay: 0.50s;
    }   
    .rorateBox div:nth-child(4) {        top: 131px;    left: 83px;
    }    .rorateBox div:nth-child(4)::after {        left: 26px;    top: 0;    animation-delay: 1s;
    }    
    @keyframes BjLoop {
        0% {            background-position: 0% 100%;
        }
        50% {            background-position: 100% 0%;
        }
        100% {            background-position: 0% 100%;        
        }
    }    
    @keyframes loading-dot {
        0% {            transform:scale(0.17);        
        }
        50% {            transform:scale(0.5);
        }
        100% {            transform:scale(0.17);                
        }
    }    
    @keyframes loadingLoop {
        0% {            transform: translate3d(-50%,-50%,0) rotate(0deg);        
        }
        100% {            transform: translate3d(-50%,-50%,0) rotate(360deg);
        }
    }    
    @keyframes run {
        %0{            text-shadow: 1px 1px 1px #ccc,                0 0 10px #fff,                0 0 20px #fff,                0 0 30px #fff,                0 0 40px #ff00de,                0 0 70px #ff00de,                0 0 80px #ff00de,                0 0 100px #ff00de,                0 0 150px #ff00de;
        }
        25%{            text-shadow: 1px  1px 1px #ccc,                  0 0 10px #fff,                   0 0 20px #fff,                   0 0 30px #fff,                   0 0 40px #3EFF3E,                   0 0 70px #3EFFff,                   0 0 80px #3EFFff,                   0 0 100px #3EFFee,                   0 0 150px #3EFFee;
        }
        50%{            text-shadow: 1px  1px 1px #ccc,                   0 0 10px #fff,                   0 0 20px #fff,                   0 0 30px #fff,                   0 0 40px #3EFF3E,                   0 0 70px #3EFFff,                   0 0 80px #3EFFff,                   0 0 100px #3EFFee,                   0 0 150px #3EFFee;
        }
        75%{            text-shadow: 1px  1px 1px #ccc,                   0 0 10px #fff,                   0 0 20px #fff,                   0 0 30px #fff,                   0 0 40px #3EFF3E,                   0 0 70px #3EFFff,                   0 0 80px #3EFFff,                   0 0 100px #3EFFee,                   0 0 150px #3EFFee;
        }
    }

image.png



作者:拯救宇宙是我的使命
链接:https://www.jianshu.com/p/04a6d181b572


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/242748.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号