-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathindex.html
More file actions
474 lines (449 loc) · 18.6 KB
/
index.html
File metadata and controls
474 lines (449 loc) · 18.6 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
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Anti-Boredom — Welcome</title>
<style>
:root {
--bg: #060617;
--accent: #7b5cff;
--accent2: #6ee7b7;
}
html,
body {
height: 100%;
margin: 0;
font-family: Inter, system-ui, Segoe UI, Roboto, "Helvetica Neue", Arial;
}
body {
background: radial-gradient(
ellipse at 10% 10%,
#071024 0%,
#020312 40%,
#000 100%
);
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
}
/* Fullscreen intro */
.intro {
position: fixed;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
color: #fff;
}
canvas#starfield {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
}
.logo-wrap {
position: relative;
z-index: 3;
display: flex;
flex-direction: column;
align-items: center;
gap: 18px;
}
.logo {
width: 96px;
height: 96px;
filter: drop-shadow(0 10px 30px rgba(123, 92, 255, 0.18));
border-radius: 14px;
background: linear-gradient(135deg, var(--accent), #9fb8ff);
display: flex;
align-items: center;
justify-content: center;
}
.logo img {
width: 80%;
height: 80%;
object-fit: contain;
}
h1.title {
font-size: 28px;
letter-spacing: 2px;
margin: 0;
font-weight: 700;
text-transform: uppercase;
}
p.tag {
margin: 0;
opacity: 0.9;
color: rgba(255, 255, 255, 0.85);
}
.tip.fade {
transition: opacity 0.48s;
opacity: 0;
}
.tip.show {
opacity: 0.92;
}
/* pulse + glow */
.pulse {
position: absolute;
z-index: 2;
width: 300px;
height: 300px;
border-radius: 50%;
background: radial-gradient(
circle at 30% 30%,
rgba(123, 92, 255, 0.18),
rgba(123, 92, 255, 0.06) 30%,
transparent 60%
);
filter: blur(18px);
animation: pulse 3.5s ease-out forwards;
}
@keyframes pulse {
0% {
transform: scale(0.6);
opacity: 1;
}
70% {
transform: scale(1.15);
opacity: 0.9;
}
100% {
transform: scale(1.6);
opacity: 0;
}
}
/* loader */
.loader {
display: flex;
gap: 10px;
margin-top: 10px;
}
.loader span {
width: 10px;
height: 10px;
background: linear-gradient(180deg, var(--accent), var(--accent2));
border-radius: 50%;
opacity: 0.95;
transform: translateY(0);
animation: jump 1s infinite;
}
.loader span:nth-child(2) {
animation-delay: 0.12s;
}
.loader span:nth-child(3) {
animation-delay: 0.24s;
}
@keyframes jump {
0% {
transform: translateY(0);
}
50% {
transform: translateY(-12px);
}
100% {
transform: translateY(0);
}
}
/* small skip hint */
.skip {
position: fixed;
right: 18px;
bottom: 18px;
background: rgba(255, 255, 255, 0.06);
color: #fff;
padding: 8px 12px;
border-radius: 999px;
font-size: 13px;
backdrop-filter: blur(6px);
z-index: 4;
}
/* responsive tweaks */
@media (max-width: 520px) {
.logo {
width: 74px;
height: 74px;
}
.logo img {
width: 70%;
}
.title {
font-size: 20px;
}
#gameThumbnails {
gap: 10px;
margin: 16px 0 8px 0;
}
#gameThumbnails > a {
min-width: 64px;
padding: 8px 2px 8px 2px;
font-size: 13px;
border-radius: 12px;
}
button, #gameThumbnails > a {
min-height: 40px;
min-width: 46px;
font-size: 1em;
}
}
#gameThumbnails > a:active, #gameThumbnails > a:focus, button:active, button:focus {
outline: 2px solid var(--accent2);
color: #391da4;
background: rgba(123,92,255,0.12);
}
</style>
</head>
<body>
<!-- ======= Greeting Banner ======= -->
<div id="greeting" style="text-align:center;font-size:1.1em;color:#dbeafe;margin:16px 0 0 0;"></div>
<!-- ======= GitHub Fork Banner ======= -->
<a href="https://github.com/ramanuj-droid/Anti-Boredom" style="
position:fixed;top:0;right:0;z-index:10000;background:#7b5cff;
color:#fff;padding:6px 18px 6px 18px;font-size:14px;transform:rotate(44deg) translate(48px,-38px);
border-radius:8px 8px 0 0;text-decoration:none;font-family:sans-serif;box-shadow:0 4px 16px #0002;"
aria-label="Fork this project on GitHub" tabindex="0">
⭐ Fork Me!
</a>
<!-- ======= Back to Top Button ======= -->
<button id="backTop" style="position:fixed;right:18px;bottom:48px;padding:10px 16px;border:none;border-radius:999px;background:rgba(123,92,255,0.87);color:#fff;font-size:16px;box-shadow:0 4px 22px #0001;cursor:pointer;display:none;z-index:99;transition:background .2s,opacity .5s;" aria-label="Back to top" tabindex="0">↑</button>
<!-- ======= Intro / Splash Screen ======= -->
<div class="intro" id="intro">
<canvas id="starfield"></canvas>
<div class="pulse" aria-hidden></div>
<!-- ======= Logo & Header Area ======= -->
<div class="logo-wrap">
<div class="logo" id="logo">
<img
src="Anti_Boredom_main/media/anti_boredom_main.png"
alt="Anti Boredom Logo - playful purple and blue gradient box"
onerror="this.style.display='none'"
/>
</div>
<button id="darkToggle" aria-label="Toggle dark/light mode" style="margin: 10px auto 0; background:rgba(255,255,255,0.1); color:#e9d8ff; border:none; border-radius:6px; padding:6px 14px; cursor:pointer; font-weight:bold; font-size:1em;" tabindex="0">🌙 Toggle Dark Mode</button>
<h1 class="title">Anti‑Boredom</h1>
<p class="tag">Mini‑games, tools & experiments — stay curious</p>
<p class="tip" id="funTip" style="margin: 7px 0 0 0; font-size: 1rem; color: #caf0f8; opacity: 0.92; min-height: 1.3em; text-align: center;"></p>
<div id="moodLight" style="width:60px;height:16px;margin:10px auto 0;border-radius:8px;box-shadow:0 0 12px #0005;"></div>
<div class="loader" aria-hidden>
<span></span><span></span><span></span>
</div>
</div>
<div class="skip" id="skip">Click or press any key to skip</div>
</div>
<!-- ======= Mini-Game Thumbnails Section ======= -->
<div id="gameThumbnails" style="display:flex;flex-direction:row;justify-content:center;gap:20px;margin:32px 0 12px 0;flex-wrap:wrap;">
<!-- Individual Game Thumbnail Links -->
<a href="Anti_Boredom_main/2048_game/index.html" title="2048" style="text-align:center;text-decoration:none;color:#fff;font-size:14px;" tabindex="0">
<svg width="52" height="52" viewBox="0 0 52 52"><rect width="52" height="52" rx="14" fill="#e9c46a"/><text x="50%" y="58%" text-anchor="middle" style="font-family:sans-serif;fill:#8d7b4a;font-size:19px;" dominant-baseline="middle">2048</text></svg><br>2048
</a>
<a href="Anti_Boredom_main/snake_game/index.html" title="Snake" style="text-align:center;text-decoration:none;color:#fff;font-size:14px;" tabindex="0">
<svg width="52" height="52" viewBox="0 0 52 52"><rect width="52" height="52" rx="14" fill="#4ade80"/><circle cx="23" cy="26" r="10" fill="#166534" /><circle cx="35" cy="26" r="4" fill="#bbf7d0" /></svg><br>Snake
</a>
<a href="Anti_Boredom_main/Tic_Tac_Toe/index.html" title="Tic Tac Toe" style="text-align:center;text-decoration:none;color:#fff;font-size:14px;" tabindex="0">
<svg width="52" height="52" viewBox="0 0 52 52"><rect width="52" height="52" rx="14" fill="#c7d2fe"/><text x="50%" y="55%" text-anchor="middle" style="font-family:sans-serif;fill:#312e81;font-size:22px;">⭕❌</text></svg><br>Tic Tac Toe
</a>
<a href="Anti_Boredom_main/Emoji_Riddle_Game/index.html" title="Emoji Riddle" style="text-align:center;text-decoration:none;color:#fff;font-size:14px;" tabindex="0">
<svg width="52" height="52" viewBox="0 0 52 52"><rect width="52" height="52" rx="14" fill="#fbbf24"/><text x="50%" y="55%" text-anchor="middle" style="font-family:sans-serif;fill:#78350f;font-size:24px;">😉</text></svg><br>Emoji Riddle
</a>
<a href="Anti_Boredom_main/Guess_The_Flag/index.html" title="Guess the Flag" style="text-align:center;text-decoration:none;color:#fff;font-size:14px;" tabindex="0">
<svg width="52" height="52" viewBox="0 0 52 52"><rect width="52" height="52" rx="14" fill="#7dd3fc"/><rect x="18" y="14" width="16" height="12" fill="#fff" stroke="#2563eb" stroke-width="2" /><rect x="18" y="26" width="16" height="8" fill="#ef4444" /><rect x="18" y="14" width="16" height="20" fill="none" stroke="#082f49" stroke-width="2" /></svg><br>Flag Guess
</a>
</div>
<!-- ======= Main Action Buttons ======= -->
<button onclick="goRandom()" style="position:fixed;left:50%;bottom:20px;transform:translateX(-50%);background:#6ee7b7;padding:10px 18px;border:none;border-radius:12px;font-size:1.1em;font-weight:700;box-shadow:0 2px 8px #0003;cursor:pointer;z-index:1002;" aria-label="Jump to a random game" tabindex="0">🎲 Random Game</button>
<a href="https://github.com/ramanuj-droid/Anti-Boredom/issues/new?title=Bug+report&body=Game:+[Name]%0D%0ADescribe+the+problem..." target="_blank"
style="position:fixed;bottom:16px;left:16px;background:#fffbe6;border-radius:50%;padding:8px 10px;
box-shadow:0 2px 8px #0002;font-size:1.2em;text-decoration:none;z-index:1000;"
aria-label="Report a bug in a game" tabindex="0">🐞</a>
<!-- ======= Help / Shortcuts Overlay ======= -->
<div id="helpOverlay" style="display:none;position:fixed;inset:0;z-index:9999;background:rgba(20,18,48,0.82);color:#fff;padding:0;
font-size:1.15em;font-family:sans-serif;align-items:center;justify-content:center;flex-direction:column;gap:20px;" tabindex="-1">
<div style="background:rgba(40,36,66,0.98);border-radius:16px;min-width:270px;max-width:92vw;padding:32px 25px 16px 25px;box-shadow:0 6px 32px #0008;text-align:center;">
<h2 style="margin-top:0;font-size:1.2em">🔑 Shortcuts & Guide</h2>
<ul style="text-align:left;margin:0 0 12px 0;padding:0;list-style-type:none;">
<li><b>Any key / Click</b>: Skip intro</li>
<li><b>Backspace/Esc</b>: Close overlays</li>
<li><b>?</b>: Show this help</li>
<li><b>B O R E D</b>: Surprise easter egg</li>
<li><b>↑</b>: Back to Top (after scrolling)</li>
</ul>
<button id="closeHelp" style="margin-top:6px;padding:6px 14px;background:#7b5cff;color:#fff;border:none;border-radius:6px;font-size:.98em;cursor:pointer;">Close</button>
</div>
</div>
<script>
// ==== Starfield Splash Animation Logic ====
(function () {
const redirectTo = "Anti_Boredom_main/index.html";
const prefersReduced = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
const duration = prefersReduced ? 600 : 3500; // shorter for reduced motion
const canvas = document.getElementById("starfield");
if (!canvas) { location.href = redirectTo; return; }
const ctx = canvas.getContext("2d");
if (!ctx) { location.href = redirectTo; return; }
let stars = [];
// === Resize canvas for crisp rendering
function resize() {
const dpr = Math.max(1, window.devicePixelRatio || 1);
canvas.width = window.innerWidth * dpr;
canvas.height = window.innerHeight * dpr;
canvas.style.width = window.innerWidth + "px";
canvas.style.height = window.innerHeight + "px";
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
}
function initStars() {
stars = [];
const count = Math.round((window.innerWidth + window.innerHeight) / 12);
for (let i = 0; i < count; i++) {
stars.push({
x: Math.random() * window.innerWidth,
y: Math.random() * window.innerHeight,
z: Math.random() * 1.2 + 0.2,
r: Math.random() * 1.2 + 0.2,
});
}
}
// === Starfield rendering
function draw(t) {
ctx.clearRect(0, 0, window.innerWidth, window.innerHeight);
// subtle gradient
const g = ctx.createLinearGradient(0, 0, 0, window.innerHeight);
g.addColorStop(0, "rgba(20,22,40,0.08)");
g.addColorStop(1, "rgba(0,0,0,0.25)");
ctx.fillStyle = g;
ctx.fillRect(0, 0, window.innerWidth, window.innerHeight);
for (let i = 0; i < stars.length; i++) {
const s = stars[i];
if (!prefersReduced) {
s.x += 0.02 * s.z * (1 + Math.sin(t / 6000));
s.y += 0.01 * s.z;
}
if (s.x > window.innerWidth) s.x = 0;
if (s.y > window.innerHeight) s.y = 0;
ctx.beginPath();
ctx.fillStyle = "rgba(255,255,255," + 0.4 * s.z + ")";
ctx.arc(s.x, s.y, s.r * s.z, 0, Math.PI * 2);
ctx.fill();
}
// gentle blur overlay
ctx.globalCompositeOperation = "lighter";
ctx.globalCompositeOperation = "source-over";
}
// === Starfield loop and animation
let rafId;
function loop(ts) {
draw(ts);
rafId = requestAnimationFrame(loop);
}
function start() {
resize();
initStars();
rafId = requestAnimationFrame(loop);
}
window.addEventListener("resize", () => {
resize();
initStars();
});
start();
// === Splash screen fade-out/redirect logic
let done = false;
function finish() {
if (done) return;
done = true;
cancelAnimationFrame(rafId);
document.getElementById("intro").style.transition = "opacity .4s";
document.getElementById("intro").style.opacity = 0;
setTimeout(() => {
location.href = redirectTo;
}, 420);
}
// Auto finish after duration
const timeoutId = setTimeout(finish, duration);
// Skip handlers
function skip() {
clearTimeout(timeoutId);
finish();
}
document
.getElementById("intro")
.addEventListener("click", skip, { passive: true });
document.addEventListener("keydown", skip, { passive: true });
// === Fun Tips Carousel Logic ===
const tips = [
"🕹️ Try the 2048 or Snake game—perfect for 2-minute breaks!",
"🎵 Music-Player even supports custom tracks. Try it!",
"🤖 Design a robot in Robot_Designer and screenshot your wackiest bot.",
"📚 Need a laugh? Generate a random fact or joke!",
"💡 Stuck? Take our Boredom Quiz and get wild new ideas.",
"⚡ Edit or add your own mini-game right now—see Contribution Guide in the repo!",
"🧑💻 Pro tip: Fork the repo and start your own experiment!",
"🙌 Share the hub with friends and give feedback!"
];
const tipElem = document.getElementById("funTip");
if (tipElem) {
let i = 0;
tipElem.textContent = tips[0];
tipElem.classList.add("show");
setInterval(() => {
// fade out
tipElem.classList.remove("show");
tipElem.classList.add("fade");
setTimeout(() => {
i = (i+1) % tips.length;
tipElem.textContent = tips[i];
tipElem.classList.remove("fade");
tipElem.classList.add("show");
}, 400);
}, 3600);
}
// Offline notice
window.addEventListener('offline',()=>{document.getElementById('offlineNotice').style.display='block';});
window.addEventListener('online',()=>{document.getElementById('offlineNotice').style.display='none';});
// Colorblind mode toggle
const btn = document.getElementById('cbModeBtn');
const cbStyle = document.getElementById('cbStyle');
let enabled = false;
btn.onclick = function(){
enabled = !enabled;
btn.style.background = enabled ? '#7dd3fc' : '#262626';
btn.style.color = enabled ? '#000' : '#fff';
cbStyle.innerHTML = enabled ? `
body, .intro { background: #ffffff !important; color: #111 !important; }
.logo { background: #f59e42 !important; filter: none !important; }
.pulse, .loader span, .progress .bar { background: #333 !important; }
a,button { color: #1346d0 !important; }
.skip,.loader { background: #e0eaff !important; color: #1346d0 !important; }
` : '';
};
})();
// === Dark Mode Toggle Logic ===
(function(){
const btn = document.getElementById('darkToggle');
if(btn) {
btn.addEventListener('click', function() {
const root = document.documentElement;
const dark = getComputedStyle(root).getPropertyValue('--bg');
if(document.body.dataset.theme === 'light') {
root.style.setProperty('--bg','#060617');
root.style.setProperty('--accent','#7b5cff');
root.style.setProperty('--accent2','#6ee7b7');
document.body.style.background = 'radial-gradient(ellipse at 10% 10%, #071024 0%, #020312 40%, #000 100%)';
document.body.dataset.theme = '';
btn.textContent = '🌙 Toggle Dark Mode';
} else {
root.style.setProperty('--bg', '#f7fafc');
root.style.setProperty('--accent', '#340299');
root.style.setProperty('--accent2', '#319795');
document.body.style.background = '#f7fafc';
document.body.dataset.theme = 'light';
btn.textContent = '🌞 Toggle Light Mode';
}
});
}
})();
</script>
</body>
</html>