
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Neon Glitch Text Animation</title>
<style>
body {
margin: 0;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background:
overflow: hidden;
}
.neon-container {
position: relative;
font-family: 'Arial', sans-serif;
font-size: 6vw;
text-transform: uppercase;
letter-spacing: 4px;
}
.neon-text {
position: relative;
color:
text-shadow:
0 0 5px
0 0 10px
0 0 20px
0 0 40px
0 0 80px
animation: flicker 2s infinite,
glitch 1s linear infinite,
float 3s ease-in-out infinite;
}
.neon-text::before,
.neon-text::after {
content: attr(data-text);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
color:
text-shadow:
0 0 5px
0 0 10px
0 0 20px
0 0 40px
opacity: 0.8;
}
.neon-text::before {
animation: glitch-left 1s linear infinite;
}
.neon-text::after {
animation: glitch-right 1s linear infinite;
}
@keyframes flicker {
0%, 18%, 22%, 25%, 53%, 57%, 100% {
opacity: 1;
}
20%, 24%, 55% {
opacity: 0;
}
}
@keyframes glitch {
0% { transform: translate(0); }
20% { transform: translate(-2px, 2px); }
40% { transform: translate(-2px, -2px); }
60% { transform: translate(2px, 2px); }
80% { transform: translate(2px, -2px); }
100% { transform: translate(0); }
}
@keyframes glitch-left {
0% { transform: translateX(-5px); }
20% { transform: translateX(5px); }
40% { transform: translateX(-3px); }
60% { transform: translateX(3px); }
80% { transform: translateX(-2px); }
100% { transform: translateX(0); }
}
@keyframes glitch-right {
0% { transform: translateX(5px); }
20% { transform: translateX(-5px); }
40% { transform: translateX(3px); }
60% { transform: translateX(-3px); }
80% { transform: translateX(2px); }
100% { transform: translateX(0); }
}
@keyframes float {
0% { transform: translateY(0); }
50% { transform: translateY(-10px); }
100% { transform: translateY(0); }
}
.scan-line {
position: absolute;
width: 100%;
height: 2px;
background: rgba(255, 255, 255, 0.1);
animation: scan 2s linear infinite;
}
@keyframes scan {
0% { transform: translateY(0); }
100% { transform: translateY(100%); }
}
.background-glitches {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
pointer-events: none;
}
.glitch-line {
position: absolute;
width: 20%;
height: 2px;
background:
opacity: 0;
animation: line-fade 3s infinite;
}
@keyframes line-fade {
0% { opacity: 0; transform: translateY(0); }
50% { opacity: 0.5; transform: translateY(100px); }
100% { opacity: 0; transform: translateY(200px); }
}
</style>
</head>
<body>
<div class="neon-container">
<div class="neon-text" data-text="container">container</div>
<div class="neon-text" data-text="PUNK" style="margin-left: 20px; color: #ff00ff;">PUNK</div>
</div>
<div class="background-glitches">
<div class="glitch-line" style="top: 20%; left: 10%; width: 15%; animation-delay: 0s;"></div>
<div class="glitch-line" style="top: 40%; right: 5%; width: 25%; animation-delay: 0.5s;"></div>
<div class="glitch-line" style="top: 60%; left: 30%; width: 10%; animation-delay: 1s;"></div>
<div class="glitch-line" style="top: 80%; right: 15%; width: 30%; animation-delay: 1.5s;"></div>
</div>
<script>
// 动态生成扫描线
for(let i = 0; i < 10; i++) {
const line = document.createElement('div');
line.className = 'scan-line';
line.style.animationDelay = `${Math.random()}s`;
document.body.appendChild(line);
}
// 鼠标交互效果
document.addEventListener('mousemove', (e) => {
const sparks = document.createElement('div');
sparks.className = 'glitch-line';
sparks.style.position = 'fixed';
sparks.style.left = `${e.clientX}px`;
sparks.style.top = `${e.clientY}px`;
sparks.style.width = '50px';
sparks.style.transform = 'rotate(45deg)';
sparks.style.animation = 'line-fade 1s forwards';
document.body.appendChild(sparks);
setTimeout(() => sparks.remove(), 1000);
});
</script>
</body>
</html>