r0cketboy commited on
Commit
3d5605e
·
verified ·
1 Parent(s): 21ea3d5

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +26 -129
index.html CHANGED
@@ -53,7 +53,6 @@
53
  justify-content: center;
54
  gap: 0;
55
  line-height: 1.2;
56
- cursor: none;
57
  }
58
 
59
  .ascii-row {
@@ -69,7 +68,7 @@
69
  justify-content: center;
70
  font-size: clamp(8px, 2vw, 16px);
71
  color: #fff;
72
- transition: transform 0.15s ease-out, text-shadow 0.15s ease-out;
73
  }
74
 
75
  @media (max-width: 768px) {
@@ -104,11 +103,6 @@
104
  let cols, rows;
105
  let grid = [];
106
  let time = 0;
107
- let mouseX = -1000;
108
- let mouseY = -1000;
109
- let targetMouseX = -1000;
110
- let targetMouseY = -1000;
111
- let isMouseInside = false;
112
 
113
  function calculateGridSize() {
114
  const charWidth = Math.max(8, Math.min(16, window.innerWidth * 0.02));
@@ -143,114 +137,62 @@
143
  rowData.push({
144
  element: charSpan,
145
  baseChar: getRandomChar(),
146
- changeTimer: Math.random() * 100,
147
- x: 0,
148
- y: 0
149
  });
150
  }
151
 
152
  container.appendChild(row);
153
  grid.push(rowData);
154
  }
155
-
156
- // Calculate positions after grid is created
157
- updateCellPositions();
158
- }
159
-
160
- function updateCellPositions() {
161
- for (let y = 0; y < rows; y++) {
162
- for (let x = 0; x < cols; x++) {
163
- const cell = grid[y][x];
164
- const rect = cell.element.getBoundingClientRect();
165
- cell.x = rect.left + rect.width / 2;
166
- cell.y = rect.top + rect.height / 2;
167
- }
168
- }
169
  }
170
 
