Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
{
"type": "remotion-element",
"version": 1,
"element": {
"assets": [],
"dependencies": [
{
"name": "@remotion/google-fonts",
"version": null
}
],
"dimensions": null,
"displayName": "Venn Merge",
"initialProps": null,
"slug": "venn-merge",
"sourceCode": "import { loadFont as loadSerif } from \"@remotion/google-fonts/InstrumentSerif\";\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport { forwardRef, useId, useImperativeHandle, useRef, type ComponentProps } from \"react\";\nimport { AbsoluteFill, Easing, Interactive, Sequence, interpolate, useCurrentFrame, useVideoConfig, type InteractiveBaseProps, type InteractiveTransformProps, type InteractivitySchema, type SequenceControls } from \"remotion\";\n\nconst { fontFamily: serif } = loadSerif(\"normal\", {\n weights: [\"400\"],\n subsets: [\"latin\"],\n});\nconst manrope = loadManrope(\"normal\", {\n weights: [\"400\", \"500\", \"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\n/** Full logo as on remocn.dev: R mark (0.76em tall, baseline-aligned) + \"emocn\" in Manrope 600. */\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\n/** gradients.sh \"limb\" palette; the deep stop takes the accent. */\nconst LIMB = [\"#e9ecff\", \"#8a8bff\", \"#4b2bd6\", \"#160c3a\"] as const;\n\ninterface VennMergeProps {\n sets?: string[];\n center?: string;\n caption?: string;\n accent?: string;\n theme?: \"dark\" | \"light\";\n speed?: number;\n}\n\nconst EASE_IO = Easing.bezier(0.65, 0, 0.35, 1);\nconst EASE_OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst CLAMP = {\n extrapolateLeft: \"clamp\",\n extrapolateRight: \"clamp\",\n} as const;\n\nconst THEMES = {\n dark: {\n bg: \"#0A0A0B\",\n fg: \"#F3F2EF\",\n muted: \"#8B8A90\",\n ring: \"rgba(243,242,239,0.62)\",\n grain: 0.06,\n },\n light: {\n bg: \"#F5F4F0\",\n fg: \"#121214\",\n muted: \"#6E6C67\",\n ring: \"rgba(18,18,20,0.6)\",\n grain: 0.045,\n },\n} as const;\n\nconst DRAW = [0, 24];\nconst SLIDE = [26, 66];\nconst FILL = [62, 84];\nconst BRAND = 74;\nconst CAPTION = 96;\n\nfunction Grain({ opacity }: { opacity: number }) {\n const id = `g${useId().replace(/[^a-zA-Z0-9_-]/g, \"\")}`;\n return (\n <svg\n width=\"100%\"\n height=\"100%\"\n style={{ position: \"absolute\", inset: 0, opacity }}\n aria-hidden\n >\n <filter id={id}>\n <feTurbulence\n type=\"fractalNoise\"\n baseFrequency=\"0.9\"\n numOctaves={2}\n seed={17}\n stitchTiles=\"stitch\"\n />\n <feColorMatrix values=\"0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0.9 0\" />\n </filter>\n <rect width=\"100%\" height=\"100%\" filter={`url(#${id})`} />\n </svg>\n );\n}\n\nfunction VennMergeBase({\n sets = [\"Design\", \"Code\"],\n center = \"remocn\",\n caption = \"Motion design, written as code.\",\n accent = \"#3B5BFD\",\n theme = \"dark\",\n speed = 1,\n}: VennMergeProps) {\n const t = useCurrentFrame() * speed;\n const { width, height } = useVideoConfig();\n const u = Math.min(width / 1280, height / 720);\n const p = THEMES[theme];\n const uid = useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n const list = (sets.length ? sets : [\"Design\", \"Code\"]).slice(0, 3);\n const n = list.length;\n const three = n === 3;\n\n const R = height * (three ? 0.25 : 0.34);\n const cx = width / 2;\n const cy =\n height * (caption ? 0.45 : 0.5) +\n (three ? (R * 0.92) / Math.sqrt(3) / 4 : 0);\n const ring = Math.max(1.5, 2 * u);\n\n const slide = interpolate(t, [SLIDE[0], SLIDE[1]], [0, 1], {\n ...CLAMP,\n easing: EASE_IO,\n });\n const draw = interpolate(t, [DRAW[0], DRAW[1]], [0, 1], {\n ...CLAMP,\n easing: EASE_IO,\n });\n const fill = interpolate(t, [FILL[0], FILL[1]], [0, 1], {\n ...CLAMP,\n easing: EASE_IO,\n });\n const brand = interpolate(t, [BRAND, BRAND + 22], [0, 1], {\n ...CLAMP,\n easing: EASE_OUT,\n });\n const capIn = interpolate(t, [CAPTION, CAPTION + 20], [0, 1], {\n ...CLAMP,\n easing: EASE_OUT,\n });\n const push = interpolate(t, [0, CAPTION + 40], [0, 1], {\n ...CLAMP,\n easing: EASE_IO,\n });\n const scale = 0.965 + 0.035 * push;\n\n const finalSep = three ? R * 0.92 : R * 0.52;\n const startSep = three ? R * 1.15 : R * 2.24;\n const sep = startSep + (finalSep - startSep) * slide;\n\n const dirs = three\n ? [\n { x: -Math.sqrt(3) / 2, y: 0.5 },\n { x: Math.sqrt(3) / 2, y: 0.5 },\n { x: 0, y: -1 },\n ]\n : [\n { x: -1, y: 0 },\n { x: 1, y: 0 },\n ];\n const reach = three ? sep / Math.sqrt(3) : sep / 2;\n const centers = dirs.map((d) => ({\n x: cx + d.x * reach,\n y: cy + d.y * reach,\n }));\n\n const labelSize = (three ? 36 : 42) * u;\n const labels = list.map((name, i) => {\n const c = centers[i];\n const d = dirs[i];\n let off = 0;\n if (three) {\n off = R * 0.42 * slide;\n } else {\n const crescent = Math.min(2 * R, sep);\n off = R - crescent / 2;\n }\n return {\n name,\n x: c.x + d.x * off,\n y: c.y + d.y * off,\n a: interpolate(t, [DRAW[0] + 4 + i * 3, DRAW[0] + 20 + i * 3], [0, 1], {\n ...CLAMP,\n easing: EASE_OUT,\n }),\n };\n });\n\n const regionW = three\n ? 2 * (R - finalSep / Math.sqrt(3)) * 0.95\n : (2 * R - finalSep) * 0.86;\n const isLogo = center.trim().toLowerCase() === \"remocn\";\n const brandSize = Math.min(\n 84 * u,\n (regionW * 0.8) / (isLogo ? 3.75 : Math.max(center.length, 3) * 0.56),\n );\n const glowX =\n R * interpolate(t, [FILL[0], CAPTION + 60], [-0.12, 0.12], CLAMP);\n const brandY = cy;\n\n const circ = 2 * Math.PI * R;\n\n return (\n <AbsoluteFill style={{ background: p.bg, overflow: \"hidden\" }}>\n <AbsoluteFill\n style={{ transform: `scale(${scale})`, transformOrigin: \"50% 50%\" }}\n >\n <svg\n width={width}\n height={height}\n style={{ position: \"absolute\", inset: 0 }}\n aria-hidden\n >\n <defs>\n {centers.map((c, i) => (\n <clipPath id={`${uid}c${i}`} key={list[i]}>\n <circle cx={c.x} cy={c.y} r={R} />\n </clipPath>\n ))}\n <radialGradient\n id={`${uid}g`}\n gradientUnits=\"userSpaceOnUse\"\n cx={cx + glowX}\n cy={cy + R * 0.95}\n r={R * 1.75}\n >\n <stop offset={0} stopColor={LIMB[0]} />\n <stop offset={0.2} stopColor={LIMB[1]} />\n <stop offset={0.5} stopColor={accent} />\n <stop offset={0.74} stopColor={LIMB[2]} />\n <stop offset={1} stopColor={LIMB[3]} />\n </radialGradient>\n <radialGradient\n id={`${uid}h`}\n gradientUnits=\"userSpaceOnUse\"\n cx={cx - glowX * 1.4}\n cy={cy - R * 0.55}\n r={R * 0.75}\n >\n <stop offset={0} stopColor={LIMB[1]} stopOpacity={0.55} />\n <stop offset={1} stopColor={LIMB[1]} stopOpacity={0} />\n </radialGradient>\n </defs>\n {centers.map((c, i) => (\n <circle\n key={list[i]}\n cx={c.x}\n cy={c.y}\n r={R}\n fill=\"none\"\n stroke={p.ring}\n strokeWidth={ring}\n strokeDasharray={`${circ * draw} ${circ}`}\n transform={`rotate(${i === 0 ? 180 : three && i === 2 ? -90 : 0} ${c.x} ${c.y})`}\n />\n ))}\n {fill > 0 ? (\n <g clipPath={`url(#${uid}c0)`}>\n <g clipPath={`url(#${uid}c1)`}>\n <g clipPath={three ? `url(#${uid}c2)` : undefined}>\n <rect\n x={cx - R * 2}\n y={cy + R - 2 * R * fill}\n width={R * 4}\n height={2 * R * fill}\n fill={`url(#${uid}g)`}\n />\n <rect\n x={cx - R * 2}\n y={cy + R - 2 * R * fill}\n width={R * 4}\n height={2 * R * fill}\n fill={`url(#${uid}h)`}\n />\n </g>\n </g>\n </g>\n ) : null}\n </svg>\n\n {labels.map((l) => (\n <div\n key={l.name}\n style={{\n position: \"absolute\",\n left: l.x,\n top: l.y,\n transform: `translate(-50%, -50%) translateY(${(1 - l.a) * 8 * u}px)`,\n fontFamily: serif,\n fontWeight: 400,\n fontSize: labelSize,\n letterSpacing: \"-0.01em\",\n lineHeight: 1,\n color: p.fg,\n opacity: l.a,\n whiteSpace: \"nowrap\",\n }}\n >\n {l.name}\n </div>\n ))}\n\n <div\n style={{\n position: \"absolute\",\n left: cx,\n top: brandY,\n transform: `translate(-50%, -50%) translateY(${(1 - brand) * 18 * u}px) scale(${1.06 - 0.06 * brand})`,\n whiteSpace: \"nowrap\",\n opacity: brand,\n filter: brand < 0.99 ? `blur(${(1 - brand) * 8 * u}px)` : undefined,\n }}\n >\n {isLogo ? (\n <RemocnLogo fontSize={brandSize} color=\"#FFFFFF\" />\n ) : (\n <div\n style={{\n fontFamily: manrope.fontFamily,\n fontWeight: 500,\n fontSize: brandSize,\n lineHeight: 1,\n letterSpacing: \"-0.035em\",\n color: \"#FFFFFF\",\n }}\n >\n {center}\n </div>\n )}\n </div>\n\n {caption ? (\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n top: cy + (three ? finalSep / Math.sqrt(3) / 2 : 0) + R + 34 * u,\n textAlign: \"center\",\n fontFamily: manrope.fontFamily,\n fontWeight: 400,\n fontSize: 24 * u,\n letterSpacing: \"-0.01em\",\n color: p.muted,\n opacity: capIn,\n transform: `translateY(${(1 - capIn) * 10 * u}px)`,\n textWrap: \"balance\",\n }}\n >\n {caption}\n </div>\n ) : null}\n </AbsoluteFill>\n <AbsoluteFill\n style={{\n background: `radial-gradient(ellipse 85% 85% at 50% 50%, transparent 62%, ${p.bg} 100%)`,\n opacity: 0.55,\n }}\n />\n <Grain opacity={p.grain} />\n </AbsoluteFill>\n );\n}\n\nconst elementSchema = {\n ...Interactive.baseSchema,\n theme: {\n type: \"enum\",\n default: \"dark\",\n variants: {\n dark: {},\n light: {},\n },\n description: \"Theme\",\n },\n accent: {\n type: \"color\",\n default: \"#3B5BFD\",\n description: \"Accent\",\n },\n center: {\n type: \"text-content\",\n default: \"remocn\",\n description: \"Center\",\n },\n caption: {\n type: \"text-content\",\n default: \"Motion design, written as code.\",\n description: \"Caption\",\n },\n speed: {\n type: \"number\",\n default: 1,\n min: 0.25,\n max: 4,\n step: 0.25,\n description: \"Speed\",\n hiddenFromList: false,\n },\n ...Interactive.transformSchema,\n} as const satisfies InteractivitySchema;\n\nconst ELEMENT_PROP_KEYS = new Set([\"theme\",\"accent\",\"center\",\"caption\",\"speed\"]);\n\nconst ELEMENT_PROP_DEFAULTS: Record<string, unknown> = {\n theme: \"dark\",\n accent: \"#3B5BFD\",\n center: \"remocn\",\n caption: \"Motion design, written as code.\",\n speed: 1,\n};\n\ntype VennMergeElementProps = InteractiveBaseProps &\n InteractiveTransformProps &\n ComponentProps<typeof VennMergeBase>;\n\nconst VennMergeInner = forwardRef<\n HTMLDivElement,\n VennMergeElementProps & { readonly controls: SequenceControls | undefined }\n>(({ controls, name, style, ...rest }, ref) => {\n const outlineRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => outlineRef.current as HTMLDivElement, []);\n const componentProps: Record<string, unknown> = { ...ELEMENT_PROP_DEFAULTS };\n const sequenceProps: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(rest)) {\n if (ELEMENT_PROP_KEYS.has(key)) {\n if (value !== undefined) componentProps[key] = value;\n } else {\n sequenceProps[key] = value;\n }\n }\n return (\n <Sequence\n layout=\"none\"\n {...sequenceProps}\n controls={controls}\n name={name ?? \"<VennMerge>\"}\n outlineRef={outlineRef}\n >\n <div\n ref={outlineRef}\n style={{\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n ...style,\n }}\n >\n <VennMergeBase\n {...(componentProps as unknown as ComponentProps<typeof VennMergeBase>)}\n />\n </div>\n </Sequence>\n );\n});\n\nexport const VennMerge = Interactive.withSchema({\n Component: VennMergeInner,\n componentName: \"<VennMerge>\",\n componentIdentity: null,\n schema: elementSchema,\n supportsEffects: false,\n});\n",
"durationInFrames": 116,
"installationMode": "component-owned-sequence"
},
"durationInFrames": 116
}