Mankeysocks commited on
Commit
6fb5614
·
verified ·
1 Parent(s): b1a4b88

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +51 -47
index.html CHANGED
@@ -360,55 +360,59 @@
360
  }
361
 
362
  // Create blips on the radar
363
- function createBlips() {
364
- const numBlips = 5;
365
- const minAngleDiff = 12;
366
- const maxAttempts = 100;
367
- let placed = 0;
368
- let attempts = 0;
369
-
370
- while (placed < numBlips && attempts < maxAttempts) {
371
- const angle = Math.random() * 360;
372
- const distance = 0.3 + Math.random() * 0.5;
373
-
374
- // 🔄 Convert angle so is top (12 o'clock)
375
- const angleRad = (angle - 90) * Math.PI / 180;
376
- const x = 160 + 160 * distance * Math.cos(angleRad);
377
- const y = 160 + 160 * distance * Math.sin(angleRad);
378
-
379
- let tooClose = blips.some(b => {
380
- const a1 = b.angle;
381
- const a2 = angle;
382
- const diff = Math.abs(a1 - a2);
383
- const angleDiff = Math.min(diff, 360 - diff);
384
- return angleDiff < minAngleDiff;
385
- });
386
-
387
- if (!tooClose) {
388
- const blip = document.createElement('div');
389
- blip.className = 'blip';
390
- blip.style.left = `${x}px`;
391
- blip.style.top = `${y}px`;
392
- blip.dataset.angle = angle;
393
-
394
- blipsContainer.appendChild(blip);
395
- blips.push({
396
- element: blip,
397
- angle: angle,
398
- locked: false
399
- });
400
-
401
- placed++;
402
- }
403
-
404
- attempts++;
405
- }
406
-
407
- if (attempts >= maxAttempts) {
408
- console.warn("Max attempts reached. Could not place all blips.");
409
- }
410
  }
411
 
 
 
 
 
412
 
413
  // Update the sweep line rotation
414
  function updateSweep() {
 
360
  }
361
 
362
  // Create blips on the radar
363
+ function createBlips() {
364
+ const numBlips = 5;
365
+ const minAngleDiff = 12; // Minimum angle difference between blips
366
+ const maxAttempts = 5; // Prevent infinite loop
367
+
368
+ let placed = 0;
369
+ let attempts = 0;
370
+
371
+ while (placed < numBlips && attempts < maxAttempts) {
372
+ const angle = Math.random() * 360;
373
+ const distance = 0.3 + Math.random() * 0.5;
374
+ const x = 160 + 160 * distance * Math.cos(angle * Math.PI / 180);
375
+ const y = 160 + 160 * distance * Math.sin(angle * Math.PI / 180);
376
+
377
+ // Check angular distance from existing blips
378
+ let tooClose = blips.some(blip => {
379
+ const diff = Math.abs(blip.angle - angle);
380
+ const angleDiff = Math.min(diff, 360 - diff); // handle wraparound
381
+ return angleDiff < minAngleDiff;
382
+ });
383
+
384
+ if (!tooClose) {
385
+ const blip = document.createElement('div');
386
+ blip.className = 'blip';
387
+ blip.style.left = x + 'px';
388
+ blip.style.top = y + 'px';
389
+ blip.dataset.angle = angle;
390
+
391
+ blipsContainer.appendChild(blip);
392
+ blips.push({
393
+ element: blip,
394
+ angle: angle,
395
+ locked: false
396
+ });
397
+
398
+ placed++;
399
+
400
+
401
+
402
+
403
+
404
+
405
+
406
+
407
+
408
+
409
+
410
  }
411
 
412
+ attempts++;
413
+ }
414
+ }
415
+
416
 
417
  // Update the sweep line rotation
418
  function updateSweep() {