A simple 404 page in html , css ans js featuring a hacker animation theme
A Pen by Panagiotis Kotsorgios on CodePen.
A simple 404 page in html , css ans js featuring a hacker animation theme
A Pen by Panagiotis Kotsorgios on CodePen.
<canvas id="matrix-canvas"></canvas> | |
<div class="container"> | |
<div class="header"> | |
<div class="error-code">404</div> | |
<h1 class="error-title">Page Not Found</h1> | |
</div> | |
</div> |
// Matrix rain effect | |
const canvas = document.getElementById("matrix-canvas"); | |
const ctx = canvas.getContext("2d"); | |
// Set canvas to full window size | |
canvas.width = window.innerWidth; | |
canvas.height = window.innerHeight; | |
// Characters for the rain | |
const chars = | |
"アァカサタナハマヤャラワガザダバパイィキシチニヒミリヰギジヂビピウゥクスツヌフムユュルグズブヅプエェケセテネヘメレヱゲゼデベペオォコソトノホモヨョロヲゴゾドボポヴッン0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$#@%&*"; | |
const charArray = chars.split(""); | |
const fontSize = 14; | |
const columns = canvas.width / fontSize; | |
// Create drops for each column | |
const drops = []; | |
for (let i = 0; i < columns; i++) { | |
drops[i] = Math.floor((Math.random() * canvas.height) / fontSize); | |
} | |
// Draw function | |
function drawMatrix() { | |
// Semi-transparent black to create trail effect | |
ctx.fillStyle = "rgba(0, 0, 0, 0.05)"; | |
ctx.fillRect(0, 0, canvas.width, canvas.height); | |
ctx.fillStyle = "#00ff41"; | |
ctx.font = fontSize + "px monospace"; | |
for (let i = 0; i < drops.length; i++) { | |
const text = charArray[Math.floor(Math.random() * charArray.length)]; | |
ctx.fillText(text, i * fontSize, drops[i] * fontSize); | |
// Reset drop if it reaches bottom, with random chance | |
if (drops[i] * fontSize > canvas.height && Math.random() > 0.975) { | |
drops[i] = 0; | |
} | |
drops[i]++; | |
} | |
} | |
// Animation loop | |
function animate() { | |
drawMatrix(); | |
requestAnimationFrame(animate); | |
} | |
// Start animation | |
animate(); | |
// Resize canvas when window resizes | |
window.addEventListener("resize", function () { | |
canvas.width = window.innerWidth; | |
canvas.height = window.innerHeight; | |
}); | |
// Terminal typing effect for last line | |
let commandIndex = 0; | |
const commandText = "initiate_recovery_protocol"; | |
const promptElement = document.querySelector(".command"); | |
function typeCommand() { | |
if (commandIndex < commandText.length) { | |
promptElement.textContent += commandText.charAt(commandIndex); | |
commandIndex++; | |
setTimeout(typeCommand, 100); | |
} | |
} | |
// Start typing after a delay | |
setTimeout(typeCommand, 3000); | |
// Button hover effects | |
const buttons = document.querySelectorAll(".btn"); | |
buttons.forEach((button) => { | |
button.addEventListener("mouseover", () => { | |
button.style.boxShadow = "0 0 15px rgba(0, 255, 65, 0.8)"; | |
}); | |
button.addEventListener("mouseout", () => { | |
button.style.boxShadow = "none"; | |
}); | |
}); |
<style> | |
* { | |
margin: 0; | |
padding: 0; | |
box-sizing: border-box; | |
} | |
body { | |
background: #0a0a0a; | |
color: #00ff41; | |
font-family: 'Courier New', monospace; | |
overflow: hidden; | |
height: 100vh; | |
position: relative; | |
line-height: 1.4; | |
} | |
#matrix-canvas { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
z-index: 0; | |
opacity: 0.3; | |
} | |
.container { | |
position: relative; | |
z-index: 10; | |
max-width: 800px; | |
margin: 0 auto; | |
padding: 2rem; | |
min-height: 100vh; | |
display: flex; | |
flex-direction: column; | |
justify-content: center; | |
} | |
.header { | |
text-align: center; | |
margin-bottom: 2rem; | |
animation: glitch 1s infinite; | |
position: relative; | |
} | |
.error-code { | |
font-size: 10rem; | |
font-weight: bold; | |
color: #ff003c; | |
text-shadow: 0 0 10px #ff003c, 0 0 20px #ff003c; | |
margin-bottom: -1rem; | |
letter-spacing: -8px; | |
} | |
.error-title { | |
font-size: 2.5rem; | |
text-transform: uppercase; | |
letter-spacing: 4px; | |
margin-bottom: 1rem; | |
color: #00eeff; | |
} | |
.terminal { | |
background: rgba(0, 20, 10, 0.8); | |
border: 2px solid #00ff41; | |
border-radius: 4px; | |
padding: 1.5rem; | |
box-shadow: 0 0 15px rgba(0, 255, 65, 0.3); | |
margin-bottom: 2rem; | |
position: relative; | |
overflow: hidden; | |
} | |
.terminal::before { | |
content: ""; | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
background: linear-gradient(transparent 50%, rgba(0, 255, 65, 0.05) 50%); | |
background-size: 100% 4px; | |
z-index: -1; | |
} | |
.terminal-header { | |
display: flex; | |
justify-content: space-between; | |
margin-bottom: 1rem; | |
border-bottom: 1px solid #008f11; | |
padding-bottom: 0.5rem; | |
font-size: 0.9rem; | |
} | |
.terminal-body { | |
font-size: 1.1rem; | |
line-height: 1.6; | |
} | |
.prompt { | |
color: #00eeff; | |
} | |
.command { | |
color: #ff00c8; | |
} | |
.output { | |
margin: 1rem 0; | |
padding-left: 1rem; | |
border-left: 2px solid #008f11; | |
} | |
.blink { | |
animation: blink 1s infinite; | |
} | |
.scan-line { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 4px; | |
background: rgba(0, 255, 65, 0.5); | |
box-shadow: 0 0 10px 2px rgba(0, 255, 65, 0.8); | |
animation: scan 5s linear infinite; | |
z-index: 1; | |
} | |
.actions { | |
display: flex; | |
justify-content: center; | |
gap: 1rem; | |
flex-wrap: wrap; | |
} | |
.btn { | |
background: transparent; | |
color: #00ff41; | |
border: 1px solid #00ff41; | |
padding: 0.8rem 1.5rem; | |
font-family: 'Courier New', monospace; | |
text-transform: uppercase; | |
letter-spacing: 2px; | |
cursor: pointer; | |
transition: all 0.3s ease; | |
position: relative; | |
overflow: hidden; | |
font-size: 0.9rem; | |
} | |
.btn:hover { | |
background: rgba(0, 255, 65, 0.2); | |
box-shadow: 0 0 10px rgba(0, 255, 65, 0.5); | |
transform: translateY(-2px); | |
} | |
.btn::before { | |
content: ""; | |
position: absolute; | |
top: 0; | |
left: -100%; | |
width: 100%; | |
height: 100%; | |
background: linear-gradient(90deg, transparent, rgba(0, 255, 65, 0.4), transparent); | |
transition: 0.5s; | |
} | |
.btn:hover::before { | |
left: 100%; | |
} | |
.footer { | |
text-align: center; | |
margin-top: 2rem; | |
font-size: 0.9rem; | |
color: #008f11; | |
} | |
@keyframes blink { | |
0%, 100% { opacity: 1; } | |
50% { opacity: 0; } | |
} | |
@keyframes scan { | |
0% { top: 0; } | |
100% { top: 100%; } | |
} | |
@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); } | |
} | |
.access-denied { | |
color: #ff003c; | |
text-shadow: 0 0 5px #ff003c; | |
animation: deny-pulse 1.5s infinite; | |
} | |
@keyframes deny-pulse { | |
0%, 100% { opacity: 0.8; } | |
50% { opacity: 0.4; } | |
} | |
/* Responsive design */ | |
@media (max-width: 768px) { | |
.error-code { font-size: 8rem; } | |
.terminal-body { font-size: 0.95rem; } | |
.container { padding: 1rem; } | |
} | |
@media (max-width: 480px) { | |
.error-code { font-size: 6rem; } | |
.error-title { font-size: 1.8rem; } | |
.btn { padding: 0.6rem 1rem; font-size: 0.8rem; } | |
} | |
</style> |