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": "bento-build",
"title": "Bento Build",
"description": "A bento grid of mini feature cards builds up and spotlights tiles in turn.",
"dependencies": ["remotion", "@remotion/google-fonts"],
"registryDependencies": ["@remocn/gsh"],
"files": [
{
"path": "registry/remocn/bento-build/index.tsx",
"content": "\"use client\";\n\nimport { loadFont } from \"@remotion/google-fonts/Geist\";\nimport { loadFont as loadMono } from \"@remotion/google-fonts/GeistMono\";\nimport type React from \"react\";\nimport { useId } from \"react\";\nimport {\n AbsoluteFill,\n Easing,\n interpolate,\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 { fontFamily } = loadFont(\"normal\", {\n weights: [\"300\", \"400\"],\n subsets: [\"latin\"],\n});\nconst { fontFamily: monoFamily } = loadMono(\"normal\", {\n weights: [\"400\"],\n subsets: [\"latin\"],\n});\n\nexport type BentoVisual =\n | \"chart\"\n | \"toggle\"\n | \"code\"\n | \"chips\"\n | \"avatars\"\n | \"none\";\nexport type BentoIconName =\n | \"sparkles\"\n | \"bolt\"\n | \"code\"\n | \"palette\"\n | \"users\"\n | \"layers\"\n | \"sliders\"\n | \"chart\";\n\nexport interface BentoTile {\n title: string;\n description: string;\n icon?: BentoIconName | React.ReactNode;\n /** [columns, rows] the tile spans on the grid. */\n span: [number, number];\n visual?: BentoVisual;\n}\n\nexport interface BentoBuildProps {\n tiles?: BentoTile[];\n /** Tile indices that get the spotlight, in order, after the grid locks. */\n highlightOrder?: number[];\n eyebrow?: string;\n heading?: string;\n columns?: number;\n theme?: \"light\" | \"dark\";\n accent?: string;\n speed?: number;\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n}\n\nconst DEFAULT_TILES: BentoTile[] = [\n {\n title: \"Renders you can measure.\",\n description: \"Every export is tracked, so you know which beat lands.\",\n span: [2, 2],\n visual: \"chart\",\n },\n {\n title: \"Motion presets.\",\n description: \"Springs tuned for 30fps.\",\n span: [2, 1],\n visual: \"toggle\",\n },\n {\n title: \"Own your code.\",\n description: \"It lands in your repo.\",\n span: [1, 1],\n visual: \"code\",\n },\n {\n title: \"Brand tokens.\",\n description: \"One accent, whole video.\",\n span: [1, 1],\n visual: \"chips\",\n },\n {\n title: \"124 components.\",\n description: \"Transitions, text, captions and full scenes.\",\n span: [2, 1],\n visual: \"chips\",\n },\n {\n title: \"Built for two.\",\n description: \"Review cuts together, ship on time.\",\n span: [2, 1],\n visual: \"avatars\",\n },\n];\n\nconst BUILD_STAGGER = 3;\nconst HIGHLIGHT_START = 46;\nconst HIGHLIGHT_LEN = 30;\nconst ENTER = Easing.bezier(0.32, 0.72, 0, 1);\nconst LIGHT = Easing.bezier(0.22, 1, 0.36, 1);\nconst MOVE = Easing.bezier(0.65, 0, 0.35, 1);\nconst CARD = { mass: 0.8, damping: 18, stiffness: 160 };\nconst MORPH = { damping: 200 };\nconst CL = { extrapolateLeft: \"clamp\", extrapolateRight: \"clamp\" } as const;\n\nfunction hash(n: number) {\n const x = Math.sin(n * 127.1 + 311.7) * 43758.5453;\n return x - Math.floor(x);\n}\n\nfunction withAlpha(hex: string, alpha: number) {\n const h = hex.replace(\"#\", \"\");\n const full = h.length === 3 ? h.replace(/./g, (c) => c + c) : h.slice(0, 6);\n const n = Number.parseInt(full, 16);\n return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`;\n}\n\ninterface Placed {\n col: number;\n row: number;\n cols: number;\n rows: number;\n}\n\nfunction pack(tiles: BentoTile[], columns: number) {\n const taken: boolean[][] = [];\n const isFree = (r: number, c: number) => !taken[r]?.[c];\n const placed: Placed[] = [];\n for (const tile of tiles) {\n const cols = Math.max(1, Math.min(columns, tile.span[0]));\n const rows = Math.max(1, tile.span[1]);\n let done = false;\n for (let r = 0; !done; r++) {\n for (let c = 0; c + cols <= columns && !done; c++) {\n let fits = true;\n for (let dr = 0; dr < rows && fits; dr++)\n for (let dc = 0; dc < cols && fits; dc++)\n if (!isFree(r + dr, c + dc)) fits = false;\n if (!fits) continue;\n for (let dr = 0; dr < rows; dr++) {\n taken[r + dr] = taken[r + dr] ?? [];\n for (let dc = 0; dc < cols; dc++) taken[r + dr][c + dc] = true;\n }\n placed.push({ col: c, row: r, cols, rows });\n done = true;\n }\n }\n }\n return { placed, rowCount: taken.length };\n}\n\ninterface Palette {\n tile: string;\n edge: string;\n lift: (f: number) => string;\n text: string;\n muted: string;\n faint: string;\n inset: string;\n hair: string;\n scrim: string;\n dark: boolean;\n}\n\nfunction palette(theme: \"light\" | \"dark\"): Palette {\n return theme === \"dark\"\n ? {\n tile: \"rgba(14,15,18,0.74)\",\n edge: \"inset 0 0 0 1px rgba(255,255,255,0.08), inset 0 1px 0 rgba(255,255,255,0.06)\",\n lift: () => \"\",\n text: \"#F2F2F3\",\n muted: \"rgba(242,242,243,0.5)\",\n faint: \"rgba(242,242,243,0.34)\",\n inset: \"rgba(255,255,255,0.035)\",\n hair: \"rgba(255,255,255,0.08)\",\n scrim: \"rgba(3,4,8,0.38)\",\n dark: true,\n }\n : {\n tile: \"rgba(255,255,255,0.84)\",\n edge: \"inset 0 0 0 1px rgba(255,255,255,0.7)\",\n lift: (f) =>\n `, 0 0 0 1px rgba(15,17,22,0.05), 0 1px 3px rgba(15,17,22,0.05), 0 ${6 + 14 * f}px ${16 + 26 * f}px -8px rgba(15,17,22,${0.1 + 0.08 * f})`,\n text: \"#121317\",\n muted: \"rgba(18,19,23,0.52)\",\n faint: \"rgba(18,19,23,0.36)\",\n inset: \"rgba(18,19,23,0.03)\",\n hair: \"rgba(18,19,23,0.08)\",\n scrim: \"rgba(245,244,241,0.3)\",\n dark: false,\n };\n}\n\nfunction Glyph({ name, color }: { name: BentoIconName; color: string }) {\n const paths: Record<BentoIconName, string> = {\n sparkles: \"M12 4l1.6 4.4L18 10l-4.4 1.6L12 16l-1.6-4.4L6 10l4.4-1.6z\",\n bolt: \"M13 3L5 14h6l-1 7 8-11h-6z\",\n code: \"M8 7l-5 5 5 5M16 7l5 5-5 5\",\n palette:\n \"M12 4a8 8 0 1 0 0 16c1 0 1.5-.7 1.5-1.4 0-.9-.9-1.4-.9-2.3 0-.9.7-1.5 1.6-1.5H16a4 4 0 0 0 4-4c0-3.7-3.6-6.8-8-6.8z\",\n users:\n \"M15 19v-1.5a3.5 3.5 0 0 0-3.5-3.5h-4A3.5 3.5 0 0 0 4 17.5V19M9.5 10.5a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM20 19v-1.5a3.5 3.5 0 0 0-2.5-3.4\",\n layers: \"M12 4l8 4.5-8 4.5-8-4.5zM4 13l8 4.5 8-4.5\",\n sliders: \"M4 7h9M17 7h3M4 17h3M11 17h9M15 5v4M9 15v4\",\n chart: \"M5 19V11M12 19V5M19 19v-7\",\n };\n return (\n <svg\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke={color}\n strokeWidth={1.5}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n style={{ verticalAlign: \"-0.12em\", marginRight: \"0.4em\" }}\n >\n <path d={paths[name]} />\n </svg>\n );\n}\n\ninterface VisualProps {\n pal: Palette;\n accent: string;\n reveal: number;\n focus: number;\n frame: number;\n u: number;\n}\n\nfunction Panel({\n pal,\n u,\n style,\n children,\n}: {\n pal: Palette;\n u: number;\n style: React.CSSProperties;\n children: React.ReactNode;\n}) {\n return (\n <div\n style={{\n position: \"absolute\",\n background: pal.inset,\n boxShadow: `inset 0 0 0 1px ${pal.hair}`,\n borderRadius: 10 * u,\n ...style,\n }}\n >\n {children}\n </div>\n );\n}\n\nfunction ChartVisual({ pal, accent, reveal, focus, u }: VisualProps) {\n const id = useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n const values = [31, 44, 37, 52, 46, 61, 57, 70, 64, 78, 73, 91];\n const w = 100;\n const h = 40;\n const pts = values.map((v, i) => [\n (i / (values.length - 1)) * w,\n h - (v / 100) * h * (0.35 + 0.65 * reveal),\n ]);\n const line = pts.map(([x, y], i) => `${i ? \"L\" : \"M\"}${x},${y}`).join(\" \");\n const area = `${line} L${w},${h} L0,${h} Z`;\n const count = Math.round(12_486 * Math.min(1, reveal * 1.04));\n return (\n <Panel\n pal={pal}\n u={u}\n style={{\n left: 16 * u,\n right: 16 * u,\n top: 16 * u,\n bottom: 104 * u,\n padding: `${16 * u}px ${18 * u}px ${12 * u}px`,\n display: \"flex\",\n flexDirection: \"column\",\n }}\n >\n <div\n style={{\n display: \"flex\",\n alignItems: \"baseline\",\n gap: 10 * u,\n fontSize: 14 * u,\n color: pal.muted,\n }}\n >\n Renders this week\n <span\n style={{\n marginLeft: \"auto\",\n color: pal.dark ? \"#6FD39A\" : \"#1F8A4C\",\n fontVariantNumeric: \"tabular-nums\",\n }}\n >\n +18.4%\n </span>\n </div>\n <div\n style={{\n fontSize: 40 * u,\n fontWeight: 300,\n letterSpacing: \"-0.03em\",\n color: pal.text,\n marginTop: 2 * u,\n fontVariantNumeric: \"tabular-nums\",\n }}\n >\n {count.toLocaleString(\"en-US\")}\n </div>\n <div style={{ position: \"relative\", flex: 1, marginTop: 10 * u }}>\n {[0.33, 0.66].map((g) => (\n <div\n key={g}\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n top: `${g * 100}%`,\n height: 1,\n background: pal.hair,\n }}\n />\n ))}\n <svg\n viewBox={`0 0 ${w} ${h}`}\n preserveAspectRatio=\"none\"\n style={{\n position: \"absolute\",\n inset: 0,\n width: \"100%\",\n height: \"100%\",\n }}\n >\n <defs>\n <linearGradient id={`${id}-a`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop\n offset=\"0\"\n stopColor={accent}\n stopOpacity={0.2 + 0.1 * focus}\n />\n <stop offset=\"1\" stopColor={accent} stopOpacity={0} />\n </linearGradient>\n <clipPath id={`${id}-c`}>\n <rect x={0} y={0} width={w * reveal} height={h} />\n </clipPath>\n </defs>\n <path d={area} fill={`url(#${id}-a)`} clipPath={`url(#${id}-c)`} />\n <path\n d={line}\n fill=\"none\"\n stroke={accent}\n strokeWidth={1.5}\n vectorEffect=\"non-scaling-stroke\"\n strokeLinejoin=\"round\"\n clipPath={`url(#${id}-c)`}\n />\n </svg>\n </div>\n <div\n style={{\n display: \"flex\",\n justifyContent: \"space-between\",\n fontSize: 12 * u,\n color: pal.faint,\n marginTop: 8 * u,\n fontFamily: monoFamily,\n }}\n >\n {[\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"].map((d) => (\n <span key={d}>{d}</span>\n ))}\n </div>\n </Panel>\n );\n}\n\nfunction Toggle({\n on,\n accent,\n pal,\n u,\n}: {\n on: number;\n accent: string;\n pal: Palette;\n u: number;\n}) {\n const off = pal.dark ? \"rgba(255,255,255,0.14)\" : \"rgba(18,19,23,0.14)\";\n return (\n <div\n style={{\n width: 30 * u,\n height: 18 * u,\n borderRadius: 99,\n background: on > 0.5 ? accent : off,\n position: \"relative\",\n flexShrink: 0,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n top: 2 * u,\n left: (2 + 12 * Math.min(1, on)) * u,\n width: 14 * u,\n height: 14 * u,\n borderRadius: 99,\n background: \"#fff\",\n boxShadow: \"0 1px 2px rgba(0,0,0,0.25)\",\n }}\n />\n </div>\n );\n}\n\nfunction ToggleVisual({ pal, accent, reveal, focus, u }: VisualProps) {\n const rows = [\n { label: \"Spring\", value: \"18 / 160\", on: 1 },\n { label: \"Motion blur\", value: \"0.4\", on: focus },\n { label: \"Reduce motion\", value: \"auto\", on: 0 },\n ];\n return (\n <Panel\n pal={pal}\n u={u}\n style={{\n right: 16 * u,\n top: 16 * u,\n bottom: 16 * u,\n width: \"50%\",\n padding: `0 ${14 * u}px`,\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n opacity: reveal,\n }}\n >\n {rows.map((r, i) => (\n <div\n key={r.label}\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: 10 * u,\n height: 34 * u,\n borderTop: i ? `1px solid ${pal.hair}` : \"none\",\n }}\n >\n <span style={{ fontSize: 14 * u, color: pal.text }}>{r.label}</span>\n <span\n style={{\n marginLeft: \"auto\",\n fontSize: 12 * u,\n color: pal.faint,\n fontFamily: monoFamily,\n }}\n >\n {r.value}\n </span>\n <Toggle on={r.on} accent={accent} pal={pal} u={u} />\n </div>\n ))}\n </Panel>\n );\n}\n\nfunction CodeVisual({ pal, reveal, frame, u }: VisualProps) {\n const cmd = \"@remocn/bento\";\n const shown = cmd.slice(0, Math.round(cmd.length * reveal));\n const blink = Math.floor(frame / 8) % 2 === 0;\n return (\n <Panel\n pal={pal}\n u={u}\n style={{\n left: 16 * u,\n right: 16 * u,\n top: 16 * u,\n padding: `${12 * u}px ${12 * u}px`,\n fontFamily: monoFamily,\n fontSize: 13 * u,\n lineHeight: 1.6,\n color: pal.text,\n whiteSpace: \"pre\",\n overflow: \"hidden\",\n }}\n >\n <div>\n <span style={{ color: pal.faint }}>$ </span>npx shadcn add\n </div>\n <div>\n <span style={{ color: pal.faint }}>{\" \"}</span>\n {shown}\n <span\n style={{\n display: \"inline-block\",\n width: 7 * u,\n height: 14 * u,\n marginLeft: 1,\n verticalAlign: \"middle\",\n background: blink ? pal.text : \"transparent\",\n }}\n />\n </div>\n </Panel>\n );\n}\n\nfunction ChipsVisual({\n pal,\n accent,\n reveal,\n focus,\n u,\n wide,\n}: VisualProps & { wide: boolean }) {\n const chips = wide\n ? [\n \"zoom-blur\",\n \"typewriter\",\n \"glass-card\",\n \"ken-burns\",\n \"caption-pop\",\n \"+119\",\n ]\n : [accent.toUpperCase(), \"Geist\", \"r 12\"];\n return (\n <div\n style={{\n position: \"absolute\",\n right: 16 * u,\n left: wide ? \"auto\" : 16 * u,\n top: wide ? \"50%\" : 16 * u,\n transform: wide ? \"translateY(-50%)\" : \"none\",\n width: wide ? \"50%\" : \"auto\",\n display: \"flex\",\n flexWrap: \"wrap\",\n gap: 6 * u,\n justifyContent: wide ? \"flex-end\" : \"flex-start\",\n }}\n >\n {chips.map((c, i) => {\n const a = interpolate(reveal * chips.length - i, [0, 1], [0, 1], CL);\n const lit = i === 0 && focus > 0.5;\n return (\n <span\n key={c}\n style={{\n display: \"inline-flex\",\n alignItems: \"center\",\n gap: 6 * u,\n fontSize: 13 * u,\n fontFamily: monoFamily,\n color: lit ? pal.text : pal.muted,\n background: pal.inset,\n boxShadow: `inset 0 0 0 1px ${lit ? withAlpha(accent, 0.6) : pal.hair}`,\n padding: `${5 * u}px ${9 * u}px`,\n borderRadius: 6 * u,\n opacity: a,\n transform: `translateY(${(1 - a) * 6 * u}px)`,\n }}\n >\n {!wide && i === 0 ? (\n <span\n style={{\n width: 9 * u,\n height: 9 * u,\n borderRadius: 2 * u,\n background: accent,\n }}\n />\n ) : null}\n {c}\n </span>\n );\n })}\n </div>\n );\n}\n\nfunction AvatarsVisual({ pal, reveal, u }: VisualProps) {\n const people = [\"MC\", \"LP\"];\n return (\n <Panel\n pal={pal}\n u={u}\n style={{\n right: 16 * u,\n top: \"50%\",\n transform: \"translateY(-50%)\",\n width: \"50%\",\n padding: `${10 * u}px ${12 * u}px`,\n display: \"flex\",\n flexDirection: \"column\",\n gap: 6 * u,\n opacity: reveal,\n }}\n >\n <div style={{ display: \"flex\", alignItems: \"center\", gap: 8 * u }}>\n <div style={{ display: \"flex\" }}>\n {people.map((p, i) => (\n <div\n key={p}\n style={{\n width: 24 * u,\n height: 24 * u,\n borderRadius: 99,\n background: pal.dark ? \"#2A2B30\" : \"#E7E6E2\",\n boxShadow: `0 0 0 ${2 * u}px ${pal.dark ? \"#121317\" : \"#fff\"}`,\n marginLeft: i ? -5 * u : 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n fontSize: 10 * u,\n color: pal.text,\n transform: `translateX(${(1 - reveal) * -8 * i * u}px)`,\n }}\n >\n {p}\n </div>\n ))}\n </div>\n <span style={{ fontSize: 13 * u, color: pal.muted }}>Maya · cut 3</span>\n <span\n style={{\n marginLeft: \"auto\",\n fontSize: 12 * u,\n fontFamily: monoFamily,\n color: pal.faint,\n }}\n >\n 0:04\n </span>\n </div>\n <div style={{ fontSize: 14 * u, color: pal.text }}>\n Hold the logo six more frames.\n </div>\n </Panel>\n );\n}\n\nexport function BentoBuild({\n tiles = DEFAULT_TILES,\n highlightOrder = [0, 1, 4],\n eyebrow = \"Features\",\n heading = \"Everything a launch video needs.\",\n columns = 4,\n theme = \"dark\",\n accent = \"#3B5BFD\",\n speed = 1,\n ground,\n groundParams,\n}: BentoBuildProps) {\n const frame = useCurrentFrame() * speed;\n const { width, height, fps } = useVideoConfig();\n const tall = height > width;\n const u = tall ? width / 760 : Math.min(width / 1280, height / 720);\n const pal = palette(theme);\n const cols = tall ? Math.min(2, columns) : columns;\n const { placed, rowCount } = pack(tiles, cols);\n\n const padX = tall ? width * 0.07 : 150 * u;\n const headTop = tall ? height * 0.07 : 48 * u;\n const headerH = tall ? 150 * u : 92 * u;\n const top = headTop + headerH;\n const gap = 12 * u;\n const gridW = width - padX * 2;\n const gridH = height - top - (tall ? height * 0.07 : 44 * u);\n const cellW = (gridW - gap * (cols - 1)) / cols;\n const cellH = (gridH - gap * (rowCount - 1)) / Math.max(1, rowCount);\n\n const buildEnd = BUILD_STAGGER * tiles.length + 26;\n const focusOf = (i: number) => {\n let v = 0;\n highlightOrder.forEach((idx, k) => {\n if (idx !== i) return;\n const s = HIGHLIGHT_START + k * HIGHLIGHT_LEN;\n v += interpolate(\n frame,\n [s - 5, s + 5, s + HIGHLIGHT_LEN - 5, s + HIGHLIGHT_LEN + 5],\n [0, 1, 1, 0],\n { ...CL, easing: MOVE },\n );\n });\n return Math.min(1, v);\n };\n const focus = tiles.map((_, i) => focusOf(i));\n const anyFocus = Math.min(\n 1,\n focus.reduce((a, b) => a + b, 0),\n );\n\n const camIn = interpolate(frame, [0, buildEnd + 6], [0.97, 1], {\n extrapolateRight: \"clamp\",\n easing: LIGHT,\n });\n let camX = 0;\n let camY = 0;\n placed.forEach((p, i) => {\n const cx =\n padX + p.col * (cellW + gap) + (p.cols * cellW + (p.cols - 1) * gap) / 2;\n const cy =\n top + p.row * (cellH + gap) + (p.rows * cellH + (p.rows - 1) * gap) / 2;\n camX += focus[i] * (width / 2 - cx) * 0.05;\n camY += focus[i] * (height / 2 - cy) * 0.05;\n });\n const camScale = camIn * (1 + 0.02 * anyFocus);\n\n const eyeIn = interpolate(frame, [0, 12], [0, 1], { ...CL, easing: LIGHT });\n const headIn = interpolate(frame, [2, 18], [0, 1], { ...CL, easing: ENTER });\n const headSize = tall ? 52 * u : 40 * u;\n\n return (\n <AbsoluteFill style={{ fontFamily, overflow: \"hidden\" }}>\n <GshGround\n preset={ground ?? (pal.dark ? \"film-blue\" : \"glasswork\")}\n params={groundParams}\n timeOffset={pal.dark ? 6 : 3}\n timeScale={0.3}\n />\n <AbsoluteFill style={{ background: pal.scrim }} />\n <AbsoluteFill\n style={{\n transform: `translate(${camX}px, ${camY}px) scale(${camScale})`,\n transformOrigin: \"50% 55%\",\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: padX,\n right: padX,\n top: headTop,\n opacity: 1 - 0.4 * anyFocus,\n }}\n >\n {eyebrow ? (\n <div\n style={{\n fontSize: (tall ? 22 : 17) * u,\n color: pal.muted,\n opacity: eyeIn,\n transform: `translateY(${(1 - eyeIn) * 8 * u}px)`,\n }}\n >\n {eyebrow}\n </div>\n ) : null}\n <div style={{ overflow: \"hidden\", paddingBottom: 6 * u }}>\n <div\n style={{\n fontSize: headSize,\n fontWeight: 300,\n letterSpacing: \"-0.035em\",\n lineHeight: 1.08,\n textWrap: \"balance\",\n color: pal.text,\n marginTop: 6 * u,\n transform: `translateY(${(1 - headIn) * 110}%)`,\n }}\n >\n {heading}\n </div>\n </div>\n </div>\n\n {tiles.map((tile, i) => {\n const p = placed[i];\n const x = padX + p.col * (cellW + gap);\n const y = top + p.row * (cellH + gap);\n const w = p.cols * cellW + (p.cols - 1) * gap;\n const h = p.rows * cellH + (p.rows - 1) * gap;\n const delay = 4 + i * BUILD_STAGGER;\n\n const cx = x + w / 2 - width / 2;\n const cy = y + h / 2 - height / 2;\n const edges = [\n [cx >= 0 ? 1 : -1, 0],\n [0, cy >= 0 ? 1 : -1],\n ];\n const [ex, ey] = edges[i % 2];\n const dist = 72 * u;\n const jitter = (hash(i) - 0.5) * 24 * u;\n const tilt = (hash(i + 7) > 0.5 ? 1 : -1) * (1.5 + hash(i + 3) * 1.5);\n\n const move = spring({ frame: frame - delay, fps, config: CARD });\n const lockAt = delay + 12;\n const click = interpolate(\n frame,\n [lockAt, lockAt + 2, lockAt + 7],\n [0, 1, 0],\n CL,\n );\n const tx = (1 - move) * (ex * dist + (ey ? jitter : 0));\n const ty = (1 - move) * (ey * dist + (ex ? jitter : 0));\n const rot = (1 - move) * tilt;\n const sc = interpolate(move, [0, 1], [0.94, 1]) * (1 - 0.012 * click);\n\n const f = focus[i];\n const lift = 1 + 0.02 * f;\n const dim = 1 - 0.45 * Math.max(0, anyFocus - f);\n\n const textIn = interpolate(frame, [delay + 4, delay + 16], [0, 1], {\n ...CL,\n easing: ENTER,\n });\n const reveal = spring({\n frame: frame - (delay + 8),\n fps,\n config: MORPH,\n durationInFrames: 30,\n });\n const big = p.rows > 1;\n const wide = p.cols > 1 && !big;\n const visual = tile.visual ?? \"none\";\n const vp: VisualProps = { pal, accent, reveal, focus: f, frame, u };\n const textW = wide && visual !== \"none\" ? \"46%\" : \"100%\";\n const titleSize = (big ? 24 : 18) * u;\n\n return (\n <div\n key={`${tile.title}-${i}`}\n style={{\n position: \"absolute\",\n left: x,\n top: y,\n width: w,\n height: h,\n zIndex: Math.round(f * 10),\n opacity: dim * interpolate(move, [0, 0.45], [0, 1], CL),\n filter:\n move < 0.99\n ? `blur(${Math.max(0, 1 - move) * 6}px)`\n : undefined,\n transform: `translate(${tx}px, ${ty}px) rotate(${rot}deg) scale(${sc * lift})`,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n borderRadius: 18 * u,\n overflow: \"hidden\",\n background: pal.tile,\n backdropFilter: \"blur(24px) saturate(1.3)\",\n boxShadow: `${pal.edge}${\n click > 0.01 || f > 0.01\n ? `, inset 0 0 0 1px ${withAlpha(accent, Math.max(0.4 * click, 0.7 * f))}`\n : \"\"\n }${pal.lift(f)}`,\n }}\n >\n {visual === \"chart\" ? <ChartVisual {...vp} /> : null}\n {visual === \"toggle\" ? <ToggleVisual {...vp} /> : null}\n {visual === \"code\" ? <CodeVisual {...vp} /> : null}\n {visual === \"chips\" ? (\n <ChipsVisual {...vp} wide={wide || big} />\n ) : null}\n {visual === \"avatars\" ? <AvatarsVisual {...vp} /> : null}\n\n <div\n style={{\n position: \"absolute\",\n left: 20 * u,\n bottom: 18 * u,\n width: textW,\n paddingRight: 20 * u,\n boxSizing: \"border-box\",\n fontSize: titleSize,\n lineHeight: 1.3,\n letterSpacing: \"-0.012em\",\n textWrap: \"pretty\",\n opacity: textIn,\n transform: `translateY(${(1 - textIn) * 10 * u}px)`,\n }}\n >\n <span style={{ color: pal.text }}>\n {typeof tile.icon === \"string\" ? (\n <Glyph\n name={tile.icon as BentoIconName}\n color={pal.text}\n />\n ) : (\n (tile.icon ?? null)\n )}\n {tile.title}\n </span>{\" \"}\n <span style={{ color: pal.muted }}>{tile.description}</span>\n </div>\n </div>\n </div>\n );\n })}\n </AbsoluteFill>\n </AbsoluteFill>\n );\n}\n",
"type": "registry:component",
"target": "components/remocn/bento-build.tsx"
}
],
"type": "registry:component"
}