Text to Video Converter
Text to Video Converter
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 400px;
text-align: center;
}
h1 {
margin-bottom: 20px;
font-size: 24px;
}
textarea {
width: 100%;
height: 150px;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
margin-bottom: 20px;
resize: none;
}
button {
background-color: #007bff;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 4px;
font-size: 16px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
#video-preview {
margin-top: 20px;
}
document.getElementById('generate-btn').addEventListener('click', function () {
const textInput = document.getElementById('text-input').value;
if (!textInput) {
alert('Please enter some text!');
return;
}
// Simulate video generation (replace with API call)
simulateVideoGeneration(textInput);
});
function simulateVideoGeneration(text) {
const videoPreview = document.getElementById('video-preview');
videoPreview.innerHTML = `
Generating video for: "${text}"...
`;
// Simulate a delay for video generation
setTimeout(() => {
videoPreview.innerHTML = `
Video generated successfully!
`;
}, 3000);
}
async function generateVideo(text) {
const response = await fetch('https://api.texttovideo.com/generate', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ text: text }),
});
const data = await response.json();
const videoUrl = data.videoUrl;
const videoPreview = document.getElementById('video-preview');
videoPreview.innerHTML = `
`;
}
No comments:
Post a Comment