AptlyDigital commited on
Commit
ae37ee6
·
verified ·
1 Parent(s): 9f8afc4

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +245 -1
index.html CHANGED
@@ -121,6 +121,90 @@
121
  100% { transform: translateX(100%); }
122
  }
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  /* === MAIN CONTAINER === */
125
  .app-container {
126
  max-width: 1800px;
@@ -1277,6 +1361,9 @@
1277
  <div class="neuron-grid" id="neuronGrid"></div>
1278
  <div class="data-stream"></div>
1279
 
 
 
 
1280
  <!-- TOAST NOTIFICATIONS -->
1281
  <div class="toast-container" id="toastContainer"></div>
1282
 
@@ -1928,7 +2015,14 @@
1928
 
1929
  // History
1930
  history: JSON.parse(localStorage.getItem('wordHistory')) || [],
1931
- sessionHistory: []
 
 
 
 
 
 
 
1932
  };
1933
 
1934
  // ========== INITIALIZATION ==========
@@ -1936,6 +2030,9 @@
1936
  // Initialize visualization
1937
  initVisualization();
1938
 
 
 
 
1939
  // Load word lists
1940
  await loadWordLists();
1941
 
@@ -1965,6 +2062,138 @@
1965
  startTimeTracker();
1966
  });
1967
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1968
  // ========== VISUALIZATION ENGINE ==========
1969
  function initVisualization() {
1970
  const neuronGrid = document.getElementById('neuronGrid');
@@ -2271,6 +2500,18 @@
2271
  AppState.isCorrect = true;
2272
  AppState.isFirstTry = AppState.attempts === 1 && AppState.hintsUsed === 0;
2273
 
 
 
 
 
 
 
 
 
 
 
 
 
2274
  // Calculate points
2275
  let points = 0;
2276
  if (AppState.isFirstTry) {
@@ -2344,6 +2585,9 @@
2344
  AppState.streak = 0;
2345
  AppState.performance.currentStreak = 0;
2346
 
 
 
 
2347
  showFeedback('❌ Incorrect. Try again.', 'incorrect');
2348
  document.getElementById('wordDisplay').classList.add('incorrect');
2349
 
 
121
  100% { transform: translateX(100%); }
122
  }
123
 
124
+ /* === CELEBRATION EFFECTS === */
125
+ .celebration-container {
126
+ position: fixed;
127
+ top: 0;
128
+ left: 0;
129
+ width: 100%;
130
+ height: 100%;
131
+ pointer-events: none;
132
+ z-index: 1000;
133
+ overflow: hidden;
134
+ }
135
+
136
+ .balloon {
137
+ position: absolute;
138
+ bottom: -100px;
139
+ width: 40px;
140
+ height: 50px;
141
+ border-radius: 50%;
142
+ animation: balloonFloat 8s ease-in forwards;
143
+ }
144
+
145
+ .balloon::before {
146
+ content: '';
147
+ position: absolute;
148
+ bottom: -15px;
149
+ left: 50%;
150
+ transform: translateX(-50%);
151
+ width: 2px;
152
+ height: 20px;
153
+ background: rgba(255, 255, 255, 0.5);
154
+ }
155
+
156
+ .bubble {
157
+ position: absolute;
158
+ bottom: -50px;
159
+ width: 30px;
160
+ height: 30px;
161
+ border-radius: 50%;
162
+ background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), rgba(0, 243, 255, 0.3));
163
+ animation: bubbleFloat 6s ease-in forwards;
164
+ filter: blur(1px);
165
+ }
166
+
167
+ .confetti {
168
+ position: absolute;
169
+ width: 12px;
170
+ height: 12px;
171
+ opacity: 0;
172
+ animation: confettiFall 3s ease-out forwards;
173
+ }
174
+
175
+ @keyframes balloonFloat {
176
+ 0% {
177
+ transform: translateY(0) rotate(0deg);
178
+ opacity: 1;
179
+ }
180
+ 100% {
181
+ transform: translateY(-100vh) rotate(20deg);
182
+ opacity: 0;
183
+ }
184
+ }
185
+
186
+ @keyframes bubbleFloat {
187
+ 0% {
188
+ transform: translateY(0) scale(1);
189
+ opacity: 1;
190
+ }
191
+ 100% {
192
+ transform: translateY(-100vh) scale(1.5);
193
+ opacity: 0;
194
+ }
195
+ }
196
+
197
+ @keyframes confettiFall {
198
+ 0% {
199
+ transform: translateY(-100px) rotate(0deg);
200
+ opacity: 1;
201
+ }
202
+ 100% {
203
+ transform: translateY(100vh) rotate(360deg);
204
+ opacity: 0;
205
+ }
206
+ }
207
+
208
  /* === MAIN CONTAINER === */
