From 593d6ce32740866a400426761224bb057cf8e4f8 Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Fri, 29 Aug 2025 10:49:52 +0000 Subject: [PATCH] Improve video card performance and visual appeal with smoother animations Refactor VideoCard component to use `animationFrame` for smoother video preview scrubbing and update transition properties for improved visual performance. 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/P3O2FU7 --- client/src/components/video-card.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/client/src/components/video-card.tsx b/client/src/components/video-card.tsx index fdf916e..7803d8b 100644 --- a/client/src/components/video-card.tsx +++ b/client/src/components/video-card.tsx @@ -50,6 +50,7 @@ export default function VideoCard({ video, onClick, className = "" }: VideoCardP const hoverTimeoutRef = useRef(); const videoRef = useRef(null); const hlsRef = useRef(null); + const animationFrameRef = useRef(); // Handle mouse scrubbing for video preview with throttling for smoothness const lastScrubTime = useRef(0); @@ -153,14 +154,21 @@ export default function VideoCard({ video, onClick, className = "" }: VideoCardP hlsRef.current.destroy(); hlsRef.current = null; } + if (animationFrameRef.current) { + cancelAnimationFrame(animationFrameRef.current); + } }; }, [showPreview, video.videoUrl]); return (
setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} > @@ -174,7 +182,7 @@ export default function VideoCard({ video, onClick, className = "" }: VideoCardP {video.title}

onClick?.(video)} data-testid={`text-title-${video.id}`} >