PirateKnobi commited on
Commit
49e5d99
·
verified ·
1 Parent(s): 98cef2c

Add 1 files

Browse files
Files changed (1) hide show
  1. index.html +343 -116
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 Generator | Image + Prompt to Video</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
  <style>
@@ -22,29 +22,21 @@
22
  .progress-bar {
23
  transition: width 0.3s ease;
24
  }
25
- @keyframes pulse {
26
- 0%, 100% { opacity: 1; }
27
- 50% { opacity: 0.5; }
28
  }
29
- .animate-pulse {
30
- animation: pulse 2s infinite;
 
31
  }
32
- .kenburns-zoom {
33
- animation: kenburnsZoom 10s infinite alternate;
34
  }
35
- @keyframes kenburnsZoom {
36
  0% { transform: scale(1); }
37
- 100% { transform: scale(1.2); }
38
  }
39
- .prompt-input {
40
- min-height: 100px;
41
- resize: none;
42
- }
43
- .ai-generated {
44
- position: relative;
45
- }
46
- .ai-generated::after {
47
- content: "AI GENERATED";
48
  position: absolute;
49
  bottom: 10px;
50
  right: 10px;
@@ -54,40 +46,55 @@
54
  border-radius: 4px;
55
  font-size: 10px;
56
  }
 
 
 
 
57
  </style>
58
  </head>
59
- <body class="bg-gray-100 min-h-screen">
60
- <div class="container mx-auto px-4 py-8">
61
  <!-- Header -->
62
- <header class="text-center mb-12">
63
- <h1 class="text-4xl font-bold text-gray-800 mb-2">AI Video Generator</h1>
64
- <p class="text-gray-600 max-w-2xl mx-auto">Transform your images into animated videos with AI magic</p>
 
 
 
 
 
 
 
 
 
 
 
65
  </header>
66
 
67
  <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
68
- <!-- Left Panel - Input -->
69
- <div class="lg:col-span-1 bg-white rounded-xl shadow-md p-6">
70
  <div class="space-y-6">
71
  <!-- Prompt Section -->
72
  <div>
73
- <h2 class="text-xl font-semibold text-gray-800 mb-4">AI Prompt</h2>
74
- <textarea id="promptInput" class="w-full prompt-input rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500" placeholder="Describe the animation you want... (e.g. 'Make the image come alive with subtle movements and atmospheric effects')"></textarea>
75
  <div class="flex items-center mt-2 text-sm text-gray-500">
76
  <i class="fas fa-lightbulb mr-2 text-yellow-500"></i>
77
- <span>Be creative! The AI will interpret your description</span>
78
  </div>
79
  </div>
80
 
81
- <!-- Upload Section -->
82
  <div>
83
- <h2 class="text-xl font-semibold text-gray-800 mb-4">Upload Image</h2>
84
- <div id="dropzone" class="dropzone rounded-lg p-8 text-center cursor-pointer">
85
  <div class="flex flex-col items-center justify-center space-y-3">
86
  <i class="fas fa-cloud-upload-alt text-4xl text-blue-500"></i>
87
  <p class="text-gray-600">Drag & drop your image here</p>
88
  <p class="text-sm text-gray-500">or</p>
89
- <label for="fileInput" class="px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600 transition cursor-pointer">
90
- Browse Files
91
  </label>
92
  <input id="fileInput" type="file" accept="image/*" class="hidden">
93
  </div>
@@ -110,22 +117,24 @@
110
  </div>
111
  </div>
112
 
113
- <!-- Settings Section -->
114
  <div class="space-y-4">
 
 
115
  <!-- Style Selector -->
116
  <div>
117
- <label class="block text-sm font-medium text-gray-700 mb-1">Animation Style</label>
118
  <div class="grid grid-cols-2 gap-2">
119
- <button class="style-option px-3 py-2 border rounded-md text-sm hover:bg-gray-50" data-style="realistic">
120
  <i class="fas fa-mountain mr-1"></i> Realistic
121
  </button>
122
- <button class="style-option px-3 py-2 border rounded-md text-sm hover:bg-gray-50" data-style="fantasy">
123
  <i class="fas fa-hat-wizard mr-1"></i> Fantasy
124
  </button>
125
- <button class="style-option px-3 py-2 border rounded-md text-sm hover:bg-gray-50" data-style="cinematic">
126
  <i class="fas fa-film mr-1"></i> Cinematic
127
  </button>
128
- <button class="style-option px-3 py-2 border rounded-md text-sm hover:bg-gray-50" data-style="painting">
129
  <i class="fas fa-palette mr-1"></i> Painting
130
  </button>
131
  </div>
@@ -133,7 +142,7 @@
133
 
134
  <!-- Duration -->
135
  <div>
136
- <label class="block text-sm font-medium text-gray-700 mb-1">Duration (seconds)</label>
137
  <input id="duration" type="range" min="3" max="30" value="10" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
138
  <div class="flex justify-between text-xs text-gray-500 mt-1">
139
  <span>3s</span>
@@ -142,62 +151,71 @@
142
  </div>
143
  </div>
144
 
145
- <!-- Generate Button -->
146
- <button id="generateBtn" class="w-full py-3 px-4 bg-gradient-to-r from-blue-500 to-purple-600 text-white font-semibold rounded-lg shadow-md hover:opacity-90 transition disabled:opacity-50 disabled:cursor-not-allowed" disabled>
147
- <i class="fas fa-magic mr-2"></i> Generate AI Video
148
- </button>
 
 
 
 
 
 
149
  </div>
 
 
 
 
 
