-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFinal.html
More file actions
235 lines (207 loc) ยท 5.7 KB
/
Final.html
File metadata and controls
235 lines (207 loc) ยท 5.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Be My Friend?</title>
<style>
body {
background-color: #fff3f3;
font-family: 'Comic Sans MS', cursive;
text-align: center;
padding-top: 100px;
overflow: hidden;
position: relative;
transition: background 1s ease;
}
h1 {
font-size: 2.5rem;
color: #ff4081;
}
button {
font-size: 1.5rem;
padding: 15px 30px;
margin: 10px;
border: none;
border-radius: 12px;
cursor: pointer;
transition: all 0.3s ease;
}
#yesBtn {
background-color: #4caf50;
color: white;
}
#noBtn {
background-color: #f44336;
color: white;
position: absolute;
}
#buttons {
margin-top: 50px;
}
.heart {
position: absolute;
font-size: 24px;
animation: floatUp 3s ease-out forwards;
pointer-events: none;
}
@keyframes floatUp {
0% {
opacity: 1;
transform: translateY(0);
}
100% {
opacity: 0;
transform: translateY(-200px) scale(1.5);
}
}
/* PAGE 2: Letter Section */
#page2 {
display: none;
opacity: 0;
transition: opacity 1s ease;
}
#message {
font-size: 2rem;
color: #009688;
margin-top: 40px;
}
#letterContainer {
position: relative;
margin: 50px auto;
width: 280px;
height: 180px;
perspective: 1000px;
}
.envelope {
position: absolute;
width: 100%;
height: 100%;
background: #fff;
border: 2px solid #ff4081;
border-radius: 10px;
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
transform-style: preserve-3d;
transition: transform 1s ease;
cursor: pointer;
}
.flap {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 50%;
background: #ff4081;
border-bottom: 2px solid #ff80ab;
transform-origin: top;
transition: transform 1s ease;
border-radius: 10px 10px 0 0;
}
.envelope.open .flap {
transform: rotateX(-180deg);
}
#letterText {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(0.1);
background-color: #fff;
border: 2px solid #ff4081;
border-radius: 10px;
padding: 20px;
width: 90%;
opacity: 0;
font-size: 1.1rem;
color: #444;
line-height: 1.5;
transition: all 1s ease;
}
.showLetter #letterText {
transform: translate(-50%, -50%) scale(1);
opacity: 1;
}
.hint {
color: #888;
font-size: 1rem;
margin-top: 10px;
}
</style>
</head>
<body>
<!-- PAGE 1 -->
<div id="page1">
<h1>Will you be my friend? ๐ฅบ</h1>
<div id="buttons">
<button id="yesBtn">Yes ๐</button>
<button id="noBtn">No ๐ข</button>
</div>
</div>
<!-- PAGE 2 -->
<div id="page2">
<div id="message">
Thanks!For Saying Yes! ๐ฅณ๐<br>
Tap the envelope below to open your message ๐
</div>
<div id="letterContainer">
<div class="envelope" id="envelope">
<div class="flap"></div>
<div id="letterText">
Hey Poonam ๐<br><br>
Just wanted to say youโre one of the sweetest, most fun people I know! ๐ธ
I'm really happy to call you my special person of my life๐
Hereโs to more smiles, laughter, and crazy little memories ahead โจ๐ซ
<br><br>โ From Kiran ๐
</div>
</div>
<div class="hint">Tap the envelope to open ๐</div>
</div>
</div>
<!-- Confetti Library -->
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.6.0/dist/confetti.browser.min.js"></script>
<script>
const noBtn = document.getElementById('noBtn');
const yesBtn = document.getElementById('yesBtn');
const page1 = document.getElementById('page1');
const page2 = document.getElementById('page2');
const envelope = document.getElementById('envelope');
function moveButtonRandomly() {
const maxX = window.innerWidth - noBtn.offsetWidth;
const maxY = window.innerHeight - noBtn.offsetHeight;
const x = Math.random() * maxX;
const y = Math.random() * maxY;
noBtn.style.left = `${x}px`;
noBtn.style.top = `${y}px`;
}
noBtn.addEventListener('mouseover', moveButtonRandomly);
noBtn.addEventListener('touchstart', (e) => {
e.preventDefault();
moveButtonRandomly();
});
// YES Button -> Transition to Page 2
yesBtn.addEventListener('click', () => {
// Hearts & confetti
confetti({ particleCount: 150, spread: 80, origin: { y: 0.6 } });
for (let i = 0; i < 15; i++) {
const heart = document.createElement("div");
heart.classList.add("heart");
heart.style.left = Math.random() * 100 + "vw";
heart.style.top = "80vh";
heart.textContent = "๐";
document.body.appendChild(heart);
setTimeout(() => heart.remove(), 3000);
}
// Transition
page1.style.opacity = "0";
setTimeout(() => {
page1.style.display = "none";
page2.style.display = "block";
setTimeout(() => (page2.style.opacity = "1"), 100);
}, 800);
});
// Open the letter
envelope.addEventListener('click', () => {
envelope.classList.toggle('open');
envelope.classList.toggle('showLetter');
});
</script>
</body>
</html>