Spaces:
Running
Running
Update index.html
Browse files- index.html +75 -133
index.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>AI Video Studio
|
| 7 |
<link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
| 8 |
<style>
|
| 9 |
:root {
|
|
@@ -35,7 +35,9 @@
|
|
| 35 |
|
| 36 |
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
|
| 37 |
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
|
| 38 |
-
@keyframes float { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-
|
|
|
|
|
|
|
| 39 |
|
| 40 |
body {
|
| 41 |
font-family: var(--app-font);
|
|
@@ -58,28 +60,35 @@
|
|
| 58 |
animation: fadeIn 0.8s 0.1s ease-out backwards;
|
| 59 |
overflow: hidden;
|
| 60 |
}
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
|
|
|
| 68 |
}
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
}
|
| 73 |
|
| 74 |
h1 {
|
| 75 |
font-size: 2.8rem;
|
| 76 |
font-weight: 800;
|
| 77 |
-
margin: 0
|
| 78 |
background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
|
| 79 |
-webkit-background-clip: text;
|
| 80 |
-webkit-text-fill-color: transparent;
|
| 81 |
letter-spacing: -1px;
|
| 82 |
-
animation: float 4s ease-in-out infinite;
|
| 83 |
}
|
| 84 |
.subtitle { font-size: 1.1rem; color: var(--text-secondary); margin-top: 0; }
|
| 85 |
|
|
@@ -140,10 +149,6 @@
|
|
| 140 |
#statusSection, #outputSection, #criticalErrorSection { display: none; width: 100%; }
|
| 141 |
#statusSection.active, #outputSection.active, #criticalErrorSection.active { display: block; animation: fadeIn 0.5s; }
|
| 142 |
|
| 143 |
-
/* Progress Bar Styling */
|
| 144 |
-
.film-timeline { height: 8px; background: var(--panel-border); border-radius: 4px; overflow: hidden; margin: 1rem 0; }
|
| 145 |
-
#progressBar { height: 100%; background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary)); transition: width 0.4s ease; border-radius: 4px; }
|
| 146 |
-
|
| 147 |
/* Status Messages Styling */
|
| 148 |
#statusMessages { max-height: 150px; overflow-y: auto; width: 100%; padding: 0.5rem; }
|
| 149 |
.status-message {
|
|
@@ -155,10 +160,10 @@
|
|
| 155 |
.status-message.error { border-left: 4px solid var(--danger-color); color: var(--danger-color); }
|
| 156 |
.status-icon { width: 18px; height: 18px; }
|
| 157 |
|
| 158 |
-
/* --- NEW LOADING ANIMATION
|
| 159 |
-
#aiLoader { align-items: center; justify-content: center; padding: 2rem 0;
|
| 160 |
.generator-container {
|
| 161 |
-
position: relative; width: 400px; max-width: 100%; height:
|
| 162 |
border: 2px solid #38bdf8; border-radius: 20px; overflow: hidden;
|
| 163 |
box-shadow: 0 0 40px rgba(56, 189, 248, 0.3);
|
| 164 |
animation: pulse-loader 5s infinite cubic-bezier(0.4, 0, 0.6, 1);
|
|
@@ -173,18 +178,18 @@
|
|
| 173 |
.noise-layer { background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect width="100" height="100" fill="none"/><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.5" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.6"/></svg>') repeat; opacity: 1; animation: fade-noise 7s infinite ease-in-out; }
|
| 174 |
@keyframes fade-noise { 0% { opacity: 1; filter: blur(5px); } 30% { opacity: 0.8; filter: blur(2px); } 100% { opacity: 0; filter: blur(0px); } }
|
| 175 |
.sketch-layer { filter: grayscale(1) contrast(1.5) blur(3px); opacity: 0; animation: reveal-sketch 7s infinite ease-in-out; }
|
| 176 |
-
@keyframes reveal-sketch { 0% { opacity: 0;
|
| 177 |
-
.building-layer { filter: blur(15px)
|
| 178 |
-
@keyframes denoise-color { 0% { opacity: 0;
|
| 179 |
.pixel-grid { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: repeating-linear-gradient(0deg, transparent 0 1px, rgba(255,255,255,0.1) 1px 2px), repeating-linear-gradient(90deg, transparent 0 1px, rgba(255,255,255,0.1) 1px 2px); opacity: 1; animation: dissolve-grid 7s infinite ease-in-out; }
|
| 180 |
@keyframes dissolve-grid { 0% { opacity: 1; } 70% { opacity: 0.5; } 100% { opacity: 0; } }
|
| 181 |
-
.particles { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, transparent 50%)
|
| 182 |
@keyframes flow-particles { 0% { transform: translate(0, 0) scale(1); opacity: 0.5; } 50% { transform: translate(10px, -15px) scale(1.05); opacity: 0.8; } 100% { transform: translate(0, 0) scale(1); opacity: 0.5; } }
|
| 183 |
-
.text-overlay { position: absolute; top:
|
| 184 |
-
@keyframes glow-text { 0% { opacity: 0.7;
|
| 185 |
-
.progress-bar { position: absolute; bottom: 0; left: 0; width: 0%; height: 6px; background: linear-gradient(to right, #38bdf8, #bb86fc, #facc15); animation: progress
|
| 186 |
-
@keyframes progress
|
| 187 |
-
/* --- END OF LOADING ANIMATION
|
| 188 |
|
| 189 |
/* Video Output Styling */
|
| 190 |
#outputVideo { width: 100%; max-width: 500px; border-radius: var(--radius-input); margin: 1rem auto; display: block; background-color: #000; box-shadow: var(--shadow-md); }
|
|
@@ -206,7 +211,7 @@
|
|
| 206 |
|
| 207 |
@media (max-width: 768px) {
|
| 208 |
main { padding: 1.5rem; } h1 { font-size: 2.2rem; }
|
| 209 |
-
.generator-container { height:
|
| 210 |
.text-overlay { font-size: 16px; }
|
| 211 |
}
|
| 212 |
</style>
|
|
@@ -214,8 +219,30 @@
|
|
| 214 |
<body>
|
| 215 |
<div class="container">
|
| 216 |
<header>
|
| 217 |
-
<
|
| 218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
<p class="subtitle">تصاویر خود را با قدرت هوش مصنوعی به ویدیو سینمایی تبدیل کنید</p>
|
| 220 |
</header>
|
| 221 |
|
|
@@ -256,17 +283,14 @@
|
|
| 256 |
|
| 257 |
<div id="statusSection">
|
| 258 |
<div id="statusMessages"></div>
|
| 259 |
-
|
| 260 |
-
<div id="progressBar" style="width: 0%"></div>
|
| 261 |
-
</div>
|
| 262 |
-
<div id="aiLoader" style="display: none;">
|
| 263 |
<div class="generator-container">
|
| 264 |
<div class="noise-layer"></div>
|
| 265 |
<div class="sketch-layer"></div>
|
| 266 |
<div class="building-layer"></div>
|
| 267 |
<div class="pixel-grid"></div>
|
| 268 |
<div class="particles"></div>
|
| 269 |
-
<div id="
|
| 270 |
<div class="progress-bar"></div>
|
| 271 |
</div>
|
| 272 |
</div>
|
|
@@ -301,7 +325,7 @@
|
|
| 301 |
</div>
|
| 302 |
|
| 303 |
<script>
|
| 304 |
-
// Main Application Logic (Unchanged)
|
| 305 |
(function() {
|
| 306 |
// DOM Elements
|
| 307 |
const resultContainer = document.getElementById('result-container');
|
|
@@ -319,8 +343,7 @@
|
|
| 319 |
const statusSection = document.getElementById('statusSection');
|
| 320 |
const statusMessagesDiv = document.getElementById('statusMessages');
|
| 321 |
const aiLoader = document.getElementById('aiLoader');
|
| 322 |
-
const
|
| 323 |
-
const progressBar = document.getElementById('progressBar');
|
| 324 |
const outputSection = document.getElementById('outputSection');
|
| 325 |
const btnRestart = document.getElementById('btnRestart');
|
| 326 |
const btnDownloadVideo = document.getElementById('btnDownloadVideo');
|
|
@@ -377,7 +400,8 @@
|
|
| 377 |
}
|
| 378 |
|
| 379 |
function setAiLoaderText(text) {
|
| 380 |
-
|
|
|
|
| 381 |
}
|
| 382 |
|
| 383 |
function addStatusMessage(message, type = 'info', isPersistent = false) {
|
|
@@ -405,7 +429,7 @@
|
|
| 405 |
|
| 406 |
function clearStatusMessages() {
|
| 407 |
statusMessagesDiv.innerHTML = '';
|
| 408 |
-
|
| 409 |
aiLoader.style.display = 'none';
|
| 410 |
|
| 411 |
if (outputVideo.src && outputVideo.src.startsWith('blob:')) {
|
|
@@ -505,7 +529,7 @@
|
|
| 505 |
async function uploadImageToServerForVideoOriginal(file) {
|
| 506 |
addStatusMessage('آمادهسازی تصویر برای آپلود...', 'info', true);
|
| 507 |
setAiLoaderText("در حال آماده سازی تصویر...");
|
| 508 |
-
aiLoader.style.display = '
|
| 509 |
|
| 510 |
const uploadId = generateRandomHash(12);
|
| 511 |
const formData = new FormData();
|
|
@@ -539,7 +563,7 @@
|
|
| 539 |
async function submitToVideoQueue(payload) {
|
| 540 |
addStatusMessage('ارسال درخواست ساخت ویدیو...', 'info', true);
|
| 541 |
setAiLoaderText("در حال ارسال درخواست ساخت ویدیو...");
|
| 542 |
-
aiLoader.style.display = '
|
| 543 |
try {
|
| 544 |
const response = await fetch(`${VIDEO_SPACE_URL_BASE}/queue/join`, {
|
| 545 |
method: 'POST',
|
|
@@ -557,7 +581,7 @@
|
|
| 557 |
function listenForVideoResults(eventId) {
|
| 558 |
addStatusMessage('در حال ساخت ویدیو...', 'info', true);
|
| 559 |
setAiLoaderText("هوش مصنوعی در حال پردازش...");
|
| 560 |
-
aiLoader.style.display = '
|
| 561 |
hideCriticalError();
|
| 562 |
statusSection.classList.add('active');
|
| 563 |
outputSection.classList.remove('active');
|
|
@@ -570,18 +594,18 @@
|
|
| 570 |
switch (data.msg) {
|
| 571 |
case "process_starts":
|
| 572 |
addStatusMessage('پردازش در سرور آغاز شد.', 'info');
|
| 573 |
-
|
| 574 |
break;
|
| 575 |
case "progress":
|
| 576 |
if (data.progress_data?.[0]) {
|
| 577 |
const progress = Math.round((data.progress_data[0].progress || 0) * 100);
|
| 578 |
-
|
| 579 |
}
|
| 580 |
break;
|
| 581 |
case "process_completed":
|
| 582 |
eventSource.close();
|
| 583 |
aiLoader.style.display = 'none';
|
| 584 |
-
|
| 585 |
if (data.success && data.output?.data?.[0]?.video?.url) {
|
| 586 |
addStatusMessage('ویدیو آماده شد! 🎉', 'success', true);
|
| 587 |
lastErrorWasGpuQuota = false;
|
|
@@ -678,7 +702,7 @@
|
|
| 678 |
clearStatusMessages();
|
| 679 |
generateButton.disabled = true;
|
| 680 |
statusSection.classList.add('active');
|
| 681 |
-
aiLoader.style.display = '
|
| 682 |
setAiLoaderText("تلاش مجدد...");
|
| 683 |
addStatusMessage('تلاش مجدد...', 'info', true);
|
| 684 |
|
|
@@ -780,7 +804,7 @@
|
|
| 780 |
generateButton.disabled = true;
|
| 781 |
resultContainer.classList.add('active');
|
| 782 |
statusSection.classList.add('active');
|
| 783 |
-
aiLoader.style.display = '
|
| 784 |
outputSection.classList.remove('active');
|
| 785 |
|
| 786 |
const [ratioW_str, ratioH_str] = autoSelectedAspectRatio.split(':');
|
|
@@ -824,87 +848,5 @@
|
|
| 824 |
});
|
| 825 |
})();
|
| 826 |
</script>
|
| 827 |
-
|
| 828 |
-
<script>
|
| 829 |
-
// --- NEW Header Animation Script ---
|
| 830 |
-
document.addEventListener('DOMContentLoaded', () => {
|
| 831 |
-
const canvas = document.getElementById('neural-network-canvas');
|
| 832 |
-
if (!canvas) return;
|
| 833 |
-
const header = canvas.parentElement;
|
| 834 |
-
const ctx = canvas.getContext('2d');
|
| 835 |
-
let particles = [];
|
| 836 |
-
const particleCount = 25;
|
| 837 |
-
const maxDistance = 120;
|
| 838 |
-
|
| 839 |
-
function resizeCanvas() {
|
| 840 |
-
canvas.width = header.clientWidth;
|
| 841 |
-
canvas.height = header.clientHeight;
|
| 842 |
-
init();
|
| 843 |
-
}
|
| 844 |
-
|
| 845 |
-
class Particle {
|
| 846 |
-
constructor() {
|
| 847 |
-
this.x = Math.random() * canvas.width;
|
| 848 |
-
this.y = Math.random() * canvas.height;
|
| 849 |
-
this.vx = (Math.random() - 0.5) * 0.4;
|
| 850 |
-
this.vy = (Math.random() - 0.5) * 0.4;
|
| 851 |
-
this.radius = Math.random() * 2 + 1;
|
| 852 |
-
this.opacity = Math.random() * 0.6 + 0.4;
|
| 853 |
-
}
|
| 854 |
-
update() {
|
| 855 |
-
this.x += this.vx;
|
| 856 |
-
this.y += this.vy;
|
| 857 |
-
if (this.x < 0 || this.x > canvas.width) this.vx *= -1;
|
| 858 |
-
if (this.y < 0 || this.y > canvas.height) this.vy *= -1;
|
| 859 |
-
}
|
| 860 |
-
draw() {
|
| 861 |
-
ctx.beginPath();
|
| 862 |
-
ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2);
|
| 863 |
-
ctx.fillStyle = `rgba(74, 108, 250, ${this.opacity})`;
|
| 864 |
-
ctx.fill();
|
| 865 |
-
}
|
| 866 |
-
}
|
| 867 |
-
|
| 868 |
-
function init() {
|
| 869 |
-
particles = [];
|
| 870 |
-
for (let i = 0; i < particleCount; i++) {
|
| 871 |
-
particles.push(new Particle());
|
| 872 |
-
}
|
| 873 |
-
}
|
| 874 |
-
|
| 875 |
-
function connectParticles() {
|
| 876 |
-
for (let i = 0; i < particles.length; i++) {
|
| 877 |
-
for (let j = i + 1; j < particles.length; j++) {
|
| 878 |
-
const dx = particles[i].x - particles[j].x;
|
| 879 |
-
const dy = particles[i].y - particles[j].y;
|
| 880 |
-
const distance = Math.sqrt(dx * dx + dy * dy);
|
| 881 |
-
if (distance < maxDistance) {
|
| 882 |
-
ctx.beginPath();
|
| 883 |
-
ctx.moveTo(particles[i].x, particles[i].y);
|
| 884 |
-
ctx.lineTo(particles[j].x, particles[j].y);
|
| 885 |
-
const opacity = (1 - distance / maxDistance) * 0.3;
|
| 886 |
-
ctx.strokeStyle = `rgba(102, 126, 234, ${opacity})`;
|
| 887 |
-
ctx.lineWidth = 0.5;
|
| 888 |
-
ctx.stroke();
|
| 889 |
-
}
|
| 890 |
-
}
|
| 891 |
-
}
|
| 892 |
-
}
|
| 893 |
-
|
| 894 |
-
function animate() {
|
| 895 |
-
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
| 896 |
-
particles.forEach(particle => {
|
| 897 |
-
particle.update();
|
| 898 |
-
particle.draw();
|
| 899 |
-
});
|
| 900 |
-
connectParticles();
|
| 901 |
-
requestAnimationFrame(animate);
|
| 902 |
-
}
|
| 903 |
-
|
| 904 |
-
window.addEventListener('resize', resizeCanvas);
|
| 905 |
-
resizeCanvas();
|
| 906 |
-
animate();
|
| 907 |
-
});
|
| 908 |
-
</script>
|
| 909 |
</body>
|
| 910 |
</html>
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>AI Video Studio</title>
|
| 7 |
<link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
| 8 |
<style>
|
| 9 |
:root {
|
|
|
|
| 35 |
|
| 36 |
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
|
| 37 |
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
|
| 38 |
+
@keyframes float { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-10px); } }
|
| 39 |
+
@keyframes pulse-icon { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
|
| 40 |
+
|
| 41 |
|
| 42 |
body {
|
| 43 |
font-family: var(--app-font);
|
|
|
|
| 60 |
animation: fadeIn 0.8s 0.1s ease-out backwards;
|
| 61 |
overflow: hidden;
|
| 62 |
}
|
| 63 |
+
|
| 64 |
+
.studio-logo {
|
| 65 |
+
display: inline-flex;
|
| 66 |
+
flex-direction: column;
|
| 67 |
+
align-items: center;
|
| 68 |
+
gap: 1rem;
|
| 69 |
+
margin-bottom: 1.5rem;
|
| 70 |
+
animation: float 4s ease-in-out infinite;
|
| 71 |
}
|
| 72 |
+
|
| 73 |
+
.logo-icon {
|
| 74 |
+
width: 70px;
|
| 75 |
+
height: 70px;
|
| 76 |
+
filter: drop-shadow(0 8px 16px rgba(74, 108, 250, 0.3));
|
| 77 |
+
}
|
| 78 |
+
.logo-icon svg {
|
| 79 |
+
width: 100%;
|
| 80 |
+
height: 100%;
|
| 81 |
+
animation: pulse-icon 2.5s ease-in-out infinite;
|
| 82 |
}
|
| 83 |
|
| 84 |
h1 {
|
| 85 |
font-size: 2.8rem;
|
| 86 |
font-weight: 800;
|
| 87 |
+
margin: 0;
|
| 88 |
background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
|
| 89 |
-webkit-background-clip: text;
|
| 90 |
-webkit-text-fill-color: transparent;
|
| 91 |
letter-spacing: -1px;
|
|
|
|
| 92 |
}
|
| 93 |
.subtitle { font-size: 1.1rem; color: var(--text-secondary); margin-top: 0; }
|
| 94 |
|
|
|
|
| 149 |
#statusSection, #outputSection, #criticalErrorSection { display: none; width: 100%; }
|
| 150 |
#statusSection.active, #outputSection.active, #criticalErrorSection.active { display: block; animation: fadeIn 0.5s; }
|
| 151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
/* Status Messages Styling */
|
| 153 |
#statusMessages { max-height: 150px; overflow-y: auto; width: 100%; padding: 0.5rem; }
|
| 154 |
.status-message {
|
|
|
|
| 160 |
.status-message.error { border-left: 4px solid var(--danger-color); color: var(--danger-color); }
|
| 161 |
.status-icon { width: 18px; height: 18px; }
|
| 162 |
|
| 163 |
+
/* --- NEW LOADING ANIMATION --- */
|
| 164 |
+
#aiLoader { align-items: center; justify-content: center; padding: 2rem 0; }
|
| 165 |
.generator-container {
|
| 166 |
+
position: relative; width: 400px; max-width: 100%; height: 250px;
|
| 167 |
border: 2px solid #38bdf8; border-radius: 20px; overflow: hidden;
|
| 168 |
box-shadow: 0 0 40px rgba(56, 189, 248, 0.3);
|
| 169 |
animation: pulse-loader 5s infinite cubic-bezier(0.4, 0, 0.6, 1);
|
|
|
|
| 178 |
.noise-layer { background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect width="100" height="100" fill="none"/><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.5" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.6"/></svg>') repeat; opacity: 1; animation: fade-noise 7s infinite ease-in-out; }
|
| 179 |
@keyframes fade-noise { 0% { opacity: 1; filter: blur(5px); } 30% { opacity: 0.8; filter: blur(2px); } 100% { opacity: 0; filter: blur(0px); } }
|
| 180 |
.sketch-layer { filter: grayscale(1) contrast(1.5) blur(3px); opacity: 0; animation: reveal-sketch 7s infinite ease-in-out; }
|
| 181 |
+
@keyframes reveal-sketch { 0% { opacity: 0; } 20% { opacity: 1; } 60% { opacity: 0.5; } 100% { opacity: 0; } }
|
| 182 |
+
.building-layer { filter: blur(15px); opacity: 0; animation: denoise-color 7s infinite ease-in-out; }
|
| 183 |
+
@keyframes denoise-color { 0% { opacity: 0; } 40% { opacity: 0.6; filter: blur(5px); } 100% { opacity: 1; filter: blur(0px); } }
|
| 184 |
.pixel-grid { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: repeating-linear-gradient(0deg, transparent 0 1px, rgba(255,255,255,0.1) 1px 2px), repeating-linear-gradient(90deg, transparent 0 1px, rgba(255,255,255,0.1) 1px 2px); opacity: 1; animation: dissolve-grid 7s infinite ease-in-out; }
|
| 185 |
@keyframes dissolve-grid { 0% { opacity: 1; } 70% { opacity: 0.5; } 100% { opacity: 0; } }
|
| 186 |
+
.particles { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, transparent 50%); animation: flow-particles 7s infinite cubic-bezier(0.4, 0, 0.6, 1); }
|
| 187 |
@keyframes flow-particles { 0% { transform: translate(0, 0) scale(1); opacity: 0.5; } 50% { transform: translate(10px, -15px) scale(1.05); opacity: 0.8; } 100% { transform: translate(0, 0) scale(1); opacity: 0.5; } }
|
| 188 |
+
.text-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 20px; font-weight: 700; text-shadow: 0 0 20px rgba(56, 189, 248, 0.8); animation: glow-text 7s infinite ease-in-out; font-family: var(--app-font); text-align: center; width: 90%; }
|
| 189 |
+
@keyframes glow-text { 0% { opacity: 0.7; } 50% { opacity: 1; } 100% { opacity: 0.7; } }
|
| 190 |
+
.progress-bar { position: absolute; bottom: 0; left: 0; width: 0%; height: 6px; background: linear-gradient(to right, #38bdf8, #bb86fc, #facc15); animation: progress 7s infinite linear; }
|
| 191 |
+
@keyframes progress { 0% { width: 0%; } 100% { width: 100%; } }
|
| 192 |
+
/* --- END OF NEW LOADING ANIMATION --- */
|
| 193 |
|
| 194 |
/* Video Output Styling */
|
| 195 |
#outputVideo { width: 100%; max-width: 500px; border-radius: var(--radius-input); margin: 1rem auto; display: block; background-color: #000; box-shadow: var(--shadow-md); }
|
|
|
|
| 211 |
|
| 212 |
@media (max-width: 768px) {
|
| 213 |
main { padding: 1.5rem; } h1 { font-size: 2.2rem; }
|
| 214 |
+
.generator-container { height: 200px; }
|
| 215 |
.text-overlay { font-size: 16px; }
|
| 216 |
}
|
| 217 |
</style>
|
|
|
|
| 219 |
<body>
|
| 220 |
<div class="container">
|
| 221 |
<header>
|
| 222 |
+
<div class="studio-logo">
|
| 223 |
+
<div class="logo-icon">
|
| 224 |
+
<svg viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
|
| 225 |
+
<defs>
|
| 226 |
+
<linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="100%">
|
| 227 |
+
<stop offset="0%" style="stop-color:#4A6CFA;stop-opacity:1" />
|
| 228 |
+
<stop offset="50%" style="stop-color:#667eea;stop-opacity:1" />
|
| 229 |
+
<stop offset="100%" style="stop-color:#0FD4A8;stop-opacity:1" />
|
| 230 |
+
</linearGradient>
|
| 231 |
+
<linearGradient id="grad2" x1="0%" y1="0%" x2="100%" y2="100%">
|
| 232 |
+
<stop offset="0%" style="stop-color:#667eea;stop-opacity:1" />
|
| 233 |
+
<stop offset="100%" style="stop-color:#764ba2;stop-opacity:1" />
|
| 234 |
+
</linearGradient>
|
| 235 |
+
</defs>
|
| 236 |
+
<rect x="25" y="35" width="35" height="30" rx="4" fill="url(#grad1)" opacity="0.8"/>
|
| 237 |
+
<circle cx="42.5" cy="50" r="12" fill="url(#grad2)" opacity="0.9"/>
|
| 238 |
+
<circle cx="42.5" cy="50" r="8" stroke="white" stroke-width="2" fill="none"/>
|
| 239 |
+
<circle cx="42.5" cy="50" r="4" fill="white" opacity="0.8"/>
|
| 240 |
+
<rect x="58" y="42" width="8" height="16" rx="2" fill="url(#grad1)" opacity="0.7"/>
|
| 241 |
+
<polygon points="75,45 85,50 75,55" fill="white" opacity="0.9"/>
|
| 242 |
+
</svg>
|
| 243 |
+
</div>
|
| 244 |
+
<h1>استودیو ویدیو هوش مصنوعی</h1>
|
| 245 |
+
</div>
|
| 246 |
<p class="subtitle">تصاویر خود را با قدرت هوش مصنوعی به ویدیو سینمایی تبدیل کنید</p>
|
| 247 |
</header>
|
| 248 |
|
|
|
|
| 283 |
|
| 284 |
<div id="statusSection">
|
| 285 |
<div id="statusMessages"></div>
|
| 286 |
+
<div id="aiLoader" style="display: none;">
|
|
|
|
|
|
|
|
|
|
| 287 |
<div class="generator-container">
|
| 288 |
<div class="noise-layer"></div>
|
| 289 |
<div class="sketch-layer"></div>
|
| 290 |
<div class="building-layer"></div>
|
| 291 |
<div class="pixel-grid"></div>
|
| 292 |
<div class="particles"></div>
|
| 293 |
+
<div id="generator-text-overlay" class="text-overlay">در حال پردازش ویدیو...</div>
|
| 294 |
<div class="progress-bar"></div>
|
| 295 |
</div>
|
| 296 |
</div>
|
|
|
|
| 325 |
</div>
|
| 326 |
|
| 327 |
<script>
|
| 328 |
+
// Main Application Logic (Unchanged, but adapted for new loader)
|
| 329 |
(function() {
|
| 330 |
// DOM Elements
|
| 331 |
const resultContainer = document.getElementById('result-container');
|
|
|
|
| 343 |
const statusSection = document.getElementById('statusSection');
|
| 344 |
const statusMessagesDiv = document.getElementById('statusMessages');
|
| 345 |
const aiLoader = document.getElementById('aiLoader');
|
| 346 |
+
const loaderProgressBar = document.querySelector('#aiLoader .progress-bar');
|
|
|
|
| 347 |
const outputSection = document.getElementById('outputSection');
|
| 348 |
const btnRestart = document.getElementById('btnRestart');
|
| 349 |
const btnDownloadVideo = document.getElementById('btnDownloadVideo');
|
|
|
|
| 400 |
}
|
| 401 |
|
| 402 |
function setAiLoaderText(text) {
|
| 403 |
+
const overlay = document.getElementById('generator-text-overlay');
|
| 404 |
+
if (overlay) overlay.textContent = text;
|
| 405 |
}
|
| 406 |
|
| 407 |
function addStatusMessage(message, type = 'info', isPersistent = false) {
|
|
|
|
| 429 |
|
| 430 |
function clearStatusMessages() {
|
| 431 |
statusMessagesDiv.innerHTML = '';
|
| 432 |
+
if(loaderProgressBar) loaderProgressBar.style.width = '0%';
|
| 433 |
aiLoader.style.display = 'none';
|
| 434 |
|
| 435 |
if (outputVideo.src && outputVideo.src.startsWith('blob:')) {
|
|
|
|
| 529 |
async function uploadImageToServerForVideoOriginal(file) {
|
| 530 |
addStatusMessage('آمادهسازی تصویر برای آپلود...', 'info', true);
|
| 531 |
setAiLoaderText("در حال آماده سازی تصویر...");
|
| 532 |
+
aiLoader.style.display = 'block';
|
| 533 |
|
| 534 |
const uploadId = generateRandomHash(12);
|
| 535 |
const formData = new FormData();
|
|
|
|
| 563 |
async function submitToVideoQueue(payload) {
|
| 564 |
addStatusMessage('ارسال درخواست ساخت ویدیو...', 'info', true);
|
| 565 |
setAiLoaderText("در حال ارسال درخواست ساخت ویدیو...");
|
| 566 |
+
aiLoader.style.display = 'block';
|
| 567 |
try {
|
| 568 |
const response = await fetch(`${VIDEO_SPACE_URL_BASE}/queue/join`, {
|
| 569 |
method: 'POST',
|
|
|
|
| 581 |
function listenForVideoResults(eventId) {
|
| 582 |
addStatusMessage('در حال ساخت ویدیو...', 'info', true);
|
| 583 |
setAiLoaderText("هوش مصنوعی در حال پردازش...");
|
| 584 |
+
aiLoader.style.display = 'block';
|
| 585 |
hideCriticalError();
|
| 586 |
statusSection.classList.add('active');
|
| 587 |
outputSection.classList.remove('active');
|
|
|
|
| 594 |
switch (data.msg) {
|
| 595 |
case "process_starts":
|
| 596 |
addStatusMessage('پردازش در سرور آغاز شد.', 'info');
|
| 597 |
+
if(loaderProgressBar) loaderProgressBar.style.width = '0%';
|
| 598 |
break;
|
| 599 |
case "progress":
|
| 600 |
if (data.progress_data?.[0]) {
|
| 601 |
const progress = Math.round((data.progress_data[0].progress || 0) * 100);
|
| 602 |
+
if(loaderProgressBar) loaderProgressBar.style.width = `${progress}%`;
|
| 603 |
}
|
| 604 |
break;
|
| 605 |
case "process_completed":
|
| 606 |
eventSource.close();
|
| 607 |
aiLoader.style.display = 'none';
|
| 608 |
+
if(loaderProgressBar) loaderProgressBar.style.width = '100%';
|
| 609 |
if (data.success && data.output?.data?.[0]?.video?.url) {
|
| 610 |
addStatusMessage('ویدیو آماده شد! 🎉', 'success', true);
|
| 611 |
lastErrorWasGpuQuota = false;
|
|
|
|
| 702 |
clearStatusMessages();
|
| 703 |
generateButton.disabled = true;
|
| 704 |
statusSection.classList.add('active');
|
| 705 |
+
aiLoader.style.display = 'block';
|
| 706 |
setAiLoaderText("تلاش مجدد...");
|
| 707 |
addStatusMessage('تلاش مجدد...', 'info', true);
|
| 708 |
|
|
|
|
| 804 |
generateButton.disabled = true;
|
| 805 |
resultContainer.classList.add('active');
|
| 806 |
statusSection.classList.add('active');
|
| 807 |
+
aiLoader.style.display = 'block';
|
| 808 |
outputSection.classList.remove('active');
|
| 809 |
|
| 810 |
const [ratioW_str, ratioH_str] = autoSelectedAspectRatio.split(':');
|
|
|
|
| 848 |
});
|
| 849 |
})();
|
| 850 |
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 851 |
</body>
|
| 852 |
</html>
|