import { AbsoluteFill, interpolate, useCurrentFrame } from "remotion"; import { SceneLayoutProps } from "./types"; export const CodeBlock: React.FC = ({ title, accentColor, bgColor, textColor, codeLines = [], codeLanguage = "", aspectRatio, }) => { const frame = useCurrentFrame(); const p = aspectRatio === "portrait"; const titleOp = interpolate(frame, [0, 20], [0, 1], { extrapolateRight: "clamp", }); const codeOp = interpolate(frame, [15, 40], [0, 1], { extrapolateRight: "clamp", }); const codeY = interpolate(frame, [15, 40], [30, 0], { extrapolateRight: "clamp", }); const lineReveal = interpolate(frame, [20, 20 + codeLines.length * 10], [0, codeLines.length], { extrapolateRight: "clamp", }); const cursorBlink = Math.floor(frame / 15) % 2; // Terminal-style dark card (always dark regardless of bgColor) const termBg = "#1a1a2e"; return (

{title}

{/* Terminal dots */}
{codeLanguage && ( {codeLanguage} )}
{codeLines.map((line, i) => (
{String(i + 1).padStart(2, " ")} {line} {i === Math.floor(lineReveal) && ( | )}
))}
); };