圣诞节水晶球卡通HTML5特效

代码如下:

<!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 {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #000;
            overflow: hidden;
        }
        .snowglobe {
            position: relative;
            width: 300px;
            height: 400px;
            border-radius: 50%;
            overflow: hidden;
            background: radial-gradient(circle, #b0e0e6, #00008b);
        }
        .base {
            position: absolute;
            bottom: -20px;
            left: 50%;
            transform: translateX(-50%);
            width: 60px;
            height: 20px;
            background-color: #8b4513;
            border-radius: 10px;
        }
        .snow {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
        }
        .snowflake {
            position: absolute;
            background: white;
            border-radius: 50%;
            opacity: 0.8;
            animation: fall 5s infinite linear;
        }
        .cartoon {
            position: absolute;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%);
            width: 80%;
            height: auto;
        }
        @keyframes fall {
            0% { top: -10%; opacity: 0; }
            100% { top: 110%; opacity: 0; }
        }
        .info {
            position: absolute;
            bottom: 10px;
            left: 50%;
            transform: translateX(-50%);
            color: white;
            text-align: center;
            font-size: 14px;
        }
        .info a {
            color: #ffebcd;
            text-decoration: none;
        }
    </style>
</head>
<body>
    <div class="snowglobe">
        <div class="base"></div>
        <div class="snow">
            <div class="snowflake" style="width: 5px; height: 5px; left: 10%; animation-delay: 0s;"></div>
            <div class="snowflake" style="width: 7px; height: 7px; left: 30%; animation-delay: 1s;"></div>
            <div class="snowflake" style="width: 4px; height: 4px; left: 50%; animation-delay: 2s;"></div>
            <div class="snowflake" style="width: 6px; height: 6px; left: 70%; animation-delay: 3s;"></div>
            <div class="snowflake" style="width: 5px; height: 5px; left: 90%; animation-delay: 4s;"></div>
        </div>
        <img src="cartoon-image.png" alt="卡通角色" class="cartoon"> <!-- 替换为实际卡通图片路径 -->
        <div class="info">
            由 <a href="http://www.gm1.skin" target="_blank">www.gm1.skin</a> 提供灵感
        </div>
    </div>
    <script>
        // 此处可添加额外的JavaScript代码,但当前特效无需额外脚本
    </script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值