Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
{
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
"name": "band-open",
"title": "Band Open",
"description": "A horizontal band opens across the frame to reveal a landscape title card.",
"dependencies": [
"remotion",
"@remotion/google-fonts",
"@remotion/transitions"
],
"registryDependencies": ["@remocn/gsh"],
"files": [
{
"path": "registry/remocn/band-open/index.tsx",
"content": "\"use client\";\n\nimport { loadFont as loadMono } from \"@remotion/google-fonts/GeistMono\";\nimport { loadFont as loadSans } from \"@remotion/google-fonts/InstrumentSans\";\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport {\n linearTiming,\n type TransitionPresentation,\n type TransitionPresentationComponentProps,\n TransitionSeries,\n} from \"@remotion/transitions\";\nimport type React from \"react\";\nimport {\n AbsoluteFill,\n Easing,\n Img,\n interpolate,\n spring,\n staticFile,\n useCurrentFrame,\n useVideoConfig,\n} from \"remotion\";\nimport type { GradientParams } from \"@/lib/remocn/gsh/gradient-engine\";\nimport { GshGround } from \"@/lib/remocn/gsh/gsh-ground\";\nimport type { GshPresetId } from \"@/lib/remocn/gsh/presets\";\n\nconst sans = loadSans(\"normal\", { weights: [\"400\"], subsets: [\"latin\"] });\nconst mono = loadMono(\"normal\", { weights: [\"400\"], subsets: [\"latin\"] });\nconst manrope = loadManrope(\"normal\", {\n weights: [\"600\"],\n subsets: [\"latin\"],\n});\n\nconst REMOCN_R_PATH =\n \"M 0.01 0.81 C 0.01 1.73, 0.36 2.79, 1.09 4.13 C 4.91 11.04, 13.45 17.16, 21.7 18.9 C 22.94 19.16, 23.18 19.16, 51.39 19.27 C 76.07 19.36, 80.02 19.4, 81.32 19.57 C 89.89 20.69, 96.2 24.68, 99.38 31.01 C 103.19 38.56, 102.53 50.1, 97.91 57.07 C 94.66 61.96, 89.68 64.99, 83.26 66 C 82.81 66.07, 70.18 66.83, 55.2 67.69 C 24.82 69.43, 27.03 69.23, 24.18 70.4 C 19.9 72.15, 14.84 75.7, 10.65 79.89 C 4.86 85.68, 1.3 91.91, 0.25 98.13 C 0.12 98.85, 0.08 103.13, 0.04 116.66 L 0 134.26 9.5 134.26 L 19 134.26 19.05 119.41 C 19.1 103.27, 19.08 103.82, 19.82 101.04 C 21.79 93.65, 27.86 88.75, 36.45 87.63 C 37.23 87.53, 39.41 87.5, 43.57 87.53 C 50.12 87.59, 50.75 87.65, 53.22 88.45 C 56.61 89.56, 59.67 91.86, 62.02 95.07 C 62.52 95.76, 69.35 103.85, 77.2 113.07 C 85.04 122.28, 91.63 130.04, 91.85 130.32 C 92.07 130.59, 92.5 131.34, 92.82 131.97 C 93.52 133.35, 94.11 133.93, 95.06 134.13 C 95.5 134.23, 98.97 134.26, 106.36 134.23 L 117.01 134.19 100.82 113.07 C 91.91 101.45, 84.52 91.78, 84.39 91.57 C 83.36 89.89, 83.66 87.53, 85.09 86 C 85.79 85.25, 86.36 84.94, 88.07 84.38 C 96.18 81.72, 104.15 76.62, 109.97 70.36 C 120.59 58.93, 124.06 44.32, 119.44 30.43 C 114.59 15.81, 101.93 4.02, 87.64 0.83 C 83.93 0.01, 88.09 0.08, 41.85 0.04 L 0.01 0 0.01 0.81 Z\";\n\nfunction RemocnLogo({ fontSize, color }: { fontSize: number; color: string }) {\n return (\n <div\n style={{\n display: \"flex\",\n alignItems: \"baseline\",\n color,\n fontFamily: manrope.fontFamily,\n fontWeight: 600,\n fontSize,\n letterSpacing: \"-0.025em\",\n lineHeight: 1,\n }}\n >\n <svg\n viewBox=\"0 0 124.06 134.26\"\n style={{ height: \"0.76em\", width: \"auto\" }}\n aria-hidden\n >\n <path fill=\"currentColor\" d={REMOCN_R_PATH} />\n </svg>\n <span style={{ marginLeft: \"0.04em\" }}>emocn</span>\n </div>\n );\n}\n\nconst CLAMP = {\n extrapolateLeft: \"clamp\",\n extrapolateRight: \"clamp\",\n} as const;\n\nconst OPEN = Easing.bezier(0.32, 0.72, 0, 1);\nconst EXPAND = Easing.bezier(0.83, 0, 0.17, 1);\nconst SETTLE = Easing.bezier(0.22, 1, 0.36, 1);\nconst RECEDE = Easing.bezier(0.65, 0, 0.35, 1);\nconst TYPE_IN = Easing.bezier(0.32, 0.72, 0, 1);\nconst STAIR = { mass: 0.8, damping: 18, stiffness: 160 };\n\nexport type BandOpenProps = {\n center?: number;\n band?: number;\n openUntil?: number;\n expandFrom?: number;\n push?: number;\n dim?: number;\n edge?: string;\n parallax?: number;\n};\n\nexport const bandOpenDefaults: Required<BandOpenProps> = {\n center: 0.5,\n band: 0.24,\n openUntil: 0.3,\n expandFrom: 0.5,\n push: 0.06,\n dim: 0.45,\n edge: \"rgba(255,255,255,0.42)\",\n parallax: 0.05,\n};\n\nconst BandOpenPresentation: React.FC<\n TransitionPresentationComponentProps<BandOpenProps>\n> = ({\n children,\n presentationProgress,\n presentationDirection,\n passedProps,\n}) => {\n const { width: W, height: H } = useVideoConfig();\n const o = { ...bandOpenDefaults, ...passedProps };\n const p = presentationProgress;\n const u = Math.min(W, H) / 720;\n const expandAt = Math.min(0.95, Math.max(o.openUntil, o.expandFrom));\n const ex = EXPAND(interpolate(p, [expandAt, 1], [0, 1], CLAMP));\n\n if (presentationDirection === \"exiting\") {\n const back = RECEDE(p);\n return (\n <AbsoluteFill\n style={{\n transform: `scale(${1 + o.push * back})`,\n filter:\n back > 0\n ? `brightness(${1 - o.dim * (0.35 * back + 0.65 * ex)}) blur(${3 * ex}px)`\n : undefined,\n }}\n >\n {children}\n </AbsoluteFill>\n );\n }\n\n const cy = H * o.center;\n const open = OPEN(interpolate(p, [0, o.openUntil], [0, 1], CLAMP));\n const breathe = interpolate(p, [o.openUntil, expandAt], [0, 1], {\n ...CLAMP,\n easing: Easing.bezier(0.45, 0, 0.55, 1),\n });\n const bandH = H * o.band * open * (1 + 0.06 * breathe);\n const top = cy - bandH / 2 + (0 - (cy - bandH / 2)) * ex;\n const bottom = cy + bandH / 2 + (H - (cy + bandH / 2)) * ex;\n const h = Math.max(0, bottom - top);\n const settle = SETTLE(p);\n const scale = 1 + o.parallax * (1 - settle);\n const drift = W * o.parallax * 0.6 * (1 - settle);\n const edgeOn = (1 - ex) * Math.min(1, open * 3);\n\n return (\n <AbsoluteFill style={{ zIndex: 2 }}>\n {h > 0.5 ? (\n <div\n style={{\n position: \"absolute\",\n left: 0,\n top,\n width: W,\n height: h,\n overflow: \"hidden\",\n boxShadow:\n edgeOn > 0\n ? `0 ${-18 * u}px ${48 * u}px rgba(0,0,0,${0.4 * edgeOn}), 0 ${18 * u}px ${48 * u}px rgba(0,0,0,${0.4 * edgeOn})`\n : undefined,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: 0,\n top: -top,\n width: W,\n height: H,\n transformOrigin: `50% ${cy}px`,\n transform: `translateX(${drift}px) scale(${scale})`,\n }}\n >\n {children}\n </div>\n {edgeOn > 0 ? (\n <>\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n top: 0,\n height: Math.max(1, u),\n background: o.edge,\n opacity: edgeOn,\n }}\n />\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n bottom: 0,\n height: Math.max(1, u),\n background: o.edge,\n opacity: edgeOn,\n }}\n />\n </>\n ) : null}\n </div>\n ) : null}\n </AbsoluteFill>\n );\n};\n\nexport function bandOpen(\n props: BandOpenProps = {},\n): TransitionPresentation<BandOpenProps> {\n return { component: BandOpenPresentation, props };\n}\n\nconst THEMES = {\n dark: {\n base: \"#05060c\",\n ink: \"#eef0f8\",\n hair: \"rgba(238,240,248,0.10)\",\n ground: \"velvet-hour\" as GshPresetId | undefined,\n groundParams: undefined as Partial<GradientParams> | undefined,\n groundOffset: 6,\n veil: \"rgba(5,6,12,0.28)\",\n },\n light: {\n base: \"#f1f1f4\",\n ink: \"#14151c\",\n hair: \"rgba(20,21,28,0.10)\",\n ground: \"paper-crease\" as GshPresetId | undefined,\n groundParams: undefined as Partial<GradientParams> | undefined,\n groundOffset: 3,\n veil: \"rgba(241,241,244,0.18)\",\n },\n};\n\ntype Theme = (typeof THEMES)[\"dark\"];\n\nexport const BAND_OPEN_TIMING = { a: 78, transition: 36, b: 84 };\nexport const bandOpenDemoLength =\n BAND_OPEN_TIMING.a + BAND_OPEN_TIMING.b - BAND_OPEN_TIMING.transition;\n\nfunction lineSize(W: number, H: number, line: string) {\n const em = Math.max(4, line.length * 0.5);\n return Math.min(H * 0.165, (W * 0.64) / em);\n}\n\nfunction strips(H: number, F: number) {\n const center = 1.5 * F;\n const ladder = [0.86, 0.72, 0.62, 0.56, 0.52, 0.5];\n const out = [{ k: 0, top: H / 2 - center / 2, h: center }];\n let up = H / 2 - center / 2;\n let down = H / 2 + center / 2;\n let i = 0;\n while (up > 0 || down < H) {\n const s = ladder[Math.min(i, ladder.length - 1)] * F;\n i++;\n out.push({ k: -i, top: up - s, h: s });\n out.push({ k: i, top: down, h: s });\n up -= s;\n down += s;\n }\n return out;\n}\n\nfunction StackScene({\n c,\n line,\n ground,\n groundParams,\n}: {\n c: Theme;\n line: string;\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n}) {\n const frame = useCurrentFrame();\n const { width: W, height: H, fps } = useVideoConfig();\n const F = lineSize(W, H, line);\n const rows = strips(H, F);\n const push = interpolate(frame, [0, 110], [1, 1.03], {\n ...CLAMP,\n easing: Easing.bezier(0.45, 0, 0.55, 1),\n });\n return (\n <AbsoluteFill style={{ background: c.base, overflow: \"hidden\" }}>\n <AbsoluteFill style={{ transform: `scale(${push})` }}>\n <GshGround\n preset={ground}\n params={groundParams}\n timeOffset={c.groundOffset}\n />\n </AbsoluteFill>\n <AbsoluteFill style={{ background: c.veil }} />\n {rows.map((r) => {\n const d = Math.abs(r.k);\n const rise = TYPE_IN(\n interpolate(frame, [-5 + 2 * d, 9 + 2 * d], [0, 1], CLAMP),\n );\n const stair = spring({ frame: frame - 2 - d, fps, config: STAIR });\n const drift = (r.k % 2 === 0 ? 1 : -1) * frame * 0.0004 * W;\n const x =\n Math.sign(r.k) * Math.min(d, 5) * W * 0.05 * stair +\n (r.k === 0 ? 0 : drift);\n const fade = [1, 0.78, 0.58, 0.44, 0.34, 0.26, 0.2, 0.15][\n Math.min(d, 7)\n ];\n return (\n <div\n key={r.k}\n style={{\n position: \"absolute\",\n left: 0,\n width: W,\n top: r.top,\n height: r.h,\n overflow: \"hidden\",\n borderTop: r.k <= 0 ? `1px solid ${c.hair}` : undefined,\n borderBottom: r.k >= 0 ? `1px solid ${c.hair}` : undefined,\n transform: `scale(${push})`,\n transformOrigin: `50% ${H / 2 - r.top}px`,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: 0,\n width: W,\n top: r.h / 2 - F * 0.62,\n height: F * 1.24,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n fontFamily: sans.fontFamily,\n fontWeight: 400,\n fontSize: F,\n letterSpacing: \"-0.04em\",\n lineHeight: 1,\n whiteSpace: \"nowrap\",\n color: c.ink,\n opacity: fade,\n filter: d >= 2 ? `blur(${(d - 1) * 0.6}px)` : undefined,\n transform: `translate(${x}px, ${(1 - rise) * (r.h / 2 + F * 0.95)}px)`,\n }}\n >\n {line}\n </div>\n </div>\n );\n })}\n </AbsoluteFill>\n );\n}\n\nfunction PhotoScene({\n line,\n src,\n meta,\n start,\n}: {\n line: string;\n src: string;\n meta: string;\n start: number;\n}) {\n const frame = useCurrentFrame();\n const { width: W, height: H } = useVideoConfig();\n const u = Math.min(W, H) / 720;\n const F = lineSize(W, H, line);\n const push = interpolate(frame, [0, 120], [1.02, 1.07], {\n ...CLAMP,\n easing: Easing.bezier(0.45, 0, 0.55, 1),\n });\n const metaIn = TYPE_IN(\n interpolate(frame, [start, start + 14], [0, 1], CLAMP),\n );\n const tagIn = TYPE_IN(interpolate(frame, [4, 16], [0, 1], CLAMP));\n return (\n <AbsoluteFill style={{ background: \"#0b0d10\", overflow: \"hidden\" }}>\n <AbsoluteFill style={{ transform: `scale(${push})` }}>\n <Img\n src={src.startsWith(\"http\") ? src : staticFile(src)}\n style={{ width: \"100%\", height: \"100%\", objectFit: \"cover\" }}\n />\n </AbsoluteFill>\n <AbsoluteFill\n style={{\n background:\n \"linear-gradient(180deg, rgba(6,10,14,0.10) 0%, rgba(6,10,14,0.34) 38%, rgba(6,10,14,0.38) 50%, rgba(6,10,14,0.30) 62%, rgba(6,10,14,0.42) 100%)\",\n }}\n />\n <div\n style={{\n position: \"absolute\",\n left: 0,\n width: W,\n top: H / 2 - F * 0.62,\n height: F * 1.24,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <div\n style={{\n position: \"relative\",\n fontFamily: sans.fontFamily,\n fontWeight: 400,\n fontSize: F,\n letterSpacing: \"-0.04em\",\n lineHeight: 1,\n whiteSpace: \"nowrap\",\n color: \"#ffffff\",\n textShadow: \"0 2px 30px rgba(0,0,0,0.25)\",\n }}\n >\n {line}\n <div\n style={{\n position: \"absolute\",\n left: \"100%\",\n top: \"50%\",\n marginLeft: 0.16 * F,\n transform: `translate(${(1 - tagIn) * -10 * u}px, -40%)`,\n opacity: tagIn,\n }}\n >\n <RemocnLogo fontSize={Math.max(14 * u, 0.2 * F)} color=\"#ffffff\" />\n </div>\n </div>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 0,\n width: W,\n top: H / 2 + F * 0.95,\n display: \"flex\",\n justifyContent: \"center\",\n fontFamily: mono.fontFamily,\n fontWeight: 400,\n fontSize: 17 * u,\n letterSpacing: \"0.06em\",\n textTransform: \"uppercase\",\n color: \"rgba(255,255,255,0.84)\",\n opacity: metaIn,\n transform: `translateY(${(1 - metaIn) * 12 * u}px)`,\n }}\n >\n {meta}\n </div>\n </AbsoluteFill>\n );\n}\n\nexport interface BandOpenDemoProps extends BandOpenProps {\n theme?: \"dark\" | \"light\";\n line?: string;\n src?: string;\n meta?: string;\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n transitionFrames?: number;\n}\n\nexport function BandOpen({\n theme = \"dark\",\n line = \"Launch day\",\n src = \"reel/reel-2.jpg\",\n meta = \"Thursday · 09:00 · remocn.dev\",\n ground,\n groundParams,\n transitionFrames = BAND_OPEN_TIMING.transition,\n band,\n ...rest\n}: BandOpenDemoProps) {\n const { width: W, height: H } = useVideoConfig();\n const c = THEMES[theme];\n const preset = ground ?? (groundParams ? undefined : c.ground);\n const bandShare = band ?? (1.5 * lineSize(W, H, line)) / H;\n return (\n <AbsoluteFill style={{ background: c.base }}>\n <TransitionSeries>\n <TransitionSeries.Sequence durationInFrames={BAND_OPEN_TIMING.a}>\n <StackScene\n c={c}\n line={line}\n ground={preset}\n groundParams={groundParams ?? c.groundParams}\n />\n </TransitionSeries.Sequence>\n <TransitionSeries.Transition\n presentation={bandOpen({ ...rest, band: bandShare })}\n timing={linearTiming({ durationInFrames: transitionFrames })}\n />\n <TransitionSeries.Sequence durationInFrames={BAND_OPEN_TIMING.b}>\n <PhotoScene\n line={line}\n src={src}\n meta={meta}\n start={transitionFrames - 4}\n />\n </TransitionSeries.Sequence>\n </TransitionSeries>\n </AbsoluteFill>\n );\n}\n",
"type": "registry:component",
"target": "components/remocn/band-open.tsx"
}
],
"type": "registry:component"
}