150
  </div>
151
  </div>
152
 
153
  <!-- Right Panel - Preview and Export -->
154
  <div class="lg:col-span-2 space-y-6">
155
  <!-- Preview Section -->
156
- <div class="bg-white rounded-xl shadow-md p-6">
157
  <div class="flex justify-between items-center mb-4">
158
  <h2 class="text-xl font-semibold text-gray-800">Video Preview</h2>
159
  <div id="aiBadge" class="text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded-full hidden">
160
  <i class="fas fa-robot mr-1"></i> AI Generated
161
  </div>
162
  </div>
163
- <div id="previewContainer" class="video-preview rounded-lg overflow-hidden flex items-center justify-center relative ai-generated">
164
  <div id="emptyPreview" class="text-center p-6">
165
  <i class="fas fa-image text-4xl text-gray-400 mb-3"></i>
166
- <p class="text-gray-500">Add a prompt and image to create your AI video</p>
167
  </div>
168
- <img id="imagePreview" class="absolute inset-0 w-full h-full object-cover hidden">
169
  <video id="videoPreview" controls class="absolute inset-0 w-full h-full hidden"></video>
170
  <canvas id="canvasPreview" class="absolute inset-0 w-full h-full hidden"></canvas>
171
  </div>
172
  </div>
173
 
174
  <!-- Export Section -->
175
- <div id="exportSection" class="bg-white rounded-xl shadow-md p-6 hidden">
176
- <h2 class="text-xl font-semibold text-gray-800 mb-4">Export Options</h2>
177
- <div class="flex flex-wrap gap-4">
178
- <button id="downloadBtn" class="flex-1 py-2 px-4 bg-green-500 text-white font-medium rounded-lg hover:bg-green-600 transition flex items-center justify-center space-x-2">
179
- <i class="fas fa-download"></i>
180
- <span>Download MP4</span>
181
  </button>
182
- <button id="gifBtn" class="flex-1 py-2 px-4 bg-indigo-500 text-white font-medium rounded-lg hover:bg-indigo-600 transition flex items-center justify-center space-x-2">
183
- <i class="fas fa-file-image"></i>
184
- <span>Download GIF</span>
185
  </button>
186
- <button id="shareBtn" class="flex-1 py-2 px-4 bg-pink-500 text-white font-medium rounded-lg hover:bg-pink-600 transition flex items-center justify-center space-x-2">
187
- <i class="fas fa-share-alt"></i>
188
- <span>Share</span>
189
  </button>
190
- </div>
191
- <div class="mt-4">
192
- <button id="newProjectBtn" class="w-full py-2 px-4 bg-gray-200 text-gray-700 font-medium rounded-lg hover:bg-gray-300 transition flex items-center justify-center space-x-2">
193
- <i class="fas fa-redo"></i>
194
- <span>Create New Project</span>
195
  </button>
196
  </div>
197
  </div>
198
 
199
  <!-- Processing Section -->
200
- <div id="processingSection" class="bg-white rounded-xl shadow-md p-6 hidden">
201
  <h2 class="text-xl font-semibold text-gray-800 mb-4">AI is Creating Your Video</h2>
202
  <div class="space-y-4">
203
  <div class="flex items-center space-x-4">
@@ -205,21 +223,21 @@
205
  <i class="fas fa-robot text-blue-500 text-xl"></i>
206
  </div>
207
  <div class="flex-1">
208
- <p class="font-medium text-gray-700" id="processingStatus">Analyzing your prompt and image...</p>
209
  <div class="w-full bg-gray-200 rounded-full h-2 mt-1">
210
  <div id="processingProgress" class="progress-bar bg-blue-500 h-2 rounded-full" style="width: 0%"></div>
211
  </div>
212
  </div>
213
  </div>
214
  <div class="text-sm text-gray-500">
215
- <p id="processingTime">Estimated time: 15-30 seconds</p>
216
- <p class="mt-1 text-xs italic" id="aiThinking">"I'm imagining how to bring your vision to life..."</p>
217
  </div>
218
  </div>
219
  </div>
220
 
221
  <!-- AI Suggestions -->
222
- <div id="suggestionsSection" class="bg-white rounded-xl shadow-md p-6 hidden">
223
  <h2 class="text-xl font-semibold text-gray-800 mb-4">AI Suggestions</h2>
224
  <div class="space-y-3">
225
  <div class="p-3 bg-blue-50 rounded-lg">
@@ -237,6 +255,33 @@
237
  </div>
238
  </div>
239
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
  <script>
