-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
165 lines (151 loc) · 6.83 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<title>✨💕</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/confetti.browser.min.js"></script>
<script>
let activeIndex = 0;
function onClickJa() {
// play sound party.mp3
const audio = new Audio("party.mp3");
audio.play();
const imageElement = document.getElementById("image");
imageElement.src =
"https://media1.giphy.com/media/v1.Y2lkPTc5MGI3NjExYjYxaHVraTdlZ3BsbzlwZXhxOWRycDZlbHU3b2FvYTJxdjlnaHJpNyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/H9qZamvBs10zByg4xb/giphy.gif";
const bodyElement = document.querySelector("body");
bodyElement.style.backgroundImage =
"url('https://media1.giphy.com/media/v1.Y2lkPTc5MGI3NjExdDhtaHRld2E2cTFxaHZmMWhlZXE5Nm5hd3FqeGs3cTAybGR2MmZvZCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/5xtDarobRW68tNCgjUA/giphy.gif')";
const headlineElement = document.querySelector("h1");
headlineElement.innerText = "Yuhuuuuu!!!";
const yesButton = document.getElementById("yesButton");
const noButton = document.getElementById("noButton");
const calButton = document.getElementById("calButton");
yesButton.style.display = "none";
noButton.style.display = "none";
calButton.style.display = "block";
const textElement = document.getElementById("text");
textElement.innerText = "🩷❤️🧡💛💚🩵💙💜🖤🩶🤍🤎";
const duration = 1200 * 1000;
const animationEnd = Date.now() + duration;
const defaults = {
startVelocity: 30,
spread: 360,
ticks: 60,
zIndex: 0,
};
function randomInRange(min, max) {
return Math.random() * (max - min) + min;
}
const interval = setInterval(function () {
let timeLeft = animationEnd - Date.now();
if (timeLeft <= 0) {
return clearInterval(interval);
}
var particleCount = 50 * (timeLeft / duration);
// since particles fall down, start a bit higher than random
confetti({
...defaults,
particleCount,
origin: { x: randomInRange(0.1, 0.3), y: Math.random() - 0.2 },
});
confetti({
...defaults,
particleCount,
origin: { x: randomInRange(0.7, 0.9), y: Math.random() - 0.2 },
});
}, 250);
}
function onClickNein() {
// play error.mp3
const audio = new Audio("error.mp3");
audio.play();
// get p with id text element
const textElement = document.getElementById("text");
const imageElement = document.getElementById("image");
// change text
const messages = [
"Bist du dir wirklich sicher? 👀",
"Ich denke du hast dich verklickt! 🙈",
"Whoopsie das war der falsche Button! 🫨",
"Mimi, der Grüne ist der richtige! ✅",
"🥲 Probiers nochmal!",
"Ich geh' nicht alleine Essen 🧑🏼🍳!",
];
const gifs = [
"https://media1.giphy.com/media/v1.Y2lkPTc5MGI3NjExNzhvanJic3NoNmQwc3NmeG4wMWdwaXNpZ3pyY2toczR6aXl5Y3NxMyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/7SF5scGB2AFrgsXP63/giphy.gif",
"https://media3.giphy.com/media/v1.Y2lkPTc5MGI3NjExbXFzaHoyemRuN2N3N2xzN2ZmY2lva2N1NTVnaWVxNTJpOWpoYmZ4ZCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/OPU6wzx8JrHna/giphy.gif",
"https://media4.giphy.com/media/v1.Y2lkPTc5MGI3NjExYzgxMmUwNWg0MHB5ajFqMjZraDJyaGtobDgyNTA5eGMzdDZ3bWhkOCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/yoJC2Olx0ekMy2nX7W/giphy.gif",
"https://media2.giphy.com/media/v1.Y2lkPTc5MGI3NjExY2V2Ym1ucDBsdmM2eW1peWlrY2lmcTFpZ2xxcW94MW5mMmt0Y3lzdSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/gfsQffBnuc6e096brx/giphy.gif",
"https://media1.giphy.com/media/v1.Y2lkPTc5MGI3NjExM3NpbWVtd3JicDVhc3I3eWhoYWZhaW43OXcwNTY2YzVjZGpiYm1yOSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/ePbtplyRUqBCdKwd43/giphy.gif",
"https://media0.giphy.com/media/v1.Y2lkPTc5MGI3NjExeGN4Z3AzdGl1eDc0dXNmNGRzNHA3Y3AxbnN1OTVhdjRkM2l6OHZrMCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/l1J9DFe9gXjjZGYMg/giphy.gif",
];
// switch though messages and gifs per click
textElement.innerText = messages[activeIndex];
imageElement.src = gifs[activeIndex];
activeIndex = activeIndex + 1 >= messages.length ? 0 : activeIndex + 1;
const yesButton = document.getElementById("yesButton");
//increase size per call by 40%
yesButton.style.width = yesButton.offsetWidth * 1.3 + "px";
yesButton.style.height = yesButton.offsetHeight * 1.3 + "px";
yesButton.style.fontSize = yesButton.offsetHeight * 0.6 + "px";
}
</script>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Protest+Riot&display=swap"
rel="stylesheet"
/>
</head>
<body style="display: flex; flex-direction: column; align-items: center">
<h1
class="text-4xl font-bold mt-4"
style="font-family: 'Protest Riot'; text-align: center"
>
Willst du meine Valentina sein?
</h1>
<img
id="image"
class="rounded-lg shadow-lg mt-4 mb-4"
src="https://media2.giphy.com/media/v1.Y2lkPTc5MGI3NjExc2VkZXJpYXNqbGl0cGM1dTN2bGY3amk4MDNqYXR6eDRiY25pMjMzciZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/3oriO6qJiXajN0TyDu/giphy.gif"
width="400"
height="400"
style="
object-fit: fill;
object-position: 50% 50%;
width: 400px;
height: 400px;
"
/>
<p class="mb-4" id="text" />
<div style="display: flex; flex-direction: column; justify-content:
space-between;"">
<button
id="yesButton"
onclick="onClickJa()"
style="width: 150px; height: 50px"
class="bg-green-500 hover:bg-green-400 text-white font-bold py-2 px-4 border-b-4 border-green-700 hover:border-green-500 rounded mb-2"
>
Ja 🚀
</button>
<button
id="noButton"
onclick="onClickNein()"
style="width: 150px; height: 50px"
class="center bg-red-500 hover:bg-red-400 text-white font-bold py-2 px-4 border-b-4 border-red-700 hover:border-red-500 rounded mt-2"
>
Nein 😢
</button>
<button
id="calButton"
onclick="window.open('event.ics', '_blank')"
style="width: 400px; height: 50px; display: none"
class="bg-pink-500 hover:bg-pink-400 text-white font-bold py-2 px-4 border-b-4 border-pink-700 hover:border-pink-500 rounded ml-2"
>
Save the Date 🗓️
</button>
</body>
</html>