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": "flood-sting",
"title": "Flood Sting",
"description": "A flood of blue fills the frame and the Remocn wordmark lands between two dots.",
"dependencies": ["remotion", "@remotion/google-fonts"],
"registryDependencies": ["@remocn/gsh"],
"files": [
{
"path": "registry/remocn/flood-sting/index.tsx",
"content": "\"use client\";\n\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport type { 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 manrope = loadManrope(\"normal\", {\n weights: [\"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\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\nexport type GlyphName =\n | \"cluster\"\n | \"download\"\n | \"globe\"\n | \"gear\"\n | \"brackets\"\n | \"spark\"\n | \"grid\"\n | \"diamonds\";\n\nconst gearPath = (() => {\n const pts: string[] = [];\n const teeth = 8;\n for (let i = 0; i < teeth * 4; i++) {\n const a = (i / (teeth * 4)) * Math.PI * 2 - Math.PI / 2;\n const r = i % 4 === 0 || i % 4 === 1 ? 10.4 : 7.6;\n const off = (Math.PI * 2) / (teeth * 8);\n const aa = a + (i % 4 === 1 || i % 4 === 2 ? off : -off) * 0.4;\n pts.push(\n `${(12 + Math.cos(aa) * r).toFixed(2)} ${(12 + Math.sin(aa) * r).toFixed(2)}`,\n );\n }\n return `M${pts.join(\" L\")} Z M12 8.6 A3.4 3.4 0 1 0 12 15.4 A3.4 3.4 0 1 0 12 8.6 Z`;\n})();\n\nfunction Glyph({ name, color }: { name: GlyphName; color: string }) {\n const body: Record<GlyphName, ReactNode> = {\n cluster: (\n <g fill={color}>\n <circle cx=\"12\" cy=\"6\" r=\"3.9\" />\n <circle cx=\"6\" cy=\"12\" r=\"3.9\" />\n <circle cx=\"18\" cy=\"12\" r=\"3.9\" />\n <circle cx=\"12\" cy=\"18\" r=\"3.9\" />\n <rect x=\"9.4\" y=\"9.4\" width=\"5.2\" height=\"5.2\" />\n </g>\n ),\n download: (\n <path\n fill={color}\n d=\"M10.4 2.5h3.2v8.1h3.9L12 16.2l-5.5-5.6h3.9z M3 14.6h3.2v3.6h11.6v-3.6H21v6.8H3z\"\n />\n ),\n globe: (\n <g fill=\"none\" stroke={color} strokeWidth=\"2.6\">\n <circle cx=\"12\" cy=\"12\" r=\"8.7\" />\n <ellipse cx=\"12\" cy=\"12\" rx=\"3.8\" ry=\"8.7\" />\n <path d=\"M3.3 12h17.4\" />\n </g>\n ),\n gear: <path fill={color} fillRule=\"evenodd\" d={gearPath} />,\n brackets: (\n <path\n fill={color}\n d=\"M3.5 2.5h6.5v3.2H6.8v12.6H10v3.2H3.5z M20.5 2.5H14v3.2h3.2v12.6H14v3.2h6.5z M10.6 8.4h2.8v7.2h-2.8z\"\n />\n ),\n spark: (\n <path\n fill={color}\n d=\"M12 1.8C12.9 8.3 15.7 11.1 22.2 12 15.7 12.9 12.9 15.7 12 22.2 11.1 15.7 8.3 12.9 1.8 12 8.3 11.1 11.1 8.3 12 1.8Z\"\n />\n ),\n grid: (\n <g fill={color}>\n {[0, 1, 2].flatMap((r) =>\n [0, 1, 2].map((c) =>\n (r + c) % 2 === 0 ? (\n <rect\n key={`${r}-${c}`}\n x={2.6 + c * 6.6}\n y={2.6 + r * 6.6}\n width=\"5.6\"\n height=\"5.6\"\n rx=\"1\"\n />\n ) : (\n <circle\n key={`${r}-${c}`}\n cx={5.4 + c * 6.6}\n cy={5.4 + r * 6.6}\n r=\"1.6\"\n />\n ),\n ),\n )}\n </g>\n ),\n diamonds: (\n <g fill={color}>\n <path d=\"M12 1.6l4.2 4.2L12 10 7.8 5.8z\" />\n <path d=\"M12 14l4.2 4.2-4.2 4.2-4.2-4.2z\" />\n <path d=\"M5.8 7.8L10 12l-4.2 4.2L1.6 12z\" />\n <path d=\"M18.2 7.8l4.2 4.2-4.2 4.2L14 12z\" />\n </g>\n ),\n };\n return (\n <svg\n viewBox=\"0 0 24 24\"\n width=\"100%\"\n height=\"100%\"\n style={{ display: \"block\" }}\n aria-hidden\n >\n {body[name]}\n </svg>\n );\n}\n\nexport interface FloodStingProps {\n icons?: GlyphName[];\n rolls?: GlyphName[][];\n pick?: number;\n theme?: \"dark\" | \"light\";\n paper?: string;\n ink?: string;\n flood?: string;\n logoColor?: string;\n hops?: string[];\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n}\n\nconst THEMES = {\n dark: {\n paper: \"#0d0d10\",\n paperGlow: \"rgba(120,130,255,0.07)\",\n ink: \"#ececf0\",\n flood: \"#3046f5\",\n logo: \"#ffffff\",\n hairline: \"rgba(236,236,240,0.16)\",\n hops: [\"#ececf0\", \"#d7f25c\", \"#ff9ad1\", \"#7d8bff\"],\n hopInk: [\"#0d0d10\", \"#0d0d10\", \"#0d0d10\", \"#ffffff\"],\n groundParams: {\n kind: \"mist\",\n background: \"#2f4cf5\",\n colors: [\"#8fa6ff\", \"#4a66ff\", \"#1f33c9\", \"#b9c6ff\"],\n seed: 4,\n grain: 0.25,\n } as Partial<GradientParams>,\n },\n light: {\n paper: \"#ebe8e3\",\n paperGlow: \"rgba(255,255,255,0.7)\",\n ink: \"#17171a\",\n flood: \"#f0560f\",\n logo: \"#170d06\",\n hairline: \"rgba(23,23,26,0.14)\",\n hops: [\"#17171a\", \"#7d8bff\", \"#ff9ad1\", \"#cdea4f\"],\n hopInk: [\"#ebe8e3\", \"#ffffff\", \"#17171a\", \"#17171a\"],\n groundParams: {\n kind: \"mist\",\n background: \"#f0560f\",\n colors: [\"#ff9a4d\", \"#ff6a1f\", \"#d63d0a\", \"#ffb37a\"],\n seed: 4,\n grain: 0.25,\n } as Partial<GradientParams>,\n },\n};\n\nconst DEFAULT_ICONS: GlyphName[] = [\n \"cluster\",\n \"download\",\n \"globe\",\n \"gear\",\n \"brackets\",\n];\nconst DEFAULT_ROLLS: GlyphName[][] = [\n [\"grid\", \"spark\", \"globe\", \"diamonds\", \"cluster\"],\n [\"diamonds\", \"grid\", \"spark\", \"cluster\", \"download\"],\n];\n\nconst BEATS = [\n { name: \"row\", at: -12 },\n { name: \"select\", at: 0 },\n { name: \"hop1\", at: 6 },\n { name: \"hop2\", at: 18 },\n { name: \"roll1\", at: 22 },\n { name: \"hop3\", at: 28 },\n { name: \"hop4\", at: 36 },\n { name: \"roll2\", at: 38 },\n { name: \"hop5\", at: 42 },\n { name: \"press\", at: 48 },\n { name: \"flood\", at: 54 },\n { name: \"logo\", at: 62 },\n { name: \"flank\", at: 62 },\n { name: \"tuck\", at: 96 },\n { name: \"end\", at: 120 },\n] as const;\ntype BeatName = (typeof BEATS)[number][\"name\"];\nconst beat = (n: BeatName) => BEATS.find((b) => b.name === n)?.at ?? 0;\nconst HOPS: BeatName[] = [\"hop1\", \"hop2\", \"hop3\", \"hop4\", \"hop5\"];\nconst ROLLS: BeatName[] = [\"roll1\", \"roll2\"];\n\nconst CARD = { mass: 0.8, damping: 18, stiffness: 160 };\nconst CHIP = { mass: 0.5, damping: 12, stiffness: 200 };\nconst BURST = Easing.bezier(0.83, 0, 0.17, 1);\nconst ROLL = Easing.bezier(0.65, 0, 0.35, 1);\nconst EXIT = Easing.bezier(0.55, 0, 1, 0.45);\nconst CLAMP = {\n extrapolateLeft: \"clamp\",\n extrapolateRight: \"clamp\",\n} as const;\n\nexport function FloodSting({\n icons = DEFAULT_ICONS,\n rolls = DEFAULT_ROLLS,\n pick = 2,\n theme = \"dark\",\n paper,\n ink,\n flood,\n logoColor,\n hops,\n ground,\n groundParams,\n}: FloodStingProps) {\n const frame = useCurrentFrame();\n const { width: W, height: H, fps } = useVideoConfig();\n const t = THEMES[theme];\n const portrait = H > W;\n const paperC = paper ?? t.paper;\n const inkC = ink ?? t.ink;\n const floodC = flood ?? t.flood;\n const logoC = logoColor ?? t.logo;\n const hopColors = hops ?? t.hops;\n const n = icons.length;\n const target = Math.max(0, Math.min(n - 1, pick));\n const sp = (at: number, config: Partial<typeof CARD>) =>\n spring({ frame: frame - at, fps, config });\n\n const S = portrait ? W * 0.108 : H * 0.112;\n const gap = S * (portrait ? 0.44 : 0.62);\n const cell = S + gap;\n const rowW = n * S + (n - 1) * gap;\n const cx = W / 2;\n const cy = H / 2;\n const slotX = (k: number) => cx - rowW / 2 + S / 2 + k * cell;\n\n const hopSlots = [Math.min(n - 1, 1), Math.min(n - 1, 3), 0, n - 1, target];\n let hx = slotX(hopSlots[0] as number);\n for (let i = 1; i < HOPS.length; i++) {\n const p = sp(beat(HOPS[i] as BeatName), CHIP);\n hx += (slotX(hopSlots[i] as number) - slotX(hopSlots[i - 1] as number)) * p;\n }\n const hopIdx = HOPS.reduce((acc, h, i) => (frame >= beat(h) ? i : acc), 0);\n const hlIn = sp(beat(\"hop1\"), CHIP);\n const hlColor =\n hopIdx === HOPS.length - 1\n ? interpolateColors(\n frame,\n [beat(\"hop5\"), beat(\"hop5\") + 4],\n [hopColors[(hopIdx - 1) % hopColors.length] as string, floodC],\n )\n : (hopColors[hopIdx % hopColors.length] as string);\n const press = sp(beat(\"press\"), CHIP);\n const pressScale = frame < beat(\"press\") ? 1 : 0.86 + 0.14 * press;\n\n const floodP = interpolate(\n frame,\n [beat(\"flood\"), beat(\"flood\") + 15],\n [0, 1],\n { ...CLAMP, easing: BURST },\n );\n const fx = slotX(target);\n const r0 = S * 0.7;\n const rMax = Math.hypot(Math.max(fx, W - fx), H / 2) * 1.04;\n const floodR = r0 + (rMax - r0) * floodP;\n const pickedOut = interpolate(\n frame,\n [beat(\"flood\") + 4, beat(\"flood\") + 11],\n [0, 1],\n { ...CLAMP, easing: EXIT },\n );\n const logoIn = sp(beat(\"logo\"), CARD);\n const logoSize = portrait ? W * 0.15 : H * 0.15;\n const logoW = logoSize * 3.95;\n const flank = sp(beat(\"flank\"), CHIP);\n const tuck = interpolate(frame, [beat(\"tuck\"), beat(\"tuck\") + 8], [0, 1], {\n ...CLAMP,\n easing: EXIT,\n });\n const push = interpolate(frame, [0, beat(\"end\")], [1, 1.04]);\n const selIn = sp(beat(\"select\"), CARD);\n const boxPad = S * 0.55;\n const box = {\n x: cx - rowW / 2 - boxPad,\n y: cy - S / 2 - boxPad,\n w: rowW + boxPad * 2,\n h: S + boxPad * 2,\n };\n const dot = S * 0.13;\n const corners = [\n [box.x, box.y, -1],\n [box.x + box.w, box.y, 1],\n [box.x, box.y + box.h, -1],\n [box.x + box.w, box.y + box.h, 1],\n ] as const;\n const flankGap = logoW / 2 + logoSize * 0.42;\n const preset = ground;\n const gParams =\n groundParams ??\n (ground\n ? undefined\n : flood\n ? { ...t.groundParams, background: flood }\n : t.groundParams);\n\n const glyphAt = (k: number) => {\n const seq = [icons[k], ...rolls.map((r) => r[k])].filter(\n Boolean,\n ) as GlyphName[];\n const layers: { name: GlyphName; y: number }[] = [];\n let current = 0;\n ROLLS.forEach((rb, ri) => {\n if (ri + 1 >= seq.length) return;\n const st = beat(rb) + Math.abs(k - target);\n if (frame >= st) current = ri + 1;\n });\n const rbName = ROLLS[current - 1];\n if (current > 0 && rbName) {\n const st = beat(rbName) + Math.abs(k - target);\n const p = interpolate(frame, [st, st + 8], [0, 1], {\n ...CLAMP,\n easing: ROLL,\n });\n if (p < 1) {\n layers.push({ name: seq[current - 1] as GlyphName, y: -p });\n }\n layers.push({ name: seq[current] as GlyphName, y: 1 - p });\n } else {\n layers.push({ name: seq[0] as GlyphName, y: 0 });\n }\n return layers;\n };\n\n return (\n <AbsoluteFill style={{ backgroundColor: paperC, overflow: \"hidden\" }}>\n <AbsoluteFill\n style={{\n backgroundImage: `radial-gradient(60% 55% at 50% 50%, ${t.paperGlow} 0%, transparent 70%), radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0,0,0,${theme === \"light\" ? 0.06 : 0.35}) 100%)`,\n }}\n />\n <AbsoluteFill style={{ transform: `scale(${push})` }}>\n <div\n style={{\n position: \"absolute\",\n left: box.x,\n top: box.y,\n width: box.w,\n height: box.h,\n boxShadow: `inset 0 0 0 1px ${t.hairline}`,\n opacity: selIn * (1 - floodP),\n transform: `scale(${1.06 - 0.06 * selIn})`,\n }}\n />\n <div\n style={{\n position: \"absolute\",\n left: hx - (S * 1.36) / 2,\n top: cy - (S * 1.36) / 2,\n width: S * 1.36,\n height: S * 1.36,\n borderRadius: S * 0.24,\n backgroundColor: hlColor,\n transform: `scale(${hlIn * pressScale})`,\n boxShadow: `0 ${S * 0.08}px ${S * 0.24}px rgba(0,0,0,${theme === \"light\" ? 0.12 : 0.4})`,\n }}\n />\n {icons.map((_, k) => {\n const pop = sp(beat(\"row\") + k * 2, CHIP);\n const isPick = k === target && frame >= beat(\"hop5\");\n const overlap =\n hlIn *\n Math.max(0, Math.min(1, 1.6 - Math.abs(hx - slotX(k)) / (S * 0.5)));\n const color = interpolateColors(\n overlap,\n [0, 1],\n [\n inkC,\n isPick\n ? \"#ffffff\"\n : (t.hopInk[hopIdx % t.hopInk.length] as string),\n ],\n );\n return (\n <div\n key={`slot-${k}`}\n style={{\n position: \"absolute\",\n left: slotX(k) - S / 2,\n top: cy - S / 2,\n width: S,\n height: S,\n overflow: \"hidden\",\n transform: `scale(${pop * (isPick ? pressScale : 1)})`,\n opacity: Math.min(1, pop * 1.5),\n }}\n >\n {glyphAt(k).map((l, li) => (\n <div\n key={`${l.name}-${li}`}\n style={{\n position: \"absolute\",\n inset: S * 0.06,\n transform: `translateY(${l.y * S * 1.1}px)`,\n }}\n >\n <Glyph name={l.name} color={color} />\n </div>\n ))}\n </div>\n );\n })}\n </AbsoluteFill>\n <AbsoluteFill\n style={{\n clipPath: `circle(${floodR}px at ${cx + (fx - cx) * push}px ${cy}px)`,\n opacity: frame >= beat(\"flood\") ? 1 : 0,\n }}\n >\n <GshGround\n preset={preset}\n params={gParams}\n timeOffset={2}\n timeScale={0.6}\n />\n </AbsoluteFill>\n <AbsoluteFill style={{ transform: `scale(${push})` }}>\n {frame >= beat(\"flood\") && pickedOut < 1 ? (\n <div\n style={{\n position: \"absolute\",\n left: fx - S / 2,\n top: cy - S / 2,\n width: S,\n height: S,\n padding: S * 0.06,\n boxSizing: \"border-box\",\n transform: `scale(${1 - 0.5 * pickedOut})`,\n opacity: 1 - pickedOut,\n filter: `blur(${pickedOut * 6}px)`,\n }}\n >\n <Glyph\n name={\n glyphAt(target)[glyphAt(target).length - 1]?.name ?? \"globe\"\n }\n color=\"#ffffff\"\n />\n </div>\n ) : null}\n {corners.map(([x0, y0, side], i) => {\n const before = interpolate(\n frame,\n [beat(\"select\") + i, beat(\"select\") + i + 8],\n [0, 1],\n CLAMP,\n );\n const popIn = sp(beat(\"select\") + i * 2, CHIP);\n const tx = cx + side * flankGap;\n const x = x0 + (tx - x0) * flank;\n const y = y0 + (cy - y0) * flank;\n const col = interpolateColors(\n floodP,\n [0, 0.6, 1],\n [floodC, floodC, logoC],\n );\n const merge = i >= 2 ? 1 - flank : 1;\n const s = popIn * (1 - tuck) * merge;\n return (\n <div\n key={`dot-${i}`}\n style={{\n position: \"absolute\",\n left: x - dot / 2,\n top: y - dot / 2,\n width: dot,\n height: dot,\n borderRadius: \"50%\",\n backgroundColor: col,\n opacity: before,\n transform: `scale(${Math.max(0, s)})`,\n }}\n />\n );\n })}\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n top: cy - logoSize * 0.5,\n display: \"flex\",\n justifyContent: \"center\",\n opacity: Math.min(1, logoIn * 1.6),\n transform: `translateY(${(1 - logoIn) * logoSize * 0.3}px) scale(${0.86 + 0.14 * logoIn})`,\n filter: logoIn < 0.98 ? `blur(${(1 - logoIn) * 8}px)` : undefined,\n }}\n >\n <RemocnLogo fontSize={logoSize} color={logoC} />\n </div>\n </AbsoluteFill>\n </AbsoluteFill>\n );\n}\n\nexport default FloodSting;\n",
"type": "registry:component",
"target": "components/remocn/flood-sting.tsx"
}
],
"type": "registry:component"
}