Improve video carousel looping behavior for smoother transitions

Update the initial state of the video carousel to correctly position the videos for seamless looping in both forward and backward directions.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 2eb1084e-b728-4449-9231-f1665924c8d5
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/2eb1084e-b728-4449-9231-f1665924c8d5/QCN70f2
This commit is contained in:
sebastjanartic 2025-08-29 15:52:08 +00:00
parent 0f55b741e9
commit 7dd25fe393

View File

@ -218,11 +218,12 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
}, speedMode === 'fast' ? 10 : 16); // Slower intervals for smoother animation
};
// Initialize with first video on the left side
// Initialize with first video on the left side
useEffect(() => {
if (category.videos.length > 0) {
// Start at beginning to show video 1 on the left
setTranslateX(0);
// Start in middle copy (segunda copia) so loop works in both directions
const totalWidth = category.videos.length * videoWidth;
setTranslateX(-totalWidth);
}
}, [category.videos.length]);