Lovely Letter - HTML 5
Lovely Letter - HTML 5
DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Te amo, mi vida</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #000;
margin: 0;
font-family: 'Georgia', serif;
color: #333;
overflow: hidden;
background-image: radial-gradient(circle, #333 1px, transparent 1px);
background-size: 30px 30px;
}
.envelope {
position: relative;
width: 280px;
height: 180px;
background: #f5e9e2;
background-image: linear-gradient(to bottom right, #f9f2ed, #e8d6cb);
border-radius: 5px;
box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
cursor: pointer;
transition: transform 0.5s;
transform-style: preserve-3d;
margin: 50px auto;
}
.envelope:hover {
transform: translateY(-10px);
box-shadow: 0 10px 25px rgba(255, 255, 255, 0.5);
}
.envelope-front {
position: absolute;
width: 100%;
height: 100%;
background: #f5e9e2;
border-radius: 5px;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
z-index: 2;
overflow: hidden;
}
.envelope-flap {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
clip-path: polygon(0 0, 50% 30%, 100% 0, 100% 100%, 0 100%);
background: #ecdad0;
z-index: 1;
}
.envelope-heart {
position: absolute;
width: 40px;
height: 40px;
bottom: 20px;
right: 20px;
}
.tulip-container {
position: absolute;
width: 100px;
height: 140px;
z-index: 5;
left: 50%;
top: 40%;
transform: translate(-50%, -50%);
}
.para-evelyn {
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
font-family: 'Brush Script MT', cursive;
font-size: 1.5em;
color: #ff66a3;
}
.container {
position: relative;
width: 100%;
max-width: 500px;
background-color: #fff;
border-radius: 20px;
padding: 20px;
box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
overflow: hidden;
display: none;
transition: all 0.8s ease;
opacity: 0;
transform: scale(0.9);
}
.heart-container {
position: relative;
width: 100%;
height: 280px;
display: flex;
justify-content: center;
align-items: center;
margin-top: 20px;
overflow: visible;
}
.heart-outline {
position: relative;
width: 280px;
height: 280px;
margin: 0 auto;
}
.heart-outline svg {
width: 100%;
height: 100%;
}
.star {
animation: twinkle 2s infinite alternate;
}
@keyframes twinkle {
0% { opacity: 0.5; }
100% { opacity: 1; }
}
.love-message {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 80%;
text-align: center;
background-color: rgba(255, 255, 255, 0.7);
border-radius: 12px;
padding: 10px;
box-shadow: 0 0 15px rgba(255, 102, 163, 0.2);
}
.timer {
margin: 10px 0;
font-size: 1.2em;
color: #333;
}
.timer span {
font-weight: bold;
}
.love-title {
font-size: 1.2em;
margin-bottom: 10px;
color: #333;
font-family: 'Brush Script MT', cursive;
}
.love-you {
font-size: 1.5em;
font-weight: bold;
margin-top: 10px;
color: #333;
font-family: 'Brush Script MT', cursive;
animation: pulse 1.5s infinite;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.1); }
100% { transform: scale(1); }
}
.code-comments {
text-align: left;
padding: 15px;
background: #f9f9f9;
border-radius: 8px;
margin-top: 20px;
font-family: monospace;
color: #666;
white-space: pre-line;
box-shadow: 0 3px 10px rgba(0,0,0,0.1);
border-left: 4px solid #ff66a3;
}
.comment {
color: #888;
}
.code {
color: #000;
}
.function {
color: #0033cc;
}
.string {
color: #006600;
}
.open-instructions {
position: absolute;
bottom: -30px;
left: 0;
width: 100%;
text-align: center;
color: #fff;
font-size: 0.9em;
animation: bounce 2s infinite;
}
@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-5px); }
}
</style>
</head>
<body>
<div class="envelope" id="envelope">
<div class="envelope-front">
<div class="envelope-flap"></div>
<div class="tulip-container">
<svg viewBox="0 0 100 200" xmlns="http://www.w3.org/2000/svg">
<!-- Tallo del tulipán -->
<path d="M50,200 Q50,160 50,120" stroke="#008800" stroke-
width="3" fill="#006600"/>
<path d="M50,140 Q55,125 60,140" stroke="#008800" stroke-
width="2" fill="#006600"/>
<path d="M50,150 Q45,135 40,150" stroke="#008800" stroke-
width="2" fill="#006600"/>
<span class="function">mi_promesa_eterna()</span>
</div>
<div class="heart-container">
<div class="heart-outline">
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
<path d="M462.3 62.6C407.5 15.9 326 24.3 275.7 76.2L256 96.5l-
19.7-20.3C186.1 24.3 104.5 15.9 49.7 62.6c-62.8 53.6-66.1 149.8-9.9 207.9l193.5
199.8c12.5 12.9 32.8 12.9 45.3 0l193.5-199.8c56.3-58.1 53-154.3-9.8-207.9z"
fill="none" stroke="#ff66a3" stroke-width="10" id="heart-path"/>
</svg>
</div>
<div class="love-message">
<div class="love-title">Me enamoré de ti hace...</div>
<div class="timer">
<span id="days">364</span> días
<span id="hours">10</span> horas
<span id="minutes">07</span> minutos
<span id="seconds">04</span> segundos
</div>
<div class="love-you">Te Amo Evelyn!</div>
</div>
</div>
</div>
<script>
// Evento para abrir la carta
document.getElementById('envelope').addEventListener('click', function() {
this.style.transform = 'scale(0.1)';
this.style.opacity = '0';
setTimeout(function() {
document.getElementById('envelope').style.display = 'none';
document.getElementById('love-message').style.display = 'block';
setTimeout(function() {
document.getElementById('love-message').style.opacity = '1';
document.getElementById('love-message').style.transform =
'scale(1)';
}, 50);
}, 500);
});
function getRandomColor() {
const colors = ["#ff9999", "#ffcc99", "#ffff99", "#99ff99", "#99ffff",
"#9999ff", "#ff99ff", "#ff6b6b", "#ffd56b", "#d4fb79", "#ff85a1", "#fbb1bd",
"#c5adff"];
return colors[Math.floor(Math.random() * colors.length)];
}
document.getElementById("days").textContent = days;
document.getElementById("hours").textContent =
hours.toString().padStart(2, '0');
document.getElementById("minutes").textContent =
minutes.toString().padStart(2, '0');
document.getElementById("seconds").textContent =
seconds.toString().padStart(2, '0');
}