-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
454 lines (439 loc) · 12.1 KB
/
index.html
File metadata and controls
454 lines (439 loc) · 12.1 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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width,initial-scale=1,shrink-to-fit=no"
/>
<style id="webmakerstyle">
:root {
--unit: 100px;
}
* {
box-sizing: border-box;
}
*:focus {
outline-offset: 3px;
outline-color: black;
outline-width: 5px;
outline-style: dashed;
}
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
font-size: 200%;
line-height: 1.4;
max-width: 100vw;
overflow-x: hidden;
margin: 0;
min-height: 100vh;
/* background: linear-gradient(
180deg,
skyblue 0%,
skyblue 82%,
white 100%
); */
background: linear-gradient(
180deg,
#141142 0%,
#58549c 82%,
#46345a 100%
);
color: #b5b1fb;
text-align: center;
position: relative;
}
@media screen and (max-width: 400px) {
body {
font-size: 100%;
}
}
.link {
color: antiquewhite;
}
.small-text {
font-size: 0.7em;
}
.screen {
/* position: absolute; */
/* contain: size layout paint style; */
top: 0;
left: 0;
right: 0;
bottom: 0;
opacity: 0;
width: 100vw;
min-height: 90vh;
overflow-x: hidden;
display: none;
}
.screen.visible {
opacity: 1;
visibility: visible;
display: block;
}
.btn {
font-family: inherit;
font-size: inherit;
padding: 1rem 2rem;
margin: 0.5rem;
border: 4px solid black;
box-shadow: 6px 6px;
cursor: pointer;
transition: 0.25s ease;
will-change: transform;
}
.btn:hover,
.btn:focus {
transform: rotateZ(6deg);
}
.btn:active {
box-shadow: 1px 1px;
}
.btn p {
margin-bottom: 0;
}
summary {
cursor: pointer;
}
.container {
transform: rotateX(60deg) rotateY(0deg) rotateZ(-45deg);
position: relative;
width: calc(var(--unit) * 6);
transform-origin: center center;
}
.tile {
font-size: calc(var(--unit) * 0.7);
text-align: center;
--border-width: 0.1em;
width: var(--unit);
height: var(--unit);
position: absolute;
background: #8ba069;
border-left: var(--border-width) solid rgba(0, 0, 0, 0.5);
border-bottom: var(--border-width) solid rgba(0, 0, 0, 0.3);
color: rgb(65, 78, 45);
contain: size layout style;
transition: opacity 0.25s ease, border 0.25s ease, margin 0.25s ease,
color 0.25s ease;
}
.tile:not(.hole):not(.cover) {
text-shadow: 7px -4px 0px rgba(0, 0, 0, 0.5),
6px -4px 0px rgba(0, 0, 0, 0.6), 0px -4px 0px rgba(255, 255, 255, 0.6);
}
.game-started .tile:not(.hole):not(.cover):hover,
.game-started .tile:not(.hole):not(.cover):focus {
margin-left: 10px;
margin-top: -10px;
z-index: 10;
box-shadow: 5px -5px 20px 2px rgba(0, 0, 0, 0.35);
}
.cover {
border: 0;
background: #3b3779;
height: 20px;
}
/* blast rays */
.hole:before {
content: "";
display: block;
position: absolute;
width: 10px;
height: 200vw;
bottom: 200vh;
background: white;
left: 20px;
opacity: 0;
transition: 0.5s ease;
transition-delay: var(--blast-delay);
}
.bomb-place-anim-1 .hole:before {
opacity: 1;
bottom: 30px;
}
.bomb-place-anim-2 .hole:before {
height: 0px;
}
.bomb-place-anim-2 .hole {
background: white;
}
.game-started .hole {
--hole-width: 0.5em;
background: crimson;
border-left: 0;
border-bottom: 0;
border-right: var(--hole-width) solid rgba(0, 0, 0, 0.5);
border-top: var(--hole-width) solid rgba(0, 0, 0, 0.3);
}
.game-started .hole:after {
content: "💣";
display: block;
margin: -0.2em 0 0 0.1em;
}
.tile:focus {
outline-width: 8px;
outline-style: solid;
outline-color: black;
}
.overlay {
background: linear-gradient(
to bottom,
rgba(255, 255, 255, 0),
rgba(255, 255, 255, 0) 50%,
rgba(0, 0, 0, 0.2) 70%,
rgba(0, 0, 0, 0.4)
);
background-size: 5px 5px;
pointer-events: none;
position: fixed;
z-index: 3;
left: 0;
right: 0;
top: 0;
bottom: 0;
opacity: 0.4;
}
[data-screen="game"] {
flex-direction: column;
}
[data-screen="game"].visible,
.game-board {
display: flex;
justify-content: center;
align-items: center;
/* transform-style: preserve-3d; doesn't work in FF */
perspective: 1170px;
transition: perspective-origin 2s cubic-bezier(0.42, 0, 0.24, 1.01);
}
details {
margin: 2rem auto;
padding: 2rem;
color: black;
background: white;
transition: 0.5s cubic-bezier(0.5, -0.03, 0.25, 1);
border: 5px solid;
box-shadow: 6px 6px;
width: 95vw;
max-width: 600px;
}
details[open] {
transform: translateY(-240px);
max-width: 95vw;
}
/* MESSAGE */
.message {
position: fixed;
contain: layout style paint;
top: 30vh;
left: 50%;
width: 3px;
height: 10px;
transform: translateX(-50%);
overflow: hidden;
background: white;
color: black;
transition: 0.4s cubic-bezier(0.99, -0.1, 0.71, 1.68);
}
.message__text {
overflow: hidden;
max-height: 0;
}
.message-anim-1 .message {
width: 90vw;
}
.message-anim-2 .message {
transition: 0.3s ease;
width: 90vw;
transform: translateX(-50%) scale(1);
border: 5px solid black;
box-shadow: 6px 6px;
}
.message-anim-2 .message__text {
max-height: 700px;
}
.message-anim-2 .message {
padding: 3rem;
height: auto;
}
.particle {
width: 15px;
height: 15px;
background: red;
position: fixed;
top: 0;
left: 0;
z-index: 3;
will-change: transform, opacity;
contain: size layout paint style;
}
[data-screen="menu"] .container {
animation: board-swing 50s;
/* animation-direction: alternate; */
/* animation-fill-mode: both; */
animation-iteration-count: infinite;
animation-timing-function: linear;
transform-origin: center center;
}
@keyframes board-swing {
30% {
transform: rotateX(60deg) rotateY(0deg) rotateZ(-15deg);
}
60% {
transform: rotateX(40deg) rotateY(0deg) rotateZ(-55deg);
}
80% {
transform: rotateX(80deg) rotateY(0deg) rotateZ(0deg);
}
}
.bomb {
position: fixed;
contain: size layout paint paint;
height: 100px;
height: 100px;
font-size: 100px;
z-index: -1;
top: 0;
left: 0;
will-change: transform, opacity;
}
.title {
display: inline-flex;
justify-content: center;
transition: 0.7s cubic-bezier(0.95, 0.05, 0.795, 0.035);
}
.title-letter {
width: 1em;
overflow: hidden;
transition: 0.6s cubic-bezier(0.8, -0.07, 0.51, 1.13);
text-transform: uppercase;
}
.title-letter-odd {
width: 0;
opacity: 0;
}
.title-wrap:hover .title-letter {
width: 0;
opacity: 0;
}
.title-wrap:hover .title-letter-odd {
width: 1em;
opacity: 1;
}
</style>
</head>
<body>
<div class="screen visible" data-screen="menu">
<div class="title-wrap">
<h1
id="titleEl"
class="title"
aria-label="Repeewsenim (Minesweeper in reverse)"
></h1>
<script>
const letters = "Minesweeper".split("");
letters.forEach((letter, i) => {
const el = document.createElement("div");
el.className = "title-letter title-letter-odd";
el.textContent = letter;
titleEl.append(el);
const el2 = document.createElement("div");
el2.className = "title-letter";
el2.textContent = letters[letters.length - i - 1];
titleEl.append(el2);
});
</script>
</div>
<div class="d-f">
<button
class="btn"
type="button"
data-level="0"
onclick="setupGame(event)"
>
Play easy <span aria-hidden="true">🙂</span>
<p class="small-text">
Highscore: <span id="easyHighScoreEl">-</span>
</p>
</button>
<button
class="btn"
type="button"
data-level="1"
onclick="setupGame(event)"
>
Play hard <span aria-hidden="true">🤪</span>
<p class="small-text">
Highscore: <span id="hardHighScoreEl">-</span>
</p>
</button>
</div>
<div>
<details>
<summary>See Help</summary>
<h2>If you know how to play Minesweeper:</h2>
<p>
You need to play Minesweeper backwards. You know where the bombs and
you need to put correct number on each tile.
</p>
<h2>If you don't know how to play Minesweeper:</h2>
<p>
A grid will show up with bombs placed in random cells. Your task is
to assign correct number to each cell which does not have a bomb.
</p>
<p>
A cell's number is the count of bombs that are placed around it i.e.
the (at most) eight cells surrounding it. So if there is just one
bomb around a cell, its number should be 1 and so on...If there is
no bomb around a cell, it should be left empty.
</p>
</details>
<details>
<summary>Controls</summary>
<h2>Mouse</h2>
<p>
Click any cell to cycle between values 0 to 8. Left click increments
by 1 and right click decrements by 1.
</p>
<h2>Keyboard</h2>
<strong>This game is screen-reader compatible.</strong>
<p>
Navigate through cells with <kbd>Tab</kbd> or <kbd>Arrow</kbd> keys.
Press <kbd>Space</kbd> or <kbd>Enter</kbd> key to cycle between
values 0 to 8 or simply press the numeric key to assign value
directly.
</p>
</details>
</div>
<div
aria-hidden="true"
style="position:fixed;z-index:-1;top:100px;opacity:0.5;pointer-events: none"
>
<div class="game-board game-started">
<div id="menuTileContainer" class="container"></div>
</div>
</div>
</div>
<div class="screen" data-screen="help">
<h2>Help</h2>
<p>Hahahaha</p>
</div>
<div class="screen" data-screen="game">
<div id="tileContainer" class="container"></div>
<div class="time">Your time: <span id="timeEl">0</span> seconds</div>
<!-- <div id="messageEl" class="message">Click to start</div> -->
</div>
<div
aria-hidden="true"
id="particleContainer"
style="position: fixed;left:0;top:0;width:100vw;height:100vh;z-index:4;contain: size layout paint style; pointer-events: none"
></div>
<div class="overlay"></div>
<footer class="small-text">
A Js13kGames 2019 entry by
<a class="link" href="https://kushagra.dev">Kushagra Gour</a>
</footer>
<script src="TinyMusic.min.js"></script>
<script src="music.js"></script>
<script src="index.js"></script>
</body>
</html>