Spaces:
Running
Running
Update index.html
Browse files- index.html +75 -18
index.html
CHANGED
|
@@ -48,13 +48,14 @@
|
|
| 48 |
}
|
| 49 |
.container { max-width: 820px; width: 100%; }
|
| 50 |
|
|
|
|
| 51 |
header {
|
| 52 |
-
position: relative;
|
| 53 |
text-align: center;
|
| 54 |
margin-bottom: 2.5rem;
|
| 55 |
-
padding: 2rem 0;
|
| 56 |
animation: fadeIn 0.8s 0.1s ease-out backwards;
|
| 57 |
-
overflow: hidden;
|
| 58 |
}
|
| 59 |
#neural-network-canvas {
|
| 60 |
position: absolute;
|
|
@@ -62,12 +63,13 @@
|
|
| 62 |
left: 0;
|
| 63 |
width: 100%;
|
| 64 |
height: 100%;
|
| 65 |
-
z-index: 1;
|
| 66 |
}
|
| 67 |
h1, .subtitle {
|
| 68 |
-
position: relative;
|
| 69 |
z-index: 2;
|
| 70 |
}
|
|
|
|
| 71 |
|
| 72 |
h1 {
|
| 73 |
font-size: 2.8rem;
|
|
@@ -234,7 +236,7 @@
|
|
| 234 |
</header>
|
| 235 |
|
| 236 |
<main>
|
| 237 |
-
<!-- ...
|
| 238 |
<div class="form-group">
|
| 239 |
<div class="form-label">
|
| 240 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4Z"/></svg>
|
|
@@ -250,6 +252,7 @@
|
|
| 250 |
</label>
|
| 251 |
<input type="file" id="file-input" accept="image/*" hidden>
|
| 252 |
</div>
|
|
|
|
| 253 |
<div class="form-group">
|
| 254 |
<label for="prompt-input" class="form-label">
|
| 255 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"/><path d="m15 5 4 4"/></svg>
|
|
@@ -263,6 +266,7 @@
|
|
| 263 |
</button>
|
| 264 |
<p id="error-message"></p>
|
| 265 |
</div>
|
|
|
|
| 266 |
<div class="form-group">
|
| 267 |
<div class="form-label">
|
| 268 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 3L12 8L17 10L12 12L10 17L8 12L3 10L8 8L10 3z"/><path d="M21 14l-1.5 3-3-1.5 3-3 1.5 3z"/><path d="M19.5 2.5l-3 1.5 1.5 3 3-1.5-1.5-3z"/></svg>
|
|
@@ -280,6 +284,7 @@
|
|
| 280 |
</div>
|
| 281 |
</div>
|
| 282 |
</main>
|
|
|
|
| 283 |
<section class="gallery-section">
|
| 284 |
<div class="gallery-header">
|
| 285 |
<div class="form-label">
|
|
@@ -294,6 +299,7 @@
|
|
| 294 |
<div id="history-grid"></div>
|
| 295 |
</section>
|
| 296 |
</div>
|
|
|
|
| 297 |
<div id="lightbox">
|
| 298 |
<div id="lightbox-content">
|
| 299 |
<img id="lightbox-img" src="">
|
|
@@ -307,6 +313,7 @@
|
|
| 307 |
</button>
|
| 308 |
</div>
|
| 309 |
</div>
|
|
|
|
| 310 |
<div id="confirmation-modal">
|
| 311 |
<div class="modal-dialog">
|
| 312 |
<div class="modal-icon">
|
|
@@ -326,25 +333,75 @@
|
|
| 326 |
<script>
|
| 327 |
// --- Application Logic Script (Unchanged) ---
|
| 328 |
const API_URL = 'https://alfa-editor-worker.onrender.com/api/edit';
|
| 329 |
-
const uploadArea = document.getElementById('upload-area');
|
| 330 |
-
|
| 331 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 332 |
document.addEventListener('DOMContentLoaded', () => { renderHistory(); checkFormState(); });
|
| 333 |
-
removeFileBtn.addEventListener('click', (e) => { e.preventDefault(); e.stopPropagation(); resetUploader(); });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
submitBtn.addEventListener('click', async () => { if (submitBtn.disabled) return; setLoading(true); const formData = new FormData(); formData.append('image', uploadedFile); formData.append('prompt', promptInput.value.trim()); try { const response = await fetch(API_URL, { method: 'POST', body: formData }); if (!response.ok) { const errorData = await response.json().catch(() => ({ error: `خطای سرور: ${response.statusText}` })); throw new Error(errorData.error || `یک خطای ناشناخته رخ داد.`); } const result = await response.json(); if (result.image_urls && Array.isArray(result.image_urls) && result.image_urls.length > 0) { displayResult(result.image_urls); addToHistory({ prompt: promptInput.value.trim(), urls: result.image_urls }); } else { throw new Error('پاسخ معتبری از سرور دریافت نشد.'); } } catch (error) { displayError(error.message); } finally { setLoading(false); } });
|
| 335 |
-
lightboxClose.addEventListener('click', closeLightbox);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 336 |
</script>
|
| 337 |
|
| 338 |
<script>
|
| 339 |
-
// --- Header Animation Script (
|
| 340 |
document.addEventListener('DOMContentLoaded', () => {
|
| 341 |
const canvas = document.getElementById('neural-network-canvas');
|
| 342 |
const header = canvas.parentElement;
|
| 343 |
const ctx = canvas.getContext('2d');
|
| 344 |
|
| 345 |
let particles = [];
|
| 346 |
-
const particleCount =
|
| 347 |
-
const maxDistance =
|
| 348 |
|
| 349 |
const computedStyles = getComputedStyle(document.documentElement);
|
| 350 |
const particleColor = computedStyles.getPropertyValue('--accent-primary').trim();
|
|
@@ -360,9 +417,9 @@
|
|
| 360 |
constructor() {
|
| 361 |
this.x = Math.random() * canvas.width;
|
| 362 |
this.y = Math.random() * canvas.height;
|
| 363 |
-
this.vx = (Math.random() - 0.5) * 0.3; //
|
| 364 |
-
this.vy = (Math.random() - 0.5) * 0.3; //
|
| 365 |
-
this.radius = 1.
|
| 366 |
}
|
| 367 |
update() {
|
| 368 |
this.x += this.vx;
|
|
@@ -397,7 +454,7 @@
|
|
| 397 |
ctx.moveTo(particles[i].x, particles[i].y);
|
| 398 |
ctx.lineTo(particles[j].x, particles[j].y);
|
| 399 |
ctx.strokeStyle = lineColor;
|
| 400 |
-
ctx.lineWidth = 0.
|
| 401 |
ctx.globalAlpha = 1 - distance / maxDistance;
|
| 402 |
ctx.stroke();
|
| 403 |
}
|
|
|
|
| 48 |
}
|
| 49 |
.container { max-width: 820px; width: 100%; }
|
| 50 |
|
| 51 |
+
/* START: Changes for Header Animation */
|
| 52 |
header {
|
| 53 |
+
position: relative; /* Required for positioning the canvas */
|
| 54 |
text-align: center;
|
| 55 |
margin-bottom: 2.5rem;
|
| 56 |
+
padding: 2rem 0; /* Add some padding for the animation to breathe */
|
| 57 |
animation: fadeIn 0.8s 0.1s ease-out backwards;
|
| 58 |
+
overflow: hidden; /* Keeps particles inside the header */
|
| 59 |
}
|
| 60 |
#neural-network-canvas {
|
| 61 |
position: absolute;
|
|
|
|
| 63 |
left: 0;
|
| 64 |
width: 100%;
|
| 65 |
height: 100%;
|
| 66 |
+
z-index: 1; /* Behind the text */
|
| 67 |
}
|
| 68 |
h1, .subtitle {
|
| 69 |
+
position: relative; /* To ensure they stay on top of the canvas */
|
| 70 |
z-index: 2;
|
| 71 |
}
|
| 72 |
+
/* END: Changes for Header Animation */
|
| 73 |
|
| 74 |
h1 {
|
| 75 |
font-size: 2.8rem;
|
|
|
|
| 236 |
</header>
|
| 237 |
|
| 238 |
<main>
|
| 239 |
+
<!-- ... (The rest of your main content remains unchanged) ... -->
|
| 240 |
<div class="form-group">
|
| 241 |
<div class="form-label">
|
| 242 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4Z"/></svg>
|
|
|
|
| 252 |
</label>
|
| 253 |
<input type="file" id="file-input" accept="image/*" hidden>
|
| 254 |
</div>
|
| 255 |
+
|
| 256 |
<div class="form-group">
|
| 257 |
<label for="prompt-input" class="form-label">
|
| 258 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"/><path d="m15 5 4 4"/></svg>
|
|
|
|
| 266 |
</button>
|
| 267 |
<p id="error-message"></p>
|
| 268 |
</div>
|
| 269 |
+
|
| 270 |
<div class="form-group">
|
| 271 |
<div class="form-label">
|
| 272 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 3L12 8L17 10L12 12L10 17L8 12L3 10L8 8L10 3z"/><path d="M21 14l-1.5 3-3-1.5 3-3 1.5 3z"/><path d="M19.5 2.5l-3 1.5 1.5 3 3-1.5-1.5-3z"/></svg>
|
|
|
|
| 284 |
</div>
|
| 285 |
</div>
|
| 286 |
</main>
|
| 287 |
+
|
| 288 |
<section class="gallery-section">
|
| 289 |
<div class="gallery-header">
|
| 290 |
<div class="form-label">
|
|
|
|
| 299 |
<div id="history-grid"></div>
|
| 300 |
</section>
|
| 301 |
</div>
|
| 302 |
+
|
| 303 |
<div id="lightbox">
|
| 304 |
<div id="lightbox-content">
|
| 305 |
<img id="lightbox-img" src="">
|
|
|
|
| 313 |
</button>
|
| 314 |
</div>
|
| 315 |
</div>
|
| 316 |
+
|
| 317 |
<div id="confirmation-modal">
|
| 318 |
<div class="modal-dialog">
|
| 319 |
<div class="modal-icon">
|
|
|
|
| 333 |
<script>
|
| 334 |
// --- Application Logic Script (Unchanged) ---
|
| 335 |
const API_URL = 'https://alfa-editor-worker.onrender.com/api/edit';
|
| 336 |
+
const uploadArea = document.getElementById('upload-area');
|
| 337 |
+
const fileInput = document.getElementById('file-input');
|
| 338 |
+
const previewImage = document.getElementById('preview-image-main');
|
| 339 |
+
const removeFileBtn = document.getElementById('remove-file-btn-main');
|
| 340 |
+
const promptInput = document.getElementById('prompt-input');
|
| 341 |
+
const submitBtn = document.getElementById('submit-btn');
|
| 342 |
+
const resultContainer = document.getElementById('result-container');
|
| 343 |
+
const resultGrid = document.getElementById('result-grid');
|
| 344 |
+
const errorMessage = document.getElementById('error-message');
|
| 345 |
+
const lightbox = document.getElementById('lightbox');
|
| 346 |
+
const lightboxImg = document.getElementById('lightbox-img');
|
| 347 |
+
const lightboxClose = document.getElementById('lightbox-close');
|
| 348 |
+
const lightboxDownload = document.getElementById('lightbox-download');
|
| 349 |
+
const lightboxNext = document.getElementById('lightbox-next');
|
| 350 |
+
const historyGrid = document.getElementById('history-grid');
|
| 351 |
+
const clearHistoryBtn = document.getElementById('clear-history-btn');
|
| 352 |
+
const confirmationModal = document.getElementById('confirmation-modal');
|
| 353 |
+
const modalMessageText = document.getElementById('modal-message-text');
|
| 354 |
+
const modalConfirmBtn = document.getElementById('modal-confirm-btn');
|
| 355 |
+
const modalCancelBtn = document.getElementById('modal-cancel-btn');
|
| 356 |
+
let uploadedFile = null;
|
| 357 |
+
let currentLightboxUrl = null;
|
| 358 |
+
let currentLightboxGroup = [];
|
| 359 |
+
let currentLightboxIndex = 0;
|
| 360 |
+
const showConfirmationModal = (message, onConfirm) => { modalMessageText.textContent = message; confirmationModal.classList.add('visible'); modalConfirmBtn.onclick = () => { onConfirm(); hideConfirmationModal(); }; modalCancelBtn.onclick = () => { hideConfirmationModal(); }; };
|
| 361 |
+
const hideConfirmationModal = () => { confirmationModal.classList.remove('visible'); modalConfirmBtn.onclick = null; modalCancelBtn.onclick = null; };
|
| 362 |
+
const resetUploader = () => { uploadedFile = null; fileInput.value = ''; previewImage.src = ''; uploadArea.classList.remove('has-file'); checkFormState(); };
|
| 363 |
+
const handleFile = (file) => { if (!file || !file.type.startsWith('image/')) { displayError('لطفا یک فایل تصویری معتبر انتخاب کنید.'); return; } uploadedFile = file; const reader = new FileReader(); reader.onload = (e) => { previewImage.src = e.target.result; }; reader.readAsDataURL(file); uploadArea.classList.add('has-file'); checkFormState(); clearResult(); };
|
| 364 |
+
const checkFormState = () => { submitBtn.disabled = !uploadedFile || promptInput.value.trim() === ''; };
|
| 365 |
+
const setLoading = (isLoading) => { const btnSpinner = submitBtn.querySelector('.spinner'); const btnText = document.getElementById('btn-text'); const btnIcon = submitBtn.querySelector('svg'); if (isLoading) { resultContainer.classList.remove('has-content'); resultContainer.classList.add('loading'); btnSpinner.style.display = 'inline-block'; btnIcon.style.display = 'none'; btnText.textContent = 'در حال پردازش...'; submitBtn.disabled = true; resultGrid.innerHTML = ''; errorMessage.style.display = 'none'; } else { resultContainer.classList.remove('loading'); btnSpinner.style.display = 'none'; btnIcon.style.display = 'inline-block'; btnText.textContent = 'خلق کن'; checkFormState(); } };
|
| 366 |
+
const displayResult = (imageUrls) => { resultGrid.innerHTML = ''; imageUrls.forEach((url) => { const img = document.createElement('img'); img.src = url; img.alt = 'تصویر ویرایش شده'; img.addEventListener('click', () => openLightbox(url, imageUrls)); resultGrid.appendChild(img); }); resultContainer.classList.add('has-content'); };
|
| 367 |
+
const clearResult = () => { resultGrid.innerHTML = ''; errorMessage.style.display = 'none'; resultContainer.classList.remove('has-content'); };
|
| 368 |
+
const displayError = (message) => { errorMessage.textContent = message; errorMessage.style.display = 'block'; };
|
| 369 |
+
const updateLightboxImage = () => { const newUrl = currentLightboxGroup[currentLightboxIndex]; lightboxImg.src = newUrl; currentLightboxUrl = newUrl; };
|
| 370 |
+
const openLightbox = (clickedUrl, urlGroup) => { currentLightboxGroup = urlGroup; currentLightboxIndex = urlGroup.indexOf(clickedUrl); updateLightboxImage(); lightboxNext.style.display = urlGroup.length > 1 ? 'flex' : 'none'; lightbox.classList.add('visible'); };
|
| 371 |
+
const closeLightbox = () => { lightbox.classList.remove('visible'); currentLightboxGroup = []; };
|
| 372 |
+
const handleDownload = async () => { if (!currentLightboxUrl) return; const spinner = lightboxDownload.querySelector('.spinner'); const icon = lightboxDownload.querySelector('svg'); spinner.style.display = 'block'; icon.style.display = 'none'; lightboxDownload.disabled = true; try { const response = await fetch(currentLightboxUrl); if (!response.ok) throw new Error('Network response was not ok.'); const blob = await response.blob(); const objectUrl = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = objectUrl; a.download = `ai-edited-image-${Date.now()}.png`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(objectUrl); } catch (e) { console.error('Download failed:', e); alert('خطا در دانلود تصویر. لطفا دوباره تلاش کنید.'); } finally { spinner.style.display = 'none'; icon.style.display = 'block'; lightboxDownload.disabled = false; } };
|
| 373 |
+
const getHistory = () => JSON.parse(localStorage.getItem('aiPhotoshopHistory') || '[]');
|
| 374 |
+
const saveHistory = (history) => { localStorage.setItem('aiPhotoshopHistory', JSON.stringify(history)); renderHistory(); };
|
| 375 |
+
const addToHistory = (item) => { let history = getHistory(); history.unshift(item); if (history.length > 15) history.pop(); saveHistory(history); };
|
| 376 |
+
const handleClearHistory = () => { showConfirmationModal('آیا از پاک کردن تمام تاریخچه مطمئن هستید؟ این عمل غیرقابل بازگشت است.', () => { saveHistory([]); }); };
|
| 377 |
+
const handleDeleteItem = (index) => { showConfirmationModal('آیا از حذف این مورد از تاریخچه مطمئن هستید؟', () => { let history = getHistory(); history.splice(index, 1); saveHistory(history); }); };
|
| 378 |
+
const renderHistory = () => { const history = getHistory(); historyGrid.innerHTML = ''; clearHistoryBtn.style.display = history.length > 0 ? 'flex' : 'none'; history.forEach((item, index) => { const card = document.createElement('div'); card.className = 'history-item'; const deleteBtn = document.createElement('button'); deleteBtn.className = 'history-delete-btn'; deleteBtn.title = 'حذف این مورد'; deleteBtn.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>`; deleteBtn.onclick = () => handleDeleteItem(index); card.appendChild(deleteBtn); const imageGrid = document.createElement('div'); imageGrid.className = 'history-item-grid'; item.urls.forEach(url => { const img = document.createElement('img'); img.src = url; img.alt = 'تصویر از تاریخچه'; img.addEventListener('click', () => openLightbox(url, item.urls)); imageGrid.appendChild(img); }); card.appendChild(imageGrid); historyGrid.appendChild(card); }); };
|
| 379 |
document.addEventListener('DOMContentLoaded', () => { renderHistory(); checkFormState(); });
|
| 380 |
+
removeFileBtn.addEventListener('click', (e) => { e.preventDefault(); e.stopPropagation(); resetUploader(); });
|
| 381 |
+
fileInput.addEventListener('change', (e) => handleFile(e.target.files[0]));
|
| 382 |
+
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(e => { uploadArea.addEventListener(e, p => { p.preventDefault(); p.stopPropagation(); }); });
|
| 383 |
+
['dragenter', 'dragover'].forEach(e => { uploadArea.addEventListener(e, () => { if (!uploadArea.classList.contains('has-file')) uploadArea.classList.add('drag-over'); }); });
|
| 384 |
+
['dragleave', 'drop'].forEach(e => { uploadArea.addEventListener(e, () => uploadArea.classList.remove('drag-over')); });
|
| 385 |
+
uploadArea.addEventListener('drop', e => { if (!uploadArea.classList.contains('has-file')) handleFile(e.dataTransfer.files[0]); });
|
| 386 |
+
promptInput.addEventListener('input', checkFormState);
|
| 387 |
submitBtn.addEventListener('click', async () => { if (submitBtn.disabled) return; setLoading(true); const formData = new FormData(); formData.append('image', uploadedFile); formData.append('prompt', promptInput.value.trim()); try { const response = await fetch(API_URL, { method: 'POST', body: formData }); if (!response.ok) { const errorData = await response.json().catch(() => ({ error: `خطای سرور: ${response.statusText}` })); throw new Error(errorData.error || `یک خطای ناشناخته رخ داد.`); } const result = await response.json(); if (result.image_urls && Array.isArray(result.image_urls) && result.image_urls.length > 0) { displayResult(result.image_urls); addToHistory({ prompt: promptInput.value.trim(), urls: result.image_urls }); } else { throw new Error('پاسخ معتبری از سرور دریافت نشد.'); } } catch (error) { displayError(error.message); } finally { setLoading(false); } });
|
| 388 |
+
lightboxClose.addEventListener('click', closeLightbox);
|
| 389 |
+
lightbox.addEventListener('click', (e) => { if (e.target === lightbox) closeLightbox(); });
|
| 390 |
+
lightboxDownload.addEventListener('click', handleDownload);
|
| 391 |
+
lightboxNext.addEventListener('click', () => { currentLightboxIndex = (currentLightboxIndex + 1) % currentLightboxGroup.length; updateLightboxImage(); });
|
| 392 |
+
clearHistoryBtn.addEventListener('click', handleClearHistory);
|
| 393 |
</script>
|
| 394 |
|
| 395 |
<script>
|
| 396 |
+
// --- Header Animation Script (Modified for less crowded effect) ---
|
| 397 |
document.addEventListener('DOMContentLoaded', () => {
|
| 398 |
const canvas = document.getElementById('neural-network-canvas');
|
| 399 |
const header = canvas.parentElement;
|
| 400 |
const ctx = canvas.getContext('2d');
|
| 401 |
|
| 402 |
let particles = [];
|
| 403 |
+
const particleCount = 35; // Reduced particle count
|
| 404 |
+
const maxDistance = 150; // Increased connection distance
|
| 405 |
|
| 406 |
const computedStyles = getComputedStyle(document.documentElement);
|
| 407 |
const particleColor = computedStyles.getPropertyValue('--accent-primary').trim();
|
|
|
|
| 417 |
constructor() {
|
| 418 |
this.x = Math.random() * canvas.width;
|
| 419 |
this.y = Math.random() * canvas.height;
|
| 420 |
+
this.vx = (Math.random() - 0.5) * 0.3; // Slower speed
|
| 421 |
+
this.vy = (Math.random() - 0.5) * 0.3; // Slower speed
|
| 422 |
+
this.radius = 1.5;
|
| 423 |
}
|
| 424 |
update() {
|
| 425 |
this.x += this.vx;
|
|
|
|
| 454 |
ctx.moveTo(particles[i].x, particles[i].y);
|
| 455 |
ctx.lineTo(particles[j].x, particles[j].y);
|
| 456 |
ctx.strokeStyle = lineColor;
|
| 457 |
+
ctx.lineWidth = 0.3; // Thinner lines
|
| 458 |
ctx.globalAlpha = 1 - distance / maxDistance;
|
| 459 |
ctx.stroke();
|
| 460 |
}
|