241
  document.addEventListener('DOMContentLoaded', function() {
242
  // DOM Elements
@@ -258,16 +303,24 @@
258
  const processingStatus = document.getElementById('processingStatus');
259
  const processingTime = document.getElementById('processingTime');
260
  const aiThinking = document.getElementById('aiThinking');
261
- const downloadBtn = document.getElementById('downloadBtn');
262
- const gifBtn = document.getElementById('gifBtn');
 
263
  const shareBtn = document.getElementById('shareBtn');
264
- const newProjectBtn = document.getElementById('newProjectBtn');
265
  const promptInput = document.getElementById('promptInput');
266
  const duration = document.getElementById('duration');
267
  const durationValue = document.getElementById('durationValue');
 
 
268
  const aiBadge = document.getElementById('aiBadge');
269
  const suggestionsSection = document.getElementById('suggestionsSection');
270
  const styleOptions = document.querySelectorAll('.style-option');
 
 
 
 
 
 
271
 
272
  // Variables
273
  let uploadedFile = null;
@@ -276,15 +329,22 @@
276
  let mediaRecorder = null;
277
  let chunks = [];
278
  let selectedStyle = 'realistic';
279
- let aiMessages = [
280
- "Analyzing the visual elements in your image...",
 
 
 
 
 
281
  "Interpreting your creative prompt...",
282
- "Generating motion paths for objects...",
283
- "Adding atmospheric effects...",
284
- "Rendering high-quality frames...",
285
- "Almost done! Applying final touches..."
286
  ];
287
 
 
 
288
  // Event Listeners
289
  dropzone.addEventListener('click', () => fileInput.click());
290
  fileInput.addEventListener('change', handleFileSelect);
@@ -309,12 +369,13 @@
309
 
310
  removeFile.addEventListener('click', resetFileUpload);
311
  generateBtn.addEventListener('click', generateVideo);
312
- downloadBtn.addEventListener('click', downloadVideo);
313
- gifBtn.addEventListener('click', downloadGif);
 
314
  shareBtn.addEventListener('click', shareVideo);
315
- newProjectBtn.addEventListener('click', resetProject);
316
- duration.addEventListener('input', updateDurationValue);
317
  promptInput.addEventListener('input', checkGenerateButton);
 
 
318
 
319
  // Style selection
320
  styleOptions.forEach(option => {
@@ -325,9 +386,16 @@
325
  });
326
  });
327
 
 
 
 
 
 
328
  // Initialize
329
  updateDurationValue();
 
330
  styleOptions[0].classList.add('border-blue-500', 'bg-blue-50');
 
331
 
332
  // Functions
333
  function handleFileSelect(e) {
@@ -398,6 +466,17 @@
398
  canvasPreview.classList.remove('hidden');
399
  aiBadge.classList.remove('hidden');
400
 
 
 
 
 
 
 
 
 
 
 
 
401
  // Start the AI processing simulation
402
  simulateAIProcessing();
403
  }
@@ -413,13 +492,20 @@
413
  if (currentStep < steps) {
414
  progress = Math.round(((currentStep + 1) / steps) * 100);
415
  processingProgress.style.width = `${progress}%`;
416
- processingStatus.textContent = aiMessages[currentStep];
 
 
 
417
 
418
  // Show "AI thinking" messages
419
  if (currentStep % 2 === 0) {
420
  showAIThinkingMessage();
421
  }
422
 
 
 
 
 
423
  // Update the canvas with "AI generation" effect
424
  updateAICanvas(currentStep / steps);
425
 
@@ -429,9 +515,6 @@
429
  processingComplete();
430
  }
431
  }, stepDuration);
432
-
433
- // Update estimated time
434
- processingTime.textContent = `Estimated time: ${Math.round(totalDuration/1000)} seconds`;
435
  }
436
 
437
  function showAIThinkingMessage() {
@@ -469,7 +552,7 @@
469
  // Style-specific effects
470
  if (selectedStyle === 'fantasy') {
471
  // Add magical particles
472
- for (let i = 0; i < 20 * progress; i++) {
473
  const x = Math.random() * canvasPreview.width;
474
  const y = Math.random() * canvasPreview.height;
475
  const size = 2 + Math.random() * 4;
@@ -548,6 +631,9 @@
548
  videoBlob = new Blob(chunks, { type: 'video/mp4' });
549
  videoPreview.src = URL.createObjectURL(videoBlob);
550
 
 
 
 
551
  // Also create a GIF version
552
  createGifVersion(canvas, img);
553
  };
@@ -588,20 +674,22 @@
588
  let x = (width - img.width * scale) / 2;
589
  let y = (height - img.height * scale) / 2;
590
 
591
- // Base animation based on style
 
 
592
  switch(selectedStyle) {
593
  case 'realistic':
594
  // Subtle natural movements
595
- x += Math.sin(progress * Math.PI * 2) * 10;
596
- y += Math.cos(progress * Math.PI) * 5;
597
  break;
598
 
599
  case 'fantasy':
600
  // Magical floating effect
601
- y += Math.sin(progress * Math.PI * 4) * 20;
602
 
603
  // Add magical particles
604
- for (let i = 0; i < 30; i++) {
605
  const px = Math.random() * width;
606
  const py = Math.random() * height;
607
  const size = 2 + Math.random() * 5;
@@ -616,7 +704,7 @@
616
 
617
  case 'cinematic':
618
  // Slow zoom with parallax
619
- const zoom = 0.1 * progress;
620
  x = (width - img.width * scale * (1 + zoom)) / 2;
621
  y = (height - img.height * scale * (1 + zoom)) / 2;
622
 
@@ -627,13 +715,15 @@
627
  );
628
  gradient.addColorStop(0, 'rgba(0,0,0,0)');
629
  gradient.addColorStop(1, 'rgba(0,0,0,0.5)');
 
 
630
  break;
631
 
632
  case 'painting':
633
  // Brush stroke effect
634
  ctx.globalAlpha = 0.9;
635
  if (progress > 0.5) {
636
- ctx.filter = 'blur(1px)';
637
  }
638
  break;
639
  }
@@ -658,6 +748,8 @@
658
 
659
  gifRecorder.onstop = function() {
660
  gifBlob = new Blob(gifChunks, { type: 'image/gif' });
 
 
661
  };
662
 
663
  // Start recording for GIF
@@ -689,33 +781,168 @@
689
  document.body.removeChild(a);
690
  }
691
 
692
- function shareVideo() {
693
- alert('In a real app, this would share your video on social media or via email');
694
- // Actual implementation would use the Web Share API or social media SDKs
 
 
 
 
 
 
 
 
 
695
  }
696
 
697
- function resetProject() {
698
- resetFileUpload();
699
- exportSection.classList.add('hidden');
700
- processingSection.classList.add('hidden');
701
- suggestionsSection.classList.add('hidden');
702
- videoPreview.classList.add('hidden');
703
- canvasPreview.classList.add('hidden');
704
- aiBadge.classList.add('hidden');
705
- videoPreview.src = '';
706
- promptInput.value = '';
707
- videoBlob = null;
708
- gifBlob = null;
709
-
710
- // Reset settings
711
- duration.value = 10;
712
- updateDurationValue();
713
- checkGenerateButton();
714
  }
715
 
716
  function updateDurationValue() {
717
  durationValue.textContent = `${duration.value}s`;
718
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
719
  });
