-
Notifications
You must be signed in to change notification settings - Fork 0
/
Valentine.html
203 lines (203 loc) · 8.97 KB
/
Valentine.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
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
<!-- @format -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Valentine</title>
<style>
body {
display: flex;
justify-content: space-around;
margin: 4vmin;
}
.question {
outline: 1vmin double pink;
padding: 2vmin;
border-radius: 8vmin;
font-size: 4vmin;
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
text-align: center;
}
.question > * {
display: flex;
justify-content: space-around;
}
.answer {
display: none;
display: inline-flex;
padding: 2vmin;
border-radius: 10vmin;
border: 1px solid white;
font-size: inherit;
transition: all 0.1s ease-in-out;
justify-content: center;
margin: 2vmin;
}
.answer:hover {
outline: 1vmin dotted pink;
}
.yes {
background-color: pink;
}
.yes:hover {
background-image: radial-gradient(red, pink, white, pink, red);
transition: all 0.1s ease-in-out;
}
.no {
background-color: red;
}
.no:hover {
background-color: transparent;
background-image: linear-gradient(transparent, red, transparent);
margin-top: 10%;
transition: all 0.1s ease-out;
}
img {
height: 50vmin;
}
#hidden-resources {
display: none;
}
</style>
<script>
const valentineGame = {
noCount: -1,
yes() {
const { yes, no, icon, question, icons, music } = this.dom
question.textContent = '❤️ YAY ❤️'
const answer = yes.parentNode
answer.replaceChildren(`You said no ${this.noCount} times before saying yes XD`)
answer.style.padding = '0 2vmin'
this.noCount = 0
music.yippee.play()
let imageIndex = 0
const imgs = [
icons.flusteredPunch,
icons.satisfiedDance,
icons.loveHug,
icons.blowingKissesAttack,
icons.hugAttack,
]
const nextImage = async () => {
this.dom.icon.replaceChildren(
imgs[imageIndex++] ?? //
imgs[(imageIndex = 0)]
)
setTimeout(nextImage, 4000)
}
nextImage()
if (music.wiiSports.paused) {
music.wiiSports.currentTime = 0
music.wiiSports.volume = 0.5
music.wiiSports.loop = true
music.wiiSports.play()
music.wiiShopping.pause()
}
},
no() {
const { yes, no, icon, question, icons, music } = this.dom
question.textContent = '❤️ Will you be my Valentine? ❤️'
yes.style.padding = `2vmin ${2 + this.noCount}vmin 2vmin`
const imgProgression = [
icons.flusteredOnPhone,
icons.confidentPlease,
icons.flusteredTipToe,
icons.handHoldPlease,
icons.blowingKissesAttack,
icons.disgustedConfused,
icons.angryLookAway,
icons.consolationHeadPat,
]
const prevImg = icon.querySelector('img')
const newImg = imgProgression[this.noCount++ / 3] ?? prevImg
if (prevImg != newImg) {
icon.replaceChildren(newImg)
;(newImg === imgProgression.at(-1) //
? music.hkCaterpillar
: music.oof
).play()
}
if (music.wiiShopping.paused) {
music.wiiShopping.currentTime = 0
music.wiiShopping.volume = 0.2
music.wiiShopping.loop = true
music.wiiShopping.play()
music.wiiSports.pause()
}
},
// prettier-ignore
dom: {
get icon () { return this.querySelector('.icon') },
get yes () { return this.querySelector('.yes ') },
get no () { return this.querySelector('.no ') },
get question () { return this.querySelector('h1 ') },
/**@returns {HTMLElement} @param {string} selector*/
querySelector(selector) { return document.querySelector(`.question ${selector.trim()}`) },
icons: {
get flusteredOnPhone () { return this.querySelector('flustered-on-phone ') },
get flusteredTipToe () { return this.querySelector('flustered-tip-toe ') },
get loveHug () { return this.querySelector('love-hug ') },
get blowingKissesAttack () { return this.querySelector('blowing-kisses-attack') },
get hugAttack () { return this.querySelector('hug-attack ') },
get consolationHeadPat () { return this.querySelector('consolation-head-pat ') },
get handHoldPlease () { return this.querySelector('hand-hold-please ') },
get flusteredPunch () { return this.querySelector('flustered-punch ') },
get satisfiedDance () { return this.querySelector('satisfied-dance ') },
get disgustedConfused () { return this.querySelector('disgusted-confused ') },
get confidentPlease () { return this.querySelector('confident-please ') },
get angryLookAway () { return this.querySelector('angry-look-away ') },
/**@returns {HTMLImgElement} @param {string} name*/
querySelector(name) { return document.querySelector(`#hidden-resources img.${name.trim()}`).cloneNode(false) },
},
music: {
get wiiShopping () { return this.querySelector('wii-shopping ') },
get wiiSports () { return this.querySelector('wii-sports ') },
get yippee () { return this.querySelector('yippee ') },
get oof () { return this.querySelector('oof ') },
get hkCaterpillar () { return this.querySelector('hk-caterpillar') },
/**@returns {HTMLAudioElement} @param {string} name*/
querySelector(name) { return document.querySelector(`#hidden-resources audio.${name.trim()}`) },
},
},
}
document.addEventListener('DOMContentLoaded', onDOMContentLoaded, { once: true })
function onDOMContentLoaded() {
valentineGame.dom.icon.replaceChildren(valentineGame.dom.icons.confidentPlease)
valentineGame.dom.yes.addEventListener('click', event => valentineGame.yes())
valentineGame.dom.no.addEventListener('click', event => valentineGame.no())
valentineGame.dom.no.click()
}
</script>
</head>
<body>
<main class="question">
<h1>❤️ Will you be my Valentine? ❤️</h1>
<div class="icon"></div>
<span>
<button type="button" class="answer yes">💞 Yes 💘</button>
<button type="button" class="answer no">💔 No ❤️🩹</button>
</span>
<!-- prettier-ignore -->
<div id="hidden-resources">
<img class="flustered-on-phone" alt="flustered-on-phone" src="https://media.tenor.com/PVJev3UoMzMAAAAi/uwu.gif"/>
<img class="flustered-tip-toe" alt="flustered-tip-toe" src="https://media.tenor.com/hpgCwxnBaK8AAAAi/milk-and-mocha.gif"/>
<img class="love-hug" alt="love-hug" src="https://media.tenor.com/kgZnQRqOZqkAAAAi/milk-and-mocha.gif"/>
<img class="blowing-kisses-attack" alt="blowing-kisses-attack" src="https://media.tenor.com/o2iDlb2KAtIAAAAi/milk-mocha-bear-kisses.gif"/>
<img class="hug-attack" alt="hug-attack" src="https://media.tenor.com/ICmg8MUfSg8AAAAi/milk-and-mocha.gif"/>
<img class="consolation-head-pat" alt="consolation-head-pat" src="https://media.tenor.com/hTFz1CU9ljcAAAAi/milk-and-mocha.gif"/>
<img class="hand-hold-please" alt="hand-hold-please" src="https://media.tenor.com/w8yxWaatwLIAAAAi/milk-and-mocha.gif"/>
<img class="flustered-punch" alt="flustered-punch" src="https://media.tenor.com/1CCNmtTzaSsAAAAi/milk-and-mocha.gif"/>
<img class="satisfied-dance" alt="satisfied-dance" src="https://media.tenor.com/O-tKN4NYQOsAAAAi/milk-mocha-dance.gif"/>
<img class="disgusted-confused" alt="disgusted-confused" src="https://media.tenor.com/KJ-ArgsmXwgAAAAi/milk-mocha-confused-milk-mocha-bear.gif"/>
<img class="confident-please" alt="confident-please" src="https://media.tenor.com/Idr_-NLOu8oAAAAi/milk-and-mocha.gif"/>
<img class="angry-look-away" alt="angry-look-away" src="https://media.tenor.com/qF1cFP9WVN8AAAAi/milk-and-mocha-mad.gif"/>
<audio class="wii-shopping" alt="wii-shopping" src="https://dl.vgmdownloads.com/soundtracks/wii-music-collection/mqwcxcbzcc/07.%20Shop%20Channel.mp3"></audio>
<audio class="wii-sports" alt="wii-sports" src="https://dl.vgmdownloads.com/soundtracks/wii-music-collection/ganfxgskdk/08.%20Title%20%28Wii%20Sports%29.mp3"></audio>
<audio class="yippee" alt="yippee" src="https://www.myinstants.com/media/sounds/yippee-meme-sound-effect.mp3"></audio>
<audio class="oof" alt="oof" src="https://www.myinstants.com/media/sounds/roblox-death-sound_1.mp3"></audio>
<audio class="hk-caterpillar" alt="hk-caterpillar" src="https://www.myinstants.com/media/sounds/caterpillar_hollow_knight.mp3"></audio>
</div>
</main>
</body>
</html>