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": "glyph-relay",
"title": "Glyph Relay",
"description": "\"Building a product\" hands off between lines until a giant question mark resolves into \"Launching it?\".",
"dependencies": ["remotion", "@remotion/google-fonts"],
"registryDependencies": ["@remocn/gsh"],
"files": [
{
"path": "registry/remocn/glyph-relay/index.tsx",
"content": "\"use client\";\n\nimport { loadFont as loadSerif } from \"@remotion/google-fonts/InstrumentSerif\";\nimport { loadFont as loadOnest } from \"@remotion/google-fonts/Onest\";\nimport type { CSSProperties, ReactNode } from \"react\";\nimport {\n AbsoluteFill,\n Easing,\n interpolate,\n interpolateColors,\n spring,\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 onest = loadOnest(\"normal\", {\n weights: [\"300\", \"400\"],\n subsets: [\"latin\"],\n});\nconst serif = loadSerif(\"italic\", { weights: [\"400\"], subsets: [\"latin\"] });\n\nconst ENTER = Easing.bezier(0.32, 0.72, 0, 1);\nconst LIGHT = Easing.bezier(0.22, 1, 0.36, 1);\nconst EXIT = Easing.bezier(0.55, 0, 1, 0.45);\nconst SWAY = Easing.bezier(0.45, 0, 0.55, 1);\nconst TILE = { mass: 0.8, damping: 18, stiffness: 160 };\nconst BLOOM = { mass: 0.7, damping: 13, stiffness: 170 };\nconst CHIP = { mass: 0.5, damping: 12, stiffness: 200 };\nconst DROP = { mass: 0.7, damping: 12, stiffness: 150 };\n\nconst B = {\n l1: -8,\n dot: 10,\n bloom: 20,\n l1out: 46,\n grow: 46,\n l2in: 52,\n l2out: 84,\n drop: 90,\n hook: 90,\n l3: 98,\n end: 146,\n};\n\nexport const GLYPH_RELAY_DURATION = B.end;\n\nconst CLAMP = {\n extrapolateLeft: \"clamp\",\n extrapolateRight: \"clamp\",\n} as const;\n\nconst ramp = (f: number, start: number, dur: number, easing = ENTER) =>\n interpolate(f, [start, start + dur], [0, 1], { ...CLAMP, easing });\n\nconst mix = (a: number, b: number, t: number) => a + (b - a) * t;\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\nconst HOOK =\n \"M 50 110 C 50 100, 50 93, 54 85 C 61 71, 88 63, 88 40 C 88 22, 75 6, 54 6 C 33 6, 18 20, 18 42\";\nconst Q_W = 100;\nconst Q_H = 160;\nconst Q_DOT_Y = 140;\nconst Q_DOT_R = 12;\nconst Q_STROKE = 22;\n\nexport interface GlyphRelayProps {\n theme?: \"dark\" | \"light\";\n accent?: string;\n line1?: [string, string];\n line2?: [string, string];\n line3?: string;\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n}\n\nconst DARK_GROUND: Partial<GradientParams> = {\n kind: \"mist\",\n colors: [\"#e9dcff\", \"#8f7bff\", \"#3a2aa6\", \"#0d0a26\"],\n background: \"#050409\",\n speed: 0.8,\n loopSeconds: 16,\n scale: 0.85,\n warp: 0.4,\n blur: 0.75,\n};\n\nconst LIGHT_GROUND: Partial<GradientParams> = {\n kind: \"pixel-glass\",\n colors: [\"#f6c7e4\", \"#d7cbff\", \"#c9d6ff\"],\n background: \"#f6f3ef\",\n grain: 0.12,\n seed: 4,\n};\n\nfunction Half({\n side,\n vertical,\n edge,\n progress,\n rise,\n fs,\n center,\n children,\n}: {\n side: \"a\" | \"b\";\n vertical: boolean;\n edge: number;\n progress: number;\n rise: number;\n fs: number;\n center: number;\n children: ReactNode;\n}) {\n const box: CSSProperties = vertical\n ? side === \"a\"\n ? { left: 0, right: 0, top: 0, height: Math.max(0, edge) }\n : { left: 0, right: 0, top: edge, bottom: 0 }\n : side === \"a\"\n ? {\n left: 0,\n width: Math.max(0, edge),\n top: center - fs * 0.8,\n height: fs * 1.6,\n }\n : { left: edge, right: 0, top: center - fs * 0.8, height: fs * 1.6 };\n const dir = side === \"a\" ? 1 : -1;\n const slide = (1 - progress) * 101 * dir;\n return (\n <div\n style={{\n position: \"absolute\",\n ...box,\n overflow: \"hidden\",\n display: \"flex\",\n flexDirection: vertical ? \"column\" : \"row\",\n alignItems: vertical ? \"center\" : \"center\",\n justifyContent:\n side === \"a\" ? \"flex-end\" : vertical ? \"flex-start\" : \"flex-start\",\n }}\n >\n <div\n style={{\n display: \"inline-block\",\n whiteSpace: \"nowrap\",\n lineHeight: 1,\n paddingBottom: vertical ? fs * 0.08 : 0,\n transform: vertical\n ? `translateY(${slide}%)`\n : `translate(${slide}%, ${(1 - rise) * fs * 0.9}px)`,\n filter:\n rise < 1 || progress < 1\n ? `blur(${(1 - rise) * 6 + (1 - progress) * 3}px)`\n : undefined,\n opacity: rise,\n }}\n >\n {children}\n </div>\n </div>\n );\n}\n\nexport function GlyphRelay({\n theme = \"dark\",\n accent = \"#3B5BFD\",\n line1 = [\"Building a\", \"product\"],\n line2 = [\"is\", \"easy.\"],\n line3 = \"Launching it?\",\n ground,\n groundParams,\n}: GlyphRelayProps) {\n const frame = useCurrentFrame();\n const { width, height, fps } = useVideoConfig();\n const dark = theme === \"dark\";\n const vertical = height > width * 1.2;\n const stageW = vertical ? 1080 : 1280;\n const stageH = vertical ? 1920 : 720;\n const sc = width / stageW;\n\n const ink = dark ? \"#f4f2fb\" : \"#121118\";\n const fs1 = vertical ? 150 : 92;\n const fs2 = vertical ? 190 : 124;\n const fs3 = vertical ? 150 : 104;\n\n const qScale = vertical ? 7.2 : 3.15;\n const qW = Q_W * qScale;\n const qH = Q_H * qScale;\n const qTextY = vertical ? stageH * 0.5 : stageH * 0.5;\n const qTop = qTextY - 92 * qScale;\n const qLeft = stageW / 2 - qW / 2;\n const dotY = qTop + Q_DOT_Y * qScale;\n const dotR = Q_DOT_R * qScale;\n\n const cx = stageW / 2;\n const cy = stageH / 2;\n\n const dotIn = spring({ frame: frame - B.dot, fps, config: CHIP });\n const bloom = spring({ frame: frame - B.bloom, fps, config: BLOOM });\n const grow = spring({ frame: frame - B.grow, fps, config: TILE });\n const drop = spring({ frame: frame - B.drop, fps, config: DROP });\n const shrink = ramp(frame, B.drop, 14, LIGHT);\n\n const rDot = fs1 * 0.14;\n const rDisc = fs1 * 0.48;\n const rBig = fs2 * 0.5;\n let r = rDot * dotIn;\n r = mix(r, rDisc, bloom);\n r = mix(r, rBig, grow);\n r = mix(r, dotR, shrink);\n const gy = mix(cy, dotY, drop);\n const gx = cx;\n\n const sideGap = (fs: number) => fs * 0.13 + r * 0.32;\n\n const l1Rise = (i: number) => ramp(frame, B.l1 + i * 3, 14);\n const l1Out = 1 - ramp(frame, B.l1out, 10, EXIT);\n const l2In = spring({ frame: frame - B.l2in, fps, config: TILE });\n const l2Out = 1 - ramp(frame, B.l2out, 9, EXIT);\n const l2 = Math.min(l2In, l2Out);\n\n const discTint = ramp(frame, B.bloom, 8, LIGHT);\n const glyphColor = interpolateColors(discTint, [0, 1], [ink, accent]);\n const markIn = ramp(frame, B.bloom + 3, 10, LIGHT);\n\n const hook = ramp(frame, B.hook + 2, 22, LIGHT);\n const hookFade = ramp(frame, B.hook, 6, LIGHT);\n\n const words3 = line3.split(\" \");\n const l3Lines = vertical\n ? [words3.slice(0, -1).join(\" \"), words3[words3.length - 1]]\n : [line3];\n\n const push = 1 + 0.045 * ramp(frame, 0, B.end, SWAY);\n\n const resolvedGround: GshPresetId | undefined = ground;\n const resolvedParams =\n groundParams ?? (ground ? undefined : dark ? DARK_GROUND : LIGHT_GROUND);\n\n const hookStroke = dark\n ? `color-mix(in oklab, ${accent} 60%, #d9d2ff)`\n : `color-mix(in oklab, ${accent} 55%, #ffffff)`;\n\n const edgeA = (fs: number) =>\n vertical ? gy - r - sideGap(fs) : gx - r - sideGap(fs);\n const edgeB = (fs: number) =>\n vertical ? gy + r + sideGap(fs) : gx + r + sideGap(fs);\n\n const showL1 = frame < B.l1out + 12;\n const showL2 = frame >= B.l2in - 1 && frame < B.l2out + 11;\n\n return (\n <AbsoluteFill style={{ fontFamily: onest.fontFamily, overflow: \"hidden\" }}>\n <GshGround\n preset={resolvedGround}\n params={resolvedParams}\n timeOffset={dark ? 4 : 3}\n timeScale={0.5}\n />\n <div\n style={{\n position: \"absolute\",\n left: 0,\n top: 0,\n width: stageW,\n height: stageH,\n transform: `scale(${sc})`,\n transformOrigin: \"0 0\",\n }}\n >\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n transform: `scale(${push})`,\n transformOrigin: \"50% 50%\",\n color: ink,\n fontWeight: 300,\n letterSpacing: \"-0.035em\",\n }}\n >\n <svg\n viewBox={`0 0 ${Q_W} ${Q_H}`}\n width={qW}\n height={qH}\n style={{\n position: \"absolute\",\n left: qLeft,\n top: qTop,\n overflow: \"visible\",\n opacity: hookFade,\n }}\n aria-hidden\n >\n <path\n d={HOOK}\n fill=\"none\"\n stroke={hookStroke}\n strokeOpacity={dark ? 0.42 : 0.4}\n strokeWidth={Q_STROKE}\n strokeLinecap=\"round\"\n pathLength={1}\n strokeDasharray=\"1 1\"\n strokeDashoffset={1 - hook}\n />\n <path\n d={HOOK}\n fill=\"none\"\n stroke=\"#ffffff\"\n strokeOpacity={dark ? 0.22 : 0.65}\n strokeWidth={Q_STROKE * 0.32}\n strokeLinecap=\"round\"\n transform=\"translate(-2.2 -2.2)\"\n pathLength={1}\n strokeDasharray=\"1 1\"\n strokeDashoffset={1 - hook}\n />\n </svg>\n {showL1 ? (\n <div style={{ position: \"absolute\", inset: 0, fontSize: fs1 }}>\n <Half\n side=\"a\"\n vertical={vertical}\n edge={edgeA(fs1)}\n progress={l1Out}\n rise={l1Rise(0)}\n fs={fs1}\n center={gy}\n >\n {line1[0]}\n </Half>\n <Half\n side=\"b\"\n vertical={vertical}\n edge={edgeB(fs1)}\n progress={l1Out}\n rise={l1Rise(1)}\n fs={fs1}\n center={gy}\n >\n {line1[1]}\n </Half>\n </div>\n ) : null}\n {showL2 ? (\n <div style={{ position: \"absolute\", inset: 0, fontSize: fs2 }}>\n <Half\n side=\"a\"\n vertical={vertical}\n edge={edgeA(fs2)}\n progress={l2}\n rise={1}\n fs={fs2}\n center={gy}\n >\n {line2[0]}\n </Half>\n <Half\n side=\"b\"\n vertical={vertical}\n edge={edgeB(fs2)}\n progress={l2}\n rise={1}\n fs={fs2}\n center={gy}\n >\n <span\n style={{\n fontFamily: serif.fontFamily,\n fontStyle: \"italic\",\n fontWeight: 400,\n letterSpacing: \"-0.01em\",\n fontSize: \"1.1em\",\n }}\n >\n {line2[1]}\n </span>\n </Half>\n </div>\n ) : null}\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n top: qTextY - (fs3 * 1.08 * l3Lines.length) / 2,\n textAlign: \"center\",\n fontSize: fs3,\n lineHeight: 1.08,\n fontWeight: 400,\n }}\n >\n {l3Lines.map((ln, i) => {\n const p = ramp(frame, B.l3 + i * 4, 14);\n return (\n <div\n key={`${ln}-${i.toString()}`}\n style={{ overflow: \"hidden\", paddingBottom: \"0.08em\" }}\n >\n <div\n style={{\n transform: `translateY(${mix(105, 0, p)}%)`,\n filter: p < 1 ? `blur(${(1 - p) * 6}px)` : undefined,\n }}\n >\n {ln}\n </div>\n </div>\n );\n })}\n </div>\n <div\n style={{\n position: \"absolute\",\n left: gx - r,\n top: gy - r,\n width: r * 2,\n height: r * 2,\n borderRadius: \"50%\",\n background: glyphColor,\n boxShadow:\n discTint > 0\n ? `inset 0 ${r * 0.08}px ${r * 0.12}px rgba(255,255,255,${0.35 * discTint}), inset 0 -${r * 0.1}px ${r * 0.2}px rgba(0,0,0,${0.18 * discTint}), 0 ${r * 0.18}px ${r * 0.5}px color-mix(in oklab, ${accent} ${Math.round(38 * discTint)}%, transparent)`\n : undefined,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <svg\n viewBox=\"0 0 124.06 134.26\"\n height={r * 0.9}\n width={(r * 0.9 * 124.06) / 134.26}\n style={{\n display: \"block\",\n marginLeft: r * 0.08,\n opacity: markIn,\n transform: `scale(${mix(0.4, 1, markIn)})`,\n }}\n aria-hidden\n >\n <path fill=\"#ffffff\" d={REMOCN_R_PATH} />\n </svg>\n </div>\n </div>\n </div>\n </AbsoluteFill>\n );\n}\n\nexport default GlyphRelay;\n",
"type": "registry:component",
"target": "components/remocn/glyph-relay.tsx"
}
],
"type": "registry:component"
}