171
  function animate() {
172
- time += 0.03;
173
-
174
- // Smooth mouse following
175
- mouseX += (targetMouseX - mouseX) * 0.15;
176
- mouseY += (targetMouseY - mouseY) * 0.15;
177
 
178
  for (let y = 0; y < rows; y++) {
179
  for (let x = 0; x < cols; x++) {
180
  const cell = grid[y][x];
181
 
182
- // Multiple wave patterns combined
183
- const wave1 = Math.sin(x * 0.1 + time) * 0.5;
184
- const wave2 = Math.sin(y * 0.08 + time * 1.3) * 0.3;
185
- const wave3 = Math.sin((x + y) * 0.05 + time * 0.7) * 0.4;
186
- const wave4 = Math.cos(x * 0.15 - time * 0.5) * Math.sin(y * 0.12 + time * 0.8) * 0.3;
187
 
188
- // Radial wave from center
189
  const centerX = cols / 2;
190
  const centerY = rows / 2;
191
  const distFromCenter = Math.sqrt((x - centerX) ** 2 + (y - centerY) ** 2);
192
- const radialWave = Math.sin(distFromCenter * 0.15 - time * 2) * 0.4;
193
-
194
- let combinedWave = wave1 + wave2 + wave3 + wave4 + radialWave;
195
-
196
- // Mouse interaction
197
- let mouseInfluence = 0;
198
- let pushX = 0;
199
- let pushY = 0;
200
-
201
- if (isMouseInside) {
202
- const dx = cell.x - mouseX;
203
- const dy = cell.y - mouseY;
204
- const distance = Math.sqrt(dx * dx + dy * dy);
205
- const maxDistance = 150;
206
-
207
- if (distance < maxDistance) {
208
- const strength = 1 - (distance / maxDistance);
209
- mouseInfluence = strength * strength;
210
-
211
- // Push characters away from mouse
212
- const angle = Math.atan2(dy, dx);
213
- const pushStrength = mouseInfluence * 20;
214
- pushX = Math.cos(angle) * pushStrength;
215
- pushY = Math.sin(angle) * pushStrength;
216
-
217
- // Add ripple effect around mouse
218
- combinedWave += Math.sin(distance * 0.1 - time * 4) * mouseInfluence * 0.8;
219
- }
220
- }
221
 
222
- // Calculate brightness based on wave and mouse
 
 
223
  const baseBrightness = 0.2 + (combinedWave + 1) * 0.3;
224
- const brightness = Math.min(1, baseBrightness + mouseInfluence * 0.8);
225
 
226
  // Apply transformations
227
- const baseScale = 0.7 + (combinedWave + 1) * 0.25;
228
- const scale = baseScale + mouseInfluence * 0.5;
229
- const translateY = combinedWave * 5 + pushY;
230
- const translateX = pushX;
231
 
232
  // White color with varying opacity
233
  const alpha = Math.max(0.15, Math.min(1, brightness));
234
  cell.element.style.color = `rgba(255, 255, 255, ${alpha})`;
235
- cell.element.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scale})`;
236
-
237
- // Add glow effect near mouse
238
- if (mouseInfluence > 0.3) {
239
- const glowIntensity = mouseInfluence * 15;
240
- cell.element.style.textShadow = `0 0 ${glowIntensity}px rgba(255, 255, 255, ${mouseInfluence})`;
241
- } else {
242
- cell.element.style.textShadow = 'none';
243
- }
244
 
245
- // Randomly change characters
246
- cell.changeTimer += 0.1 + mouseInfluence * 0.5;
247
- if (cell.changeTimer > 50 + Math.random() * 100) {
248
  cell.element.textContent = getRandomChar();
249
  cell.changeTimer = 0;
250
  }
251
 
252
- // More frequent changes at wave peaks and near mouse
253
- if ((combinedWave > 0.8 || mouseInfluence > 0.5) && Math.random() < 0.15) {
254
  cell.element.textContent = getRandomChar();
255
  }
256
  }
@@ -265,48 +207,6 @@
265
  animate();
266
  }
267
 
268
- // Mouse event handlers
269
- document.addEventListener('mousemove', (e) => {
270
- targetMouseX = e.clientX;
271
- targetMouseY = e.clientY;
272
- isMouseInside = true;
273
- });
274
-
275
- document.addEventListener('mouseleave', () => {
276
- isMouseInside = false;
277
- targetMouseX = -1000;
278
- targetMouseY = -1000;
279
- });
280
-
281
- document.addEventListener('mouseenter', () => {
282
- isMouseInside = true;
283
- });
284
-
285
- // Touch support for mobile
286
- document.addEventListener('touchmove', (e) => {
287
- if (e.touches.length > 0) {
288
- targetMouseX = e.touches[0].clientX;
289
- targetMouseY = e.touches[0].clientY;
290
- isMouseInside = true;
291
- }
292
- });
293
-
294
- document.addEventListener('touchstart', (e) => {
295
- if (e.touches.length > 0) {
296
- targetMouseX = e.touches[0].clientX;
297
- targetMouseY = e.touches[0].clientY;
298
- mouseX = targetMouseX;
299
- mouseY = targetMouseY;
300
- isMouseInside = true;
301
- }
302
- });
303
-
304
- document.addEventListener('touchend', () => {
305
- isMouseInside = false;
306
- targetMouseX = -1000;
307
- targetMouseY = -1000;
308
- });
309
-
310
  // Handle window resize
311
  let resizeTimeout;
312
  window.addEventListener('resize', () => {
@@ -317,9 +217,6 @@
317
  }, 250);
318
  });
319
 
320
- // Update cell positions on scroll (if any)
321
- window.addEventListener('scroll', updateCellPositions);
322
-
323
  // Initialize
324
  init();
325
  </script>
 
53
  justify-content: center;
54
  gap: 0;
55
  line-height: 1.2;
 
56
  }
57
 
58
  .ascii-row {
 
68
  justify-content: center;
69
  font-size: clamp(8px, 2vw, 16px);
70
  color: #fff;
71
+ transition: transform 0.1s ease-out;
72
  }
73
 
74
  @media (max-width: 768px) {
 
103
  let cols, rows;
104
  let grid = [];
105
  let time = 0;
 
 
 
 
 
106
 
107
  function calculateGridSize() {
108
  const charWidth = Math.max(8, Math.min(16, window.innerWidth * 0.02));
 
137
  rowData.push({
138
  element: charSpan,
139
  baseChar: getRandomChar(),
140
+ changeTimer: Math.random() * 100
 
 
141
  });
142
  }
143
 
144
  container.appendChild(row);
145
  grid.push(rowData);
146
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  }
148
 
149
  function animate() {
150
+ // Increased time increment for faster animation (was 0.03)
151
+ time += 0.08;
 
 
 
152
 
153
  for (let y = 0; y < rows; y++) {
154
  for (let x = 0; x < cols; x++) {
155
  const cell = grid[y][x];
156
 
157
+ // Multiple wave patterns combined with faster multipliers
158
+ const wave1 = Math.sin(x * 0.1 + time * 2.5) * 0.5;
159
+ const wave2 = Math.sin(y * 0.08 + time * 3.2) * 0.3;
160
+ const wave3 = Math.sin((x + y) * 0.05 + time * 1.8) * 0.4;
161
+ const wave4 = Math.cos(x * 0.15 - time * 1.5) * Math.sin(y * 0.12 + time * 2) * 0.3;
162
 
163
+ // Radial wave from center - faster
164
  const centerX = cols / 2;
165
  const centerY = rows / 2;
166
  const distFromCenter = Math.sqrt((x - centerX) ** 2 + (y - centerY) ** 2);
167
+ const radialWave = Math.sin(distFromCenter * 0.15 - time * 5) * 0.4;
168
+
169
+ // Additional fast diagonal wave
170
+ const diagonalWave = Math.sin((x - y) * 0.08 + time * 4) * 0.25;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
 
172
+ let combinedWave = wave1 + wave2 + wave3 + wave4 + radialWave + diagonalWave;
173
+
174
+ // Calculate brightness based on wave
175
  const baseBrightness = 0.2 + (combinedWave + 1) * 0.3;
176
+ const brightness = Math.min(1, baseBrightness);
177
 
178
  // Apply transformations
179
+ const scale = 0.7 + (combinedWave + 1) * 0.25;
180
+ const translateY = combinedWave * 5;
 
 
181
 
182
  // White color with varying opacity
183
  const alpha = Math.max(0.15, Math.min(1, brightness));
184
  cell.element.style.color = `rgba(255, 255, 255, ${alpha})`;
185
+ cell.element.style.transform = `translateY(${translateY}px) scale(${scale})`;
 
 
 
 
 
 
 
 
186
 
187
+ // Randomly change characters - faster rate
188
+ cell.changeTimer += 0.15;
189
+ if (cell.changeTimer > 40 + Math.random() * 80) {
190
  cell.element.textContent = getRandomChar();
191
  cell.changeTimer = 0;
192
  }
193
 
194
+ // More frequent changes at wave peaks
195
+ if (combinedWave > 0.7 && Math.random() < 0.2) {
196
  cell.element.textContent = getRandomChar();
197
  }
198
  }
 
207
  animate();
208
  }
209
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  // Handle window resize
211
  let resizeTimeout;
212
  window.addEventListener('resize', () => {
 
217
  }, 250);
218
  });
219
 
 
 
 
220
  // Initialize
221
  init();
222
  </script>