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": "Index List",
"initialProps": null,
"slug": "index-list",
"sourceCode": "import { loadFont as loadHanken } from \"@remotion/google-fonts/HankenGrotesk\";\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport React, { 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: hanken } = loadHanken(\"normal\", {\n weights: [\"400\", \"500\"],\n subsets: [\"latin\"],\n});\nconst manrope = loadManrope(\"normal\", {\n weights: [\"500\", \"600\"],\n subsets: [\"latin\"],\n});\n\ninterface IndexListProps {\n items?: string[];\n highlight?: number;\n title?: string;\n logo?: React.ReactNode;\n accent?: string;\n theme?: \"dark\" | \"light\";\n speed?: number;\n}\n\nconst DEFAULT_ITEMS = [\n \"Transitions\",\n \"Captions\",\n \"Backgrounds\",\n \"Kinetic type\",\n \"Templates\",\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 key: \"rgba(255,255,255,0.05)\",\n fg: \"#F3F2EF\",\n muted: \"#6F6E74\",\n hair: \"rgba(255,255,255,0.14)\",\n rule: \"rgba(243,242,239,0.9)\",\n onAccent: \"#FFFFFF\",\n grain: 0.07,\n },\n light: {\n bg: \"#F5F4F0\",\n key: \"rgba(255,255,255,0.9)\",\n fg: \"#121214\",\n muted: \"#9A9892\",\n hair: \"rgba(18,18,20,0.14)\",\n rule: \"rgba(18,18,20,0.9)\",\n onAccent: \"#FFFFFF\",\n grain: 0.045,\n },\n} as const;\n\nconst RULE_START = 2;\nconst STAGGER = 3;\nconst BLOCK_IN = 40;\n\nfunction pad(n: number) {\n return n < 10 ? `0${n}` : `${n}`;\n}\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, pointerEvents: \"none\" }}\n aria-hidden\n >\n <filter id={id}>\n <feTurbulence\n type=\"fractalNoise\"\n baseFrequency=\"0.9\"\n numOctaves={2}\n seed={7}\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\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/** remocn.dev logo: R mark (0.76em, on the baseline) + \"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 \"beam\" palette (its #3d5bff stop is the accent), used as the fill of the travelling highlight band.\nconst BEAM = [\"#f4f7ff\", \"#8fb4ff\", \"#3d5bff\", \"#1a1660\"] as const;\n\nfunction beamFill(t: number, accent: string) {\n const x = 30 + 14 * Math.sin(t / 55);\n const y = -10 + 8 * Math.cos(t / 47);\n return [\n `radial-gradient(60% 140% at ${x}% ${y}%, color-mix(in oklab, ${BEAM[1]} 70%, transparent) 0%, transparent 70%)`,\n `radial-gradient(40% 120% at ${100 - x * 0.6}% 120%, color-mix(in oklab, ${BEAM[0]} 12%, transparent) 0%, transparent 70%)`,\n `linear-gradient(100deg, ${accent} 0%, ${accent} 30%, ${BEAM[3]} 100%)`,\n ].join(\", \");\n}\n\nfunction Arrow({ size, color }: { size: number; color: string }) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" aria-hidden>\n <path\n d=\"M4 12h15 M13 6l6 6-6 6\"\n fill=\"none\"\n stroke={color}\n strokeWidth={2}\n strokeLinecap=\"square\"\n />\n </svg>\n );\n}\n\ninterface RowsProps {\n items: string[];\n t: number;\n rowTop: (i: number) => number;\n rowH: number;\n F: number;\n numX: number;\n nameX: number;\n numColor: string;\n nameColor: string;\n}\n\nfunction Rows({\n items,\n t,\n rowTop,\n rowH,\n F,\n numX,\n nameX,\n numColor,\n nameColor,\n}: RowsProps) {\n const maskH = F * 1.24;\n const cell = (\n key: string,\n x: number,\n i: number,\n delay: number,\n style: React.CSSProperties,\n text: string,\n ) => {\n const p = interpolate(\n t,\n [\n RULE_START + 8 + i * STAGGER + delay,\n RULE_START + 26 + i * STAGGER + delay,\n ],\n [0, 1],\n { ...CLAMP, easing: EASE_OUT },\n );\n return (\n <div\n key={key}\n style={{\n position: \"absolute\",\n left: x,\n top: rowTop(i) + rowH / 2 - maskH / 2,\n height: maskH,\n overflow: \"hidden\",\n paddingRight: F * 0.2,\n }}\n >\n <div\n style={{\n height: maskH,\n display: \"flex\",\n alignItems: \"center\",\n transform: `translateY(${(1 - p) * maskH}px)`,\n fontSize: F,\n lineHeight: 1,\n whiteSpace: \"nowrap\",\n ...style,\n }}\n >\n {text}\n </div>\n </div>\n );\n };\n return (\n <>\n {items.map((item, i) => (\n <div key={`${i}-${item}`}>\n {cell(\n \"n\",\n numX,\n i,\n 0,\n {\n fontFamily: hanken,\n fontWeight: 400,\n letterSpacing: \"-0.02em\",\n fontVariantNumeric: \"tabular-nums\",\n color: numColor,\n },\n pad(i + 1),\n )}\n {cell(\n \"t\",\n nameX,\n i,\n 2,\n {\n fontFamily: hanken,\n fontWeight: 500,\n letterSpacing: \"-0.03em\",\n color: nameColor,\n },\n item,\n )}\n </div>\n ))}\n </>\n );\n}\n\nfunction IndexListBase({\n items = DEFAULT_ITEMS,\n highlight = 3,\n title = \"What’s inside 3.0\",\n logo,\n accent = \"#3B5BFD\",\n theme = \"dark\",\n speed = 1,\n}: IndexListProps) {\n const t = useCurrentFrame() * speed;\n const { width: W, height: H } = useVideoConfig();\n const u = H / 720;\n const c = THEMES[theme];\n const n = Math.max(1, items.length);\n const hl = Math.min(Math.max(0, Math.round(highlight)), n - 1);\n\n const mX = W * 0.075;\n const cw = W - mX * 2;\n const col = cw / 12;\n const headerY = H * 0.1;\n const listTop = H * 0.205;\n const listBottom = H * 0.9;\n const rowH = (listBottom - listTop) / n;\n const longest = Math.max(...items.map((s) => s.length), 1);\n const F = Math.min(rowH * 0.5, 58 * u, (cw - col * 2.4) / (longest * 0.56));\n const inset = 20 * u;\n const numX = mX + inset;\n const nameX = mX + col * 2;\n const rowTop = (i: number) => listTop + rowH * i;\n const hair = Math.max(1, u);\n\n const rule = (i: number) =>\n interpolate(\n t,\n [RULE_START + i * STAGGER, RULE_START + 22 + i * STAGGER],\n [0, 1],\n { ...CLAMP, easing: EASE_IO },\n );\n const head = (d: number) =>\n interpolate(t, [d, d + 18], [0, 1], { ...CLAMP, easing: EASE_OUT });\n\n const wipe = interpolate(t, [BLOCK_IN, BLOCK_IN + 14], [0, 1], {\n ...CLAMP,\n easing: EASE_IO,\n });\n const travelStart = BLOCK_IN + 12;\n const travelDur = 14 + hl * 5;\n const lead = interpolate(t, [travelStart, travelStart + travelDur], [0, hl], {\n ...CLAMP,\n easing: EASE_IO,\n });\n const trail = interpolate(\n t,\n [travelStart + 5, travelStart + 5 + travelDur],\n [0, hl],\n { ...CLAMP, easing: EASE_IO },\n );\n const parkedAt = travelStart + 5 + travelDur;\n const bTop = rowTop(trail) + hair;\n const bBottom = rowTop(lead) + rowH;\n const bLeft = mX;\n const bRight = mX + cw * wipe;\n const arrowP = interpolate(t, [parkedAt - 4, parkedAt + 12], [0, 1], {\n ...CLAMP,\n easing: EASE_OUT,\n });\n const push = interpolate(t, [0, parkedAt + 40], [1.03, 1], {\n ...CLAMP,\n easing: Easing.bezier(0.33, 0, 0.2, 1),\n });\n\n const rowsProps = { items, t, rowTop, rowH, F, numX, nameX };\n const arrowSize = F * 0.78;\n const dim = interpolate(t, [parkedAt - 2, parkedAt + 18], [1, 0.42], {\n ...CLAMP,\n easing: EASE_IO,\n });\n\n return (\n <AbsoluteFill style={{ background: c.bg, overflow: \"hidden\" }}>\n <AbsoluteFill\n style={{\n background: `radial-gradient(ellipse 70% 80% at 30% 30%, ${c.key}, transparent 70%)`,\n }}\n />\n <AbsoluteFill\n style={{ transform: `scale(${push})`, transformOrigin: \"50% 45%\" }}\n >\n <div\n style={{\n position: \"absolute\",\n left: mX,\n top: headerY,\n display: \"flex\",\n alignItems: \"baseline\",\n gap: 14 * u,\n fontFamily: hanken,\n fontWeight: 400,\n fontSize: 19 * u,\n lineHeight: 1,\n letterSpacing: \"-0.01em\",\n color: c.muted,\n opacity: head(0),\n transform: `translateY(${(1 - head(0)) * 10 * u}px)`,\n }}\n >\n {logo ?? <RemocnLogo fontSize={24 * u} color={c.fg} />}\n <span\n style={{\n width: hair,\n height: 18 * u,\n background: c.hair,\n alignSelf: \"center\",\n }}\n />\n {title}\n </div>\n <div\n style={{\n position: \"absolute\",\n right: mX,\n top: headerY,\n height: 24 * u,\n display: \"flex\",\n alignItems: \"center\",\n fontFamily: hanken,\n fontWeight: 400,\n fontSize: 18 * u,\n lineHeight: 1,\n letterSpacing: \"-0.01em\",\n fontVariantNumeric: \"tabular-nums\",\n color: c.muted,\n opacity: head(4),\n transform: `translateY(${(1 - head(4)) * 10 * u}px)`,\n }}\n >\n {`${pad(n)} features`}\n </div>\n\n {Array.from({ length: n + 1 }, (_, i) => {\n const strong = i === 0;\n const th = strong ? 2 * u : hair;\n return (\n <div\n key={`r${i}`}\n style={{\n position: \"absolute\",\n left: mX,\n top: rowTop(i) - th / 2,\n width: cw * rule(i),\n height: th,\n background: strong ? c.rule : c.hair,\n }}\n />\n );\n })}\n\n <div style={{ position: \"absolute\", inset: 0, opacity: dim }}>\n <Rows {...rowsProps} numColor={c.muted} nameColor={c.fg} />\n </div>\n\n {wipe > 0 ? (\n <>\n <div\n style={{\n position: \"absolute\",\n left: bLeft,\n top: bTop,\n width: bRight - bLeft,\n height: bBottom - bTop,\n backgroundImage: beamFill(t, accent),\n }}\n />\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n clipPath: `inset(${bTop}px ${W - bRight}px ${H - bBottom}px ${bLeft}px)`,\n }}\n >\n <Rows\n {...rowsProps}\n numColor=\"rgba(255,255,255,0.62)\"\n nameColor={c.onAccent}\n />\n <div\n style={{\n position: \"absolute\",\n left: W - mX - inset - arrowSize,\n top: rowTop(hl) + rowH / 2 - arrowSize / 2,\n opacity: arrowP,\n transform: `translateX(${(1 - arrowP) * -24 * u}px)`,\n }}\n >\n <Arrow size={arrowSize} color={c.onAccent} />\n </div>\n </div>\n </>\n ) : null}\n </AbsoluteFill>\n <Grain opacity={c.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 title: {\n type: \"text-content\",\n default: \"What’s inside 3.0\",\n description: \"Title\",\n },\n highlight: {\n type: \"number\",\n default: 3,\n min: 0,\n max: 10,\n step: 1,\n description: \"Highlight\",\n hiddenFromList: false,\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\",\"title\",\"highlight\",\"speed\"]);\n\nconst ELEMENT_PROP_DEFAULTS: Record<string, unknown> = {\n theme: \"dark\",\n accent: \"#3B5BFD\",\n title: \"What’s inside 3.0\",\n highlight: 3,\n speed: 1,\n};\n\ntype IndexListElementProps = InteractiveBaseProps &\n InteractiveTransformProps &\n ComponentProps<typeof IndexListBase>;\n\nconst IndexListInner = forwardRef<\n HTMLDivElement,\n IndexListElementProps & { 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 ?? \"<IndexList>\"}\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 <IndexListBase\n {...(componentProps as unknown as ComponentProps<typeof IndexListBase>)}\n />\n </div>\n </Sequence>\n );\n});\n\nexport const IndexList = Interactive.withSchema({\n Component: IndexListInner,\n componentName: \"<IndexList>\",\n componentIdentity: null,\n schema: elementSchema,\n supportsEffects: false,\n});\n",
"durationInFrames": 126,
"installationMode": "component-owned-sequence"
},
"durationInFrames": 126
}