-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclarence.html
More file actions
247 lines (212 loc) · 6.36 KB
/
clarence.html
File metadata and controls
247 lines (212 loc) · 6.36 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Whack-a-Supreme Court Justice</title>
<style>
:root {
--bg: #e6eaed;
--board-bg: #f7f9fb;
--hole-rim: #2a2f36;
--text: #222;
}
* ,
*::before,
*::after {
box-sizing: border-box;
}
body {
margin: 0;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: radial-gradient(circle at top, #ffffff 0, var(--bg) 55%, #c2ccd6 100%);
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
h1 {
margin-bottom: 24px;
font-size: 32px;
letter-spacing: 0.04em;
}
/* Board container */
.game {
position: relative;
padding: 40px 50px;
border-radius: 30px;
background: var(--board-bg);
box-shadow:
0 20px 40px rgba(0, 0, 0, 0.35),
0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}
/* 3x3 grid for holes */
.grid {
display: grid;
grid-template-columns: repeat(3, 160px);
grid-gap: 55px;
justify-content: center;
}
/* --- HOLE (sunken pit with depth) --- */
.hole {
position: relative;
width: 160px;
height: 110px;
border-radius: 50%;
overflow: hidden;
background: radial-gradient(ellipse at 30% 30%, #333 0, #111 40%, #000 100%);
box-shadow:
0 14px 18px rgba(0, 0, 0, 0.8) inset,
0 10px 18px rgba(0, 0, 0, 0.5);
}
/* subtle rim around the hole */
.hole::before {
content: "";
position: absolute;
inset: 0;
border-radius: 50%;
border: 4px solid var(--hole-rim);
box-shadow:
0 0 8px rgba(0, 0, 0, 0.5) inset,
0 4px 8px rgba(0, 0, 0, 0.4);
pointer-events: none;
}
/* inner shadow where the mole emerges */
.hole::after {
content: "";
position: absolute;
bottom: -8px;
left: 50%;
width: 80%;
height: 40px;
transform: translateX(-50%);
background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.9), transparent 70%);
filter: blur(3px);
pointer-events: none;
}
/* --- MOLE (face popping out) --- */
.mole {
position: absolute;
left: 50%;
bottom: -120px; /* start well BELOW the hole */
width: 110px;
height: 110px;
transform: translateX(-50%); /* only horizontal centering */
border-radius: 50%;
background: url("clarence.png") center/cover no-repeat;
box-shadow: 0 10px 18px rgba(0, 0, 0, 0.6);
transition:
bottom 0.18s cubic-bezier(0.22, 0.61, 0.36, 1),
filter 0.18s ease;
}
/* when active, she rises UP into view from below */
.hole.active .mole {
bottom: -10px; /* tweak this to show more/less of her */
filter: brightness(1.03);
}
/* optional tiny bounce on first pop */
.hole.active .mole {
animation: pop 0.16s ease-out;
}
@keyframes pop {
0% { bottom: -25px; transform: translateX(-50%) scale(0.96); }
70% { bottom: -10px; transform: translateX(-50%) scale(1.02); }
100% { bottom: -10px; transform: translateX(-50%) scale(1); }
}
/* Score display */
.scoreboard {
margin-top: 24px;
font-size: 18px;
letter-spacing: 0.12em;
text-transform: uppercase;
color: var(--text);
}
/* custom cursor over holes / mole */
.hole,
.mole {
cursor: url("cursor.png") 56 112, pointer; /* 112x112 cursor, hotspot bottom-center */
}
</style>
</head>
<body>
<h1>Whack-a-Cunt</h1>
<div class="game">
<div class="grid">
<div class="hole"><div class="mole"></div></div>
<div class="hole"><div class="mole"></div></div>
<div class="hole"><div class="mole"></div></div>
<div class="hole"><div class="mole"></div></div>
<div class="hole"><div class="mole"></div></div>
<div class="hole"><div class="mole"></div></div>
<div class="hole"><div class="mole"></div></div>
<div class="hole"><div class="mole"></div></div>
<div class="hole"><div class="mole"></div></div>
</div>
</div>
<div class="scoreboard">
<span id="score">Score: 0</span>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
const grid = document.querySelector('.grid');
const holes = document.querySelectorAll('.hole');
const scoreEl = document.getElementById('score');
let score = 0;
let activeHole = null;
let upTimeout = null; // how long she's visible
let cycleTimeout = null; // delay between appearances
// difficulty
const upTime = 600; // ms she stays visible
const minDownTime = 1000; // min quiet time
const maxDownTime = 3000; // max quiet time
function getRandomDownTime() {
return Math.floor(Math.random() * (maxDownTime - minDownTime + 1)) + minDownTime;
}
function hideMole() {
if (activeHole) {
activeHole.classList.remove('active');
activeHole = null;
}
}
function gameCycle() {
hideMole();
const downTime = getRandomDownTime();
cycleTimeout = setTimeout(() => {
const index = Math.floor(Math.random() * holes.length);
activeHole = holes[index];
activeHole.classList.add('active');
upTimeout = setTimeout(() => {
hideMole();
gameCycle();
}, upTime);
}, downTime);
}
// unified handler for mouse / touch / pointer
function handleWhack(event) {
// so touch doesn't also fire a click later
event.preventDefault();
const hole = event.target.closest('.hole');
if (!hole) return;
if (!hole.classList.contains('active')) return;
score++;
scoreEl.textContent = 'Score: ' + score;
if (upTimeout) {
clearTimeout(upTimeout);
upTimeout = null;
}
hideMole();
gameCycle();
}
// Prefer Pointer Events if available (covers mouse + touch)
if (window.PointerEvent) {
grid.addEventListener('pointerdown', handleWhack);
} else {
// Fallback for older browsers
grid.addEventListener('mousedown', handleWhack);
grid.addEventListener('touchstart', handleWhack, { passive: false });
}
gameCycle();
});
</script>
</body>
</html>