带粒子背景与打字机效果的极客留言板代码

唯美留言板代码唯美留言板代码 2026-01-04
带粒子背景与打字机效果的极客留言板代码

带粒子背景与打字机效果的极客留言板代码

深色模式 + 动态粒子背景 + 打字机效果。这种风格极具现代感,适合开发者社区或个人极客博客。由于Canvas动画无法直接预览,下方代码包含完整的JS逻辑。

> 正在连接服务器...
> 欢迎访问 Guest_8823
> 请在此处输入您的秘密讯息...
_
点击查看完整HTML/JS代码(含粒子背景)
<!DOCTYPE html>
<html>
<head>
<style>
    body { margin: 0; overflow: hidden; background: #1e1e2e; font-family: 'Consolas', monospace; }
    canvas { position: fixed; top: 0; left: 0; z-index: 0; }
    .container { position: relative; z-index: 1; width: 100%; height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; }
    .terminal { width: 500px; background: rgba(30, 30, 46, 0.9); border: 1px solid #00d2ff; padding: 20px; border-radius: 5px; box-shadow: 0 0 20px rgba(0, 210, 255, 0.2); backdrop-filter: blur(5px); }
    .output { height: 150px; overflow-y: auto; color: #a0a0a0; margin-bottom: 10px; font-size: 14px; }
    .output div { margin-bottom: 5px; }
    .input-group { display: flex; gap: 10px; }
    input { flex: 1; background: transparent; border: none; border-bottom: 2px solid #00d2ff; color: #fff; padding: 8px; outline: none; font-family: inherit; font-size: 16px; }
    button { background: #00d2ff; color: #1e1e2e; border: none; padding: 8px 20px; font-weight: bold; cursor: pointer; transition: 0.3s; }
    button:hover { background: #fff; }
    ::-webkit-scrollbar { width: 5px; }
    ::-webkit-scrollbar-thumb { background: #00d2ff; }
</style>
</head>
<body>
<canvas id="bgCanvas"></canvas>
<div class="container">
    <div class="terminal">
        <div class="output" id="output"></div>
        <div class="input-group">
            <input type="text" id="msg" placeholder="输入留言并回车..." onkeydown="if(event.keyCode==13) sendMessage()">
            <button onclick="sendMessage()">SEND</button>
        </div>
    </div>
</div>

<script>
    // 粒子背景逻辑
    const canvas = document.getElementById('bgCanvas');
    const ctx = canvas.getContext('2d');
    let width, height;
    let particles = [];
    
    function resize() { width = canvas.width = window.innerWidth; height = canvas.height = window.innerHeight; }
    window.onresize = resize; resize();

    class Particle {
        constructor() {
            this.x = Math.random() * width;
            this.y = Math.random() * height;
            this.vx = (Math.random() - 0.5) * 0.5;
            this.vy = (Math.random() - 0.5) * 0.5;
            this.size = Math.random() * 2;
        }
        update() {
            this.x += this.vx; this.y += this.vy;
            if (this.x  width) this.vx *= -1;
            if (this.y  height) this.vy *= -1;
        }
        draw() {
            ctx.fillStyle = 'rgba(0, 210, 255, 0.5)';
            ctx.beginPath(); ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2); ctx.fill();
        }
    }
    for (let i = 0; i  { p.update(); p.draw(); });
        // 连线
        for (let i = 0; i  {
            const reply = document.createElement('div');
            reply.style.color = '#ff0055';
            reply.innerHTML = `> [SYSTEM]: Message received. Stored in sector 7G.`;
            output.appendChild(reply);
            output.scrollTop = output.scrollHeight;
        }, 600);
        
        input.value = '';
        output.scrollTop = output.scrollHeight;
    }
</script>
</body>
</html>
        
精选评论
  • 赤色月光:106.89.170.234
    補記仲係讀書時候睇嘅經典之作烚下烚下  带粒子背景与打字机效果的极客留言板代码
  • 环游发光睡裤:139.202.120.180
    这季尾收的太工整带粒子背景与打字机效果的极客留言板代码没有弄大事件真好奇第6季怎么开头 带粒子背景与打字机效果的极客留言板代码
  • Phoebe的情书:121.76.190.87
    这种片子得是阅碟颇多的人才能看懂 搞笑啊 哈哈  带粒子背景与打字机效果的极客留言板代码
  • 惟勤Heart:222.83.163.64
    拍得很好看浓墨重彩的表现风格 疤面煞星不知道是不是从这片来的灵感写一个人如何走向灵魂的深渊 最好的故事感觉没有讲完带粒子背景与打字机效果的极客留言板代码可能是觉得无论是谁杀死谁都不够高级吧 我倒是喜欢他不被杀死一个不死的恶魂就很带劲  带粒子背景与打字机效果的极客留言板代码
  • 捕雨:36.58.144.126
    董永太太太丑了 杨子好好的商人干嘛非要出来演戏辣眼睛 他俩算是公费谈恋爱黄圣依好美啊  带粒子背景与打字机效果的极客留言板代码
🆕 New