| Name | Message | Date |
|---|---|---|
| 📄 GameScreen.svelte | 1 month ago | |
| 📄 ResultsScreen.svelte | 1 month ago |
📄
GameScreen.svelte
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
<script lang="ts">
interface Props {
color: string;
isMaster: boolean;
onTap?: () => void;
}
let { color = '', isMaster = false, onTap }: Props = $props();
function handleClick() {
if (color && onTap) {
onTap();
}
}
function handleKeydown(event: KeyboardEvent) {
if (event.key === 'Enter' || event.key === ' ') {
handleClick();
}
}
</script>
<div
class="game-screen"
style="background-color: {color || '#000000'}"
onclick={handleClick}
onkeydown={handleKeydown}
role="button"
tabindex="0"
>
{#if color}
<div class="tap-indicator">TAP!</div>
{/if}
</div>
<style>
.game-screen {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
user-select: none;
-webkit-tap-highlight-color: transparent;
}
.tap-indicator {
font-size: 4rem;
font-weight: bold;
color: rgba(255, 255, 255, 0.9);
text-shadow:
0 0 10px rgba(0, 0, 0, 0.5),
0 0 20px rgba(0, 0, 0, 0.3);
animation: pulse 0.5s ease-in-out infinite alternate;
}
@keyframes pulse {
from {
transform: scale(1);
opacity: 0.8;
}
to {
transform: scale(1.1);
opacity: 1;
}
}
</style>