Remove artificial 30-second delay from generation loading bar
Loading bar now only displays during actual beat generation instead of forcing a fixed 30-second wait time. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
26d66f329c
commit
facaabd4eb
@ -78,32 +78,24 @@ export function LofiGenerator() {
|
||||
setIsGenerating(true);
|
||||
setGenerationProgress(0);
|
||||
|
||||
// Simulate 30-second generation with intermittent progress
|
||||
const totalDuration = 30000; // 30 seconds
|
||||
const updateInterval = 100; // Update every 100ms
|
||||
const steps = totalDuration / updateInterval;
|
||||
// Animate progress while generating
|
||||
let currentProgress = 0;
|
||||
|
||||
const progressInterval = setInterval(() => {
|
||||
// Intermittent progress - sometimes jumps, sometimes slow
|
||||
const jump = Math.random() > 0.7 ? Math.random() * 5 : Math.random() * 2;
|
||||
currentProgress = Math.min(currentProgress + (100 / steps) + jump, 99);
|
||||
const jump = Math.random() > 0.5 ? Math.random() * 15 : Math.random() * 8;
|
||||
currentProgress = Math.min(currentProgress + jump, 90);
|
||||
setGenerationProgress(currentProgress);
|
||||
}, updateInterval);
|
||||
}, 50);
|
||||
|
||||
// Actually generate the beat
|
||||
// Generate the beat
|
||||
await generateNewBeat();
|
||||
|
||||
// Wait for the full 30 seconds
|
||||
await new Promise((resolve) => setTimeout(resolve, totalDuration));
|
||||
|
||||
clearInterval(progressInterval);
|
||||
setGenerationProgress(100);
|
||||
|
||||
setTimeout(() => {
|
||||
setIsGenerating(false);
|
||||
setGenerationProgress(0);
|
||||
}, 500);
|
||||
}, 300);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user