import React from "react"; import { AbsoluteFill, useCurrentFrame, useVideoConfig, spring, interpolate, } from "remotion"; import { theme } from "../../components/shared/theme"; // Confetti particles const Confetti: React.FC = () => { const frame = useCurrentFrame(); const { fps, width, height } = useVideoConfig(); const particles = React.useMemo(() => { const colors = [theme.colors.accent, theme.colors.secondary, theme.colors.gold, "#9B59B6"]; return Array.from({ length: 25 }, (_, i) => ({ id: i, x: Math.random() * width, color: colors[Math.floor(Math.random() * colors.length)], size: 6 + Math.random() * 10, rotation: Math.random() * 360, speed: 0.4 + Math.random() * 0.4, delay: Math.random() * 8, })); }, [width]); return ( <> {particles.map((particle) => { const localFrame = frame - particle.delay; if (localFrame < 0) return null; const y = interpolate( localFrame, [0, fps * 2], [-50, height + 100], { extrapolateRight: "clamp" } ) * particle.speed; const rotation = particle.rotation + localFrame * 4; const opacity = interpolate( localFrame, [0, fps * 0.3, fps * 1.5, fps * 2], [0, 1, 1, 0], { extrapolateRight: "clamp" } ); return (
); })} ); }; export const ResultsReveal: React.FC = () => { const frame = useCurrentFrame(); const { fps } = useVideoConfig(); // Winner card entrance const cardProgress = spring({ frame, fps, config: { damping: 15, stiffness: 120 }, }); const cardScale = interpolate(cardProgress, [0, 1], [0.8, 1]); const cardOpacity = interpolate(cardProgress, [0, 1], [0, 1]); // "Democracy wins" text entrance const textProgress = spring({ frame: frame - fps * 0.6, fps, config: theme.animation.smooth, }); const textOpacity = interpolate(textProgress, [0, 1], [0, 1]); const textY = interpolate(textProgress, [0, 1], [20, 0]); return ( {/* Confetti */} {/* Winner card */}
{/* Winner badge */}
Winner
{/* Winning game */}
NBA
Lakers vs Celtics
{/* Vote count */}
{/* Voter avatars */}
{["#FF6B6B", "#4ECDC4", "#45B7D1"].map((color, i) => (
0 ? -10 : 0, }} /> ))}
3 votes • 100%
{/* "Democracy wins" text */}
Democracy wins.
); };