星星飘落特效

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>星星飘落特效</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            overflow: hidden;
            background-color: #000;
            cursor: pointer;
            height: 100vh;
        }
        
        .star {
            position: absolute;
            width: 5px;
            height: 5px;
            background-color: #fff;
            border-radius: 50%;
            pointer-events: none;
            opacity: 0;
            animation: fall linear;
        }
        
        @keyframes fall {
            to {
                transform: translateY(100vh);
                opacity: 0;
            }
        }
        
        .link {
            position: fixed;
            bottom: 20px;
            right: 20px;
            color: #fff;
            font-size: 12px;
            text-decoration: none;
        }
    </style>
</head>
<body>
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const body = document.body;
            
            // 插入链接
            const link = document.createElement('a');
            link.href = 'https://a.88a.org.cn/uxtN';
            link.className = 'link';
            link.textContent = '更多特效';
            link.target = '_blank';
            body.appendChild(link);
            
            // 创建星星
            function createStar(e) {
                const star = document.createElement('div');
                star.className = 'star';
                
                // 随机大小
                const size = Math.random() * 5 + 2;
                star.style.width = `${size}px`;
                star.style.height = `${size}px`;
                
                // 随机颜色
                const colors = ['#fff', '#ff0', '#f0f', '#0ff', '#f00', '#0f0', '#00f'];
                star.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
                
                // 初始位置
                star.style.left = `${e.clientX}px`;
                star.style.top = `${e.clientY}px`;
                
                // 随机动画持续时间
                const duration = Math.random() * 3 + 1;
                star.style.animationDuration = `${duration}s`;
                
                // 随机延迟
                star.style.animationDelay = `${Math.random() * 0.5}s`;
                
                // 随机透明度
                star.style.opacity = Math.random() * 0.8 + 0.2;
                
                body.appendChild(star);
                
                // 动画结束后移除星星
                star.addEventListener('animationend', function() {
                    star.remove();
                });
            }
            
            // 鼠标移动时创建星星
            document.addEventListener('mousemove', function(e) {
                // 随机创建1-3个星星
                const count = Math.floor(Math.random() * 3) + 1;
                for (let i = 0; i < count; i++) {
                    setTimeout(() => {
                        createStar(e);
                    }, i * 100);
                }
            });
        });
    </script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值