720
  </script>
721
  <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=PirateKnobi/appcreator" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AI Video Creator | Transform Images to Videos</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
  <style>
 
22
  .progress-bar {
23
  transition: width 0.3s ease;
24
  }
25
+ .workspace-item {
26
+ transition: all 0.2s ease;
 
27
  }
28
+ .workspace-item:hover {
29
+ transform: translateY(-2px);
30
+ box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
31
  }
32
+ .kenburns-effect {
33
+ animation: kenburns 20s infinite alternate;
34
  }
35
+ @keyframes kenburns {
36
  0% { transform: scale(1); }
37
+ 100% { transform: scale(1.1); }
38
  }
39
+ .ai-badge {
 
 
 
 
 
 
 
 
40
  position: absolute;
41
  bottom: 10px;
42
  right: 10px;
 
46
  border-radius: 4px;
47
  font-size: 10px;
48
  }
49
+ .prompt-input {
50
+ min-height: 100px;
51
+ resize: none;
52
+ }
53
  </style>
54
  </head>
55
+ <body class="bg-gray-50 min-h-screen">
56
+ <div class="container mx-auto px-4 py-6">
57
  <!-- Header -->
58
+ <header class="flex justify-between items-center mb-8">
59
+ <div>
60
+ <h1 class="text-3xl font-bold text-gray-800">AI Video Creator</h1>
61
+ <p class="text-gray-600">Transform images into animated videos with AI</p>
62
+ </div>
63
+ <div class="flex items-center space-x-4">
64
+ <button id="workspaceBtn" class="px-4 py-2 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 flex items-center">
65
+ <i class="fas fa-folder-open mr-2 text-blue-500"></i>
66
+ My Workspace
67
+ </button>
68
+ <div class="w-10 h-10 rounded-full bg-blue-500 text-white flex items-center justify-center">
69
+ <i class="fas fa-user"></i>
70
+ </div>
71
+ </div>
72
  </header>
73
 
74
  <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
75
+ <!-- Left Panel - Creation Tools -->
76
+ <div class="lg:col-span-1 bg-white rounded-xl shadow-sm p-6">
77
  <div class="space-y-6">
78
  <!-- Prompt Section -->
79
  <div>
80
+ <h2 class="text-xl font-semibold text-gray-800 mb-3">AI Prompt</h2>
81
+ <textarea id="promptInput" class="w-full prompt-input rounded-lg border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500" placeholder="Describe the animation you want..."></textarea>
82
  <div class="flex items-center mt-2 text-sm text-gray-500">
83
  <i class="fas fa-lightbulb mr-2 text-yellow-500"></i>
84
+ <span>Example: "Make the waterfall flow and add mist effects"</span>
85
  </div>
86
  </div>
87
 
88
+ <!-- Image Upload -->
89
  <div>
90
+ <h2 class="text-xl font-semibold text-gray-800 mb-3">Upload Image</h2>
91
+ <div id="dropzone" class="dropzone rounded-lg p-6 text-center cursor-pointer">
92
  <div class="flex flex-col items-center justify-center space-y-3">
93
  <i class="fas fa-cloud-upload-alt text-4xl text-blue-500"></i>
94
  <p class="text-gray-600">Drag & drop your image here</p>
95
  <p class="text-sm text-gray-500">or</p>
96
+ <label for="fileInput" class="px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition cursor-pointer">
97
+ Select Image
98
  </label>
99
  <input id="fileInput" type="file" accept="image/*" class="hidden">
100
  </div>
 
117
  </div>
118
  </div>
119
 
120
+ <!-- Animation Settings -->
121
  <div class="space-y-4">
122
+ <h2 class="text-xl font-semibold text-gray-800">Animation Settings</h2>
123
+
124
  <!-- Style Selector -->
125
  <div>
126
+ <label class="block text-sm font-medium text-gray-700 mb-2">Animation Style</label>
127
  <div class="grid grid-cols-2 gap-2">
128
+ <button class="style-option px-3 py-2 border rounded-lg text-sm hover:bg-gray-50" data-style="realistic">
129
  <i class="fas fa-mountain mr-1"></i> Realistic
130
  </button>
131
+ <button class="style-option px-3 py-2 border rounded-lg text-sm hover:bg-gray-50" data-style="fantasy">
132
  <i class="fas fa-hat-wizard mr-1"></i> Fantasy
133
  </button>
134
+ <button class="style-option px-3 py-2 border rounded-lg text-sm hover:bg-gray-50" data-style="cinematic">
135
  <i class="fas fa-film mr-1"></i> Cinematic
136
  </button>
137
+ <button class="style-option px-3 py-2 border rounded-lg text-sm hover:bg-gray-50" data-style="painting">
138
  <i class="fas fa-palette mr-1"></i> Painting
