LED文字展示效果

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>LED文字展示效果</title>
    <style>
        body {
            background-color: #000;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            overflow: hidden;
            font-family: Arial, sans-serif;
        }
        
        .led-container {
            background-color: #111;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
        }
        
        .led-text {
            color: #0f0;
            font-size: 48px;
            font-weight: bold;
            text-shadow: 0 0 10px #0f0;
            letter-spacing: 5px;
            animation: blink 0.5s infinite alternate;
        }
        
        @keyframes blink {
            from {
                opacity: 0.8;
                text-shadow: 0 0 5px #0f0;
            }
            to {
                opacity: 1;
                text-shadow: 0 0 15px #0f0;
            }
        }
        
        .link {
            color: #0f0;
            text-align: center;
            margin-top: 20px;
            font-size: 14px;
            text-decoration: none;
            display: block;
        }
        
        .link:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <div class="led-container">
        <div class="led-text" id="ledDisplay">欢迎光临</div>
     
    </div>

    <script>
        const messages = [
            "欢迎光临",
            "LED效果展示",
            "动态文字变化",
            "HTML+CSS+JS",
            "感谢访问"
        ];
        
        const ledElement = document.getElementById('ledDisplay');
        let currentIndex = 0;
        
        function changeMessage() {
            ledElement.style.animation = 'none';
            ledElement.offsetHeight; // 触发重绘
            ledElement.style.animation = 'blink 0.5s infinite alternate';
            
            ledElement.textContent = messages[currentIndex];
            currentIndex = (currentIndex + 1) % messages.length;
        }
        
        // 初始显示
        changeMessage();
        
        // 每3秒切换一次消息
        setInterval(changeMessage, 3000);
        
        // 添加随机颜色变化效果
        setInterval(() => {
            const hue = Math.floor(Math.random() * 60) + 90; // 绿色到黄色范围
            ledElement.style.color = `hsl(${hue}, 100%, 50%)`;
            ledElement.style.textShadow = `0 0 10px hsl(${hue}, 100%, 50%)`;
        }, 5000);
    </script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值