白天黑夜动画场景特效

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>白天黑夜动画场景特效</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            height: 100vh;
            overflow: hidden;
            font-family: Arial, sans-serif;
            position: relative;
        }

        .scene {
            position: relative;
            width: 100%;
            height: 100%;
            background: linear-gradient(to bottom, #87CEEB 0%, #E0F7FA 100%);
            animation: day-night 20s infinite alternate;
            overflow: hidden;
        }

        .sun {
            position: absolute;
            width: 100px;
            height: 100px;
            background: #FFD54F;
            border-radius: 50%;
            top: 100px;
            left: 100px;
            box-shadow: 0 0 50px #FFD54F;
            animation: sun-move 20s infinite alternate;
            z-index: 2;
        }

        .moon {
            position: absolute;
            width: 80px;
            height: 80px;
            background: #E0E0E0;
            border-radius: 50%;
            top: 100px;
            right: -100px;
            box-shadow: 0 0 30px #FFFFFF;
            animation: moon-move 20s infinite alternate;
            z-index: 2;
        }

        .ground {
            position: absolute;
            bottom: 0;
            width: 100%;
            height: 40%;
            background: linear-gradient(to bottom, #8BC34A 0%, #689F38 100%);
            z-index: 1;
        }

        .mountain {
            position: absolute;
            bottom: 40%;
            width: 0;
            height: 0;
            border-left: 150px solid transparent;
            border-right: 150px solid transparent;
            border-bottom: 200px solid #4CAF50;
            left: 50%;
            transform: translateX(-50%);
            z-index: 1;
        }

        .mountain:nth-child(2) {
            left: 30%;
            border-bottom-color: #388E3C;
            transform: translateX(-50%) scale(0.8);
        }

        .mountain:nth-child(3) {
            left: 70%;
            border-bottom-color: #2E7D32;
            transform: translateX(-50%) scale(0.7);
        }

        .tree {
            position: absolute;
            bottom: 40%;
            width: 40px;
            height: 100px;
            background: #5D4037;
            left: 200px;
            z-index: 2;
        }

        .tree::before {
            content: '';
            position: absolute;
            width: 0;
            height: 0;
            border-left: 50px solid transparent;
            border-right: 50px solid transparent;
            border-bottom: 100px solid #4CAF50;
            bottom: 100px;
            left: -30px;
        }

        .tree:nth-child(5) {
            left: 400px;
            height: 80px;
        }

        .tree:nth-child(5)::before {
            border-bottom-width: 80px;
            bottom: 80px;
        }

        .tree:nth-child(6) {
            left: 600px;
            height: 120px;
        }

        .tree:nth-child(6)::before {
            border-bottom-width: 120px;
            bottom: 120px;
        }

        .star {
            position: absolute;
            background: white;
            border-radius: 50%;
            animation: twinkle 2s infinite alternate;
            opacity: 0;
        }

        .star:nth-child(7) {
            width: 3px;
            height: 3px;
            top: 50px;
            left: 50px;
        }

        .star:nth-child(8) {
            width: 2px;
            height: 2px;
            top: 80px;
            left: 150px;
            animation-delay: 0.5s;
        }

        .star:nth-child(9) {
            width: 4px;
            height: 4px;
            top: 30px;
            left: 250px;
            animation-delay: 1s;
        }

        .star:nth-child(10) {
            width: 3px;
            height: 3px;
            top: 70px;
            left: 350px;
            animation-delay: 1.5s;
        }

        .star:nth-child(11) {
            width: 2px;
            height: 2px;
            top: 40px;
            left: 450px;
            animation-delay: 0.8s;
        }

        .star:nth-child(12) {
            width: 3px;
            height: 3px;
            top: 60px;
            left: 550px;
            animation-delay: 1.2s;
        }

        .star:nth-child(13) {
            width: 4px;
            height: 4px;
            top: 20px;
            left: 650px;
            animation-delay: 0.3s;
        }

        .star:nth-child(14) {
            width: 2px;
            height: 2px;
            top: 90px;
            left: 750px;
            animation-delay: 0.7s;
        }

        @keyframes day-night {
            0%, 40% {
                background: linear-gradient(to bottom, #87CEEB 0%, #E0F7FA 100%);
            }
            60%, 100% {
                background: linear-gradient(to bottom, #0F2027 0%, #203A43 50%, #2C5364 100%);
            }
        }

        @keyframes sun-move {
            0%, 40% {
                transform: translate(0, 0);
                opacity: 1;
            }
            50%, 100% {
                transform: translate(500px, 500px);
                opacity: 0;
            }
        }

        @keyframes moon-move {
            0%, 40% {
                transform: translate(0, 0);
                opacity: 0;
            }
            60%, 100% {
                transform: translate(-500px, 100px);
                opacity: 1;
            }
        }

        @keyframes twinkle {
            0% {
                opacity: 0.2;
            }
            100% {
                opacity: 1;
            }
        }

        /* 插入的链接样式 */
        .custom-link {
            position: fixed;
            bottom: 20px;
            right: 20px;
            color: rgba(255,255,255,0.7);
            text-decoration: none;
            font-size: 14px;
            background: rgba(0,0,0,0.3);
            padding: 8px 15px;
            border-radius: 20px;
            z-index: 10;
            transition: all 0.3s ease;
        }

        .custom-link:hover {
            color: white;
            background: rgba(0,0,0,0.5);
        }
    </style>
</head>
<body>
    <div class="scene">
        <div class="sun"></div>
        <div class="moon"></div>
        
        <div class="mountain"></div>
        <div class="mountain"></div>
        <div class="mountain"></div>
        
        <div class="tree"></div>
        <div class="tree"></div>
        <div class="tree"></div>
        
        <div class="star"></div>
        <div class="star"></div>
        <div class="star"></div>
        <div class="star"></div>
        <div class="star"></div>
        <div class="star"></div>
        <div class="star"></div>
        <div class="star"></div>
    </div>
    

</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值