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": "calendar-pick",
"title": "Calendar Pick",
"description": "A month calendar picks a launch day, tagging dates with small event labels.",
"dependencies": ["remotion", "@remotion/google-fonts"],
"registryDependencies": ["@remocn/gsh"],
"files": [
{
"path": "registry/remocn/calendar-pick/index.tsx",
"content": "\"use client\";\n\nimport { loadFont as loadGeistMono } from \"@remotion/google-fonts/GeistMono\";\nimport { loadFont as loadOnest } from \"@remotion/google-fonts/Onest\";\nimport type React 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 onest = loadOnest(\"normal\", {\n weights: [\"300\", \"400\"],\n subsets: [\"latin\"],\n});\nconst mono = loadGeistMono(\"normal\", {\n weights: [\"400\"],\n subsets: [\"latin\"],\n});\n\nconst ENTER = Easing.bezier(0.32, 0.72, 0, 1);\nconst MOVE = Easing.bezier(0.65, 0, 0.35, 1);\nconst CAM = Easing.bezier(0.87, 0, 0.13, 1);\nconst HEAVY = { mass: 1, damping: 26, stiffness: 120 };\nconst CARD = { mass: 0.8, damping: 18, stiffness: 160 };\nconst CHIP = { mass: 0.5, damping: 12, stiffness: 200 };\nconst MORPH = { damping: 200 };\n\nconst B = {\n enter: -8,\n rows: 0,\n title: 6,\n zoom: 24,\n cursor: 42,\n click: 66,\n open: 70,\n type: 78,\n commit: 120,\n flood: 122,\n label: 130,\n pull: 132,\n end: 168,\n};\n\nconst ramp = (f: number, start: number, dur: number, easing = ENTER) =>\n interpolate(f, [start, start + dur], [0, 1], {\n extrapolateLeft: \"clamp\",\n extrapolateRight: \"clamp\",\n easing,\n });\n\nconst mix = (a: number, b: number, t: number) => a + (b - a) * t;\n\nfunction Chevron({ dir, color }: { dir: \"l\" | \"r\"; color: string }) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n width={18}\n height={18}\n aria-hidden\n style={{ display: \"block\" }}\n >\n <path\n d={dir === \"l\" ? \"m14.5 6-6 6 6 6\" : \"m9.5 6 6 6-6 6\"}\n fill=\"none\"\n stroke={color}\n strokeWidth={1.5}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\nfunction Pointer({ size, dark }: { size: number; dark: boolean }) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n width={size}\n height={size}\n style={{\n display: \"block\",\n filter: \"drop-shadow(0 3px 6px rgba(0,0,0,0.3))\",\n }}\n aria-hidden\n >\n <path\n d=\"M5 3.2v16.2l4.3-4.1 2.8 6.3 2.6-1.1-2.8-6.2h6z\"\n fill={dark ? \"#ffffff\" : \"#16110d\"}\n stroke={dark ? \"#16110d\" : \"#ffffff\"}\n strokeWidth={1.3}\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\nexport interface CalendarPickProps {\n theme?: \"dark\" | \"light\";\n accent?: string;\n title?: string;\n month?: string;\n year?: string;\n firstWeekday?: number;\n daysInMonth?: number;\n today?: number;\n pickDay?: number;\n timeRange?: string;\n eventLabel?: string;\n busyDays?: number[];\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n}\n\nexport function CalendarPick({\n theme = \"dark\",\n accent = \"#F26A2E\",\n title = \"Launch day, booked.\",\n month = \"June\",\n year = \"2026\",\n firstWeekday = 0,\n daysInMonth = 30,\n today = 9,\n pickDay = 18,\n timeRange = \"10:00 AM – 4:00 PM\",\n eventLabel = \"Launch\",\n busyDays = [3, 11, 12, 22, 25, 29],\n ground,\n groundParams,\n}: CalendarPickProps) {\n const frame = useCurrentFrame();\n const { width, height, fps } = useVideoConfig();\n const dark = theme === \"dark\";\n const portrait = height > width * 1.2;\n const stageW = portrait ? 1080 : 1280;\n const stageH = portrait ? 1920 : 720;\n const s = width / stageW;\n\n const ink = dark ? \"#f6f1ec\" : \"#1b1612\";\n const soft = dark ? \"rgba(246,241,236,0.7)\" : \"rgba(27,22,18,0.66)\";\n const muted = dark ? \"rgba(246,241,236,0.4)\" : \"rgba(27,22,18,0.38)\";\n const hair = dark ? \"rgba(255,255,255,0.08)\" : \"rgba(40,24,10,0.08)\";\n const tile = dark ? \"rgba(255,255,255,0.045)\" : \"rgba(60,36,16,0.04)\";\n\n const W = 760;\n const padX = 30;\n const headH = 92;\n const weekH = 34;\n const colW = (W - padX * 2) / 7;\n const rowH = 84;\n const lead = ((firstWeekday % 7) + 7) % 7;\n const rows = Math.ceil((lead + daysInMonth) / 7);\n const H = headH + weekH + rows * rowH + 26;\n const gridTop = headH + weekH;\n const cellOf = (d: number) => {\n const i = lead + d - 1;\n return { col: i % 7, row: Math.floor(i / 7) };\n };\n const pick = cellOf(Math.max(1, Math.min(daysInMonth, pickDay)));\n const cellX = padX + pick.col * colW;\n const cellY = gridTop + pick.row * rowH;\n const inset = 5;\n\n const enter = spring({ frame: frame - B.enter, fps, config: CARD });\n const enterBlur = mix(10, 0, ramp(frame, B.enter, 15));\n const zoom = ramp(frame, B.zoom, 36, CAM);\n const pullBack = spring({ frame: frame - B.pull, fps, config: HEAVY });\n const zMax = portrait ? 1.9 : 1.75;\n const zRest = portrait ? 1.06 : 1.5;\n const Z =\n mix(mix(1, zMax, zoom), zRest, pullBack) *\n (1 + 0.025 * ramp(frame, B.pull + 20, B.end - B.pull - 20, Easing.linear)) *\n (portrait ? 1.25 : 1);\n const spanCols = Math.min(3, 6 - pick.col);\n const focusX = mix(W / 2, cellX + colW * (0.5 + spanCols / 2), zoom);\n const focusY = mix(H / 2, cellY + rowH / 2, zoom);\n const fX = mix(\n focusX,\n mix(W / 2, cellX + colW / 2, portrait ? 0.05 : 0.7),\n pullBack,\n );\n const fY = mix(focusY, mix(H / 2, cellY + rowH / 2, 0.7), pullBack);\n const screenX = stageW / 2;\n const screenY = portrait ? 1180 : 372;\n const rotX =\n mix(22, 0, enter) + mix(0, 7, zoom) * (1 - pullBack) + 3 * pullBack;\n const rotZ = mix(-5, 0, enter) + mix(0, -1.5, zoom) * (1 - pullBack);\n const rotY = mix(0, -8, zoom) * (1 - pullBack) - 4 * pullBack;\n\n const cStart = { x: W + 120, y: H + 80 };\n const cEnd = { x: cellX + colW * 0.56, y: cellY + rowH * 0.5 };\n const cP = ramp(frame, B.cursor, 24, MOVE);\n const cPrev = ramp(frame - 1, B.cursor, 24, MOVE);\n const exitP = ramp(frame, B.commit, 18, MOVE);\n const cX = mix(cStart.x, cEnd.x, cP) + 46 * exitP;\n const cY =\n mix(cStart.y, cEnd.y, cP) - Math.sin(Math.PI * cP) * 46 + 52 * exitP;\n const cBlur = Math.min(3, Math.abs(cP - cPrev) * 900 * 0.03);\n const clickDip = spring({ frame: frame - B.click, fps, config: CHIP });\n const clickUp = spring({ frame: frame - B.click - 4, fps, config: CHIP });\n const press = 1 - 0.12 * clickDip + 0.12 * clickUp;\n const ripple = ramp(frame, B.click, 18, ENTER);\n\n const openP = spring({ frame: frame - B.open, fps, config: CARD });\n const closeP = spring({ frame: frame - B.commit, fps, config: MORPH });\n const inputW = mix(\n colW - inset * 2,\n colW * (spanCols + 1) - inset * 2,\n openP * (1 - closeP),\n );\n const inputOn = frame >= B.open && closeP < 0.98;\n const chars = Math.max(\n 0,\n Math.min(timeRange.length, Math.floor((frame - B.type) / 2)),\n );\n const typed = timeRange.slice(0, chars);\n const caretOn =\n Math.floor(frame / 8) % 2 === 0 ||\n (frame >= B.type && chars < timeRange.length);\n const flood = spring({ frame: frame - B.flood, fps, config: CHIP });\n const labelIn = ramp(frame, B.label, 12);\n const titleIn = ramp(frame, B.title, 15);\n\n const surface = dark\n ? \"linear-gradient(180deg, rgba(34,27,23,0.94) 0%, rgba(22,18,16,0.96) 100%)\"\n : \"linear-gradient(180deg, #ffffff 0%, #fdfbf9 100%)\";\n const shadow = dark\n ? \"inset 0 1px 0 rgba(255,255,255,0.07), 0 2px 6px rgba(0,0,0,0.3), 0 30px 60px rgba(20,6,0,0.45), 0 80px 140px rgba(20,6,0,0.5)\"\n : \"inset 0 1px 0 #fff, 0 1px 2px rgba(80,40,10,0.06), 0 22px 50px rgba(120,60,20,0.1), 0 70px 130px rgba(160,80,30,0.16)\";\n\n const weekdays = [\"MON\", \"TUE\", \"WED\", \"THU\", \"FRI\", \"SAT\", \"SUN\"];\n\n const days: React.ReactNode[] = [];\n for (let d = 1; d <= daysInMonth; d++) {\n const { col, row } = cellOf(d);\n const isPick = d === pickDay;\n const isToday = d === today;\n const weekend = col >= 5;\n const busy = busyDays.includes(d);\n const appear = ramp(frame, B.rows + row * 2 + col * 0.5, 12);\n const cellFlood = isPick ? flood : 0;\n const scale = isPick\n ? press * (1 + 0.06 * Math.sin(Math.PI * Math.min(1, cellFlood)))\n : 1;\n days.push(\n <div\n key={d}\n style={{\n position: \"absolute\",\n left: padX + col * colW + inset,\n top: gridTop + row * rowH + inset,\n width: colW - inset * 2,\n height: rowH - inset * 2,\n borderRadius: 14,\n background: weekend ? \"transparent\" : tile,\n opacity: appear,\n transform: `translateY(${mix(10, 0, appear)}px) scale(${scale})`,\n }}\n >\n {isPick ? (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n borderRadius: 14,\n background: `linear-gradient(180deg, color-mix(in oklab, ${accent} 86%, white) 0%, ${accent} 100%)`,\n boxShadow: `inset 0 1px 0 rgba(255,255,255,0.35), 0 10px 24px color-mix(in oklab, ${accent} 40%, transparent)`,\n opacity: Math.min(1, cellFlood),\n transform: `scale(${mix(0.4, 1, Math.min(1, cellFlood))})`,\n }}\n />\n ) : null}\n {isToday ? (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n borderRadius: 14,\n boxShadow: `inset 0 0 0 1.5px color-mix(in oklab, ${accent} 70%, transparent)`,\n }}\n />\n ) : null}\n <div\n style={{\n position: \"absolute\",\n left: 12,\n top: 9,\n fontSize: 24,\n letterSpacing: \"-0.02em\",\n fontWeight: 400,\n color:\n cellFlood > 0.5\n ? \"#ffffff\"\n : weekend\n ? muted\n : isToday\n ? accent\n : ink,\n fontVariantNumeric: \"tabular-nums\",\n }}\n >\n {d}\n </div>\n {busy ? (\n <div\n style={{\n position: \"absolute\",\n left: 13,\n bottom: 12,\n display: \"flex\",\n gap: 4,\n }}\n >\n <span\n style={{\n width: 16,\n height: 4,\n borderRadius: 2,\n background: `color-mix(in oklab, ${accent} 55%, transparent)`,\n }}\n />\n {d % 2 ? (\n <span\n style={{\n width: 8,\n height: 4,\n borderRadius: 2,\n background: muted,\n }}\n />\n ) : null}\n </div>\n ) : null}\n {isPick ? (\n <div\n style={{\n position: \"absolute\",\n left: 12,\n right: 8,\n bottom: 9,\n fontSize: 13,\n lineHeight: \"16px\",\n color: \"#ffffff\",\n opacity: labelIn,\n transform: `translateY(${mix(8, 0, labelIn)}px)`,\n whiteSpace: \"nowrap\",\n }}\n >\n {eventLabel}\n <div\n style={{\n fontFamily: mono.fontFamily,\n fontSize: 11,\n opacity: 0.85,\n }}\n >\n {timeRange.split(\" \")[0]}\n </div>\n </div>\n ) : null}\n </div>,\n );\n }\n\n const resolvedGround: GshPresetId =\n ground ?? (dark ? \"hearth\" : \"paper-crease\");\n const resolvedParams =\n groundParams ??\n (dark\n ? undefined\n : {\n kind: \"mist\",\n colors: [\"#ff9a5a\", \"#ffc79c\", \"#fbe9da\", \"#e0622a\"],\n background: \"#f7f3ee\",\n });\n\n return (\n <AbsoluteFill style={{ fontFamily: onest.fontFamily, overflow: \"hidden\" }}>\n <GshGround\n preset={resolvedGround}\n params={resolvedParams}\n timeOffset={5}\n timeScale={0.6}\n />\n <div\n style={{\n position: \"absolute\",\n left: 0,\n top: 0,\n width: stageW,\n height: stageH,\n transform: `scale(${s})`,\n transformOrigin: \"0 0\",\n perspective: 2200,\n }}\n >\n {portrait ? (\n <div\n style={{\n position: \"absolute\",\n left: 90,\n right: 90,\n top: 260,\n overflow: \"hidden\",\n paddingBottom: 12,\n }}\n >\n <div\n style={{\n fontSize: 104,\n lineHeight: 1.0,\n letterSpacing: \"-0.045em\",\n fontWeight: 300,\n color: ink,\n transform: `translateY(${mix(110, 0, titleIn)}%)`,\n }}\n >\n {title}\n </div>\n </div>\n ) : null}\n <div\n style={{\n position: \"absolute\",\n left: screenX - fX * Z,\n top: screenY - fY * Z + mix(160, 0, enter),\n width: W,\n height: H,\n transformOrigin: \"0 0\",\n transform: `scale(${Z})`,\n opacity: ramp(frame, -6, 8),\n filter: enterBlur > 0.3 ? `blur(${enterBlur}px)` : undefined,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n transformStyle: \"preserve-3d\",\n transformOrigin: `${fX}px ${fY}px`,\n transform: `rotateX(${rotX}deg) rotateY(${rotY}deg) rotateZ(${rotZ}deg)`,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n borderRadius: 28,\n background: surface,\n boxShadow: shadow,\n border: `1px solid ${hair}`,\n overflow: \"hidden\",\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: padX + 4,\n top: 30,\n fontSize: 34,\n letterSpacing: \"-0.03em\",\n fontWeight: 300,\n color: ink,\n }}\n >\n {month}\n <span style={{ color: muted, marginLeft: 10 }}>{year}</span>\n </div>\n <div\n style={{\n position: \"absolute\",\n right: padX,\n top: 32,\n display: \"flex\",\n gap: 8,\n alignItems: \"center\",\n }}\n >\n <div\n style={{\n height: 36,\n padding: \"0 14px\",\n borderRadius: 10,\n border: `1px solid ${hair}`,\n display: \"flex\",\n alignItems: \"center\",\n fontSize: 15,\n color: soft,\n }}\n >\n Today\n </div>\n {([\"l\", \"r\"] as const).map((dir) => (\n <div\n key={dir}\n style={{\n width: 36,\n height: 36,\n borderRadius: 10,\n border: `1px solid ${hair}`,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <Chevron dir={dir} color={soft} />\n </div>\n ))}\n </div>\n {weekdays.map((wd, i) => (\n <div\n key={wd}\n style={{\n position: \"absolute\",\n left: padX + i * colW + 17,\n top: headH,\n height: weekH,\n fontFamily: mono.fontFamily,\n fontSize: 13,\n letterSpacing: \"0.06em\",\n color: i >= 5 ? muted : soft,\n }}\n >\n {wd}\n </div>\n ))}\n {days}\n <div\n style={{\n position: \"absolute\",\n left: cellX + colW * 0.56 - 30,\n top: cellY + rowH * 0.5 - 30,\n width: 60,\n height: 60,\n borderRadius: 30,\n border: `1.5px solid ${accent}`,\n opacity: frame >= B.click ? (1 - ripple) * 0.8 : 0,\n transform: `scale(${mix(0.3, 1.4, ripple)})`,\n }}\n />\n {inputOn ? (\n <div\n style={{\n position: \"absolute\",\n left: cellX + inset,\n top: cellY + inset,\n width: inputW,\n height: rowH - inset * 2,\n borderRadius: 14,\n background: dark ? \"#2a221d\" : \"#ffffff\",\n boxShadow: dark\n ? `0 0 0 1.5px ${accent}, 0 0 0 5px color-mix(in oklab, ${accent} 22%, transparent), 0 14px 30px rgba(0,0,0,0.4)`\n : `0 0 0 1.5px ${accent}, 0 0 0 5px color-mix(in oklab, ${accent} 16%, transparent), 0 14px 30px rgba(120,60,20,0.14)`,\n overflow: \"hidden\",\n opacity: Math.min(1, openP * 2),\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: 12,\n top: 9,\n fontSize: 24,\n letterSpacing: \"-0.02em\",\n color: ink,\n }}\n >\n {pickDay}\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 58,\n top: 0,\n bottom: 0,\n display: \"flex\",\n alignItems: \"center\",\n fontSize: 21,\n color: ink,\n whiteSpace: \"pre\",\n opacity: ramp(frame, B.open + 4, 8),\n }}\n >\n {chars === 0 ? (\n <span style={{ color: muted }}>Add time</span>\n ) : (\n typed\n )}\n <span\n style={{\n width: 2,\n height: 24,\n marginLeft: 2,\n borderRadius: 1,\n background: accent,\n opacity: caretOn ? 1 : 0,\n }}\n />\n </div>\n <div\n style={{\n position: \"absolute\",\n right: 12,\n top: 0,\n bottom: 0,\n display: \"flex\",\n alignItems: \"center\",\n fontFamily: mono.fontFamily,\n fontSize: 12,\n color: muted,\n opacity: ramp(frame, B.type + 30, 8),\n }}\n >\n ↵\n </div>\n </div>\n ) : null}\n </div>\n <div\n style={{\n position: \"absolute\",\n left: cX,\n top: cY,\n opacity:\n ramp(frame, B.cursor, 4) * (1 - ramp(frame, B.commit + 6, 9)),\n transform: `scale(${press})`,\n transformOrigin: \"20% 15%\",\n filter: cBlur > 0.3 ? `blur(${cBlur}px)` : undefined,\n display: frame >= B.cursor ? \"block\" : \"none\",\n }}\n >\n <Pointer size={26} dark={dark} />\n </div>\n </div>\n </div>\n </div>\n </AbsoluteFill>\n );\n}\n\nexport default CalendarPick;\n",
"type": "registry:component",
"target": "components/remocn/calendar-pick.tsx"
}
],
"type": "registry:component"
}