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": "photo-halo",
"title": "Photo Halo",
"description": "The Remocn wordmark sits next to a halo of circular photo thumbnails.",
"dependencies": ["remotion", "@remotion/google-fonts"],
"registryDependencies": ["@remocn/gsh"],
"files": [
{
"path": "registry/remocn/photo-halo/index.tsx",
"content": "\"use client\";\n\nimport { loadFont as loadSerif } from \"@remotion/google-fonts/InstrumentSerif\";\nimport { loadFont } from \"@remotion/google-fonts/InterTight\";\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport {\n AbsoluteFill,\n Easing,\n Img,\n interpolate,\n random,\n spring,\n staticFile,\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 interTight = loadFont(\"normal\", {\n weights: [\"300\", \"400\"],\n subsets: [\"latin\"],\n});\nconst serif = loadSerif(\"italic\", { weights: [\"400\"], subsets: [\"latin\"] });\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 whiteSpace: \"nowrap\",\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 interface PhotoHaloProps {\n words?: string[];\n accentWord?: number;\n images?: string[];\n theme?: \"dark\" | \"light\";\n background?: string;\n ink?: string;\n blooms?: string[];\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n}\n\nconst THEMES = {\n dark: {\n background: \"#0b0605\",\n ink: \"#fbf1e7\",\n accent: \"#ffc79a\",\n ground: \"hearth\" as GshPresetId | undefined,\n groundParams: undefined as Partial<GradientParams> | undefined,\n scrim: \"rgba(8,4,3,0.62)\",\n shadow: [0.32, 0.3, 0.42],\n shadowRgb: \"10,4,2\",\n ring: \"#160b08\",\n hairline: \"rgba(255,255,255,0.16)\",\n },\n light: {\n background: \"#f4efe8\",\n ink: \"#1e1712\",\n accent: \"#c2522a\",\n ground: undefined as GshPresetId | undefined,\n groundParams: {\n kind: \"mist\",\n background: \"#f4efe8\",\n colors: [\"#ff9a5c\", \"#f7c06a\", \"#f6d4c0\", \"#e8708e\"],\n blur: 0.75,\n grain: 0.2,\n warp: 0.4,\n scale: 0.9,\n seed: 6,\n } as Partial<GradientParams> | undefined,\n scrim: \"rgba(246,241,234,0.7)\",\n shadow: [0.1, 0.12, 0.18],\n shadowRgb: \"92,48,18\",\n ring: \"#f6f1ea\",\n hairline: \"rgba(255,255,255,0.5)\",\n },\n};\n\nconst DEFAULT_WORDS = [\"Launch\", \"films\", \"for\", \"everything\", \"you\", \"ship\"];\nconst DEFAULT_IMAGES = [\n \"templates/brand-guidelines/ceramics.jpg\",\n \"reel/reel-2.jpg\",\n \"templates/product-showcase/sculpture.jpg\",\n \"templates/launch-anything/desk.jpg\",\n \"templates/brand-guidelines/chair.jpg\",\n \"reel/reel-4.jpg\",\n \"templates/product-showcase/courtyard.jpg\",\n \"templates/brand-guidelines/materials.jpg\",\n \"reel/reel-6.jpg\",\n \"templates/product-showcase/workbench.jpg\",\n \"templates/launch-anything/horizon.jpg\",\n \"reel/reel-1.jpg\",\n];\n\nconst BEATS = [\n { id: \"words\", at: -6 },\n { id: \"pops\", at: 6 },\n { id: \"textOut\", at: 72 },\n { id: \"converge\", at: 72 },\n { id: \"logo\", at: 90 },\n { id: \"land\", at: 96 },\n { id: \"end\", at: 138 },\n] as const;\nconst beat = (id: (typeof BEATS)[number][\"id\"]) =>\n BEATS.find((b) => b.id === id)?.at ?? 0;\n\nconst EASE_ENTER = Easing.bezier(0.32, 0.72, 0, 1);\nconst EASE_REVEAL = Easing.bezier(0.22, 1, 0.36, 1);\nconst EASE_EXIT = Easing.bezier(0.55, 0, 1, 0.45);\nconst EASE_CAMERA = Easing.bezier(0.87, 0, 0.13, 1);\nconst SPRING_CARD = { mass: 0.8, damping: 18, stiffness: 160 };\nconst SPRING_MORPH = { damping: 200 };\nconst SPRING_CHIP = { mass: 0.5, damping: 12, stiffness: 200 };\nconst CLAMP = {\n extrapolateLeft: \"clamp\",\n extrapolateRight: \"clamp\",\n} as const;\n\nfunction popTime(order: number) {\n let t = beat(\"pops\");\n let step = 6;\n for (let k = 0; k < order; k++) {\n t += step;\n step = Math.max(2, step * 0.82);\n }\n return Math.round(t);\n}\n\ninterface Slot {\n x: number;\n y: number;\n w: number;\n h: number;\n z: number;\n dx: number;\n dy: number;\n rot: number;\n t: number;\n}\n\nfunction buildSlots(\n n: number,\n W: number,\n H: number,\n portrait: boolean,\n textW: number,\n textH: number,\n): Slot[] {\n const cx = W / 2;\n const cy = H / 2;\n const base = portrait ? W * 0.27 : W * 0.15;\n const a = portrait ? W * 0.42 : W * 0.41;\n const b = portrait ? H * 0.34 : H * 0.35;\n const margin = (portrait ? W : H) * 0.04;\n const aspects = [1.34, 1, 0.8, 1.5, 1.12, 0.86];\n const order = Array.from({ length: n }, (_, i) => i).sort(\n (p, q) => random(`ph2-order-${p}`) - random(`ph2-order-${q}`),\n );\n const slots: Slot[] = [];\n for (let i = 0; i < n; i++) {\n const ang =\n -Math.PI / 2 +\n (i / n) * Math.PI * 2 +\n (random(`ph2-a-${i}`) - 0.5) * 0.34;\n const z = 0.28 + random(`ph2-z-${i}`) * 0.72;\n const size = base * (0.5 + 0.72 * z);\n const asp =\n aspects[Math.floor(random(`ph2-asp-${i}`) * aspects.length)] ?? 1;\n const w = size * Math.sqrt(asp);\n const h = size / Math.sqrt(asp);\n const rad = 0.8 + random(`ph2-r-${i}`) * 0.28;\n const ca = Math.cos(ang);\n const sa = Math.sin(ang);\n let x = cx + ca * a * rad;\n let y = cy + sa * b * rad;\n for (let k = 0; k < 160; k++) {\n const clearX = Math.abs(x - cx) > textW / 2 + margin + w / 2;\n const clearY = Math.abs(y - cy) > textH / 2 + margin + h / 2;\n if (clearX || clearY) break;\n x += ca * 4;\n y += sa * 4;\n }\n x = Math.min(Math.max(x, w * 0.32), W - w * 0.32);\n y = Math.min(Math.max(y, h * 0.4), H - h * 0.4);\n slots.push({\n x,\n y,\n w,\n h,\n z,\n dx: (x < cx ? -1 : 1) * (0.5 + random(`ph2-dx-${i}`)),\n dy: (y < cy ? -1 : 1) * (0.3 + random(`ph2-dy-${i}`) * 0.5),\n rot: (random(`ph2-rot-${i}`) - 0.5) * 7,\n t: popTime(order.indexOf(i)),\n });\n }\n return slots;\n}\n\nexport function PhotoHalo({\n words = DEFAULT_WORDS,\n accentWord = 3,\n images,\n theme = \"dark\",\n background,\n ink,\n blooms,\n ground,\n groundParams,\n}: PhotoHaloProps) {\n const frame = useCurrentFrame();\n const { width: W, height: H, fps } = useVideoConfig();\n const t = THEMES[theme];\n const light = theme === \"light\";\n const bg = background ?? t.background;\n const fg = ink ?? t.ink;\n const srcs = (\n images && images.length > 0 ? images : DEFAULT_IMAGES.map(staticFile)\n ).filter(Boolean);\n const portrait = H > W;\n const cx = W / 2;\n const cy = H / 2;\n const unit = W / 1280;\n\n const preset = ground ?? (groundParams ? undefined : t.ground);\n const gParams =\n groundParams ??\n (blooms ? { ...(t.groundParams ?? {}), colors: blooms } : t.groundParams);\n\n const fontSize = portrait ? W * 0.104 : W * 0.074;\n const maxW = portrait ? W * 0.8 : W * 0.66;\n const totalEm =\n words.reduce((acc, w) => acc + w.length * 0.5, 0) +\n Math.max(0, words.length - 1) * 0.24;\n const lines = Math.max(1, Math.ceil((totalEm * fontSize) / (maxW * 0.92)));\n const textW = Math.min(maxW, totalEm * fontSize);\n const textH = lines * fontSize * 1.06;\n\n const count = portrait ? 12 : 11;\n const slots = buildSlots(count, W, H, portrait, textW, textH);\n\n const rowCount = Math.min(5, count, srcs.length);\n const rowPick = slots\n .map((s, i) => ({ i, z: s.z }))\n .sort((p, q) => q.z - p.z)\n .slice(0, rowCount)\n .map((p) => p.i)\n .sort((p, q) => (slots[p]?.x ?? 0) - (slots[q]?.x ?? 0));\n\n const d = portrait ? W * 0.17 : W * 0.082;\n const step = d * 0.76;\n const ring = Math.max(2, d * 0.045);\n const logoSize = portrait ? d * 0.9 : d * 0.92;\n const logoW = logoSize * 3.72;\n const gap = d * 0.46;\n const rowW = (rowCount - 1) * step + d;\n const groupW = logoW + gap + rowW;\n const rowCentred = cx - rowW / 2;\n const rowFinal = portrait ? rowCentred : cx - groupW / 2 + logoW + gap;\n const rowY = portrait ? cy + d * 0.7 : cy;\n\n const logoP = interpolate(frame, [beat(\"logo\"), beat(\"logo\") + 12], [0, 1], {\n ...CLAMP,\n easing: EASE_REVEAL,\n });\n const rowShift = spring({\n frame: frame - beat(\"logo\"),\n fps,\n config: SPRING_MORPH,\n durationInFrames: 16,\n });\n const rowLeft = rowCentred + (rowFinal - rowCentred) * rowShift;\n const landSpring = spring({\n frame: frame - beat(\"land\"),\n fps,\n config: SPRING_CHIP,\n });\n const punch = 1 + 0.05 * Math.sin(Math.min(1, landSpring) * Math.PI);\n const lockPush = interpolate(frame, [beat(\"land\"), beat(\"end\")], [1, 1.03], {\n ...CLAMP,\n easing: EASE_CAMERA,\n });\n const pushAll = interpolate(frame, [0, beat(\"converge\")], [0, 0.08], {\n ...CLAMP,\n easing: Easing.bezier(0.65, 0, 0.35, 1),\n });\n\n const convergeStart = (i: number) => {\n const k = rowPick.indexOf(i);\n return beat(\"converge\") + (k >= 0 ? k * 2 : rowCount + (i % 3));\n };\n\n const stateAt = (i: number, f: number) => {\n const s = slots[i] as Slot;\n const k = rowPick.indexOf(i);\n const pop = spring({ frame: f - s.t, fps, config: SPRING_CARD });\n const push = 1 + pushAll * (0.4 + s.z);\n const sx = cx + (s.x - cx) * push + f * s.dx * 0.6 * s.z * unit;\n const sy =\n cy +\n (s.y - cy) * push +\n f * s.dy * 0.34 * s.z * unit +\n (1 - pop) * H * 0.06;\n const c0 = convergeStart(i);\n const q = spring({ frame: f - c0, fps, config: SPRING_CARD });\n const m = spring({ frame: f - c0, fps, config: SPRING_MORPH });\n const tx = k >= 0 ? rowLeft + d / 2 + k * step : cx;\n const ty = k >= 0 ? rowY : cy;\n const td = k >= 0 ? d : d * 0.3;\n const x = sx + (tx - sx) * q;\n const y = sy + (ty - sy) * q;\n const w = s.w + (td - s.w) * m;\n const h = s.h + (td - s.h) * m;\n const r0 = Math.min(s.w, s.h) * 0.08;\n const r = r0 + (td / 2 - r0) * m;\n return { x, y, w, h, r, q: Math.min(1, m), pop, k };\n };\n\n const textOut = interpolate(\n frame,\n [beat(\"textOut\"), beat(\"textOut\") + 8],\n [0, 1],\n { ...CLAMP, easing: EASE_EXIT },\n );\n\n const order = slots\n .map((s, i) => ({ i, z: s.z }))\n .sort((p, q) => p.z - q.z)\n .map((p) => p.i);\n\n const scrimP = 1 - textOut * 0.6;\n\n return (\n <AbsoluteFill style={{ backgroundColor: bg, overflow: \"hidden\" }}>\n <GshGround\n preset={preset}\n params={gParams}\n timeOffset={light ? 4 : 2.4}\n timeScale={0.7}\n />\n <AbsoluteFill\n style={{\n backgroundImage: `radial-gradient(${portrait ? \"70% 30%\" : \"44% 40%\"} at 50% 50%, ${t.scrim} 0%, transparent 72%)`,\n opacity: scrimP,\n }}\n />\n <svg width=\"0\" height=\"0\" style={{ position: \"absolute\" }} aria-hidden>\n {order.map((i) => {\n const now = stateAt(i, frame);\n const prev = stateAt(i, frame - 1);\n const vx = Math.min(10, Math.abs(now.x - prev.x) * 0.1);\n const vy = Math.min(10, Math.abs(now.y - prev.y) * 0.1);\n return (\n <filter\n key={`f-${i}`}\n id={`ph2-mb-${i}`}\n x=\"-20%\"\n y=\"-20%\"\n width=\"140%\"\n height=\"140%\"\n >\n <feGaussianBlur stdDeviation={`${vx} ${vy}`} />\n </filter>\n );\n })}\n </svg>\n <AbsoluteFill\n style={{\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <div\n style={{\n display: \"flex\",\n flexWrap: \"wrap\",\n justifyContent: \"center\",\n columnGap: \"0.24em\",\n maxWidth: maxW,\n fontFamily: interTight.fontFamily,\n fontWeight: 300,\n fontSize,\n lineHeight: 1.04,\n letterSpacing: \"-0.04em\",\n color: fg,\n transform: `scale(${(1 + pushAll * 0.4) * (1 - textOut * 0.1)})`,\n opacity: 1 - textOut,\n filter: `blur(${textOut * 10}px)`,\n }}\n >\n {words.map((word, i) => {\n const start = beat(\"words\") + i * 3;\n const p = interpolate(frame, [start, start + 12], [0, 1], {\n ...CLAMP,\n easing: EASE_ENTER,\n });\n const accent = i === accentWord;\n return (\n <span\n key={`${word}-${i}`}\n style={{\n display: \"inline-block\",\n overflow: \"hidden\",\n padding: \"0.04em 0.06em 0.16em\",\n margin: \"-0.04em -0.06em -0.16em\",\n }}\n >\n <span\n style={{\n display: \"inline-block\",\n transform: `translateY(${(1 - p) * 140}%)`,\n filter: `blur(${(1 - p) * 6}px)`,\n fontFamily: accent ? serif.fontFamily : undefined,\n fontStyle: accent ? \"italic\" : undefined,\n fontWeight: 400,\n letterSpacing: accent ? \"-0.02em\" : undefined,\n color: accent ? t.accent : undefined,\n fontSize: accent ? \"1.08em\" : undefined,\n lineHeight: accent ? 0.96 : undefined,\n }}\n >\n {word}\n </span>\n </span>\n );\n })}\n </div>\n </AbsoluteFill>\n <AbsoluteFill style={{ perspective: portrait ? 2400 : 1600 }}>\n {order.map((i) => {\n const s = slots[i] as Slot;\n if (frame < s.t) return null;\n const now = stateAt(i, frame);\n const prev = stateAt(i, frame - 1);\n const moving = Math.hypot(now.x - prev.x, now.y - prev.y) > 4 ? 1 : 0;\n const flat = 1 - now.q;\n const depthBlur = (1 - s.z) * (portrait ? 7 : 6) * flat;\n const dim = 1 - (1 - s.z) * (light ? 0.25 : 0.45) * flat;\n const fade =\n now.k >= 0\n ? 1\n : interpolate(\n frame,\n [convergeStart(i) + 6, convergeStart(i) + 14],\n [1, 0],\n CLAMP,\n );\n const locked = now.k >= 0 && frame >= beat(\"land\");\n const scale = locked\n ? punch * lockPush\n : 0.6 + 0.4 * Math.min(1.04, now.pop);\n const rotY = ((now.x - cx) / W) * -22 * flat;\n const rotX = ((now.y - cy) / H) * 16 * flat;\n const rotZ = s.rot * flat;\n const lift = (18 + 30 * s.z) * unit * flat + 4 * unit;\n const [s1, s2, s3] = t.shadow;\n const src = srcs[i % srcs.length] as string;\n return (\n <div\n key={`ph-${i}`}\n style={{\n position: \"absolute\",\n left: now.x - now.w / 2,\n top: now.y - now.h / 2,\n width: now.w,\n height: now.h,\n borderRadius: now.r,\n opacity: Math.min(1, now.pop * 2.4) * fade,\n transform: `scale(${scale}) rotateX(${rotX}deg) rotateY(${rotY}deg) rotateZ(${rotZ}deg)`,\n transformOrigin: locked\n ? `${cx - (now.x - now.w / 2)}px ${cy - (now.y - now.h / 2)}px`\n : \"50% 50%\",\n filter: `${moving ? `url(#ph2-mb-${i}) ` : \"\"}blur(${depthBlur}px) brightness(${dim})`,\n boxShadow: `0 0 0 ${ring * now.q}px ${t.ring}, 0 ${lift * 0.08}px ${lift * 0.16}px rgba(${t.shadowRgb},${s1}), 0 ${lift * 0.4}px ${lift}px rgba(${t.shadowRgb},${s2}), 0 ${lift}px ${lift * 2.6}px rgba(${t.shadowRgb},${s3})`,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n borderRadius: \"inherit\",\n overflow: \"hidden\",\n }}\n >\n <Img\n src={src}\n style={{\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n display: \"block\",\n }}\n />\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n borderRadius: \"inherit\",\n boxShadow: `inset 0 0 0 1px ${t.hairline}, inset 0 1px 0 rgba(255,255,255,0.22)`,\n backgroundImage:\n \"linear-gradient(160deg, rgba(255,255,255,0.14) 0%, rgba(255,255,255,0) 40%, rgba(0,0,0,0) 70%, rgba(0,0,0,0.16) 100%)\",\n }}\n />\n </div>\n </div>\n );\n })}\n </AbsoluteFill>\n <div\n style={{\n position: \"absolute\",\n left: portrait ? cx - logoW / 2 : cx - groupW / 2,\n top: portrait ? cy - d * 0.7 - logoSize * 1.25 : cy - logoSize * 0.56,\n height: logoSize * 1.1,\n display: \"flex\",\n alignItems: \"center\",\n clipPath: portrait\n ? `inset(${(1 - logoP) * 100}% -10% -20% -10%)`\n : `inset(-20% ${(1 - logoP) * 100}% -20% 0)`,\n transform: portrait\n ? `translateY(${(1 - logoP) * logoSize * 0.4}px) scale(${lockPush})`\n : `translateX(${(1 - logoP) * logoSize * 0.5}px) scale(${lockPush})`,\n transformOrigin: portrait ? \"50% 50%\" : `${groupW / 2}px 50%`,\n opacity: logoP > 0 ? 1 : 0,\n }}\n >\n <RemocnLogo fontSize={logoSize} color={fg} />\n </div>\n </AbsoluteFill>\n );\n}\n\nexport default PhotoHalo;\n",
"type": "registry:component",
"target": "components/remocn/photo-halo.tsx"
}
],
"type": "registry:component"
}