我是靠谱客的博主 俊秀毛巾,最近开发中收集的这篇文章主要介绍前端例程20221227:下雪动画演示代码更多例程,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

演示

在这里插入图片描述
动图太大了不好上传,这里就放个静态图吧,实际上这里是雪花从上到下飘落的效果。

代码

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <title>下雪动画</title>

    <style>
        * {
            padding: 0;
            margin: 0;
            user-select: none;
            box-sizing: border-box;
        }

        html,
        body {
            height: 100vh;
            width: 100vw;
        }
    </style>

    <style>
        .bg {
            height: 100vh;
            width: 100vw;
        }

        .bg>img {
            height: 100%;
            width: 100%;
            object-fit: cover;
            position: absolute;
        }
    </style>

    <style>
        .snow-area {
            height: 100vh;
            width: 100vw;
            position: fixed;
            left: 0px;
            top: 0px;
            overflow: hidden;
            pointer-events: none;
        }

        .snow-slice {
            width: 100%;
            height: 100%;
            position: absolute;
            background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlgAAADICAMAAAADQW+EAAABxVBMVEXsayP7AAAAl3RSTlMAAgMFBwgKDA4PERQTGBcaFhweISMmKig1Ly4kPTknTB8zMSw4O0hAQkpHMkRSN05qPkZBZmBbUVVoXF9UbLdQZKh3gWNehXt+cmJ/gJV5WJRlblaSc5qTgm1ZsnCsq7C1cXWHjp+WuZd2ka6xs6G7uoiZfKO9nKCiiq2NhKZ6wIu0r8Kp0ce8htienb7DyMalzLjLj7a/RceXpwAAFu5JREFUGBntwQODI2nbsOHzulGM1bY9to21bTxcPDZf8/Pv/XZ3Zmca6U4lqUqqO3UcDAIJ1+v0m2kYMkeMkEbaOmQiEKKS2oQrJEt5OUOqOfW6JtOSrq4RkZq6PKJIliouuqSaGqpqMi3Z2XlDREMTLgkTx9ekmxgyETg54WgQMpnY+RNDmjSSkpA5vKZfPJejb0zg0lzx7qs5MoeXNz/q0jd2qSg0Vfjk3U0yh5mmf3ToC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RwxZBLlhL4waLxz510yiSpeHTYMGpndUmQSlV8rkMnETikyh02uWpH/D0KjpmXSgCH0AAAAAElFTkSuQmCC");
            background-repeat: repeat;
            top: -100%;
            opacity: 0;
            overflow: hidden;
            pointer-events: none;
            /* transform-origin: 0% 0%; */
            animation-name: snow-falling;
            animation-timing-function: linear;
            animation-iteration-count: infinite;
        }

        @keyframes snow-falling {
            0% {
                top: -100%;
                opacity: 0;
            }

            1% {
                top: -100%;
                opacity: 1;
            }

            99.8% {
                top: 100%;
                opacity: 1;
            }

            99.9% {
                opacity: 0;
            }

            100% {
                top: -100%;
                opacity: 0;
            }
        }

        .snow-slice:nth-child(1) {
            animation-delay: 0s;
            animation-duration: 50s;
            background-position: 10% 20%;
        }

        .snow-slice:nth-child(2) {
            animation-delay: 25s;
            animation-duration: 50s;
            background-position: 40% 60%;
        }

        .snow-slice:nth-child(3) {
            animation-delay: 0s;
            animation-duration: 70s;
            background-position: 90% 10%;
            opacity: 0.5;
        }

        .snow-slice:nth-child(4) {
            animation-delay: 35s;
            animation-duration: 70s;
            background-position: 50% 15%;
            opacity: 0.5;
        }
    </style>
</head>

<body>
    <div class="bg">
        <img src="./R0001452.webp" alt="">
    </div>
    <div class="snow-area">
        <div class="snow-slice"></div>
        <div class="snow-slice"></div>
        <div class="snow-slice"></div>
        <div class="snow-slice"></div>
    </div>
</body>

</html>

更多例程

更多例程可以参考下面代码仓库:
https://github.com/NaisuXu/front-end-web-examples

最后

以上就是俊秀毛巾为你收集整理的前端例程20221227:下雪动画演示代码更多例程的全部内容,希望文章能够帮你解决前端例程20221227:下雪动画演示代码更多例程所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(43)

评论列表共有 0 条评论

立即
投稿
返回
顶部