38女神节祝福代码
可以直接复制到控制台使用
(() => { const style = document.createElement('style'); style.textContent = ` .falling-item { position: fixed;font-size: 24px; animation: fall linear infinite;user-select: none; z-index:999;white-space: nowrap;top: -50px; } @keyframes fall { 0% { transform: translateY(0) rotate(0deg); } 100% { transform: translateY(110vh) rotate(360deg); } } `; document.head.appendChild(style); const items = [ { text: '🌸', weight: 20, type: 'emoji' }, { text: '💻', weight: 3, type: 'emoji' }, { text: '🩷', weight: 5, type: 'emoji' }, { text: '女神节快乐!', weight: 2, type: 'text' }, { text: '打破刻板印象', weight: 2, type: 'text' }, { text: '出色的程序媛', weight: 2, type: 'text' }, ]; const warmColors = ['#FF6F61', '#FFA07A', '#FFD700', '#FF69B4', '#FF4500', '#FF8C00', '#FF6347', '#FFA500']; function getRandomItem() { const totalWeight = items.reduce((sum, item) => sum + item.weight, 0); let random = Math.random() * totalWeight; for (const item of items) { if (random < item.weight) return item; random -= item.weight; } } function getRandomWarmColor() { return warmColors[Math.floor(Math.random() * warmColors.length)]; } function createFallingItems() { const numItems = 100; for (let i = 0; i < numItems; i++) { const item = document.createElement('div'); item.className = 'falling-item'; const selectedItem = getRandomItem(); item.textContent = selectedItem.text; if (selectedItem.type === 'text') { item.style.color = getRandomWarmColor(); } item.style.left = `${Math.random() * 100}vw`; item.style.animationDuration = `${Math.random() * 5 + 5}s`; item.style.animationDelay = `${Math.random() * 5}s`; item.style.fontSize = `${Math.random() * 20 + 16}px`; item.style.opacity = Math.random() * 0.8 + 0.3; document.body.appendChild(item); } } function consoleMessage() { const styles = [ 'color: #ff69b4', 'font-size: 18px', 'font-weight: bold', 'font-family: Arial, sans-serif', 'text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1)', 'padding: 10px', 'border-radius: 5px', 'background: linear-gradient(90deg, #ff9a9e, #fad0c4)', 'display: inline-block' ].join(';'); const message = `🌸 祝所有出色的女性程序员妇女节快乐! 🌸 不断打破障碍,编写出色的代码,激励世界! 💻✨ 你们是现实生活中科技世界的超级英雄! 💪👩💻`; console.log(`%c${message}`, styles); } createFallingItems(); consoleMessage(); })();

浙公网安备 33010602011771号