forked from JesuscoinsIII/RegenTrail-Modal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimmersed.html
486 lines (426 loc) · 13.2 KB
/
immersed.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
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
475
476
477
478
479
480
481
482
483
484
485
486
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Regen Trail Adventure</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet">
<style>
/* General styles */
body {
background-color: #1a1a1a;
color: #ffffff;
font-family: "Courier New", monospace;
margin: 0;
overflow: hidden;
}
/* Scene background */
#scene-container {
height: 100vh;
width: 100vw;
background-size: cover;
background-position: center;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
}
/* Matrix rain effect */
.matrix {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow: hidden;
z-index: 1;
pointer-events: none; /* Allow clicks to pass through */
}
/* Stats and Story Container */
#stats-story-container {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 10px;
z-index: 2;
}
/* Stats section */
#stats-container {
display: flex;
align-items: center;
justify-content: center;
gap: 20px;
}
.stat-box {
background: rgba(0, 0, 0, 0.5);
padding: 10px;
border-radius: 10px;
text-align: center;
}
/* Health bar */
.health-bar {
background: #555;
border-radius: 5px;
overflow: hidden;
width: 150px;
height: 15px;
margin-top: 5px;
}
.health-bar-inner {
height: 100%;
background: linear-gradient(90deg, #ff0000, #00ff00);
width: 100%;
}
/* Story box for storytelling */
.story-box {
background: rgba(0, 0, 0, 0.7);
padding: 20px;
border-radius: 10px;
max-width: 800px;
width: 90%;
word-break: break-word;
overflow: hidden;
white-space: normal;
text-align: center;
margin-top: 10px;
}
/* Console box for action text */
.console-box {
background: rgba(0, 0, 0, 0.9);
padding: 15px;
border-radius: 10px;
max-width: 800px;
width: 90%;
max-height: 200px;
overflow-y: scroll;
margin-top: 10px;
font-family: "Courier New", monospace;
white-space: pre-wrap;
color: #00ff46;
z-index: 2;
}
/* Purple starburst button */
@keyframes starburst {
0%, 100% {
box-shadow: 0 0 10px #800080, 0 0 20px #800080;
}
50% {
box-shadow: 0 0 20px #800080, 0 0 40px #800080;
}
}
.starburst-button {
background-color: #800080;
padding: 15px 25px;
border-radius: 50px;
color: white;
border: none;
cursor: pointer;
animation: starburst 2s infinite;
transition: transform 0.3s ease-in-out;
margin-top: 10px;
z-index: 2;
}
.starburst-button:hover {
transform: scale(1.1);
}
/* Action buttons */
.action-button {
background-color: #4CAF50;
padding: 10px 20px;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
margin: 10px 5px;
transition: transform 0.3s ease-in-out;
z-index: 2;
}
.action-button:hover {
transform: scale(1.1);
background-color: #45a049;
}
.action-button:disabled {
background-color: #555;
cursor: not-allowed;
transform: none;
}
/* Confetti effect */
.confetti {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 0;
overflow: visible;
z-index: 3;
pointer-events: none;
}
.confetti-piece {
position: absolute;
width: 10px;
height: 10px;
background-color: #f2f2f2;
opacity: 0.7;
animation: confetti 5s linear forwards;
}
@keyframes confetti {
0% {
transform: translateY(0) rotate(0deg);
opacity: 1;
}
100% {
transform: translateY(100vh) rotate(720deg);
opacity: 0;
}
}
</style>
</head>
<body>
<canvas class="matrix" id="matrix"></canvas>
<div id="scene-container">
<div id="stats-story-container">
<!-- Stats Container -->
<div id="stats-container">
<div class="stat-box">
<p>HAND Tokens: <span id="hand-tokens">100</span></p>
<p>EARTH Tokens: <span id="earth-tokens">50</span></p>
<p>CARBON Tokens: <span id="carbon-tokens">0</span></p>
</div>
<div class="stat-box">
<p>Energy</p>
<div class="health-bar">
<div class="health-bar-inner" id="energy-bar"></div>
</div>
</div>
</div>
<!-- Story Box -->
<div class="story-box" id="main-story-box">
<h2 id="story-title" class="text-2xl font-bold mb-4">Ready for your journey?</h2>
</div>
</div>
<!-- Action Buttons will be injected here -->
<div id="actions-container"></div>
<!-- Travel Button (Initially Hidden) -->
<button id="travel-button" class="starburst-button" style="display: none;">Travel to Next Event</button>
<!-- Console Box -->
<div id="action-log" class="console-box"></div>
<!-- Confetti Container -->
<div id="confetti-container" class="confetti"></div>
</div>
<!-- JavaScript for interactive story -->
<script>
// Matrix rain effect
const matrix = document.getElementById('matrix');
const matrixChars = 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモ';
const fontSize = 16;
const columns = Math.floor(window.innerWidth / fontSize);
const drops = [];
for (let x = 0; x < columns; x++) {
drops[x] = Math.random() * window.innerHeight;
}
function drawMatrix() {
const ctx = matrix.getContext('2d');
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
ctx.fillRect(0, 0, matrix.width, matrix.height);
ctx.fillStyle = '#00ff46';
ctx.font = fontSize + 'px monospace';
for (let i = 0; i < drops.length; i++) {
const text = matrixChars.charAt(Math.floor(Math.random() * matrixChars.length));
ctx.fillText(text, i * fontSize, drops[i] * fontSize);
if (drops[i] * fontSize > matrix.height && Math.random() > 0.975) {
drops[i] = 0;
}
drops[i]++;
}
}
matrix.width = window.innerWidth;
matrix.height = window.innerHeight;
setInterval(drawMatrix, 50);
// Game variables
let sceneContainer = document.getElementById('scene-container');
let storyTitle = document.getElementById('story-title');
let travelButton = document.getElementById('travel-button');
let statsContainer = document.getElementById('stats-container');
let actionLog = document.getElementById('action-log');
let energyBar = document.getElementById('energy-bar');
let confettiContainer = document.getElementById('confetti-container');
let actionsContainer = document.getElementById('actions-container');
// Stats
let handTokens = 100;
let earthTokens = 50;
let carbonTokens = 0;
let energy = 100;
// Story progression
let currentStage = 0;
let activitySelected = false;
// Event scenes
const scenes = [
{
background: 'https://via.placeholder.com/1500x800?text=ETHDenver',
title: 'ETHDenver - The Blockchain Gathering',
text: 'You arrive at ETHDenver, the heart of blockchain innovation. The air buzzes with ideas about decentralization and sustainability. What will you do?',
options: ['Attend Workshops', 'Join a Panel Discussion', 'Explore the Event']
},
{
background: 'https://via.placeholder.com/1500x800?text=Devcon+Bangkok',
title: 'Devcon - Bangkok, Thailand',
text: 'At Devcon in Bangkok, the community is vibrant. Discussions range from DeFi to regenerative finance. How will you contribute?',
options: ['Build a Solar Farm', 'Lead a Regen Project', 'Network with Developers']
},
{
background: 'https://via.placeholder.com/1500x800?text=SolarPunk+Summit',
title: 'SolarPunk Summit',
text: 'Welcome to the SolarPunk Summit! Visionaries unite to create sustainable futures. What path will you take?',
options: ['Give a Talk on Eco Tech', 'Visit Sustainable Booths', 'Collaborate with Green Architects']
}
];
// Start the adventure
function startAdventure() {
if (currentStage < scenes.length) {
progressStory(scenes[currentStage]);
} else {
endAdventure();
}
}
// Function to progress the story and display text
function progressStory(scene) {
sceneContainer.style.backgroundImage = `url(${scene.background})`;
storyTitle.innerText = scene.title;
actionLog.innerText = '';
showTypingEffect(scene.text);
// Create action buttons
createActionButtons(scene.options, scene.title);
}
// Create action buttons for each option
function createActionButtons(options, eventTitle) {
actionsContainer.innerHTML = ''; // Clear previous buttons
activitySelected = false;
options.forEach((option, index) => {
const actionButton = document.createElement('button');
actionButton.innerText = option;
actionButton.className = 'action-button';
actionButton.addEventListener('click', () => handleAction(actionButton, index, option, eventTitle));
actionsContainer.appendChild(actionButton);
});
}
// Handle actions
function handleAction(button, actionIndex, action, eventTitle) {
let logEntry = '';
if (!button.disabled) {
if (actionIndex === 0) {
storyTitle.innerText = `You engaged deeply at ${eventTitle}!`;
earthTokens += 10;
energy -= 20;
logEntry = `You chose to "${action}". Earned 10 EARTH tokens. Energy -20.`;
} else if (actionIndex === 1) {
storyTitle.innerText = `You made a significant impact at ${eventTitle}!`;
handTokens += 20;
energy -= 30;
logEntry = `You chose to "${action}". Earned 20 HAND tokens. Energy -30.`;
} else if (actionIndex === 2) {
storyTitle.innerText = `You expanded your horizons at ${eventTitle}!`;
energy -= 10;
logEntry = `You chose to "${action}". Energy -10.`;
}
// Update the log
updateLog(logEntry);
// Update stats
updateStats();
// Mark the button as selected
button.disabled = true;
activitySelected = true;
// Show the travel button after first activity selection
if (activitySelected) {
travelButton.style.display = 'block';
}
// Signal rest if energy is low
if (energy <= 20) {
signalRest();
}
}
}
// Travel to next event
travelButton.addEventListener('click', () => {
currentStage++;
travelButton.style.display = 'none';
startAdventure();
});
// Function to update the log
function updateLog(entry) {
actionLog.innerHTML += `${entry}\n`;
actionLog.scrollTop = actionLog.scrollHeight;
}
// Show typing effect
function showTypingEffect(text) {
storyTitle.innerHTML = '';
let i = 0;
const interval = setInterval(() => {
if (i < text.length) {
storyTitle.innerHTML += text.charAt(i);
i++;
} else {
clearInterval(interval);
}
}, 30);
}
// Update the stats on the page
function updateStats() {
document.getElementById('hand-tokens').innerText = handTokens;
document.getElementById('earth-tokens').innerText = earthTokens;
document.getElementById('carbon-tokens').innerText = carbonTokens;
if (energy < 0) energy = 0;
energyBar.style.width = `${energy}%`;
}
// Signal rest when energy is low
function signalRest() {
const restMessage = document.createElement('div');
restMessage.innerText = 'Your energy is low. Resting to recover...';
restMessage.style.position = 'absolute';
restMessage.style.top = '50%';
restMessage.style.left = '50%';
restMessage.style.transform = 'translate(-50%, -50%)';
restMessage.style.backgroundColor = 'rgba(0, 0, 0, 0.8)';
restMessage.style.padding = '20px';
restMessage.style.borderRadius = '10px';
restMessage.style.zIndex = '3';
sceneContainer.appendChild(restMessage);
setTimeout(() => {
restMessage.remove();
energy += 50;
if (energy > 100) energy = 100;
updateStats();
}, 3000);
}
// End the adventure with confetti and submit to karmaGAP
function endAdventure() {
storyTitle.innerText = 'Congratulations on completing your regen trail!';
actionsContainer.innerHTML = '';
travelButton.remove();
triggerConfetti();
// Simulate submission to karmaGAP
setTimeout(() => {
updateLog('Submitting your achievements to karmaGAP...');
// Add any submission logic here
}, 2000);
}
// Trigger confetti effect
function triggerConfetti() {
for (let i = 0; i < 100; i++) {
const confettiPiece = document.createElement('div');
confettiPiece.classList.add('confetti-piece');
confettiPiece.style.left = Math.random() * window.innerWidth + 'px';
confettiPiece.style.backgroundColor = `hsl(${Math.random() * 360}, 100%, 50%)`;
confettiContainer.appendChild(confettiPiece);
confettiPiece.addEventListener('animationend', () => {
confettiPiece.remove();
});
}
}
// Initialize the game
function initGame() {
updateStats();
startAdventure();
}
initGame();
</script>
</body>
</html>