139
  </button>
140
  </div>
 
142
 
143
  <!-- Duration -->
144
  <div>
145
+ <label class="block text-sm font-medium text-gray-700 mb-2">Duration (seconds)</label>
146
  <input id="duration" type="range" min="3" max="30" value="10" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
147
  <div class="flex justify-between text-xs text-gray-500 mt-1">
148
  <span>3s</span>
 
151
  </div>
152
  </div>
153
 
154
+ <!-- Intensity -->
155
+ <div>
156
+ <label class="block text-sm font-medium text-gray-700 mb-2">Motion Intensity</label>
157
+ <input id="intensity" type="range" min="1" max="5" value="3" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
158
+ <div class="flex justify-between text-xs text-gray-500 mt-1">
159
+ <span>Subtle</span>
160
+ <span id="intensityValue">Medium</span>
161
+ <span>Strong</span>
162
+ </div>
163
+ </div>
164
  </div>
165
+
166
+ <!-- Generate Button -->
167
+ <button id="generateBtn" class="w-full py-3 px-4 bg-gradient-to-r from-blue-500 to-purple-600 text-white font-semibold rounded-lg shadow-md hover:opacity-90 transition disabled:opacity-50 disabled:cursor-not-allowed" disabled>
168
+ <i class="fas fa-magic mr-2"></i> Generate AI Video
169
+ </button>
170
  </div>
171
  </div>
172
 
173
  <!-- Right Panel - Preview and Export -->
174
  <div class="lg:col-span-2 space-y-6">
175
  <!-- Preview Section -->
176
+ <div class="bg-white rounded-xl shadow-sm p-6">
177
  <div class="flex justify-between items-center mb-4">
178
  <h2 class="text-xl font-semibold text-gray-800">Video Preview</h2>
179
  <div id="aiBadge" class="text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded-full hidden">
180
  <i class="fas fa-robot mr-1"></i> AI Generated
181
  </div>
182
  </div>
183
+ <div id="previewContainer" class="video-preview rounded-lg overflow-hidden flex items-center justify-center relative">
184
  <div id="emptyPreview" class="text-center p-6">
185
  <i class="fas fa-image text-4xl text-gray-400 mb-3"></i>
186
+ <p class="text-gray-500">Upload an image and enter a prompt to create your AI video</p>
187
  </div>
188
+ <img id="imagePreview" class="absolute inset-0 w-full h-full object-cover hidden kenburns-effect">
189
  <video id="videoPreview" controls class="absolute inset-0 w-full h-full hidden"></video>
190
  <canvas id="canvasPreview" class="absolute inset-0 w-full h-full hidden"></canvas>
191
  </div>
192
  </div>
193
 
194
  <!-- Export Section -->
195
+ <div id="exportSection" class="bg-white rounded-xl shadow-sm p-6 hidden">
196
+ <h2 class="text-xl font-semibold text-gray-800 mb-4">Export & Save</h2>
197
+ <div class="grid grid-cols-2 md:grid-cols-4 gap-4">
198
+ <button id="downloadMp4Btn" class="py-2 px-3 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition flex flex-col items-center">
199
+ <i class="fas fa-file-video text-xl mb-1"></i>
200
+ <span class="text-sm">MP4</span>
201
  </button>
202
+ <button id="downloadGifBtn" class="py-2 px-3 bg-purple-500 text-white rounded-lg hover:bg-purple-600 transition flex flex-col items-center">
203
+ <i class="fas fa-file-image text-xl mb-1"></i>
204
+ <span class="text-sm">GIF</span>
205
  </button>
206
+ <button id="saveWorkspaceBtn" class="py-2 px-3 bg-green-500 text-white rounded-lg hover:bg-green-600 transition flex flex-col items-center">
207
+ <i class="fas fa-save text-xl mb-1"></i>
208
+ <span class="text-sm">Save</span>
209
  </button>
210
+ <button id="shareBtn" class="py-2 px-3 bg-pink-500 text-white rounded-lg hover:bg-pink-600 transition flex flex-col items-center">
211
+ <i class="fas fa-share-alt text-xl mb-1"></i>
212
+ <span class="text-sm">Share</span>
 
 
213
  </button>
214
  </div>
215
  </div>
216
 
217
  <!-- Processing Section -->
218
+ <div id="processingSection" class="bg-white rounded-xl shadow-sm p-6 hidden">
219
  <h2 class="text-xl font-semibold text-gray-800 mb-4">AI is Creating Your Video</h2>
220
  <div class="space-y-4">
221
  <div class="flex items-center space-x-4">
 
223
  <i class="fas fa-robot text-blue-500 text-xl"></i>
224
  </div>
225
  <div class="flex-1">
226
+ <p class="font-medium text-gray-700" id="processingStatus">Analyzing your image and prompt...</p>
227
  <div class="w-full bg-gray-200 rounded-full h-2 mt-1">
228
  <div id="processingProgress" class="progress-bar bg-blue-500 h-2 rounded-full" style="width: 0%"></div>
229
  </div>
230
  </div>
231
  </div>
232
  <div class="text-sm text-gray-500">
233
+ <p id="processingTime">Estimated time remaining: 20 seconds</p>
234
+ <p class="mt-1 text-xs italic" id="aiThinking">"I'm analyzing the composition of your image..."</p>
235
  </div>
236
  </div>
237
  </div>
238
 
239
  <!-- AI Suggestions -->
