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": "Feature Trio",
"initialProps": null,
"slug": "feature-trio",
"sourceCode": "import { loadFont as loadBricolage } from \"@remotion/google-fonts/BricolageGrotesque\";\nimport { loadFont as loadGeist } from \"@remotion/google-fonts/Geist\";\nimport { AbsoluteFill, Easing, Interactive, Sequence, interpolate, useCurrentFrame, useVideoConfig, type InteractiveBaseProps, type InteractiveTransformProps, type InteractivitySchema, type SequenceControls } from \"remotion\";\nimport { forwardRef, useImperativeHandle, useRef, type ComponentProps } from \"react\";\n\nconst bricolage = loadBricolage(\"normal\", {\n weights: [\"500\"],\n subsets: [\"latin\"],\n});\nconst geist = loadGeist(\"normal\", {\n weights: [\"400\"],\n subsets: [\"latin\"],\n});\n\n/**\n * Beat sheet (30fps, speed 1, three items, 165 frames):\n * 6–40 \"Fast.\" rises out of a mask at hero size, its line follows; a row\n * of progress ticks under it fills for the current item.\n * 40–74 it leaves upward as \"Composable.\" rises into the same spot.\n * 74–104 \"Open source.\" rises and holds.\n * 104–132 resolve: the last title shrinks and travels into its column,\n * the earlier titles rise back into theirs, the ticks stretch into\n * the column rules, descriptions settle under each.\n * 132–165 poster hold.\n * The per-item slot stretches or shrinks with `durationInFrames`.\n */\n\ninterface FeatureTrioItem {\n title: string;\n description: string;\n}\n\ninterface FeatureTrioProps {\n /** 2–4 short benefits. */\n items?: FeatureTrioItem[];\n accent?: string;\n /** Stage fill. \"transparent\" drops the stage and its glow. */\n background?: string;\n /** Playback multiplier. */\n speed?: number;\n theme?: \"dark\" | \"light\";\n}\n\n/** gradients.sh \"grain\": bg #070505, [#ffd8b4, #e0703b, #8a2c1d, #2b1015]. */\nconst GRAIN = [\"#ffd8b4\", \"#e0703b\", \"#8a2c1d\", \"#2b1015\"] as const;\n/** gradients.sh \"smear\" (light): bg #efe8dc, [#f2552c, #f7b23b, #e889b5, #2f6b3f]. */\nconst SMEAR = [\"#f2552c\", \"#f7b23b\", \"#e889b5\", \"#2f6b3f\"] as const;\n\nconst PALETTES = {\n dark: {\n bg: \"#0A0A0B\",\n fg: \"#F4F3F0\",\n muted: \"#8E8D94\",\n track: \"rgba(255,255,255,0.14)\",\n rule: \"rgba(255,255,255,0.22)\",\n glow: [GRAIN[0], GRAIN[1], GRAIN[2]],\n glowAlpha: [0.36, 0.4, 0.42],\n },\n light: {\n bg: \"#F5F4F0\",\n fg: \"#111113\",\n muted: \"#6E6C67\",\n track: \"rgba(17,17,19,0.12)\",\n rule: \"rgba(17,17,19,0.2)\",\n glow: [SMEAR[1], SMEAR[0], SMEAR[2]],\n glowAlpha: [0.22, 0.16, 0.18],\n },\n} as const;\n\nconst EASE_OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst EASE_IN = Easing.bezier(0.6, 0, 0.9, 0.5);\nconst EASE_IO = Easing.bezier(0.65, 0, 0.35, 1);\nconst CLAMP = {\n extrapolateLeft: \"clamp\",\n extrapolateRight: \"clamp\",\n} as const;\n\n/** Bricolage Grotesque 500 advances (per 1000 em), ASCII 32–126. */\nconst BRICOLAGE_500 = [\n 246, 266, 317, 612, 630, 947, 756, 158, 305, 290, 395, 516, 165, 339, 196,\n 353, 656, 320, 583, 595, 595, 599, 646, 493, 645, 640, 207, 187, 516, 516,\n 516, 413, 952, 671, 666, 670, 691, 599, 578, 706, 708, 274, 357, 666, 508,\n 908, 746, 716, 629, 719, 660, 641, 553, 719, 657, 957, 652, 600, 560, 315,\n 341, 300, 546, 578, 283, 567, 618, 555, 617, 570, 380, 588, 608, 259, 266,\n 561, 257, 912, 608, 604, 618, 617, 411, 535, 380, 599, 546, 827, 534, 591,\n 500, 353, 259, 331, 516,\n];\nconst TRACK = -0.04;\n\nfunction titleEm(text: string) {\n let w = 0;\n for (const ch of text) {\n const c = ch.charCodeAt(0);\n w += c >= 32 && c <= 126 ? BRICOLAGE_500[c - 32] : 620;\n }\n return w / 1000 + TRACK * [...text].length;\n}\n\nconst DEFAULT_ITEMS: FeatureTrioItem[] = [\n { title: \"Fast.\", description: \"Drop in a scene and render it in minutes.\" },\n {\n title: \"Composable.\",\n description: \"Every piece is a React component you can remix.\",\n },\n {\n title: \"Open source.\",\n description: \"MIT licensed. The code lands in your repo.\",\n },\n];\n\nfunction FeatureTrioBase({\n items = DEFAULT_ITEMS,\n accent = \"#3B5BFD\",\n background,\n speed = 1,\n theme = \"dark\",\n}: FeatureTrioProps) {\n const frame = useCurrentFrame() * speed;\n const { width, height, durationInFrames } = useVideoConfig();\n const p = PALETTES[theme];\n const list = items.slice(0, 4);\n const n = list.length;\n const portrait = height > width * 1.1;\n const s = portrait\n ? (width / 1280) * 1.5\n : Math.min(width / 1280, height / 720);\n\n // ---- timing ----------------------------------------------------------------\n const START = 6;\n const RESOLVE = 24;\n const HOLD = 36;\n const total = durationInFrames * speed;\n const slot = Math.max(\n 22,\n Math.min(40, (total - START - RESOLVE - HOLD + 4) / Math.max(1, n)),\n );\n const at = (i: number) => START + i * slot;\n const r0 = at(n - 1) + slot - 4;\n const resolve = interpolate(frame, [r0, r0 + RESOLVE], [0, 1], {\n ...CLAMP,\n easing: EASE_IO,\n });\n\n // ---- geometry ----------------------------------------------------------------\n const maxEm = Math.max(...list.map((it) => titleEm(it.title)), 1);\n const heroFs = Math.min((portrait ? 150 : 172) * s, (width * 0.84) / maxEm);\n const heroY = height * (portrait ? 0.46 : 0.45);\n const heroDescFs = (portrait ? 34 : 28) * s;\n const heroDescTop = heroY + heroFs * 0.52 + 18 * s;\n // progress ticks sit above the hero title, so on the way to becoming the\n // column rules they never cross a line of text\n const ticksY = heroY - heroFs * 0.62 - (portrait ? 48 : 34) * s;\n const tickW = 40 * s;\n const tickGap = 8 * s;\n const ticksW = n * tickW + (n - 1) * tickGap;\n\n // final layout: a row (landscape) or a stack (portrait)\n const rowW = Math.min(width * 0.88, 1180 * s);\n const colW = portrait ? width * 0.84 : rowW / n;\n const gutter = (portrait ? 0 : 26) * s;\n const rowFs = portrait\n ? Math.min(84 * s, (colW * 0.92) / maxEm)\n : Math.min(60 * s, ((colW - gutter * 2) * 0.94) / maxEm);\n const rowDescFs = (portrait ? 28 : 19) * s;\n const ruleToTitle = rowFs * 0.5 + 30 * s;\n const titleToDesc = rowFs * 0.52 + 12 * s;\n const blockH = ruleToTitle + titleToDesc + rowDescFs * 1.45 * 2;\n const stackGap = 64 * s;\n const col = (i: number) => {\n if (portrait) {\n const groupH = n * blockH + (n - 1) * stackGap;\n const top = height / 2 - groupH / 2 + i * (blockH + stackGap);\n return { x: width / 2, ruleY: top, w: colW * 0.4 };\n }\n const groupH = blockH;\n return {\n x: width / 2 - rowW / 2 + colW * (i + 0.5),\n ruleY: height / 2 - groupH / 2,\n w: colW - gutter * 2,\n };\n };\n\n const transparent = background === \"transparent\";\n\n // the glow breathes with each new item and widens into a band for the row\n const beat = list.reduce(\n (acc, _, i) =>\n acc +\n interpolate(\n frame,\n [at(i), at(i) + 10, at(i) + slot],\n [0, 1, 0.35],\n CLAMP,\n ) *\n (i === n - 1\n ? 1\n : interpolate(frame, [at(i + 1), at(i + 1) + 6], [1, 0], CLAMP)),\n 0,\n );\n const glowIn = interpolate(frame, [0, 24], [0, 1], {\n ...CLAMP,\n easing: EASE_OUT,\n });\n const glowW = interpolate(resolve, [0, 1], [46, 95]);\n const glowH = interpolate(resolve, [0, 1], [58, 44]);\n const glowY = interpolate(resolve, [0, 1], [104, 112]);\n const glowLift = 0.75 + Math.min(1, beat) * 0.25;\n\n return (\n <AbsoluteFill\n style={{\n background: transparent ? \"transparent\" : (background ?? p.bg),\n overflow: \"hidden\",\n }}\n >\n {!transparent && background === undefined ? (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n opacity: glowIn * glowLift,\n background: [\n `radial-gradient(${glowW * 0.6}% ${glowH * 0.6}% at 50% ${glowY}%, color-mix(in oklab, ${p.glow[0]} ${p.glowAlpha[0] * 100}%, transparent) 0%, transparent 70%)`,\n `radial-gradient(${glowW * 0.85}% ${glowH * 0.85}% at 50% ${glowY}%, color-mix(in oklab, ${p.glow[1]} ${p.glowAlpha[1] * 100}%, transparent) 0%, transparent 70%)`,\n `radial-gradient(${glowW * 1.1}% ${glowH * 1.1}% at 50% ${glowY + 4}%, color-mix(in oklab, ${p.glow[2]} ${p.glowAlpha[2] * 100}%, transparent) 0%, transparent 72%)`,\n ].join(\", \"),\n }}\n />\n ) : null}\n\n {/* ticks → column rules */}\n {list.map((it, i) => {\n const c = col(i);\n const tickX =\n width / 2 - ticksW / 2 + i * (tickW + tickGap) + tickW / 2;\n const x = interpolate(resolve, [0, 1], [tickX, c.x]);\n const y = interpolate(resolve, [0, 1], [ticksY, c.ruleY]);\n const w = interpolate(resolve, [0, 1], [tickW, c.w]);\n const th = interpolate(resolve, [0, 1], [3, 1.5]) * s;\n const fill =\n i === n - 1\n ? interpolate(frame, [at(i), at(i) + slot - 6], [0, 1], CLAMP)\n : interpolate(frame, [at(i), at(i + 1)], [0, 1], CLAMP);\n const tickIn = interpolate(frame, [0, 14], [0, 1], {\n ...CLAMP,\n easing: EASE_OUT,\n });\n // the accent hands over to a neutral rule once the row stands\n const accentShare = 1 - resolve;\n return (\n <div\n key={`${it.title}-rule`}\n style={{\n position: \"absolute\",\n left: x - w / 2,\n top: y - th / 2,\n width: w,\n height: th,\n borderRadius: th,\n background: resolve > 0 ? p.rule : p.track,\n overflow: \"hidden\",\n opacity: tickIn,\n transform: `scaleX(${0.4 + tickIn * 0.6})`,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: 0,\n top: 0,\n bottom: 0,\n width: `${fill * 100}%`,\n background: accent,\n opacity: accentShare,\n }}\n />\n </div>\n );\n })}\n\n {list.map((it, i) => {\n const last = i === n - 1;\n const c = col(i);\n const rowTitleY = c.ruleY + ruleToTitle;\n const rowDescTop = c.ruleY + ruleToTitle + titleToDesc;\n\n // solo: rise in, hold, leave upward (except the last)\n const rise = interpolate(frame, [at(i), at(i) + 14], [0, 1], {\n ...CLAMP,\n easing: EASE_OUT,\n });\n const leave = last\n ? 0\n : interpolate(frame, [at(i + 1) - 8, at(i + 1) + 2], [0, 1], {\n ...CLAMP,\n easing: EASE_IN,\n });\n const descIn = interpolate(frame, [at(i) + 5, at(i) + 19], [0, 1], {\n ...CLAMP,\n easing: EASE_OUT,\n });\n // row: earlier titles come back into their columns\n const back = interpolate(\n frame,\n [r0 + 15 + i * 3, r0 + 31 + i * 3],\n [0, 1],\n { ...CLAMP, easing: EASE_OUT },\n );\n const rowDescIn = interpolate(\n frame,\n [r0 + 20 + i * 3, r0 + 36 + i * 3],\n [0, 1],\n { ...CLAMP, easing: EASE_OUT },\n );\n\n const titleStyle = {\n fontFamily: bricolage.fontFamily,\n fontWeight: 500,\n letterSpacing: `${TRACK}em`,\n lineHeight: 1,\n color: p.fg,\n whiteSpace: \"nowrap\" as const,\n };\n\n // hero copy (and, for the last item, the copy that travels)\n const heroX = last\n ? interpolate(resolve, [0, 1], [width / 2, c.x])\n : width / 2;\n const heroYNow = last\n ? interpolate(resolve, [0, 1], [heroY, rowTitleY])\n : heroY;\n const heroFsNow = last\n ? interpolate(resolve, [0, 1], [heroFs, rowFs])\n : heroFs;\n const soloY = (1 - rise) * 112 - leave * 112;\n const heroVisible = rise > 0 && leave < 1 && (last || frame < r0);\n const heroDescOut = last\n ? interpolate(resolve, [0, 0.35], [1, 0], CLAMP)\n : interpolate(frame, [at(i + 1) - 10, at(i + 1) - 3], [1, 0], CLAMP);\n\n return (\n <div key={it.title}>\n {heroVisible ? (\n <>\n <div\n style={{\n position: \"absolute\",\n left: heroX,\n top: heroYNow,\n transform: \"translate(-50%, -50%)\",\n overflow: resolve > 0 && last ? \"visible\" : \"hidden\",\n padding: `${heroFsNow * 0.08}px ${heroFsNow * 0.06}px ${heroFsNow * 0.14}px`,\n }}\n >\n <div\n style={{\n ...titleStyle,\n fontSize: heroFsNow,\n transform: `translateY(${soloY}%)`,\n }}\n >\n {it.title}\n </div>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: width / 2 - width * 0.35,\n width: width * 0.7,\n top: heroDescTop,\n textAlign: \"center\",\n textWrap: \"balance\",\n fontFamily: geist.fontFamily,\n fontWeight: 400,\n fontSize: heroDescFs,\n lineHeight: 1.35,\n letterSpacing: \"-0.01em\",\n color: p.muted,\n opacity: descIn * heroDescOut,\n transform: `translateY(${(1 - descIn) * 12 * s - (1 - heroDescOut) * 10 * s}px)`,\n filter: `blur(${(1 - descIn) * 5 * s}px)`,\n }}\n >\n {it.description}\n </div>\n </>\n ) : null}\n\n {/* row copy for the earlier items */}\n {!last && back > 0 ? (\n <div\n style={{\n position: \"absolute\",\n left: c.x,\n top: rowTitleY,\n transform: \"translate(-50%, -50%)\",\n overflow: \"hidden\",\n padding: `${rowFs * 0.08}px ${rowFs * 0.06}px ${rowFs * 0.14}px`,\n }}\n >\n <div\n style={{\n ...titleStyle,\n fontSize: rowFs,\n transform: `translateY(${(1 - back) * 112}%)`,\n }}\n >\n {it.title}\n </div>\n </div>\n ) : null}\n\n {/* row description */}\n {rowDescIn > 0 ? (\n <div\n style={{\n position: \"absolute\",\n left: c.x - (portrait ? colW : c.w) / 2,\n width: portrait ? colW : c.w,\n top: rowDescTop,\n textAlign: \"center\",\n textWrap: \"balance\",\n fontFamily: geist.fontFamily,\n fontWeight: 400,\n fontSize: rowDescFs,\n lineHeight: 1.45,\n letterSpacing: \"-0.005em\",\n color: p.muted,\n opacity: rowDescIn,\n transform: `translateY(${(1 - rowDescIn) * 10 * s}px)`,\n filter: `blur(${(1 - rowDescIn) * 4 * s}px)`,\n }}\n >\n {it.description}\n </div>\n ) : null}\n </div>\n );\n })}\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 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\",\"speed\"]);\n\nconst ELEMENT_PROP_DEFAULTS: Record<string, unknown> = {\n theme: \"dark\",\n accent: \"#3B5BFD\",\n speed: 1,\n};\n\ntype FeatureTrioElementProps = InteractiveBaseProps &\n InteractiveTransformProps &\n ComponentProps<typeof FeatureTrioBase>;\n\nconst FeatureTrioInner = forwardRef<\n HTMLDivElement,\n FeatureTrioElementProps & { 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 ?? \"<FeatureTrio>\"}\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 <FeatureTrioBase\n {...(componentProps as unknown as ComponentProps<typeof FeatureTrioBase>)}\n />\n </div>\n </Sequence>\n );\n});\n\nexport const FeatureTrio = Interactive.withSchema({\n Component: FeatureTrioInner,\n componentName: \"<FeatureTrio>\",\n componentIdentity: null,\n schema: elementSchema,\n supportsEffects: false,\n});\n",
"durationInFrames": 133,
"installationMode": "component-owned-sequence"
},
"durationInFrames": 133
}