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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="fa" dir="rtl">
|
| 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 |
+
/* تمامی CSS های گرافیکی اختصاصی شما بدون تغییر حفظ شده است */
|
| 10 |
+
:root {
|
| 11 |
+
--app-font: 'Vazirmatn', sans-serif;
|
| 12 |
+
--app-bg: #F8F9FC;
|
| 13 |
+
--panel-bg: #FFFFFF;
|
| 14 |
+
--panel-border: #EAEFF7;
|
| 15 |
+
--input-bg: #F6F8FB;
|
| 16 |
+
--input-border: #E1E7EF;
|
| 17 |
+
--text-primary: #1A202C;
|
| 18 |
+
--text-secondary: #626F86;
|
| 19 |
+
--text-tertiary: #8A94A6;
|
| 20 |
+
--accent-primary: #4A6CFA;
|
| 21 |
+
--accent-primary-hover: #3553D6;
|
| 22 |
+
--accent-primary-glow: rgba(74, 108, 250, 0.25);
|
| 23 |
+
--accent-secondary: #0FD4A8;
|
| 24 |
+
--success-color: #38A169;
|
| 25 |
+
--danger-color: #e53e3e;
|
| 26 |
+
--shadow-sm: 0 1px 2px 0 rgba(26, 32, 44, 0.03);
|
| 27 |
+
--shadow-md: 0 4px 6px -1px rgba(26, 32, 44, 0.05);
|
| 28 |
+
--shadow-lg: 0 10px 15px -3px rgba(26, 32, 44, 0.06);
|
| 29 |
+
--shadow-xl: 0 20px 25px -5px rgba(26, 32, 44, 0.07);
|
| 30 |
+
--radius-card: 24px;
|
| 31 |
+
--radius-btn: 14px;
|
| 32 |
+
--radius-input: 12px;
|
| 33 |
+
--transition-smooth: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
|
| 37 |
+
@keyframes core-pulse { 0%, 100% { transform: scale(0.95); box-shadow: 0 0 25px var(--accent-primary-glow); } 50% { transform: scale(1.05); box-shadow: 0 0 50px rgba(74, 108, 250, 0.5); } }
|
| 38 |
+
@keyframes ring-rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
|
| 39 |
+
@keyframes background-pan { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
|
| 40 |
+
|
| 41 |
+
body { font-family: var(--app-font); background-color: var(--app-bg); color: var(--text-primary); margin: 0; padding: 2.5rem 1rem; display: flex; justify-content: center; align-items: flex-start; min-height: 100vh; }
|
| 42 |
+
.container { max-width: 820px; width: 100%; }
|
| 43 |
+
header { position: relative; text-align: center; margin-bottom: 2.5rem; padding: 2rem 0; animation: fadeIn 0.8s 0.1s ease-out backwards; overflow: hidden; }
|
| 44 |
+
#neural-network-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }
|
| 45 |
+
.header-content { position: relative; z-index: 2; }
|
| 46 |
+
.ai-orb-container { width: 150px; height: 150px; margin: 0 auto 1rem; position: relative; display: flex; align-items: center; justify-content: center; }
|
| 47 |
+
.orb-background { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: radial-gradient(ellipse at center, rgba(74, 108, 250, 0.15) 0%, transparent 70%), linear-gradient(45deg, rgba(15, 212, 168, 0.05), rgba(74, 108, 250, 0.05)); border-radius: 50%; animation: background-pan 12s ease-in-out infinite; background-size: 200% 200%; }
|
| 48 |
+
.orb-core { width: 60px; height: 60px; border-radius: 50%; background: radial-gradient(circle, #394A7A 0%, #1A202C 70%); box-shadow: 0 0 25px var(--accent-primary-glow); display: flex; align-items: center; justify-content: center; position: relative; z-index: 2; animation: core-pulse 4s ease-in-out infinite; border: 1px solid rgba(74, 108, 250, 0.3); }
|
| 49 |
+
.play-icon { width: 24px; height: 24px; color: var(--accent-secondary); filter: drop-shadow(0 0 8px rgba(15, 212, 168, 0.7)); transition: var(--transition-smooth); }
|
| 50 |
+
.orb-core:hover .play-icon { transform: scale(1.1); color: #fff; filter: drop-shadow(0 0 12px rgba(15, 212, 168, 1)); }
|
| 51 |
+
.orb-ring { position: absolute; top: 50%; left: 50%; border-style: solid; border-color: transparent; border-radius: 50%; z-index: 1; mix-blend-mode: screen; }
|
| 52 |
+
.orb-ring.one { width: 100px; height: 100px; margin-top: -50px; margin-left: -50px; border-width: 2px; border-top-color: var(--accent-primary); border-right-color: var(--accent-primary); animation: ring-rotate 8s linear infinite; filter: blur(1px); }
|
| 53 |
+
.orb-ring.two { width: 120px; height: 120px; margin-top: -60px; margin-left: -60px; border-width: 1px; border-bottom-color: var(--accent-secondary); animation: ring-rotate 10s linear infinite reverse; }
|
| 54 |
+
.orb-ring.three { width: 140px; height: 140px; margin-top: -70px; margin-left: -70px; border-width: 2px; border-left-color: rgba(255, 255, 255, 0.5); border-right-color: rgba(255, 255, 255, 0.5); animation: ring-rotate 12s linear infinite; filter: blur(1px); opacity: 0.5; }
|
| 55 |
+
h1 { font-size: 2.8rem; font-weight: 800; margin: 0; background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: -1px; }
|
| 56 |
+
.subtitle { font-size: 1.1rem; color: var(--text-secondary); margin-top: 0.5rem; }
|
| 57 |
+
.instruction { font-size: 0.95rem; color: var(--text-tertiary); margin-top: 0.75rem; font-weight: 500; }
|
| 58 |
+
|
| 59 |
+
main { padding: 3rem; background-color: var(--panel-bg); border-radius: var(--radius-card); box-shadow: var(--shadow-xl); border: 1px solid var(--panel-border); animation: fadeIn 0.8s 0.3s ease-out backwards; }
|
| 60 |
+
.form-group { margin-bottom: 2.5rem; }
|
| 61 |
+
.form-label { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; color: var(--text-primary); font-size: 1.2em; margin-bottom: 1.2rem; }
|
| 62 |
+
.form-label svg { width: 24px; height: 24px; color: var(--accent-primary); }
|
| 63 |
+
|
| 64 |
+
#image-drop-zone { position: relative; border: 2px dashed var(--input-border); border-radius: var(--radius-input); padding: 2.5rem; text-align: center; cursor: pointer; transition: var(--transition-smooth); background-color: var(--input-bg); min-height: 200px; display: flex; flex-direction: column; justify-content: center; align-items: center; overflow: hidden; }
|
| 65 |
+
#image-drop-zone.drag-over, #image-drop-zone:hover:not(.has-image) { border-color: var(--accent-primary); background-color: #fff; box-shadow: 0 0 15px var(--accent-primary-glow); }
|
| 66 |
+
#image-drop-zone.has-image { border-style: solid; border-color: var(--success-color); padding: 0; cursor: default; }
|
| 67 |
+
.upload-content { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
|
| 68 |
+
.upload-icon svg { width: 48px; height: 48px; color: var(--accent-primary); stroke-width: 1.5; opacity: 0.8; }
|
| 69 |
+
#image-drop-zone p { margin: 0; color: var(--text-secondary); font-weight: 500; }
|
| 70 |
+
#imagePreview { display: none; width: 100%; height: 100%; object-fit: contain; position: absolute; top: 0; left: 0; }
|
| 71 |
+
#image-drop-zone.has-image .upload-content { display: none; }
|
| 72 |
+
#image-drop-zone.has-image #imagePreview { display: block; }
|
| 73 |
+
#remove-image-btn { position: absolute; top: 12px; left: 12px; width: 32px; height: 32px; background-color: rgba(26, 32, 44, 0.7); color: white; border: none; border-radius: 50%; font-size: 22px; font-weight: bold; line-height: 32px; text-align: center; cursor: pointer; opacity: 0; visibility: hidden; transform: scale(0.8); transition: all 0.25s ease-out; z-index: 10; }
|
| 74 |
+
#image-drop-zone.has-image #remove-image-btn { opacity: 1; visibility: visible; transform: scale(1); }
|
| 75 |
+
#remove-image-btn:hover { background-color: var(--danger-color); transform: scale(1.1) rotate(90deg); }
|
| 76 |
+
|
| 77 |
+
textarea { width: 100%; padding: 1rem 1.2rem; border-radius: var(--radius-input); border: 1px solid var(--input-border); background-color: var(--input-bg); color: var(--text-primary); box-shadow: var(--shadow-sm) inset; font-family: var(--app-font); font-size: 1rem; box-sizing: border-box; transition: var(--transition-smooth); min-height: 120px; resize: vertical; }
|
| 78 |
+
textarea:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-primary-glow), var(--shadow-sm) inset; background-color: var(--panel-bg); }
|
| 79 |
+
|
| 80 |
+
.slider-group { margin-top: 2rem; margin-bottom: 1.5rem; }
|
| 81 |
+
.slider-label-container { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
|
| 82 |
+
.slider-label { font-weight: 600; color: var(--text-secondary); font-size: 0.95rem; }
|
| 83 |
+
.slider-value { font-weight: 700; font-size: 1rem; color: var(--accent-primary); background-color: var(--input-bg); padding: 0.25rem 0.75rem; border-radius: 8px; border: 1px solid var(--input-border); min-width: 80px; text-align: center; }
|
| 84 |
+
.slider-wrapper { display: flex; align-items: center; gap: 1rem; }
|
| 85 |
+
.slider-icon { width: 22px; height: 22px; color: var(--text-tertiary); flex-shrink: 0; opacity: 0.8; }
|
| 86 |
+
input[type="range"] { -webkit-appearance: none; appearance: none; flex-grow: 1; width: 100%; height: 12px; background: var(--input-bg); border-radius: var(--radius-input); outline: none; cursor: pointer; direction: rtl; box-shadow: inset 0 1px 3px rgba(0,0,0,0.1); transition: var(--transition-smooth); }
|
| 87 |
+
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 24px; height: 24px; background: linear-gradient(145deg, var(--accent-primary), var(--accent-secondary)); border-radius: 50%; border: 3px solid white; box-shadow: var(--shadow-md); transition: all 0.2s ease-in-out; margin-top: -6px; }
|
| 88 |
+
|
| 89 |
+
#generateButton { display: flex; align-items: center; justify-content: center; gap: 0.75rem; width: 100%; padding: 1.1rem; font-size: 1.2rem; font-weight: 700; background: linear-gradient(95deg, var(--accent-secondary) 0%, var(--accent-primary) 100%); color: #fff; border: none; border-radius: var(--radius-btn); cursor: pointer; transition: all 0.3s ease; box-shadow: 0 6px 12px -3px var(--accent-primary-glow); margin-top: 1rem; }
|
| 90 |
+
#generateButton:hover:not(:disabled) { transform: translateY(-5px) scale(1.02); }
|
| 91 |
+
#generateButton:disabled { background: var(--text-tertiary); cursor: not-allowed; box-shadow: none; opacity: 0.7; transform: none;}
|
| 92 |
+
|
| 93 |
+
#results-container { min-height: 250px; position: relative; padding: 1rem; background-color: var(--input-bg); border-radius: var(--radius-card); border: 2px dashed var(--input-border); display: flex; flex-direction: column; align-items: center; justify-content: center; }
|
| 94 |
+
|
| 95 |
+
/* انیمیشن لودینگ مخصوص ویدیو */
|
| 96 |
+
#aiLoader { display: none; flex-direction: column; align-items: center; justify-content: center; width: 100%;}
|
| 97 |
+
.generator-container { position: relative; width: 400px; max-width: 100%; height: 250px; border: 2px solid #38bdf8; border-radius: 20px; overflow: hidden; box-shadow: 0 0 40px rgba(56, 189, 248, 0.3); background-color: #161b22; color: #f0f6fc; }
|
| 98 |
+
.text-overlay { position: absolute; top: 45%; left: 50%; transform: translate(-50%, -50%); font-size: 20px; font-weight: 700; text-shadow: 0 0 20px rgba(56, 189, 248, 0.8); text-align: center; width: 100%;}
|
| 99 |
+
.progress-bar { position: absolute; bottom: 0; left: 0; width: 0%; height: 6px; background: linear-gradient(to right, #38bdf8, #bb86fc, #facc15); transition: width 0.5s ease-out; }
|
| 100 |
+
|
| 101 |
+
.video-result-card { width: 100%; text-align: center; }
|
| 102 |
+
.video-result-card video { max-width: 100%; border-radius: 20px; box-shadow: var(--shadow-xl); background-color: #000; margin-bottom: 1rem;}
|
| 103 |
+
.video-button { padding: 0.7rem 1.5rem; border-radius: var(--radius-btn); border: none; cursor: pointer; font-family: inherit; font-weight: 600; font-size: 1rem; transition: var(--transition-smooth); display: inline-flex; align-items: center; gap: 0.5rem; background-color: var(--accent-primary); color: white; text-decoration: none;}
|
| 104 |
+
.video-button:hover { background-color: var(--accent-primary-hover); transform: translateY(-2px); }
|
| 105 |
+
|
| 106 |
+
@media (max-width: 768px) { main { padding: 1.5rem; } h1 { font-size: 2.2rem; } .generator-container { height: 200px; } }
|
| 107 |
+
</style>
|
| 108 |
+
</head>
|
| 109 |
+
<body>
|
| 110 |
+
<div class="container">
|
| 111 |
+
<header>
|
| 112 |
+
<canvas id="neural-network-canvas"></canvas>
|
| 113 |
+
<div class="header-content">
|
| 114 |
+
<div class="ai-orb-container">
|
| 115 |
+
<div class="orb-background"></div>
|
| 116 |
+
<div class="orb-core">
|
| 117 |
+
<svg class="play-icon" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M8 5v14l11-7z"></path></svg>
|
| 118 |
+
</div>
|
| 119 |
+
<div class="orb-ring one"></div><div class="orb-ring two"></div><div class="orb-ring three"></div>
|
| 120 |
+
</div>
|
| 121 |
+
<h1>استودیو ویدیو هوش مصنوعی</h1>
|
| 122 |
+
<p class="subtitle">تصاویر خود را با قدرت هوش مصنوعی به ویدیو سینمایی تبدیل کنید</p>
|
| 123 |
+
<p class="instruction">ابتدا تصویر خود را آپلود کرده و ویدیوی خود را بسازید.</p>
|
| 124 |
+
</div>
|
| 125 |
+
</header>
|
| 126 |
+
<main>
|
| 127 |
+
<div class="form-group">
|
| 128 |
+
<div class="form-label">
|
| 129 |
+
<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>
|
| 130 |
+
۱. تصویر پروژه
|
| 131 |
+
</div>
|
| 132 |
+
<label id="image-drop-zone" for="imageFile">
|
| 133 |
+
<div class="upload-content">
|
| 134 |
+
<div class="upload-icon">
|
| 135 |
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="17 8 12 3 7 8"></polyline><line x1="12" y1="3" x2="12" y2="15"></line></svg>
|
| 136 |
+
</div>
|
| 137 |
+
<p>فایل تصویر را اینجا بکشید یا برای انتخاب کلیک کنید</p>
|
| 138 |
+
</div>
|
| 139 |
+
<img id="imagePreview" src="" alt="">
|
| 140 |
+
<button id="remove-image-btn" type="button" title="حذف تصویر">×</button>
|
| 141 |
+
</label>
|
| 142 |
+
<input type="file" id="imageFile" accept="image/jpeg, image/png, image/webp" hidden>
|
| 143 |
+
</div>
|
| 144 |
+
|
| 145 |
+
<div class="form-group">
|
| 146 |
+
<label for="prompt" class="form-label">
|
| 147 |
+
<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>
|
| 148 |
+
۲. دستور ساخت
|
| 149 |
+
</label>
|
| 150 |
+
<textarea id="prompt" rows="3" placeholder="مثال: زوم آهسته به بیرون در حالی که برگها در باد میرقصند..."></textarea>
|
| 151 |
+
|
| 152 |
+
<div class="slider-group">
|
| 153 |
+
<div class="slider-label-container">
|
| 154 |
+
<label for="durationSlider" class="slider-label">مدت زمان</label>
|
| 155 |
+
<span id="durationValue" class="slider-value">5.0 ثانیه</span>
|
| 156 |
+
</div>
|
| 157 |
+
<div class="slider-wrapper">
|
| 158 |
+
<svg class="slider-icon" 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 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.72"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.72-1.72"></path></svg>
|
| 159 |
+
<input type="range" id="durationSlider" min="1.0" max="5.0" value="5.0" step="0.5">
|
| 160 |
+
<svg class="slider-icon" 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"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>
|
| 161 |
+
</div>
|
| 162 |
+
</div>
|
| 163 |
+
|
| 164 |
+
<button id="generateButton">
|
| 165 |
+
<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"/></svg>
|
| 166 |
+
<span id="btn-text">ساخت ویدیو جادویی</span>
|
| 167 |
+
</button>
|
| 168 |
+
</div>
|
| 169 |
+
|
| 170 |
+
<div class="form-group">
|
| 171 |
+
<div class="form-label">
|
| 172 |
+
<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>
|
| 173 |
+
۳. نتیجه
|
| 174 |
+
</div>
|
| 175 |
+
<div id="results-container">
|
| 176 |
+
<p id="idle-text">برای شروع تصویر را آپلود کرده و دکمه ساخت را بزنید.</p>
|
| 177 |
+
|
| 178 |
+
<div id="aiLoader">
|
| 179 |
+
<div class="generator-container">
|
| 180 |
+
<div class="text-overlay" id="loading-text">در حال پردازش ویدیو...</div>
|
| 181 |
+
<div class="progress-bar" id="loader-progress"></div>
|
| 182 |
+
</div>
|
| 183 |
+
</div>
|
| 184 |
+
|
| 185 |
+
<div id="latest-result-wrapper"></div>
|
| 186 |
+
</div>
|
| 187 |
+
</div>
|
| 188 |
+
</main>
|
| 189 |
+
</div>
|
| 190 |
+
|
| 191 |
+
<script>
|
| 192 |
+
const imageFileInput = document.getElementById('imageFile');
|
| 193 |
+
const imagePreview = document.getElementById('imagePreview');
|
| 194 |
+
const imageDropZone = document.getElementById('image-drop-zone');
|
| 195 |
+
const removeImageBtn = document.getElementById('remove-image-btn');
|
| 196 |
+
const promptInput = document.getElementById('prompt');
|
| 197 |
+
const durationSlider = document.getElementById('durationSlider');
|
| 198 |
+
const durationValueDisplay = document.getElementById('durationValue');
|
| 199 |
+
const generateButton = document.getElementById('generateButton');
|
| 200 |
+
const btnText = document.getElementById('btn-text');
|
| 201 |
+
const resultsContainer = document.getElementById('results-container');
|
| 202 |
+
const idleText = document.getElementById('idle-text');
|
| 203 |
+
const aiLoader = document.getElementById('aiLoader');
|
| 204 |
+
const loadingText = document.getElementById('loading-text');
|
| 205 |
+
const loaderProgress = document.getElementById('loader-progress');
|
| 206 |
+
const latestResultWrapper = document.getElementById('latest-result-wrapper');
|
| 207 |
+
|
| 208 |
+
let currentImageFile = null;
|
| 209 |
+
let pollTimer = null;
|
| 210 |
+
let progressInterval = null;
|
| 211 |
+
|
| 212 |
+
// تنظیمات اسلایدر
|
| 213 |
+
durationSlider.addEventListener('input', () => {
|
| 214 |
+
const value = parseFloat(durationSlider.value);
|
| 215 |
+
durationValueDisplay.textContent = `${value.toFixed(1)} ثانیه`;
|
| 216 |
+
const percentage = ((value - durationSlider.min) / (durationSlider.max - durationSlider.min)) * 100;
|
| 217 |
+
durationSlider.style.background = `linear-gradient(to left, var(--accent-primary), var(--accent-secondary) ${percentage}%, var(--input-bg) ${percentage}%)`;
|
| 218 |
+
});
|
| 219 |
+
|
| 220 |
+
// آپلود عکس
|
| 221 |
+
imageFileInput.addEventListener('change', function(event) {
|
| 222 |
+
currentImageFile = event.target.files[0];
|
| 223 |
+
if (currentImageFile) {
|
| 224 |
+
imagePreview.src = URL.createObjectURL(currentImageFile);
|
| 225 |
+
imageDropZone.classList.add('has-image');
|
| 226 |
+
}
|
| 227 |
+
});
|
| 228 |
+
|
| 229 |
+
removeImageBtn.addEventListener('click', (e) => {
|
| 230 |
+
e.preventDefault();
|
| 231 |
+
currentImageFile = null;
|
| 232 |
+
imageFileInput.value = '';
|
| 233 |
+
imagePreview.src = '';
|
| 234 |
+
imageDropZone.classList.remove('has-image');
|
| 235 |
+
latestResultWrapper.innerHTML = '';
|
| 236 |
+
idleText.style.display = 'block';
|
| 237 |
+
});
|
| 238 |
+
|
| 239 |
+
// مدیریت لودینگ
|
| 240 |
+
function setLoadingState(isLoading, message) {
|
| 241 |
+
if (isLoading) {
|
| 242 |
+
generateButton.disabled = true;
|
| 243 |
+
btnText.textContent = "در حال ارتباط با سرور...";
|
| 244 |
+
idleText.style.display = 'none';
|
| 245 |
+
aiLoader.style.display = 'flex';
|
| 246 |
+
latestResultWrapper.innerHTML = '';
|
| 247 |
+
loadingText.textContent = message;
|
| 248 |
+
|
| 249 |
+
// شبیه ساز نوار پیشرفت
|
| 250 |
+
let prog = 0;
|
| 251 |
+
loaderProgress.style.width = '0%';
|
| 252 |
+
if(progressInterval) clearInterval(progressInterval);
|
| 253 |
+
progressInterval = setInterval(() => {
|
| 254 |
+
prog += 1;
|
| 255 |
+
if(prog > 95) clearInterval(progressInterval);
|
| 256 |
+
loaderProgress.style.width = `${prog}%`;
|
| 257 |
+
}, 1000);
|
| 258 |
+
} else {
|
| 259 |
+
generateButton.disabled = false;
|
| 260 |
+
btnText.textContent = "ساخت ویدیو جادویی";
|
| 261 |
+
aiLoader.style.display = 'none';
|
| 262 |
+
if(progressInterval) clearInterval(progressInterval);
|
| 263 |
+
}
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
// درخواست ساخت
|
| 267 |
+
generateButton.addEventListener('click', async () => {
|
| 268 |
+
if (!currentImageFile) {
|
| 269 |
+
return alert('لطفاً ابتدا یک تصویر را آپلود کنید.');
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
setLoadingState(true, 'در حال آپلود و پردازش... (حدود ۲ تا ۵ دقیقه)');
|
| 273 |
+
|
| 274 |
+
const formData = new FormData();
|
| 275 |
+
formData.append('image', currentImageFile);
|
| 276 |
+
formData.append('prompt', promptInput.value.trim());
|
| 277 |
+
formData.append('duration', durationSlider.value);
|
| 278 |
+
|
| 279 |
+
try {
|
| 280 |
+
// ارسال درخواست به بکاند شما
|
| 281 |
+
const res = await fetch('/api/generate-video', {
|
| 282 |
+
method: 'POST',
|
| 283 |
+
body: formData
|
| 284 |
+
});
|
| 285 |
+
|
| 286 |
+
const data = await res.json();
|
| 287 |
+
|
| 288 |
+
if (data.status === 'success') {
|
| 289 |
+
loadingText.textContent = 'ویدیو در حال ساخت است. لطفاً شکیبا باشید...';
|
| 290 |
+
// پیگیری وضعیت از داکر
|
| 291 |
+
pollTimer = setInterval(() => checkResult(data.run_id), 5000);
|
| 292 |
+
} else {
|
| 293 |
+
alert('خطا در ارسال به سرور گیتهاب!');
|
| 294 |
+
setLoadingState(false);
|
| 295 |
+
}
|
| 296 |
+
} catch (e) {
|
| 297 |
+
alert('خطای اتصال به سرور!');
|
| 298 |
+
setLoadingState(false);
|
| 299 |
+
}
|
| 300 |
+
});
|
| 301 |
+
|
| 302 |
+
// دریافت نتیجه
|
| 303 |
+
async function checkResult(run_id) {
|
| 304 |
+
try {
|
| 305 |
+
const res = await fetch(`/api/status/${run_id}`);
|
| 306 |
+
const data = await res.json();
|
| 307 |
+
|
| 308 |
+
if (data.status === 'ready') {
|
| 309 |
+
clearInterval(pollTimer);
|
| 310 |
+
setLoadingState(false);
|
| 311 |
+
|
| 312 |
+
// نمایش ویدیو
|
| 313 |
+
latestResultWrapper.innerHTML = `
|
| 314 |
+
<div class="video-result-card">
|
| 315 |
+
<video src="${data.url}" controls autoplay loop></video>
|
| 316 |
+
<div style="margin-top: 15px;">
|
| 317 |
+
<a href="${data.url}" download="magic_video.mp4" class="video-button">
|
| 318 |
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" style="margin-left:8px;"><path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg>
|
| 319 |
+
دانلود ویدیو
|
| 320 |
+
</a>
|
| 321 |
+
</div>
|
| 322 |
+
</div>
|
| 323 |
+
`;
|
| 324 |
+
}
|
| 325 |
+
} catch(e) {
|
| 326 |
+
console.log('Polling...', e);
|
| 327 |
+
}
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
// انیمیشن پسزمینه
|
| 331 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 332 |
+
const canvas = document.getElementById('neural-network-canvas');
|
| 333 |
+
if (!canvas) return; const ctx = canvas.getContext('2d'); const header = canvas.parentElement;
|
| 334 |
+
let particles = []; const particleCount = 20; const maxDistance = 100;
|
| 335 |
+
function resizeCanvas() { canvas.width = header.clientWidth; canvas.height = header.clientHeight; init(); }
|
| 336 |
+
class Particle { constructor() { this.x = Math.random() * canvas.width; this.y = Math.random() * canvas.height; this.vx = (Math.random() - 0.5) * 0.3; this.vy = (Math.random() - 0.5) * 0.3; this.radius = 1.2; } update() { this.x += this.vx; this.y += this.vy; if (this.x < 0 || this.x > canvas.width) this.vx *= -1; if (this.y < 0 || this.y > canvas.height) this.vy *= -1; } draw() { ctx.beginPath(); ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2); ctx.fillStyle = '#4A6CFA'; ctx.fill(); } }
|
| 337 |
+
function init() { particles = []; for (let i = 0; i < particleCount; i++) particles.push(new Particle()); }
|
| 338 |
+
function connectParticles() { for (let i = 0; i < particles.length; i++) { for (let j = i + 1; j < particles.length; j++) { const dx = particles[i].x - particles[j].x; const dy = particles[i].y - particles[j].y; const distance = Math.sqrt(dx * dx + dy * dy); if (distance < maxDistance) { ctx.beginPath(); ctx.moveTo(particles[i].x, particles[i].y); ctx.lineTo(particles[j].x, particles[j].y); ctx.strokeStyle = '#8A94A6'; ctx.lineWidth = 0.2; ctx.globalAlpha = 1 - distance / maxDistance; ctx.stroke(); } } } ctx.globalAlpha = 1; }
|
| 339 |
+
function animate() { ctx.clearRect(0, 0, canvas.width, canvas.height); particles.forEach(p => { p.update(); p.draw(); }); connectParticles(); requestAnimationFrame(animate); }
|
| 340 |
+
window.addEventListener('resize', resizeCanvas); resizeCanvas(); animate();
|
| 341 |
+
});
|
| 342 |
+
</script>
|
| 343 |
+
</body>
|
| 344 |
+
</html>
|