UNPKG

bloodspatter-js

Version:

Blood effects library for web applications - realistic blood cells, drips, reveals, and animations

305 lines (264 loc) 6.98 kB
/* ================================ BLOODSPATTER.JS LIBRARY v1.0 ================================ */ /* BLOOD CELL EFFECTS */ .blood-cell { position: absolute; border-radius: 50%; z-index: 1; pointer-events: none; } .blood-cell-1 { width: 20px; height: 20px; background: radial-gradient(ellipse 6px 6px at center, #450000 0%, #650000 30%, transparent 45%), radial-gradient(ellipse 4px 4px at 40% 40%, rgba(0, 0, 0, 0.5) 25%, transparent 40%), radial-gradient(ellipse at center, #DC143C 25%, #B22222 45%, #8B0000 70%, #654321 100%); box-shadow: inset 0px 0px 6px rgba(0, 0, 0, 0.6), inset -3px -3px 6px rgba(0, 0, 0, 0.4), inset 2px 2px 4px rgba(220, 20, 60, 0.3), 2px 2px 8px rgba(139, 0, 0, 0.4); } .blood-cell-2 { width: 16px; height: 16px; background: radial-gradient(ellipse 4px 4px at center, #350000 0%, #550000 35%, transparent 50%), radial-gradient(ellipse 3px 3px at 45% 35%, rgba(0, 0, 0, 0.4) 20%, transparent 35%), radial-gradient(ellipse at center, #B22222 20%, #DC143C 40%, #8B0000 65%, #654321 100%); box-shadow: inset 0px 0px 5px rgba(0, 0, 0, 0.6), inset -2px -2px 4px rgba(0, 0, 0, 0.5), inset 1px 1px 3px rgba(220, 20, 60, 0.4), 1px 1px 6px rgba(139, 0, 0, 0.3); } .blood-cell-3 { width: 24px; height: 24px; background: radial-gradient(ellipse 7px 7px at center, #400000 0%, #600000 25%, transparent 40%), radial-gradient(ellipse 5px 5px at 35% 35%, rgba(0, 0, 0, 0.4) 30%, transparent 45%), radial-gradient(ellipse at center, #DC143C 30%, #B22222 50%, #8B0000 75%, #654321 100%); box-shadow: inset 0px 0px 7px rgba(0, 0, 0, 0.6), inset -4px -4px 6px rgba(0, 0, 0, 0.4), inset 3px 3px 5px rgba(220, 20, 60, 0.2), 3px 3px 10px rgba(139, 0, 0, 0.5); } .blood-cell-4 { width: 18px; height: 18px; background: radial-gradient(ellipse 5px 5px at center, #300000 0%, #500000 30%, transparent 45%), radial-gradient(ellipse 3px 3px at 50% 35%, rgba(0, 0, 0, 0.4) 25%, transparent 40%), radial-gradient(ellipse at center, #B22222 25%, #DC143C 45%, #8B0000 70%, #5A1A1A 100%); box-shadow: inset 0px 0px 5px rgba(0, 0, 0, 0.6), inset -2px -2px 5px rgba(0, 0, 0, 0.5), inset 2px 2px 4px rgba(220, 20, 60, 0.3), 2px 2px 7px rgba(139, 0, 0, 0.4); } /* BLOOD CELL ANIMATIONS - NOW MOVING DOWNWARD */ @keyframes bloodCellFloat { 0% { opacity: 0; transform: translateY(-30px) scale(0.5) rotate(0deg); } 20% { opacity: 0.9; transform: translateY(0px) scale(1) rotate(45deg); } 80% { opacity: 0.9; transform: translateY(80px) scale(1) rotate(270deg); } 100% { opacity: 0; transform: translateY(120px) scale(0.8) rotate(360deg); } } .blood-cell-animated { animation: bloodCellFloat 4s ease-in-out infinite; } /* BLOOD DRIP EFFECTS */ .blood-drip { position: absolute; width: 4px; height: 8px; background: linear-gradient(to bottom, #DC143C, #8B0000); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; pointer-events: none; z-index: 100; } @keyframes bloodDrip { 0% { transform: translateY(-20px) scale(0.3); opacity: 0; } 20% { opacity: 1; transform: translateY(0px) scale(1); } 100% { transform: translateY(200px) scale(0.8); opacity: 0; } } .blood-drip-animated { animation: bloodDrip 3s ease-in forwards; } /* BLOOD SMEAR HOVER EFFECT */ .blood-smear-hover { position: relative; transition: all 0.3s ease; } .blood-smear-hover::before { content: ''; position: absolute; top: 50%; left: 10px; width: 0; height: 6px; background: linear-gradient(90deg, #DC143C, #8B0000, transparent); transform: translateY(-50%) skew(-15deg); transition: width 0.8s ease-out; z-index: 1; pointer-events: none; } .blood-smear-hover:hover::before { width: 70%; } /* BLOOD REVEAL EFFECT WITH REAL TYPING */ .blood-reveal { position: relative; overflow: hidden; } .blood-reveal-text { color: #DC143C; position: relative; z-index: 2; } .blood-reveal-text.typing { color: #DC143C; text-shadow: 0 0 10px rgba(220, 20, 60, 0.5); } .blood-reveal-text.revealed { color: #DC143C; text-shadow: 0 0 10px rgba(220, 20, 60, 0.5); } /* Typing cursor effect */ .blood-reveal-text.typing::after { content: '|'; animation: blink 1s infinite; color: #DC143C; } @keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } } .blood-reveal::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(220, 20, 60, 0.3), transparent); z-index: 1; } .blood-reveal.scanning::before { animation: bloodScan 1.5s ease-out forwards; } @keyframes bloodScan { 0% { left: -100%; } 100% { left: 100%; } } /* CHAT MESSAGE BLOOD EFFECTS - FLOWING DOWNWARD */ .chat-blood-background { position: relative; overflow: hidden; } .chat-blood-background::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-image: radial-gradient(ellipse 3px 5px at 25% 25%, #8B0000 60%, transparent 70%), radial-gradient(ellipse 2px 4px at 75% 15%, #DC143C 60%, transparent 70%), radial-gradient(ellipse 4px 6px at 60% 75%, #B22222 60%, transparent 70%), radial-gradient(ellipse 2px 3px at 20% 85%, #8B0000 60%, transparent 70%), radial-gradient(ellipse 3px 5px at 85% 65%, #DC143C 60%, transparent 70%); background-size: 80px 80px, 60px 60px, 100px 100px, 70px 70px, 90px 90px; animation: bloodFlowDownAndFade 4s ease-out forwards; z-index: 1; pointer-events: none; } @keyframes bloodFlowDownAndFade { 0% { opacity: 0; transform: translateY(-20px); } 30% { opacity: 0.8; transform: translateY(0px); } 70% { opacity: 0.6; transform: translateY(30px); } 100% { opacity: 0; transform: translateY(60px); } } /* BLOOD SPATTER BACKGROUNDS - MOVING DOWNWARD */ .blood-spatter-moving { position: relative; } .blood-spatter-moving::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-image: radial-gradient(ellipse 4px 6px at 20% 30%, #8B0000 60%, transparent 70%), radial-gradient(ellipse 3px 5px at 80% 10%, #DC143C 60%, transparent 70%), radial-gradient(ellipse 5px 7px at 60% 80%, #B22222 60%, transparent 70%), radial-gradient(ellipse 2px 4px at 30% 60%, #8B0000 60%, transparent 70%), radial-gradient(ellipse 4px 6px at 90% 40%, #DC143C 60%, transparent 70%); background-size: 120px 120px, 100px 100px, 140px 140px, 80px 80px, 110px 110px; animation: bloodFlowDown 8s linear infinite; z-index: 1; pointer-events: none; } @keyframes bloodFlowDown { 0% { opacity: 0.7; transform: translateY(-100px); } 50% { opacity: 0.8; transform: translateY(0px); } 100% { opacity: 0.3; transform: translateY(100px); } }