240
+ <div id="suggestionsSection" class="bg-white rounded-xl shadow-sm p-6 hidden">
241
  <h2 class="text-xl font-semibold text-gray-800 mb-4">AI Suggestions</h2>
242
  <div class="space-y-3">
243
  <div class="p-3 bg-blue-50 rounded-lg">
 
255
  </div>
256
  </div>
257
 
258
+ <!-- Workspace Modal -->
259
+ <div id="workspaceModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50 hidden">
260
+ <div class="bg-white rounded-xl shadow-lg w-full max-w-4xl max-h-[90vh] overflow-hidden">
261
+ <div class="flex justify-between items-center border-b p-4">
262
+ <h3 class="text-xl font-semibold text-gray-800">My Workspace</h3>
263
+ <button id="closeWorkspaceBtn" class="text-gray-500 hover:text-gray-700">
264
+ <i class="fas fa-times"></i>
265
+ </button>
266
+ </div>
267
+ <div class="p-4 overflow-y-auto max-h-[70vh]">
268
+ <div id="workspaceGrid" class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
269
+ <!-- Workspace items will be added here dynamically -->
270
+ <div class="text-center py-10 text-gray-500" id="emptyWorkspace">
271
+ <i class="fas fa-folder-open text-4xl mb-3"></i>
272
+ <p>Your workspace is empty</p>
273
+ <p class="text-sm mt-1">Create and save videos to see them here</p>
274
+ </div>
275
+ </div>
276
+ </div>
277
+ <div class="border-t p-4 flex justify-end">
278
+ <button id="clearWorkspaceBtn" class="px-4 py-2 bg-red-500 text-white rounded-lg hover:bg-red-600 transition">
279
+ <i class="fas fa-trash mr-2"></i> Clear Workspace
280
+ </button>
281
+ </div>
282
+ </div>
283
+ </div>
284
+
285
  <script>
286
  document.addEventListener('DOMContentLoaded', function() {
287
  // DOM Elements
 
303
  const processingStatus = document.getElementById('processingStatus');
304
  const processingTime = document.getElementById('processingTime');
305
  const aiThinking = document.getElementById('aiThinking');
306
+ const downloadMp4Btn = document.getElementById('downloadMp4Btn');
307
+ const downloadGifBtn = document.getElementById('downloadGifBtn');
308
+ const saveWorkspaceBtn = document.getElementById('saveWorkspaceBtn');
309
  const shareBtn = document.getElementById('shareBtn');
 
310
  const promptInput = document.getElementById('promptInput');
311
  const duration = document.getElementById('duration');
312
  const durationValue = document.getElementById('durationValue');
313
+ const intensity = document.getElementById('intensity');
314
+ const intensityValue = document.getElementById('intensityValue');
315
  const aiBadge = document.getElementById('aiBadge');
316
  const suggestionsSection = document.getElementById('suggestionsSection');
317
  const styleOptions = document.querySelectorAll('.style-option');
318
+ const workspaceBtn = document.getElementById('workspaceBtn');
319
+ const workspaceModal = document.getElementById('workspaceModal');
320
+ const closeWorkspaceBtn = document.getElementById('closeWorkspaceBtn');
321
+ const workspaceGrid = document.getElementById('workspaceGrid');
322
+ const emptyWorkspace = document.getElementById('emptyWorkspace');
323
+ const clearWorkspaceBtn = document.getElementById('clearWorkspaceBtn');
324
 
325
  // Variables
326
  let uploadedFile = null;
 
329
  let mediaRecorder = null;
330
  let chunks = [];
331
  let selectedStyle = 'realistic';
332
+ let motionIntensity = 3;
333
+ let workspaceItems = JSON.parse(localStorage.getItem('aiVideoWorkspace')) || [];
334
+ let currentProject = null;
335
+
336
+ // Animation messages
337
+ const aiMessages = [
338
+ "Analyzing image composition...",
339
  "Interpreting your creative prompt...",
340
+ "Generating motion paths...",
341
+ "Applying ${selectedStyle} effects...",
342
+ "Rendering animation frames...",
343
+ "Finalizing video output..."
344
  ];
345
 
346
+ const intensityLabels = ['Subtle', 'Light', 'Medium', 'Strong', 'Extreme'];
347
+
348
  // Event Listeners
349
  dropzone.addEventListener('click', () => fileInput.click());
350
  fileInput.addEventListener('change', handleFileSelect);
 
369
 
370
  removeFile.addEventListener('click', resetFileUpload);
371
  generateBtn.addEventListener('click', generateVideo);
372
+ downloadMp4Btn.addEventListener('click', downloadVideo);
373
+ downloadGifBtn.addEventListener('click', downloadGif);
374
+ saveWorkspaceBtn.addEventListener('click', saveToWorkspace);
375
  shareBtn.addEventListener('click', shareVideo);
 
 
376
  promptInput.addEventListener('input', checkGenerateButton);
377
+ duration.addEventListener('input', updateDurationValue);
378
+ intensity.addEventListener('input', updateIntensityValue);
379
 
380
  // Style selection
381
  styleOptions.forEach(option => {
 
386
  });
387
  });
388
 
389
+ // Workspace
390
+ workspaceBtn.addEventListener('click', openWorkspace);
391
+ closeWorkspaceBtn.addEventListener('click', closeWorkspace);
392
+ clearWorkspaceBtn.addEventListener('click', clearWorkspace);
393
+
394
  // Initialize
395
  updateDurationValue();
396
+ updateIntensityValue();
397
  styleOptions[0].classList.add('border-blue-500', 'bg-blue-50');
