Download index.html from Filimon1/animation: direct link, hf CLI and curl.
- Browser
- Download file 33.8 kB
-
https://huggingface.co/spaces/Filimon1/animation/resolve/main/index.html
- Command line
-
hf download hf://spaces/Filimon1/animation/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Filimon1/animation/resolve/main/index.html
33.8 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>ViralToon - AI Animation Creator</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap'); | |
| body { | |
| font-family: 'Poppins', sans-serif; | |
| background-color: #f8f9fa; | |
| } | |
| .gradient-bg { | |
| background: linear-gradient(135deg, #6e8efb, #a777e3); | |
| } | |
| .animation-preview { | |
| aspect-ratio: 9/16; | |
| background: linear-gradient(45deg, #f3f4f6, #e5e7eb); | |
| } | |
| .character-option:hover, .scene-option:hover { | |
| transform: scale(1.05); | |
| box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); | |
| } | |
| .progress-bar { | |
| height: 4px; | |
| transition: width 0.3s ease; | |
| } | |
| .tab-active { | |
| border-bottom: 3px solid #6e8efb; | |
| color: #6e8efb; | |
| } | |
| .voice-wave { | |
| animation: wave 1.5s infinite ease-in-out; | |
| } | |
| @keyframes wave { | |
| 0%, 100% { height: 60%; } | |
| 50% { height: 100%; } | |
| } | |
| .voice-wave:nth-child(2) { | |
| animation-delay: 0.2s; | |
| } | |
| .voice-wave:nth-child(3) { | |
| animation-delay: 0.4s; | |
| } | |
| .voice-wave:nth-child(4) { | |
| animation-delay: 0.6s; | |
| } | |
| .voice-wave:nth-child(5) { | |
| animation-delay: 0.8s; | |
| } | |
| .template-card { | |
| transition: all 0.3s ease; | |
| } | |
| .template-card:hover { | |
| transform: translateY(-5px); | |
| } | |
| .download-btn { | |
| background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); | |
| } | |
| .fade-in { | |
| animation: fadeIn 0.5s ease-in; | |
| } | |
| @keyframes fadeIn { | |
| from { opacity: 0; } | |
| to { opacity: 1; } | |
| } | |
| </style> | |
| </head> | |
| <body class="text-gray-800"> | |
| <!-- Mobile App Container --> | |
| <div class="max-w-md mx-auto bg-white min-h-screen relative overflow-hidden"> | |
| <!-- Header --> | |
| <header class="gradient-bg text-white p-4 flex justify-between items-center"> | |
| <button class="p-2 rounded-full bg-white bg-opacity-20" onclick="goBack()"> | |
| <i class="fas fa-arrow-left text-white"></i> | |
| </button> | |
| <h1 class="text-xl font-bold">ViralToon</h1> | |
| <button class="p-2 rounded-full bg-white bg-opacity-20"> | |
| <i class="fas fa-user text-white"></i> | |
| </button> | |
| </header> | |
| <!-- Main Content --> | |
| <main class="pb-20"> | |
| <!-- Animation Preview Section --> | |
| <div class="relative animation-preview w-full flex items-center justify-center"> | |
| <div id="preview-placeholder" class="absolute inset-0 flex flex-col items-center justify-center text-center p-4"> | |
| <div class="w-32 h-32 rounded-full bg-blue-100 flex items-center justify-center mb-4"> | |
| <i class="fas fa-play text-blue-500 text-4xl"></i> | |
| </div> | |
| <p class="text-gray-600">Your animation will appear here</p> | |
| </div> | |
| <div id="generated-preview" class="hidden absolute inset-0 bg-black"> | |
| <!-- Generated animation would appear here --> | |
| <div class="absolute bottom-0 left-0 right-0 bg-black bg-opacity-50 text-white p-3"> | |
| <div id="subtitles" class="text-center text-sm font-medium">This is an example of auto-generated subtitles that sync with the voice</div> | |
| </div> | |
| </div> | |
| <div class="absolute bottom-4 left-4 bg-black bg-opacity-50 text-white px-3 py-1 rounded-full text-sm"> | |
| <span id="animation-time">0:15</span> | |
| </div> | |
| </div> | |
| <!-- Creation Tabs --> | |
| <div class="flex border-b"> | |
| <button class="flex-1 py-3 font-medium tab-active" onclick="switchTab('input')"> | |
| <i class="fas fa-keyboard mr-1"></i> Input | |
| </button> | |
| <button class="flex-1 py-3 font-medium" onclick="switchTab('templates')"> | |
| <i class="fas fa-th-large mr-1"></i> Templates | |
| </button> | |
| <button class="flex-1 py-3 font-medium" onclick="switchTab('customize')"> | |
| <i class="fas fa-sliders-h mr-1"></i> Customize | |
| </button> | |
| </div> | |
| <!-- Tab Content --> | |
| <div class="p-4"> | |
| <!-- Input Tab --> | |
| <div id="input-tab" class="tab-content"> | |
| <div class="mb-4"> | |
| <label class="block text-sm font-medium mb-1">Enter Your Script</label> | |
| <textarea id="script-input" class="w-full p-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" rows="4" placeholder="Type what you want your character to say... (e.g. 'Hey there! Did you know this animation was made with AI?')"></textarea> | |
| </div> | |
| <div class="mb-4"> | |
| <label class="block text-sm font-medium mb-1">Or Record Your Voice</label> | |
| <div class="flex items-center justify-center p-4 border-2 border-dashed rounded-lg"> | |
| <button id="record-btn" class="w-12 h-12 rounded-full bg-red-500 flex items-center justify-center text-white"> | |
| <i class="fas fa-microphone"></i> | |
| </button> | |
| <div id="voice-waves" class="hidden ml-4 h-8 flex items-center space-x-1"> | |
| <div class="voice-wave w-1 bg-blue-500 rounded-full"></div> | |
| <div class="voice-wave w-1 bg-blue-500 rounded-full"></div> | |
| <div class="voice-wave w-1 bg-blue-500 rounded-full"></div> | |
| <div class="voice-wave w-1 bg-blue-500 rounded-full"></div> | |
| <div class="voice-wave w-1 bg-blue-500 rounded-full"></div> | |
| </div> | |
| <span id="record-status" class="ml-4 text-sm">Press to record</span> | |
| </div> | |
| </div> | |
| <button onclick="generateAnimation()" class="w-full gradient-bg text-white py-3 rounded-lg font-medium flex items-center justify-center"> | |
| <i class="fas fa-magic mr-2"></i> Generate Animation | |
| </button> | |
| </div> | |
| <!-- Templates Tab (Hidden by default) --> | |
| <div id="templates-tab" class="tab-content hidden"> | |
| <div class="mb-4"> | |
| <label class="block text-sm font-medium mb-2">Trending Templates</label> | |
| <div class="grid grid-cols-2 gap-3"> | |
| <div class="template-card bg-gray-100 rounded-lg overflow-hidden cursor-pointer" onclick="selectTemplate('meme')"> | |
| <div class="aspect-video bg-yellow-100 flex items-center justify-center"> | |
| <i class="fas fa-laugh-squint text-3xl text-yellow-500"></i> | |
| </div> | |
| <div class="p-2"> | |
| <h4 class="font-medium text-sm">Meme Reaction</h4> | |
| <p class="text-xs text-gray-500">Popular meme formats</p> | |
| </div> | |
| </div> | |
| <div class="template-card bg-gray-100 rounded-lg overflow-hidden cursor-pointer" onclick="selectTemplate('story')"> | |
| <div class="aspect-video bg-purple-100 flex items-center justify-center"> | |
| <i class="fas fa-book-open text-3xl text-purple-500"></i> | |
| </div> | |
| <div class="p-2"> | |
| <h4 class="font-medium text-sm">Story Time</h4> | |
| <p class="text-xs text-gray-500">Narrative animations</p> | |
| </div> | |
| </div> | |
| <div class="template-card bg-gray-100 rounded-lg overflow-hidden cursor-pointer" onclick="selectTemplate('tutorial')"> | |
| <div class="aspect-video bg-blue-100 flex items-center justify-center"> | |
| <i class="fas fa-chalkboard-teacher text-3xl text-blue-500"></i> | |
| </div> | |
| <div class="p-2"> | |
| <h4 class="font-medium text-sm">Tutorial</h4> | |
| <p class="text-xs text-gray-500">How-to explanations</p> | |
| </div> | |
| </div> | |
| <div class="template-card bg-gray-100 rounded-lg overflow-hidden cursor-pointer" onclick="selectTemplate('emotional')"> | |
| <div class="aspect-video bg-pink-100 flex items-center justify-center"> | |
| <i class="fas fa-heart text-3xl text-pink-500"></i> | |
| </div> | |
| <div class="p-2"> | |
| <h4 class="font-medium text-sm">Emotional</h4> | |
| <p class="text-xs text-gray-500">Heartfelt stories</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="mb-4"> | |
| <label class="block text-sm font-medium mb-2">Recently Popular</label> | |
| <div class="flex overflow-x-auto pb-2 space-x-3"> | |
| <div class="flex-shrink-0 w-24 h-32 bg-gray-100 rounded-lg flex items-center justify-center cursor-pointer" onclick="selectTemplate('dance')"> | |
| <i class="fas fa-music text-2xl text-purple-500"></i> | |
| <span class="absolute bottom-2 text-xs font-medium">Dance Trend</span> | |
| </div> | |
| <div class="flex-shrink-0 w-24 h-32 bg-gray-100 rounded-lg flex items-center justify-center cursor-pointer" onclick="selectTemplate('challenge')"> | |
| <i class="fas fa-trophy text-2xl text-yellow-500"></i> | |
| <span class="absolute bottom-2 text-xs font-medium">Challenge</span> | |
| </div> | |
| <div class="flex-shrink-0 w-24 h-32 bg-gray-100 rounded-lg flex items-center justify-center cursor-pointer" onclick="selectTemplate('prank')"> | |
| <i class="fas fa-surprise text-2xl text-red-500"></i> | |
| <span class="absolute bottom-2 text-xs font-medium">Prank</span> | |
| </div> | |
| <div class="flex-shrink-0 w-24 h-32 bg-gray-100 rounded-lg flex items-center justify-center cursor-pointer" onclick="selectTemplate('food')"> | |
| <i class="fas fa-utensils text-2xl text-orange-500"></i> | |
| <span class="absolute bottom-2 text-xs font-medium">Food Review</span> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Customize Tab (Hidden by default) --> | |
| <div id="customize-tab" class="tab-content hidden"> | |
| <div class="mb-4"> | |
| <label class="block text-sm font-medium mb-2">Character</label> | |
| <div class="flex overflow-x-auto pb-2 space-x-3"> | |
| <div class="character-option flex-shrink-0 w-20 h-20 bg-gray-100 rounded-lg flex items-center justify-center cursor-pointer" onclick="selectCharacter('human')"> | |
| <i class="fas fa-user text-3xl text-gray-400"></i> | |
| </div> | |
| <div class="character-option flex-shrink-0 w-20 h-20 bg-blue-100 rounded-lg flex items-center justify-center cursor-pointer" onclick="selectCharacter('robot')"> | |
| <i class="fas fa-robot text-3xl text-blue-500"></i> | |
| </div> | |
| <div class="character-option flex-shrink-0 w-20 h-20 bg-purple-100 rounded-lg flex items-center justify-center cursor-pointer" onclick="selectCharacter('cat')"> | |
| <i class="fas fa-cat text-3xl text-purple-500"></i> | |
| </div> | |
| <div class="character-option flex-shrink-0 w-20 h-20 bg-yellow-100 rounded-lg flex items-center justify-center cursor-pointer" onclick="selectCharacter('dog')"> | |
| <i class="fas fa-dog text-3xl text-yellow-500"></i> | |
| </div> | |
| <div class="character-option flex-shrink-0 w-20 h-20 bg-green-100 rounded-lg flex items-center justify-center cursor-pointer" onclick="selectCharacter('alien')"> | |
| <i class="fas fa-user-astronaut text-3xl text-green-500"></i> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="mb-4"> | |
| <label class="block text-sm font-medium mb-2">Voice Style</label> | |
| <div class="grid grid-cols-2 gap-2"> | |
| <button class="py-2 px-1 bg-gray-100 rounded text-sm flex items-center justify-center" onclick="selectVoice('male')"> | |
| <i class="fas fa-male text-blue-500 mr-1"></i> Male | |
| </button> | |
| <button class="py-2 px-1 bg-gray-100 rounded text-sm flex items-center justify-center" onclick="selectVoice('female')"> | |
| <i class="fas fa-female text-pink-500 mr-1"></i> Female | |
| </button> | |
| <button class="py-2 px-1 bg-gray-100 rounded text-sm flex items-center justify-center" onclick="selectVoice('child')"> | |
| <i class="fas fa-child text-yellow-500 mr-1"></i> Child | |
| </button> | |
| <button class="py-2 px-1 bg-gray-100 rounded text-sm flex items-center justify-center" onclick="selectVoice('robot')"> | |
| <i class="fas fa-robot text-purple-500 mr-1"></i> Robot | |
| </button> | |
| </div> | |
| </div> | |
| <div class="mb-4"> | |
| <label class="block text-sm font-medium mb-2">Background Music</label> | |
| <div class="grid grid-cols-3 gap-2"> | |
| <button class="py-2 px-1 bg-gray-100 rounded text-xs" onclick="selectMusic('upbeat')"> | |
| <i class="fas fa-music text-blue-500 mr-1"></i> Upbeat | |
| </button> | |
| <button class="py-2 px-1 bg-gray-100 rounded text-xs" onclick="selectMusic('chill')"> | |
| <i class="fas fa-music text-green-500 mr-1"></i> Chill | |
| </button> | |
| <button class="py-2 px-1 bg-gray-100 rounded text-xs" onclick="selectMusic('dramatic')"> | |
| <i class="fas fa-music text-purple-500 mr-1"></i> Dramatic | |
| </button> | |
| <button class="py-2 px-1 bg-gray-100 rounded text-xs" onclick="selectMusic('none')"> | |
| <i class="fas fa-ban text-gray-500 mr-1"></i> None | |
| </button> | |
| </div> | |
| </div> | |
| <div class="mb-4"> | |
| <label class="block text-sm font-medium mb-2">Scene</label> | |
| <div class="grid grid-cols-3 gap-2"> | |
| <div class="scene-option aspect-square bg-gray-200 rounded-lg flex items-center justify-center cursor-pointer" onclick="selectScene('office')"> | |
| <i class="fas fa-building text-gray-600"></i> | |
| </div> | |
| <div class="scene-option aspect-square bg-blue-200 rounded-lg flex items-center justify-center cursor-pointer" onclick="selectScene('beach')"> | |
| <i class="fas fa-umbrella-beach text-blue-600"></i> | |
| </div> | |
| <div class="scene-option aspect-square bg-green-200 rounded-lg flex items-center justify-center cursor-pointer" onclick="selectScene('park')"> | |
| <i class="fas fa-tree text-green-600"></i> | |
| </div> | |
| <div class="scene-option aspect-square bg-yellow-200 rounded-lg flex items-center justify-center cursor-pointer" onclick="selectScene('home')"> | |
| <i class="fas fa-home text-yellow-600"></i> | |
| </div> | |
| <div class="scene-option aspect-square bg-purple-200 rounded-lg flex items-center justify-center cursor-pointer" onclick="selectScene('space')"> | |
| <i class="fas fa-meteor text-purple-600"></i> | |
| </div> | |
| <div class="scene-option aspect-square bg-red-200 rounded-lg flex items-center justify-center cursor-pointer" onclick="selectScene('party')"> | |
| <i class="fas fa-glass-cheers text-red-600"></i> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Download Section (Hidden by default) --> | |
| <div id="download-section" class="hidden p-4 border-t"> | |
| <div class="flex items-center justify-between mb-4"> | |
| <div> | |
| <h3 class="font-bold">Your Animation is Ready!</h3> | |
| <p class="text-sm text-gray-500">Share it with the world</p> | |
| </div> | |
| <button id="play-btn" class="w-12 h-12 rounded-full bg-blue-500 text-white flex items-center justify-center"> | |
| <i class="fas fa-play"></i> | |
| </button> | |
| </div> | |
| <div class="grid grid-cols-4 gap-2 mb-4"> | |
| <button class="p-2 bg-gray-100 rounded flex flex-col items-center"> | |
| <i class="fab fa-tiktok text-xl"></i> | |
| <span class="text-xs mt-1">TikTok</span> | |
| </button> | |
| <button class="p-2 bg-gray-100 rounded flex flex-col items-center"> | |
| <i class="fab fa-instagram text-xl text-pink-600"></i> | |
| <span class="text-xs mt-1">Instagram</span> | |
| </button> | |
| <button class="p-2 bg-gray-100 rounded flex flex-col items-center"> | |
| <i class="fab fa-youtube text-xl text-red-600"></i> | |
| <span class="text-xs mt-1">YouTube</span> | |
| </button> | |
| <button class="p-2 bg-gray-100 rounded flex flex-col items-center"> | |
| <i class="fas fa-link text-xl"></i> | |
| <span class="text-xs mt-1">Copy Link</span> | |
| </button> | |
| </div> | |
| <button id="download-btn" class="w-full download-btn text-white py-3 rounded-lg font-medium flex items-center justify-center"> | |
| <i class="fas fa-download mr-2"></i> Download HD Video | |
| </button> | |
| </div> | |
| </main> | |
| <!-- Bottom Navigation --> | |
| <nav class="fixed bottom-0 w-full max-w-md bg-white border-t flex justify-around py-3"> | |
| <button class="p-2 text-blue-500"> | |
| <i class="fas fa-home text-xl"></i> | |
| </button> | |
| <button class="p-2 text-gray-500"> | |
| <i class="fas fa-compass text-xl"></i> | |
| </button> | |
| <button class="p-2 gradient-bg text-white rounded-full px-4"> | |
| <i class="fas fa-plus text-xl"></i> | |
| </button> | |
| <button class="p-2 text-gray-500"> | |
| <i class="fas fa-heart text-xl"></i> | |
| </button> | |
| <button class="p-2 text-gray-500"> | |
| <i class="fas fa-user text-xl"></i> | |
| </button> | |
| </nav> | |
| <!-- Generate Modal --> | |
| <div id="generate-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden"> | |
| <div class="bg-white rounded-lg p-6 w-4/5 max-w-sm"> | |
| <h3 class="font-bold text-lg mb-4">Generating Animation</h3> | |
| <div class="mb-4"> | |
| <div class="h-2 bg-gray-200 rounded-full overflow-hidden"> | |
| <div id="generation-progress" class="progress-bar bg-blue-500 w-1/4"></div> | |
| </div> | |
| <div class="text-xs text-gray-500 mt-1" id="generation-status">Processing your input...</div> | |
| </div> | |
| <div class="text-center py-4"> | |
| <i class="fas fa-cog fa-spin text-blue-500 text-3xl"></i> | |
| </div> | |
| <p class="text-sm text-gray-600 mb-4">Our AI is creating your viral animation with lip-sync and expressive actions...</p> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| // Current animation settings | |
| const animationSettings = { | |
| character: 'human', | |
| voice: 'male', | |
| music: 'upbeat', | |
| scene: 'office', | |
| template: null, | |
| script: '' | |
| }; | |
| // Tab switching | |
| function switchTab(tabName) { | |
| // Hide all tab contents | |
| document.querySelectorAll('.tab-content').forEach(tab => { | |
| tab.classList.add('hidden'); | |
| }); | |
| // Show selected tab content | |
| document.getElementById(`${tabName}-tab`).classList.remove('hidden'); | |
| // Update active tab indicator | |
| document.querySelectorAll('.flex.border-b button').forEach(btn => { | |
| btn.classList.remove('tab-active'); | |
| if (btn.textContent.includes(tabName.charAt(0).toUpperCase() + tabName.slice(1))) { | |
| btn.classList.add('tab-active'); | |
| } | |
| }); | |
| } | |
| // Record button functionality | |
| const recordBtn = document.getElementById('record-btn'); | |
| const voiceWaves = document.getElementById('voice-waves'); | |
| const recordStatus = document.getElementById('record-status'); | |
| let isRecording = false; | |
| recordBtn.addEventListener('click', function() { | |
| isRecording = !isRecording; | |
| if (isRecording) { | |
| this.innerHTML = '<i class="fas fa-stop"></i>'; | |
| this.classList.add('bg-blue-500'); | |
| this.classList.remove('bg-red-500'); | |
| voiceWaves.classList.remove('hidden'); | |
| recordStatus.textContent = 'Recording...'; | |
| // Get the script from voice recording (simulated) | |
| setTimeout(() => { | |
| document.getElementById('script-input').value = "This is a simulated voice recording being converted to text by our AI."; | |
| }, 2000); | |
| // Simulate progress | |
| let progress = 0; | |
| const progressInterval = setInterval(() => { | |
| progress += 5; | |
| if (progress >= 100) { | |
| clearInterval(progressInterval); | |
| stopRecording(); | |
| } | |
| }, 300); | |
| } else { | |
| stopRecording(); | |
| } | |
| }); | |
| function stopRecording() { | |
| recordBtn.innerHTML = '<i class="fas fa-microphone"></i>'; | |
| recordBtn.classList.remove('bg-blue-500'); | |
| recordBtn.classList.add('bg-red-500'); | |
| voiceWaves.classList.add('hidden'); | |
| recordStatus.textContent = 'Press to record'; | |
| isRecording = false; | |
| } | |
| // Template selection | |
| function selectTemplate(template) { | |
| animationSettings.template = template; | |
| document.getElementById('script-input').value = getTemplateScript(template); | |
| showToast(`"${template.charAt(0).toUpperCase() + template.slice(1)}" template selected`); | |
| } | |
| function getTemplateScript(template) { | |
| const templates = { | |
| 'meme': "When you realize this animation was made with AI...\n\n*record scratch*\n\nYep, that's me. You're probably wondering how I got here.", | |
| 'story': "Let me tell you a story about the time I tried to make breakfast...\n\nIt was a normal Tuesday morning. The sun was shining. Birds were singing. And then... disaster struck.", | |
| 'tutorial': "Here's how to make the perfect cup of coffee:\n\n1. Boil water\n2. Add coffee grounds\n3. Wait patiently\n4. Enjoy!\n\nPro tip: Don't forget the mug!", | |
| 'emotional': "Sometimes the smallest things take up the most room in your heart.\n\nLike when someone remembers how you take your coffee, or saves you the last slice of pizza.", | |
| 'dance': "When that beat drops...\n\n*starts dancing*\n\nNo one:\n\nAbsolutely no one:\n\nMe: *still dancing*", | |
| 'challenge': "I challenge you to try this for 7 days!\n\n1. Smile at a stranger\n2. Compliment someone\n3. Do something kind\n\nTag 3 friends to join!", | |
| 'prank': "POV: You're about to prank your best friend\n\n*carefully sets up the prank*\n\n*waits patiently*\n\n*BAM!* Gotcha!", | |
| 'food': "This is the BEST burger I've ever had!\n\nLook at that cheese pull!\n\n*shows close-up*\n\n10/10 would recommend!" | |
| }; | |
| return templates[template] || "This is a custom animation script. Edit me to create your own viral content!"; | |
| } | |
| // Character selection | |
| function selectCharacter(character) { | |
| animationSettings.character = character; | |
| showToast(`${character.charAt(0).toUpperCase() + character.slice(1)} character selected`); | |
| } | |
| // Voice selection | |
| function selectVoice(voice) { | |
| animationSettings.voice = voice; | |
| showToast(`${voice.charAt(0).toUpperCase() + voice.slice(1)} voice selected`); | |
| } | |
| // Music selection | |
| function selectMusic(music) { | |
| animationSettings.music = music; | |
| showToast(`${music.charAt(0).toUpperCase() + music.slice(1)} music selected`); | |
| } | |
| // Scene selection | |
| function selectScene(scene) { | |
| animationSettings.scene = scene; | |
| showToast(`${scene.charAt(0).toUpperCase() + scene.slice(1)} scene selected`); | |
| } | |
| // Generate animation | |
| function generateAnimation() { | |
| const script = document.getElementById('script-input').value; | |
| if (!script.trim()) { | |
| showToast("Please enter a script or record your voice", true); | |
| return; | |
| } | |
| animationSettings.script = script; | |
| const modal = document.getElementById('generate-modal'); | |
| const progressBar = document.getElementById('generation-progress'); | |
| const statusText = document.getElementById('generation-status'); | |
| modal.classList.remove('hidden'); | |
| // Simulate generation progress | |
| let progress = 25; | |
| progressBar.style.width = '25%'; | |
| statusText.textContent = 'Processing script...'; | |
| const interval1 = setTimeout(() => { | |
| progress = 50; | |
| progressBar.style.width = '50%'; | |
| statusText.textContent = 'Generating character...'; | |
| }, 1500); | |
| const interval2 = setTimeout(() => { | |
| progress = 75; | |
| progressBar.style.width = '75%'; | |
| statusText.textContent = 'Animating scenes...'; | |
| }, 3000); | |
| const interval3 = setTimeout(() => { | |
| progress = 100; | |
| progressBar.style.width = '100%'; | |
| statusText.textContent = 'Finalizing animation...'; | |
| setTimeout(() => { | |
| modal.classList.add('hidden'); | |
| showPreview(); | |
| }, 1000); | |
| }, 4500); | |
| } | |
| // Show preview after generation | |
| function showPreview() { | |
| document.getElementById('preview-placeholder').classList.add('hidden'); | |
| document.getElementById('generated-preview').classList.remove('hidden'); | |
| document.getElementById('download-section').classList.remove('hidden'); | |
| // Animate subtitles | |
| const subtitles = document.getElementById('subtitles'); | |
| const words = animationSettings.script.split(' '); | |
| let i = 0; | |
| const subtitleInterval = setInterval(() => { | |
| if (i < words.length) { | |
| subtitles.textContent = words.slice(0, i+1).join(' '); | |
| i++; | |
| } else { | |
| clearInterval(subtitleInterval); | |
| } | |
| }, 200); | |
| showToast("Animation generated successfully!"); | |
| } | |
| // Download functionality | |
| document.getElementById('download-btn').addEventListener('click', function() { | |
| showToast("Downloading HD video..."); | |
| // In a real app, this would trigger the actual download | |
| setTimeout(() => { | |
| showToast("Video downloaded successfully!"); | |
| }, 2000); | |
| }); | |
| // Play button functionality | |
| document.getElementById('play-btn').addEventListener('click', function() { | |
| this.innerHTML = '<i class="fas fa-pause"></i>'; | |
| showToast("Playing animation..."); | |
| // In a real app, this would play the animation | |
| }); | |
| // Back button functionality | |
| function goBack() { | |
| if (document.getElementById('download-section').classList.contains('hidden')) { | |
| showToast("Going back..."); | |
| // In a real app, this would navigate back | |
| } else { | |
| document.getElementById('download-section').classList.add('hidden'); | |
| document.getElementById('generated-preview').classList.add('hidden'); | |
| document.getElementById('preview-placeholder').classList.remove('hidden'); | |
| } | |
| } | |
| // Show toast messages | |
| function showToast(message, isError = false) { | |
| const toast = document.createElement('div'); | |
| toast.className = `fixed bottom-20 left-1/2 transform -translate-x-1/2 bg-${isError ? 'red' : 'gray'}-800 text-white px-4 py-2 rounded-lg shadow-lg text-sm fade-in`; | |
| toast.textContent = message; | |
| document.body.appendChild(toast); | |
| setTimeout(() => { | |
| toast.remove(); | |
| }, 3000); | |
| } | |
| // Animation time counter | |
| let seconds = 15; | |
| setInterval(() => { | |
| seconds = seconds < 59 ? seconds + 1 : 0; | |
| document.getElementById('animation-time').textContent = `0:${seconds < 10 ? '0' + seconds : seconds}`; | |
| }, 1000); | |
| </script> | |
| <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=Filimon1/animation" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |