炫酷文字抖动动画网页特效

代码如下:

<!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;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            background: #000;
            overflow: hidden;
            font-family: 'Arial Black', sans-serif;
        }
        
        .text-container {
            position: relative;
            text-align: center;
        }
        
        .shaking-text {
            font-size: 5rem;
            color: transparent;
            background: linear-gradient(90deg, #ff00cc, #3333ff, #00ccff, #ff00cc);
            background-size: 400% 100%;
            -webkit-background-clip: text;
            background-clip: text;
            animation: shake 0.5s infinite alternate, gradient 8s linear infinite;
            text-shadow: 0 0 10px rgba(255,255,255,0.3);
            position: relative;
            z-index: 2;
        }
        
        .shaking-text::before {
            content: attr(data-text);
            position: absolute;
            left: 0;
            top: 0;
            color: rgba(255,255,255,0.2);
            z-index: -1;
            filter: blur(5px);
        }
        
        @keyframes shake {
            0% {
                transform: translateX(-5px) rotate(-2deg);
            }
            20% {
                transform: translateX(5px) rotate(2deg);
            }
            40% {
                transform: translateX(-5px) rotate(-2deg);
            }
            60% {
                transform: translateX(5px) rotate(2deg);
            }
            80% {
                transform: translateX(-5px) rotate(-2deg);
            }
            100% {
                transform: translateX(5px) rotate(2deg);
            }
        }
        
        @keyframes gradient {
            0% {
                background-position: 0% 50%;
            }
            100% {
                background-position: 400% 50%;
            }
        }
        
        .particles {
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            z-index: 1;
        }
        
        .particle {
            position: absolute;
            width: 3px;
            height: 3px;
            background: #fff;
            border-radius: 50%;
            opacity: 0;
            animation: particle 3s infinite;
        }
        
        @keyframes particle {
            0% {
                transform: translate(0, 0);
                opacity: 0;
            }
            20% {
                opacity: 1;
            }
            100% {
                transform: translate(var(--tx), var(--ty));
                opacity: 0;
            }
        }
        
        .footer {
            position: fixed;
            bottom: 30px;
            color: rgba(255,255,255,0.5);
            font-size: 14px;
            text-align: center;
            width: 100%;
        }
        
        .footer a {
            color: rgba(255,255,255,0.7);
            text-decoration: none;
            transition: color 0.3s;
        }
        
        .footer a:hover {
            color: #fff;
            text-shadow: 0 0 10px #00ccff;
        }
    </style>
</head>
<body>
    <div class="particles" id="particles"></div>
    
    <div class="text-container">
        <h1 class="shaking-text" data-text="炫酷抖动效果">炫酷抖动效果</h1>
    </div>
    
    <div class="footer">
     
    </div>

    <script>
        // 创建粒子效果
        const particlesContainer = document.getElementById('particles');
        const particleCount = 50;
        
        for (let i = 0; i < particleCount; i++) {
            const particle = document.createElement('div');
            particle.classList.add('particle');
            
            // 随机位置
            const x = Math.random() * 100;
            const y = Math.random() * 100;
            
            // 随机移动距离
            const tx = (Math.random() - 0.5) * 200;
            const ty = (Math.random() - 0.5) * 200;
            
            particle.style.left = `${x}%`;
            particle.style.top = `${y}%`;
            particle.style.setProperty('--tx', `${tx}px`);
            particle.style.setProperty('--ty', `${ty}px`);
            particle.style.animationDelay = `${Math.random() * 3}s`;
            
            particlesContainer.appendChild(particle);
        }
    </script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值