398
+ renderWorkspace();
399
 
400
  // Functions
401
  function handleFileSelect(e) {
 
466
  canvasPreview.classList.remove('hidden');
467
  aiBadge.classList.remove('hidden');
468
 
469
+ // Create project object
470
+ currentProject = {
471
+ id: Date.now(),
472
+ prompt: promptInput.value.trim(),
473
+ style: selectedStyle,
474
+ intensity: motionIntensity,
475
+ duration: parseInt(duration.value),
476
+ image: imagePreview.src,
477
+ createdAt: new Date().toISOString()
478
+ };
479
+
480
  // Start the AI processing simulation
481
  simulateAIProcessing();
482
  }
 
492
  if (currentStep < steps) {
493
  progress = Math.round(((currentStep + 1) / steps) * 100);
494
  processingProgress.style.width = `${progress}%`;
495
+
496
+ // Update status with interpolated message
497
+ const message = aiMessages[currentStep].replace('${selectedStyle}', selectedStyle);
498
+ processingStatus.textContent = message;
499
 
500
  // Show "AI thinking" messages
501
  if (currentStep % 2 === 0) {
502
  showAIThinkingMessage();
503
  }
504
 
505
+ // Update estimated time
506
+ const remaining = Math.round((totalDuration - (currentStep * stepDuration)) / 1000);
507
+ processingTime.textContent = `Estimated time remaining: ${remaining} seconds`;
508
+
509
  // Update the canvas with "AI generation" effect
510
  updateAICanvas(currentStep / steps);
511
 
 
515
  processingComplete();
516
  }
517
  }, stepDuration);
 
 
 
518
  }
519
 