209
  .app-container {
210
  max-width: 1800px;
 
1361
  <div class="neuron-grid" id="neuronGrid"></div>
1362
  <div class="data-stream"></div>
1363
 
1364
+ <!-- CELEBRATION EFFECTS -->
1365
+ <div class="celebration-container" id="celebrationContainer"></div>
1366
+
1367
  <!-- TOAST NOTIFICATIONS -->
1368
  <div class="toast-container" id="toastContainer"></div>
1369
 
 
2015
 
2016
  // History
2017
  history: JSON.parse(localStorage.getItem('wordHistory')) || [],
2018
+ sessionHistory: [],
2019
+
2020
+ // Sound Effects
2021
+ sounds: {
2022
+ perfect: null,
2023
+ ding: null,
2024
+ tryAgain: null
2025
+ }
2026
  };
2027
 
2028
  // ========== INITIALIZATION ==========
 
2030
  // Initialize visualization
2031
  initVisualization();
2032
 
2033
+ // Load sound effects
2034
+ loadSoundEffects();
2035
+
2036
  // Load word lists
2037
  await loadWordLists();
2038
 
 
2062
  startTimeTracker();
2063
  });
2064
 
2065
+ // ========== SOUND EFFECTS ==========
2066
+ function loadSoundEffects() {
2067
+ try {
2068
+ AppState.sounds.perfect = new Audio('sounds/perfect.wav');
2069
+ AppState.sounds.ding = new Audio('sounds/ding.wav');
2070
+ AppState.sounds.tryAgain = new Audio('sounds/try_again.wav');
2071
+
2072
+ // Preload sounds
2073
+ AppState.sounds.perfect.load();
2074
+ AppState.sounds.ding.load();
2075
+ AppState.sounds.tryAgain.load();
2076
+
2077
+ console.log('Sound effects loaded successfully');
2078
+ } catch (error) {
2079
+ console.warn('Could not load sound effects:', error);
2080
+ }
2081
+ }
2082
+
2083
+ function playSound(soundName) {
2084
+ try {
2085
+ if (!AppState.sounds[soundName]) return;
2086
+
2087
+ const sound = AppState.sounds[soundName];
2088
+ sound.volume = AppState.speechVolume;
2089
+ sound.currentTime = 0;
2090
+ sound.play().catch(e => console.warn('Could not play sound:', e));
2091
+ } catch (error) {
2092
+ console.warn('Error playing sound:', error);
2093
+ }
2094
+ }
2095
+
2096
+ // ========== CELEBRATION EFFECTS ==========
2097
+ function createCelebration(isFirstTry = false) {
2098
+ const container = document.getElementById('celebrationContainer');
2099
+ container.innerHTML = '';
2100
+
2101
+ if (isFirstTry) {
2102
+ // Balloons for perfect first try
2103
+ for (let i = 0; i < 15; i++) {
2104
+ createBalloon(i);
2105
+ }
2106
+
2107
+ // Bubbles for extra effect
2108
+ for (let i = 0; i < 20; i++) {
2109
+ createBubble(i);
2110
+ }
2111
+ } else {
2112
+ // Confetti for regular correct answer
2113
+ for (let i = 0; i < 25; i++) {
2114
+ createConfetti(i);
2115
+ }
2116
+ }
2117
+ }
2118
+
2119
+ function createBalloon(index) {
2120
+ const container = document.getElementById('celebrationContainer');
2121
+ const balloon = document.createElement('div');
2122
+ balloon.className = 'balloon';
2123
+
2124
+ // Random colors
2125
+ const colors = [
2126
+ 'rgba(0, 243, 255, 0.8)', // Cyan
2127
+ 'rgba(157, 0, 255, 0.8)', // Purple
2128
+ 'rgba(255, 0, 255, 0.8)', // Pink
2129
+ 'rgba(0, 255, 157, 0.8)', // Green
2130
+ 'rgba(255, 214, 0, 0.8)' // Yellow
2131
+ ];
2132
+
2133
+ const color = colors[Math.floor(Math.random() * colors.length)];
2134
+ balloon.style.background = `radial-gradient(circle at 30% 30%, ${color}, rgba(0,0,0,0.3))`;
2135
+ balloon.style.left = `${Math.random() * 100}%`;
2136
+ balloon.style.animationDelay = `${index * 0.1}s`;
2137
+ balloon.style.width = `${Math.random() * 30 + 30}px`;
2138
+ balloon.style.height = `${Math.random() * 40 + 40}px`;
2139
+
2140
+ container.appendChild(balloon);
2141
+
2142
+ // Remove after animation
2143
+ setTimeout(() => {
2144
+ if (balloon.parentNode) {
2145
+ balloon.remove();
2146
+ }
2147
+ }, 8000);
2148
+ }
2149
+
2150
+ function createBubble(index) {
2151
+ const container = document.getElementById('celebrationContainer');
2152
+ const bubble = document.createElement('div');
2153
+ bubble.className = 'bubble';
2154
+
2155
+ bubble.style.left = `${Math.random() * 100}%`;
2156
+ bubble.style.animationDelay = `${index * 0.2}s`;
2157
+ bubble.style.width = `${Math.random() * 20 + 20}px`;
2158
+ bubble.style.height = bubble.style.width;
2159
+
2160
+ container.appendChild(bubble);
2161
+
2162
+ setTimeout(() => {
2163
+ if (bubble.parentNode) {
2164
+ bubble.remove();
2165
+ }
2166
+ }, 6000);
2167
+ }
2168
+
2169
+ function createConfetti(index) {
2170
+ const container = document.getElementById('celebrationContainer');
2171
+ const confetti = document.createElement('div');
2172
+ confetti.className = 'confetti';
2173
+
2174
+ const colors = [
2175
+ 'var(--primary)',
2176
+ 'var(--secondary)',
2177
+ 'var(--accent)',
2178
+ 'var(--success)',
2179
+ 'var(--warning)'
2180
+ ];
2181
+
2182
+ confetti.style.background = colors[Math.floor(Math.random() * colors.length)];
2183
+ confetti.style.left = `${Math.random() * 100}%`;
2184
+ confetti.style.animationDelay = `${Math.random() * 1}s`;
2185
+ confetti.style.width = `${Math.random() * 8 + 4}px`;
2186
+ confetti.style.height = confetti.style.width;
2187
+
2188
+ container.appendChild(confetti);
2189
+
2190
+ setTimeout(() => {
2191
+ if (confetti.parentNode) {
2192
+ confetti.remove();
2193
+ }
2194
+ }, 3000);
2195
+ }
2196
+
2197
  // ========== VISUALIZATION ENGINE ==========
2198
  function initVisualization() {
2199
  const neuronGrid = document.getElementById('neuronGrid');
 
2500
  AppState.isCorrect = true;
2501
  AppState.isFirstTry = AppState.attempts === 1 && AppState.hintsUsed === 0;
2502
 
2503
+ // Play sound effect
2504
+ if (AppState.isFirstTry) {
2505
+ playSound('perfect');
2506
+ } else {
2507
+ playSound('ding');
2508
+ }
2509
+
2510
+ // Create visual celebration
2511
+ if (document.getElementById('animationsCheck')?.checked) {
2512
+ createCelebration(AppState.isFirstTry);
2513
+ }
2514
+
2515
  // Calculate points
2516
  let points = 0;
2517
  if (AppState.isFirstTry) {
 
2585
  AppState.streak = 0;
2586
  AppState.performance.currentStreak = 0;
2587
 
2588
+ // Play try again sound
2589
+ playSound('tryAgain');
2590
+
2591
  showFeedback('❌ Incorrect. Try again.', 'incorrect');
2592
  document.getElementById('wordDisplay').classList.add('incorrect');
2593