做一个SVG动画,要求:使用多种emoji,夸张,离谱,抽象,极具视觉冲击力
我来为你创建一个极具视觉冲击力的抽象SVG动画。这将是一个充满emoji的混沌宇宙,融合了故障艺术、超现实主义和迷幻色彩。
HTML
预览
复制
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Emoji混沌宇宙 | Emoji Chaos Universe</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #000;
overflow: hidden;
font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
}
#canvas-container {
width: 100vw;
height: 100vh;
position: relative;
background: radial-gradient(ellipse at center, #1a0033 0%, #000000 100%);
}
svg {
width: 100%;
height: 100%;
display: block;
}
.glitch-text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 4rem;
font-weight: 900;
color: #fff;
text-shadow:
2px 2px #ff00ff,
-2px -2px #00ffff,
4px 4px #ffff00;
animation: glitch 0.3s infinite;
pointer-events: none;
z-index: 10;
mix-blend-mode: difference;
}
@keyframes glitch {
0% { transform: translate(-50%, -50%) skew(0deg); }
20% { transform: translate(-48%, -52%) skew(2deg); }
40% { transform: translate(-52%, -48%) skew(-2deg); }
60% { transform: translate(-50%, -50%) skew(1deg); }
80% { transform: translate(-49%, -51%) skew(-1deg); }
100% { transform: translate(-50%, -50%) skew(0deg); }
}
.controls {
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
z-index: 100;
display: flex;
gap: 10px;
}
button {
background: rgba(255, 255, 255, 0.1);
border: 2px solid #ff00ff;
color: #fff;
padding: 10px 20px;
cursor: pointer;
font-size: 1rem;
text-transform: uppercase;
letter-spacing: 2px;
transition: all 0.3s;
backdrop-filter: blur(10px);
}
button:hover {
background: #ff00ff;
box-shadow: 0 0 20px #ff00ff;
}
</style>
</head>
<body>
<div id="canvas-container">
<div class="glitch-text">🌀 混沌核心 🌀</div>
<svg id="chaos-svg" viewBox="0 0 1920 1080" preserveAspectRatio="xMidYMid slice">
<defs>
<!-- 滤镜:故障效果 -->
<filter id="glitch-filter" x="-50%" y="-50%" width="200%" height="200%">
<feTurbulence type="fractalNoise" baseFrequency="0.1" numOctaves="2" result="noise">
<animate attributeName="baseFrequency" values="0.1;0.5;0.1" dur="2s" repeatCount="indefinite"/>
</feTurbulence>
<feDisplacementMap in="SourceGraphic" in2="noise" scale="50" xChannelSelector="R" yChannelSelector="G"/>
</filter>
<!-- 滤镜:发光 -->
<filter id="glow">
<feGaussianBlur stdDeviation="4" result="coloredBlur"/>
<feMerge>
<feMergeNode in="coloredBlur"/>
<feMergeNode in="SourceGraphic"/>
</feMerge>
</filter>
<!-- 滤镜:液化 -->
<filter id="liquify">
<feTurbulence type="turbulence" baseFrequency="0.02" numOctaves="3" result="turbulence">
<animate attributeName="baseFrequency" values="0.02;0.05;0.02" dur="10s" repeatCount="indefinite"/>
</feTurbulence>
<feDisplacementMap in2="turbulence" in="SourceGraphic" scale="100" xChannelSelector="R" yChannelSelector="G"/>
</filter>
<!-- 渐变 -->
<radialGradient id="cosmic-gradient" cx="50%" cy="50%" r="50%">
<stop offset="0%" style="stop-color:#ff006e;stop-opacity:1">
<animate attributeName="stop-color" values="#ff006e;#8338ec;#3a86ff;#06ffa5;#ffbe0b;#ff006e" dur="4s" repeatCount="indefinite"/>
</stop>
<stop offset="100%" style="stop-color:#000000;stop-opacity:0"/>
</radialGradient>
<!-- 图案 -->
<pattern id="emoji-pattern" x="0" y="0" width="100" height="100" patternUnits="userSpaceOnUse">
<text x="50" y="50" font-size="40" text-anchor="middle" dominant-baseline="middle" fill="white" opacity="0.3">👁️</text>
</pattern>
</defs>
<!-- 背景层 -->
<rect width="100%" height="100%" fill="url(#cosmic-gradient)" opacity="0.3">
<animate attributeName="opacity" values="0.3;0.6;0.3" dur="3s" repeatCount="indefinite"/>
</rect>
<!-- 旋转的emoji环 -->
<g id="ring1" transform="translate(960, 540)">
<animateTransform attributeName="transform" type="rotate" from="0 960 540" to="360 960 540" dur="20s" repeatCount="indefinite"/>
</g>
<g id="ring2" transform="translate(960, 540)">
<animateTransform attributeName="transform" type="rotate" from="360 960 540" to="0 960 540" dur="15s" repeatCount="indefinite"/>
</g>
<!-- 中心黑洞 -->
<circle cx="960" cy="540" r="100" fill="black" filter="url(#glow)">
<animate attributeName="r" values="100;150;100" dur="4s" repeatCount="indefinite"/>
</circle>
<!-- 粒子群 -->
<g id="particles"></g>
<!-- 故障层 -->
<g id="glitch-layer" filter="url(#glitch-filter)" opacity="0.7"></g>
<!-- 液化层 -->
<g id="liquify-layer" filter="url(#liquify)"></g>
</svg>
<div class="controls">
<button onclick="intensify()">⚡ 加强混乱</button>
<button onclick="toggleGlitch()">🔧 故障开关</button>
<button onclick="resetChaos()">🔄 重置宇宙</button>
</div>
</div>
<script>
const svg = document.getElementById('chaos-svg');
const ring1 = document.getElementById('ring1');
const ring2 = document.getElementById('ring2');
const particlesGroup = document.getElementById('particles');
const glitchLayer = document.getElementById('glitch-layer');
const liquifyLayer = document.getElementById('liquify-layer');
// Emoji库 - 抽象、夸张、离谱
const emojis = [
'👁️', '🧠', '👽', '🤖', '💀', '👻', '🤡', '💩',
'🌈', '🔥', '💥', '⚡', '🌪️', '🌊', '🍄', '🦄',
'🐙', '🦑', '🐉', '🦕', '🦖', '🐊', '🐅', '🦓',
'🎭', '🎪', '🎨', '🎬', '🎮', '🎯', '🎲', '🎰',
'🔮', '🧿', '🧸', '🪆', '🎎', '🎏', '🎐', '🧬',
'🦠', '🧫', '🔬', '⚗️', '🔭', '🛸', '🚀', '🛰️',
'⏰', '⏳', '⌛', '🕰️', '⏱️', '⏲️', '🧭', '🔱',
'⚜️', '🔰', '⭕', '❌', '❓', '❗', '‼️', '⁉️',
'⚠️', '☢️', '☣️', '⬆️', '⬇️', '⬅️', '➡️', '🔄',
'🔃', '🔂', '🔁', '▶️', '⏸️', '⏹️', '⏺️', '⏭️',
'🎵', '🎶', '🔔', '📢', '📣', '🔊', '🔉', '🔈',
'💎', '💍', '👑', '🎩', '🧢', '👒', '🎓', '⛑️',
'🌑', '🌒', '🌓', '🌔', '🌕', '🌖', '🌗', '🌘',
'🪐', '⭐', '🌟', '✨', '💫', '☄️', '🌠', '🌌'
];
let chaosLevel = 1;
let glitchEnabled = true;
let animationId;
// 创建轨道环
function createRing(group, count, radius, emojiSize, direction) {
for (let i = 0; i < count; i++) {
const angle = (i / count) * Math.PI * 2;
const x = Math.cos(angle) * radius;
const y = Math.sin(angle) * radius;
const emoji = emojis[Math.floor(Math.random() * emojis.length)];
const text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
text.setAttribute('x', x);
text.setAttribute('y', y);
text.setAttribute('font-size', emojiSize);
text.setAttribute('text-anchor', 'middle');
text.setAttribute('dominant-baseline', 'middle');
text.textContent = emoji;
// 个体旋转
const animateRotate = document.createElementNS('http://www.w3.org/2000/svg', 'animateTransform');
animateRotate.setAttribute('attributeName', 'transform');
animateRotate.setAttribute('type', 'rotate');
animateRotate.setAttribute('from', `0 ${x} ${y}`);
animateRotate.setAttribute('to', `${direction * 360} ${x} ${y}`);
animateRotate.setAttribute('dur', `${2 + Math.random() * 3}s`);
animateRotate.setAttribute('repeatCount', 'indefinite');
// 缩放脉冲
const animateScale = document.createElementNS('http://www.w3.org/2000/svg', 'animateTransform');
animateScale.setAttribute('attributeName', 'transform');
animateScale.setAttribute('type', 'scale');
animateScale.setAttribute('values', '1;1.5;1');
animateScale.setAttribute('dur', `${0.5 + Math.random()}s`);
animateScale.setAttribute('repeatCount', 'indefinite');
animateScale.setAttribute('additive', 'sum');
text.appendChild(animateRotate);
text.appendChild(animateScale);
group.appendChild(text);
}
}
// 创建粒子
function createParticle() {
const emoji = emojis[Math.floor(Math.random() * emojis.length)];
const x = Math.random() * 1920;
const y = Math.random() * 1080;
const size = 20 + Math.random() * 80;
const text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
text.setAttribute('x', x);
text.setAttribute('y', y);
text.setAttribute('font-size', size);
text.setAttribute('text-anchor', 'middle');
text.setAttribute('dominant-baseline', 'middle');
text.setAttribute('opacity', Math.random());
text.textContent = emoji;
// 随机运动路径
const pathX = (Math.random() - 0.5) * 400;
const pathY = (Math.random() - 0.5) * 400;
const animateMove = document.createElementNS('http://www.w3.org/2000/svg', 'animate');
animateMove.setAttribute('attributeName', 'x');
animateMove.setAttribute('values', `${x};${x + pathX};${x}`);
animateMove.setAttribute('dur', `${3 + Math.random() * 5}s`);
animateMove.setAttribute('repeatCount', 'indefinite');
const animateMoveY = document.createElementNS('http://www.w3.org/2000/svg', 'animate');
animateMoveY.setAttribute('attributeName', 'y');
animateMoveY.setAttribute('values', `${y};${y + pathY};${y}`);
animateMoveY.setAttribute('dur', `${3 + Math.random() * 5}s`);
animateMoveY.setAttribute('repeatCount', 'indefinite');
// 颜色变化
const animateColor = document.createElementNS('http://www.w3.org/2000/svg', 'animate');
animateColor.setAttribute('attributeName', 'fill');
const colors = ['#ff006e', '#8338ec', '#3a86ff', '#06ffa5', '#ffbe0b', '#fb5607'];
animateColor.setAttribute('values', colors.join(';'));
animateColor.setAttribute('dur', '2s');
animateColor.setAttribute('repeatCount', 'indefinite');
text.appendChild(animateMove);
text.appendChild(animateMoveY);
text.appendChild(animateColor);
return text;
}
// 创建故障层元素
function createGlitchElement() {
const emoji = emojis[Math.floor(Math.random() * emojis.length)];
const text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
text.setAttribute('x', Math.random() * 1920);
text.setAttribute('y', Math.random() * 1080);
text.setAttribute('font-size', 100 + Math.random() * 200);
text.setAttribute('fill', ['#ff00ff', '#00ffff', '#ffff00'][Math.floor(Math.random() * 3)]);
text.setAttribute('opacity', 0.3);
text.setAttribute('style', 'mix-blend-mode: difference;');
text.textContent = emoji;
const animateX = document.createElementNS('http://www.w3.org/2000/svg', 'animate');
animateX.setAttribute('attributeName', 'x');
animateX.setAttribute('values', `${Math.random() * 1920};${Math.random() * 1920};${Math.random() * 1920}`);
animateX.setAttribute('dur', '0.5s');
animateX.setAttribute('repeatCount', 'indefinite');
text.appendChild(animateX);
return text;
}
// 初始化
function init() {
createRing(ring1, 20, 300, 60, 1);
createRing(ring2, 15, 450, 80, -1);
// 添加粒子
for (let i = 0; i < 30; i++) {
particlesGroup.appendChild(createParticle());
}
// 添加故障元素
for (let i = 0; i < 5; i++) {
glitchLayer.appendChild(createGlitchElement());
}
// 添加液化层大emoji
for (let i = 0; i < 3; i++) {
const text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
text.setAttribute('x', 960 + (Math.random() - 0.5) * 800);
text.setAttribute('y', 540 + (Math.random() - 0.5) * 600);
text.setAttribute('font-size', 300);
text.setAttribute('text-anchor', 'middle');
text.setAttribute('fill', 'white');
text.setAttribute('opacity', 0.2);
text.textContent = emojis[Math.floor(Math.random() * emojis.length)];
liquifyLayer.appendChild(text);
}
}
// 加强混乱
function intensify() {
chaosLevel++;
// 添加更多粒子
for (let i = 0; i < 10 * chaosLevel; i++) {
particlesGroup.appendChild(createParticle());
}
// 添加更多故障
if (glitchEnabled) {
for (let i = 0; i < 3; i++) {
glitchLayer.appendChild(createGlitchElement());
}
}
// 视觉反馈
document.querySelector('.glitch-text').textContent = `🌀 混沌等级: ${chaosLevel} 🌀`;
document.body.style.filter = `hue-rotate(${Math.random() * 360}deg) contrast(${1 + chaosLevel * 0.2})`;
}
// 切换故障效果
function toggleGlitch() {
glitchEnabled = !glitchEnabled;
glitchLayer.style.display = glitchEnabled ? 'block' : 'none';
document.getElementById('chaos-svg').style.filter = glitchEnabled ? 'none' : 'saturate(0.5)';
}
// 重置
function resetChaos() {
chaosLevel = 1;
particlesGroup.innerHTML = '';
glitchLayer.innerHTML = '';
ring1.innerHTML = '';
ring2.innerHTML = '';
liquifyLayer.innerHTML = '';
document.body.style.filter = 'none';
document.querySelector('.glitch-text').textContent = '🌀 混沌核心 🌀';
init();
}
// 鼠标交互
document.addEventListener('mousemove', (e) => {
const x = (e.clientX / window.innerWidth) * 1920;
const y = (e.clientY / window.innerHeight) * 1080;
// 创建鼠标轨迹
if (Math.random() > 0.7) {
const trail = document.createElementNS('http://www.w3.org/2000/svg', 'text');
trail.setAttribute('x', x);
trail.setAttribute('y', y);
trail.setAttribute('font-size', 40);
trail.textContent = emojis[Math.floor(Math.random() * emojis.length)];
trail.style.pointerEvents = 'none';
const animate = document.createElementNS('http://www.w3.org/2000/svg', 'animate');
animate.setAttribute('attributeName', 'opacity');
animate.setAttribute('values', '1;0');
animate.setAttribute('dur', '1s');
animate.setAttribute('fill', 'freeze');
trail.appendChild(animate);
particlesGroup.appendChild(trail);
setTimeout(() => trail.remove(), 1000);
}
});
// 点击爆炸效果
document.addEventListener('click', (e) => {
const x = (e.clientX / window.innerWidth) * 1920;
const y = (e.clientY / window.innerHeight) * 1080;
for (let i = 0; i < 10; i++) {
const explosion = document.createElementNS('http://www.w3.org/2000/svg', 'text');
explosion.setAttribute('x', x);
explosion.setAttribute('y', y);
explosion.setAttribute('font-size', 50);
explosion.textContent = ['💥', '⚡', '🔥', '✨', '💫'][Math.floor(Math.random() * 5)];
const angle = (Math.PI * 2 * i) / 10;
const distance = 200;
const tx = x + Math.cos(angle) * distance;
const ty = y + Math.sin(angle) * distance;
const animateX = document.createElementNS('http://www.w3.org/2000/svg', 'animate');
animateX.setAttribute('attributeName', 'x');
animateX.setAttribute('values', `${x};${tx}`);
animateX.setAttribute('dur', '0.5s');
animateX.setAttribute('fill', 'freeze');
const animateY = document.createElementNS('http://www.w3.org/2000/svg', 'animate');
animateY.setAttribute('attributeName', 'y');
animateY.setAttribute('values', `${y};${ty}`);
animateY.setAttribute('dur', '0.5s');
animateY.setAttribute('fill', 'freeze');
const animateOp = document.createElementNS('http://www.w3.org/2000/svg', 'animate');
animateOp.setAttribute('attributeName', 'opacity');
animateOp.setAttribute('values', '1;0');
animateOp.setAttribute('dur', '0.5s');
animateOp.setAttribute('fill', 'freeze');
explosion.appendChild(animateX);
explosion.appendChild(animateY);
explosion.appendChild(animateOp);
particlesGroup.appendChild(explosion);
setTimeout(() => explosion.remove(), 500);
}
});
// 启动
init();
// 自动增加混乱度
setInterval(() => {
if (chaosLevel < 5 && Math.random() > 0.7) {
intensify();
}
}, 5000);
</script>
</body>
</html>这个SVG动画包含了以下离谱和抽象的元素:
视觉冲击特性:
- 故障艺术滤镜 - 使用SVG滤镜创建数字故障、噪点和扭曲效果
- 迷幻色彩 - 霓虹渐变、高对比度、色相旋转
- 多层叠加 - 轨道环、粒子群、液化层、故障层同时运作
交互功能:
- 鼠标移动 - 产生emoji轨迹
- 点击屏幕 - 触发爆炸效果(💥⚡🔥)
- "加强混乱"按钮 - 指数级增加粒子数量和视觉噪点
- "故障开关" - 切换赛博朋克故障效果
- 自动进化 - 每5秒自动提升混乱等级
抽象元素:
- 旋转的emoji环(顺时针+逆时针)
- 随机缩放和颜色变化的粒子
- 巨大的液化emoji(300px+)
- RGB分离故障文字
- 混合模式(difference, overlay)
这是一个真正的"视觉污染"艺术作品,融合了达达主义、故障艺术和迷幻文化。警告:长时间观看可能会引起轻微眩晕!🌀👁️💥