520
  function showAIThinkingMessage() {
 
552
  // Style-specific effects
553
  if (selectedStyle === 'fantasy') {
554
  // Add magical particles
555
+ for (let i = 0; i < 20 * progress * motionIntensity; i++) {
556
  const x = Math.random() * canvasPreview.width;
557
  const y = Math.random() * canvasPreview.height;
558
  const size = 2 + Math.random() * 4;
 
631
  videoBlob = new Blob(chunks, { type: 'video/mp4' });
632
  videoPreview.src = URL.createObjectURL(videoBlob);
633
 
634
+ // Save video URL to current project
635
+ currentProject.videoUrl = URL.createObjectURL(videoBlob);
636
+
637
  // Also create a GIF version
638
  createGifVersion(canvas, img);
639
  };
 
674
  let x = (width - img.width * scale) / 2;
675
  let y = (height - img.height * scale) / 2;
676
 
677
+ // Base animation based on style and intensity
678
+ const intensityFactor = motionIntensity / 3; // Normalize to 1
679
+
680
  switch(selectedStyle) {
681
  case 'realistic':
682
  // Subtle natural movements
683
+ x += Math.sin(progress * Math.PI * 2) * 10 * intensityFactor;
684
+ y += Math.cos(progress * Math.PI) * 5 * intensityFactor;
685
  break;
686
 
687
  case 'fantasy':
688
  // Magical floating effect
689
+ y += Math.sin(progress * Math.PI * 4) * 20 * intensityFactor;
690
 
691
  // Add magical particles
692
+ for (let i = 0; i < 30 * intensityFactor; i++) {
693
  const px = Math.random() * width;
694
  const py = Math.random() * height;
695
  const size = 2 + Math.random() * 5;
 
704
 
705
  case 'cinematic':
706
  // Slow zoom with parallax
707
+ const zoom = 0.1 * progress * intensityFactor;
708
  x = (width - img.width * scale * (1 + zoom)) / 2;
709
  y = (height - img.height * scale * (1 + zoom)) / 2;
710
 
 
715
  );
716
  gradient.addColorStop(0, 'rgba(0,0,0,0)');
717
  gradient.addColorStop(1, 'rgba(0,0,0,0.5)');
718
+ ctx.fillStyle = gradient;
719
+ ctx.fillRect(0, 0, width, height);
720
  break;
721
 
722
  case 'painting':
723
  // Brush stroke effect
724
  ctx.globalAlpha = 0.9;
725
  if (progress > 0.5) {
726
+ ctx.filter = `blur(${intensityFactor}px)`;
727
  }
728
  break;
729
  }
 
748
 
749
  gifRecorder.onstop = function() {
750
  gifBlob = new Blob(gifChunks, { type: 'image/gif' });
751
+ // Save GIF URL to current project
752
+ currentProject.gifUrl = URL.createObjectURL(gifBlob);
753
  };
754
 
755
  // Start recording for GIF
 
781
  document.body.removeChild(a);
782
  }
783
 
784
+ function saveToWorkspace() {
785
+ if (!currentProject) return;
786
+
787
+ // Add to workspace
788
+ workspaceItems.unshift(currentProject);
789
+ localStorage.setItem('aiVideoWorkspace', JSON.stringify(workspaceItems));
790
+
791
+ // Show success message
792
+ alert('Project saved to your workspace!');
793
+
794
+ // Update workspace display
795
+ renderWorkspace();
796
  }
797
 
798
+ function shareVideo() {
799
+ if (!videoBlob) return;
800
+
801
+ // In a real app, this would use the Web Share API or social media SDKs
802
+ alert('Share functionality would be implemented here. In a real app, this would allow sharing to social media or via email.');
 
 
 
 
 
 
 
 
 
 
 
 
803
  }
804
 
805
  function updateDurationValue() {
806
  durationValue.textContent = `${duration.value}s`;
807
  }
808
+
809
+ function updateIntensityValue() {
810
+ motionIntensity = parseInt(intensity.value);
811
+ intensityValue.textContent = intensityLabels[motionIntensity - 1];
812
+ }
813
+
814
+ // Workspace Functions
815
+ function openWorkspace() {
816
+ workspaceModal.classList.remove('hidden');
817
+ }
818
+
819
+ function closeWorkspace() {
820
+ workspaceModal.classList.add('hidden');
821
+ }
822
+
823
+ function clearWorkspace() {
824
+ if (confirm('Are you sure you want to clear your workspace? This cannot be undone.')) {
825
+ workspaceItems = [];
826
+ localStorage.setItem('aiVideoWorkspace', JSON.stringify(workspaceItems));
827
+ renderWorkspace();
828
+ }
829
+ }
830
+
831
+ function renderWorkspace() {
832
+ workspaceGrid.innerHTML = '';
833
+
834
+ if (workspaceItems.length === 0) {
835
+ emptyWorkspace.classList.remove('hidden');
836
+ return;
837
+ }
838
+
839
+ emptyWorkspace.classList.add('hidden');
840
+
841
+ workspaceItems.forEach((project, index) => {
842
+ const projectElement = document.createElement('div');
843
+ projectElement.className = 'workspace-item bg-white rounded-lg overflow-hidden shadow-sm border border-gray-200 cursor-pointer';
844
+ projectElement.innerHTML = `
845
+ <div class="relative pt-[56.25%]">
846
+ <img src="${project.image}" class="absolute inset-0 w-full h-full object-cover">
847
+ <div class="ai-badge">
848
+ <i class="fas fa-robot mr-1"></i> ${project.style}
849
+ </div>
850
+ </div>
851
+ <div class="p-3">
852
+ <h4 class="font-medium text-gray-800 truncate">${project.prompt}</h4>
853
+ <div class="flex justify-between items-center mt-2 text-xs text-gray-500">
854
+ <span>${new Date(project.createdAt).toLocaleDateString()}</span>
855
+ <div class="flex space-x-2">
856
+ <button class="text-blue-500 hover:text-blue-700 edit-project" data-id="${project.id}">
857
+ <i class="fas fa-edit"></i>
858
+ </button>
859
+ <button class="text-red-500 hover:text-red-700 delete-project" data-id="${project.id}">
860
+ <i class="fas fa-trash"></i>
861
+ </button>
862
+ </div>
863
+ </div>
864
+ </div>
865
+ `;
866
+
867
+ workspaceGrid.appendChild(projectElement);
868
+
869
+ // Add event listeners to the new buttons
870
+ projectElement.querySelector('.edit-project').addEventListener('click', (e) => {
871
+ e.stopPropagation();
872
+ editProject(project.id);
873
+ });
874
+
875
+ projectElement.querySelector('.delete-project').addEventListener('click', (e) => {
876
+ e.stopPropagation();
877
+ deleteProject(project.id);
878
+ });
879
+
880
+ projectElement.addEventListener('click', () => openProject(project.id));
881
+ });
882
+ }
883
+
884
+ function openProject(id) {
885
+ const project = workspaceItems.find(p => p.id === id);
886
+ if (!project) return;
887
+
888
+ // Load project into editor
889
+ promptInput.value = project.prompt;
890
+ duration.value = project.duration;
891
+ updateDurationValue();
892
+ intensity.value = project.intensity;
893
+ updateIntensityValue();
894
+
895
+ // Set style
896
+ styleOptions.forEach(opt => opt.classList.remove('border-blue-500', 'bg-blue-50'));
897
+ const styleBtn = document.querySelector(`.style-option[data-style="${project.style}"]`);
898
+ if (styleBtn) styleBtn.classList.add('border-blue-500', 'bg-blue-50');
899
+ selectedStyle = project.style;
900
+
901
+ // Load image
902
+ imagePreview.src = project.image;
903
+ imagePreview.classList.remove('hidden');
904
+ emptyPreview.classList.add('hidden');
905
+
906
+ // Load video if available
907
+ if (project.videoUrl) {
908
+ videoPreview.src = project.videoUrl;
909
+ videoPreview.classList.remove('hidden');
910
+ exportSection.classList.remove('hidden');
911
+ aiBadge.classList.remove('hidden');
912
+ } else {
913
+ videoPreview.classList.add('hidden');
914
+ exportSection.classList.add('hidden');
915
+ }
916
+
917
+ // Set as current project
918
+ currentProject = project;
919
+
920
+ // Close workspace
921
+ closeWorkspace();
922
+
923
+ // Scroll to top
924
+ window.scrollTo(0, 0);
925
+ }
926
+
927
+ function editProject(id) {
928
+ const project = workspaceItems.find(p => p.id === id);
929
+ if (!project) return;
930
+
931
+ const newPrompt = prompt('Edit your prompt:', project.prompt);
932
+ if (newPrompt !== null) {
933
+ project.prompt = newPrompt;
934
+ localStorage.setItem('aiVideoWorkspace', JSON.stringify(workspaceItems));
935
+ renderWorkspace();
936
+ }
937
+ }
938
+
939
+ function deleteProject(id) {
940
+ if (confirm('Are you sure you want to delete this project?')) {
941
+ workspaceItems = workspaceItems.filter(p => p.id !== id);
942
+ localStorage.setItem('aiVideoWorkspace', JSON.stringify(workspaceItems));
943
+ renderWorkspace();
944
+ }
945
+ }
946
  });
947
  </script>
948
  <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=PirateKnobi/appcreator" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>