<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Matrix Emoji Effect</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #000;
overflow: hidden;
font-family: 'Courier New', monospace;
cursor: none;
}
#canvas {
display: block;
background: radial-gradient(circle at center, transparent 0%, #000 100%);
}
.circle-mask {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 400px;
height: 400px;
border-radius: 50%;
border: 2px solid rgba(0, 255, 0, 0.3);
box-shadow:
0 0 20px rgba(0, 255, 0, 0.5),
inset 0 0 20px rgba(0, 255, 0, 0.1);
pointer-events: none;
animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% {
box-shadow:
0 0 20px rgba(0, 255, 0, 0.5),
inset 0 0 20px rgba(0, 255, 0, 0.1);
}
50% {
box-shadow:
0 0 40px rgba(0, 255, 0, 0.8),
inset 0 0 40px rgba(0, 255, 0, 0.2);
}
}
.info {
position: absolute;
top: 20px;
left: 20px;
color: #0f0;
font-size: 14px;
opacity: 0.7;
}
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<div class="circle-mask"></div>
<div class="info">Matrix Emoji Effect</div>
<script>
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
// Настройки
const EMOJIS = ['💻', '🤖', '👾', '🎮', '🔮', '⚡', '🔥', '💚', '🌿', '✨', '🎯', '🚀', '🔍', '💡', '🌐'];
const FONT_SIZE = 20;
const CIRCLE_RADIUS = 200;
const CENTER_X = window.innerWidth / 2;
const CENTER_Y = window.innerHeight / 2;
// Устанавливаем размеры canvas
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
// Класс для капли
class Drop {
constructor(x, y) {
this.x = x;
this.y = y;
this.speed = Math.random() * 3 + 1;
this.emoji = EMOJIS[Math.floor(Math.random() * EMOJIS.length)];
this.opacity = 1;
this.trail = [];
this.maxTrailLength = Math.floor(Math.random() * 5) + 3;
}
update() {
this.y += this.speed;
// Добавляем след
this.trail.unshift({ emoji: this.emoji, y: this.y, opacity: this.opacity });
if (this.trail.length > this.maxTrailLength) {
this.trail.pop();
}
// Уменьшаем прозрачность следа
this.trail.forEach((segment, index) => {
segment.opacity = (this.maxTrailLength - index) / this.maxTrailLength * 0.5;
});
// Проверяем, вышла ли капля за пределы круга
const distance = Math.sqrt(Math.pow(this.x - CENTER_X, 2) + Math.pow(this.y - CENTER_Y, 2));
if (distance > CIRCLE_RADIUS || this.y > CENTER_Y + CIRCLE_RADIUS) {
this.reset();
}
}
reset() {
this.x = CENTER_X + (Math.random() - 0.5) * CIRCLE_RADIUS * 2;
this.y = CENTER_Y - CIRCLE_RADIUS - Math.random() * 100;
this.emoji = EMOJIS[Math.floor(Math.random() * EMOJIS.length)];
this.speed = Math.random() * 3 + 1;
this.trail = [];
}
draw() {
// Проверяем, находится ли капля в круге
const distance = Math.sqrt(Math.pow(this.x - CENTER_X, 2) + Math.pow(this.y - CENTER_Y, 2));
if (distance <= CIRCLE_RADIUS) {
// Рисуем след
this.trail.forEach((segment, index) => {
ctx.save();
ctx.globalAlpha = segment.opacity;
ctx.fillStyle = '#0f0';
ctx.font = `${FONT_SIZE}px monospace`;
ctx.fillText(segment.emoji, this.x - FONT_SIZE/2, segment.y);
ctx.restore();
});
// Рисуем основную каплю
ctx.save();
ctx.shadowBlur = 10;
ctx.shadowColor = '#0f0';
ctx.fillStyle = '#0f0';
ctx.font = `${FONT_SIZE}px monospace`;
ctx.fillText(this.emoji, this.x - FONT_SIZE/2, this.y);
ctx.restore();
}
}
}
// Создаем капли
const drops = [];
const dropCount = 50;
for (let i = 0; i < dropCount; i++) {
const x = CENTER_X + (Math.random() - 0.5) * CIRCLE_RADIUS * 2;
const y = CENTER_Y - CIRCLE_RADIUS + Math.random() * CIRCLE_RADIUS * 2;
drops.push(new Drop(x, y));
}
// Анимация
function animate() {
// Очищаем canvas с эффектом затухания
ctx.fillStyle = 'rgba(0, 0, 0, 0.1)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Рисуем маску круга
ctx.save();
ctx.beginPath();
ctx.arc(CENTER_X, CENTER_Y, CIRCLE_RADIUS, 0, Math.PI * 2);
ctx.clip();
// Обновляем и рисуем капли
drops.forEach(drop => {
drop.update();
drop.draw();
});
ctx.restore();
requestAnimationFrame(animate);
}
// Обработка изменения размера окна
window.addEventListener('resize', () => {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
});
// Запускаем анимацию
animate();
</script>
</body>
</html>