雪花飘落的效果,纯css3实现


<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <title></title>
        <style type="text/css">
        body{}
        #page_end_html{}
        .box{width: 100%; height: 1500px; background: #000; background: url(img/22.jpg);}
           .snow-container {
                position: fixed;
                height: 100%;
                width: 100%;
                max-width: 100%;
                top: 0;
                overflow: hidden;
                z-index: 2;
                pointer-events: none;
                -webkit-backface-visibility: hidden;
backface-visibility: hidden;
            }
            
            .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;
                -webkit-backface-visibility: hidden;
backface-visibility: hidden;
            }
            
            .snow.foreground {
                background-image: url("img/snow-large.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(img/snow-medium.png);
                -webkit-animation-duration: 20s;
                animation-duration: 20s;
            }
            
            .snow.middleground.layered {
                -webkit-animation-delay: 10s;
                animation-delay: 10s;
            }
            
            .snow.background {
                background-image: url(img/snow-small.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);
                }
            }

        </style>
        
    </head>

    <body class="test">
        <div class="box"></div>
            <div id="page_end_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>
        </div>
        
    </body>
    

</html>

 

所涉及的图片如下

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM