zoukankan      html  css  js  c++  java
  • 首页下雪效果

    下雪效果,转自网络,快去试试吧 :)

    原理

    通过多张雪花图片,不同速度的移动,达到下雪的效果。
    清晰度: 清晰 ----> 模糊
    远近: 近 ----> 远

    HTML

    <div class="snow-container">
      <div class="snow foreground"></div>
      <div class="snow foreground layered"></div>
      <div class="snow middleground"></div>
      <div class="snow middleground layered"></div>
      <div class="snow background"></div>
      <div class="snow background layered"></div>
    </div>
    

    CSS

    .snow-container {
      position: fixed;
      top:0;
      left:0;
      right: 0;
      bottom:0;
      overflow: hidden;
      z-index: 2;
      pointer-events: none;
      background-color: none;
    }
    
    .snow {
      display: block;
      position: absolute;
      z-index: 2;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      pointer-events: none;
      -webkit-transform: translate3d(0, -100%, 0);
              transform: translate3d(0, -100%, 0);
      -webkit-animation: snow linear infinite;
              animation: snow linear infinite;
    }
    .snow.foreground {
      background-image: url("https://dl6rt3mwcjzxg.cloudfront.net/assets/snow/snow-large-075d267ecbc42e3564c8ed43516dd557.png");
      -webkit-animation-duration: 15s;
              animation-duration: 15s;
    }
    .snow.foreground.layered {
      -webkit-animation-delay: 7.5s;
              animation-delay: 7.5s;
    }
    .snow.middleground {
      background-image: url(https://dl6rt3mwcjzxg.cloudfront.net/assets/snow/snow-medium-0b8a5e0732315b68e1f54185be7a1ad9.png);
      -webkit-animation-duration: 20s;
              animation-duration: 20s;
    }
    .snow.middleground.layered {
      -webkit-animation-delay: 10s;
              animation-delay: 10s;
    }
    .snow.background {
      background-image: url(https://dl6rt3mwcjzxg.cloudfront.net/assets/snow/snow-small-1ecd03b1fce08c24e064ff8c0a72c519.png);
      -webkit-animation-duration: 30s;
              animation-duration: 30s;
    }
    .snow.background.layered {
      -webkit-animation-delay: 15s;
              animation-delay: 15s;
    }
    
    @-webkit-keyframes snow {
      0% {
        -webkit-transform: translate3d(0, -100%, 0);
                transform: translate3d(0, -100%, 0);
      }
      100% {
        -webkit-transform: translate3d(15%, 100%, 0);
                transform: translate3d(15%, 100%, 0);
      }
    }
    
    @keyframes snow {
      0% {
        -webkit-transform: translate3d(0, -100%, 0);
                transform: translate3d(0, -100%, 0);
      }
      100% {
        -webkit-transform: translate3d(15%, 100%, 0);
                transform: translate3d(15%, 100%, 0);
      }
    }
    
    console.log("talk is cheap, show me you code.")
  • 相关阅读:
    js_浏览器对象模型BOM---通过对象来抽象浏览器功能
    js_dom 之事件注册、移除 、pageX
    js组成之dom_dom对象样式操作及运用
    js_组成之DOM_dom对象的注册事件及属性操作
    js_字符串、数组常用方法及应用
    js_内置对象Date Math
    Caffe入门学习(代码实践)
    char和uchar区别
    c/c++中过滤文件路经 后缀
    shell中$(( )) 、 $( ) 、${ }的区别
  • 原文地址:https://www.cnblogs.com/mlocvery/p/11533468.html
Copyright © 2011-2022 走看看