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": "pricing-reveal",
"title": "Pricing Reveal",
"description": "A pricing table highlights the Pro plan and strikes the old price for the new one.",
"dependencies": ["remotion", "@remotion/google-fonts"],
"registryDependencies": ["@remocn/gsh"],
"files": [
{
"path": "registry/remocn/pricing-reveal/index.tsx",
"content": "\"use client\";\n\nimport { loadFont as loadGeist } from \"@remotion/google-fonts/Geist\";\nimport { loadFont as loadGeistMono } from \"@remotion/google-fonts/GeistMono\";\nimport { loadFont as loadSerif } from \"@remotion/google-fonts/InstrumentSerif\";\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 geist = loadGeist(\"normal\", {\n weights: [\"300\", \"400\"],\n subsets: [\"latin\"],\n});\nconst mono = loadGeistMono(\"normal\", { weights: [\"400\"], subsets: [\"latin\"] });\nconst serif = loadSerif(\"normal\", { weights: [\"400\"], subsets: [\"latin\"] });\n\nexport interface PricingPlan {\n name: string;\n price: number | string;\n /** Previous price, struck through and replaced by `price` on the featured plan. */\n was?: number | string;\n period: string;\n description: string;\n features: string[];\n cta: string;\n featured?: boolean;\n}\n\nexport interface PricingRevealProps {\n plans?: PricingPlan[];\n currency?: string;\n discountLabel?: string;\n badgeLabel?: string;\n eyebrow?: string;\n heading?: string;\n theme?: \"light\" | \"dark\";\n accent?: string;\n speed?: number;\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n}\n\nconst DEFAULT_PLANS: PricingPlan[] = [\n {\n name: \"Starter\",\n price: 0,\n period: \"/mo\",\n description: \"For side projects and your first launch video.\",\n features: [\n \"40 core components\",\n \"1080p renders\",\n \"Community templates\",\n \"MIT licensed source\",\n \"Discord support\",\n ],\n cta: \"Get started\",\n },\n {\n name: \"Pro\",\n price: 29,\n was: 45,\n period: \"/mo\",\n description: \"For solo builders shipping a launch every month.\",\n features: [\n \"Everything in Starter\",\n \"All 128 components\",\n \"4K renders, no watermark\",\n \"Premium launch templates\",\n \"Priority support\",\n ],\n cta: \"Start free trial\",\n featured: true,\n },\n {\n name: \"Team\",\n price: 79,\n period: \"/mo\",\n description: \"For small teams reviewing cuts together.\",\n features: [\n \"Everything in Pro\",\n \"Up to 5 seats\",\n \"Shared brand tokens\",\n \"Review links with comments\",\n \"Invoice billing\",\n ],\n cta: \"Talk to sales\",\n },\n];\n\nconst clamp = { extrapolateLeft: \"clamp\", extrapolateRight: \"clamp\" } as const;\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 CAMERA = 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 head: 0,\n cards: 6,\n stagger: 3,\n features: 16,\n lift: 30,\n strike: 36,\n roll: 42,\n press: 58,\n fill: 61,\n tag: 66,\n};\n\ninterface Pal {\n text: string;\n muted: string;\n faint: string;\n card: string;\n ring: string;\n rule: string;\n depth: string;\n ink: string;\n inkText: string;\n dark: boolean;\n}\n\nfunction palette(theme: \"light\" | \"dark\"): Pal {\n return theme === \"dark\"\n ? {\n text: \"#f2f3f5\",\n muted: \"#a4a8b3\",\n faint: \"#6c707c\",\n card: \"rgba(14,15,20,0.84)\",\n ring: \"rgba(255,255,255,0.09)\",\n rule: \"rgba(255,255,255,0.07)\",\n depth:\n \"inset 0 1px 0 rgba(255,255,255,0.06), 0 30px 60px -24px rgba(0,0,0,0.7)\",\n ink: \"#f2f3f5\",\n inkText: \"#0b0c10\",\n dark: true,\n }\n : {\n text: \"#16171b\",\n muted: \"#5d606a\",\n faint: \"#93959e\",\n card: \"#ffffff\",\n ring: \"rgba(22,23,27,0.07)\",\n rule: \"rgba(22,23,27,0.07)\",\n depth:\n \"0 1px 2px rgba(22,23,27,0.04), 0 18px 40px -18px rgba(22,23,27,0.18)\",\n ink: \"#16171b\",\n inkText: \"#ffffff\",\n dark: false,\n };\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\nfunction Check({ color }: { color: string }) {\n return (\n <svg width={18} height={18} viewBox=\"0 0 24 24\" style={{ flexShrink: 0 }}>\n <path\n d=\"M5 12.5l4.2 4.2L19 7\"\n fill=\"none\"\n stroke={color}\n strokeWidth={1.5}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\nfunction Arrow() {\n return (\n <svg width={16} height={16} viewBox=\"0 0 24 24\">\n <path\n d=\"M5 12h14M13 6l6 6-6 6\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={1.5}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\nfunction RollingNumber({\n value,\n frame,\n start,\n lineHeight,\n}: {\n value: string;\n frame: number;\n start: number;\n lineHeight: number;\n}) {\n return (\n <span style={{ display: \"inline-flex\", height: lineHeight }}>\n {value.split(\"\").map((ch, i) => {\n const p = interpolate(\n frame,\n [start + i * 2, start + i * 2 + 14],\n [0, 1],\n { ...clamp, easing: LIGHT },\n );\n if (!/\\d/.test(ch)) return <span key={`${ch}-${i}`}>{ch}</span>;\n const pos = Number(ch) + (2 + i) * (1 - p);\n const shown = Math.round(pos);\n const off = pos - shown;\n return (\n <span\n key={`${ch}-${i}`}\n style={{\n display: \"inline-block\",\n width: \"0.6em\",\n textAlign: \"center\",\n lineHeight: `${lineHeight}px`,\n opacity: 1 - Math.abs(off) * 0.9,\n transform: `translateY(${off * lineHeight * 0.18}px)`,\n }}\n >\n {shown % 10}\n </span>\n );\n })}\n </span>\n );\n}\n\nfunction pressScale(frame: number, at: number, fps: number) {\n const down = spring({ frame: frame - at, fps, config: CHIP });\n const up = spring({ frame: frame - at - 4, fps, config: CHIP });\n return 1 - 0.04 * (down - up);\n}\n\ninterface CardProps {\n plan: PricingPlan;\n index: number;\n pal: Pal;\n accent: string;\n currency: string;\n discountLabel: string;\n badgeLabel: string;\n frame: number;\n fps: number;\n width: number;\n height: number;\n compact: boolean;\n}\n\nfunction PlanCard({\n plan,\n index,\n pal,\n accent,\n currency,\n discountLabel,\n badgeLabel,\n frame,\n fps,\n width,\n height,\n compact,\n}: CardProps) {\n const featured = !!plan.featured;\n const enterAt = B.cards + index * B.stagger;\n const rise = spring({ frame: frame - enterAt, fps, config: CARD });\n const fade = interpolate(frame, [enterAt, enterAt + 10], [0, 1], {\n ...clamp,\n easing: ENTER,\n });\n const lift = spring({ frame: frame - B.lift, fps, config: HEAVY });\n const recede = featured\n ? 0\n : spring({ frame: frame - B.lift, fps, config: MORPH });\n const strike = featured\n ? interpolate(frame, [B.strike, B.strike + 9], [0, 1], {\n ...clamp,\n easing: MOVE,\n })\n : 0;\n const settle = featured\n ? spring({ frame: frame - B.roll, fps, config: MORPH })\n : 0;\n const fill = featured\n ? interpolate(frame, [B.fill, B.fill + 8], [0, 1], {\n ...clamp,\n easing: ENTER,\n })\n : 0;\n const tag = featured\n ? spring({ frame: frame - B.tag, fps, config: CHIP })\n : 0;\n const press = featured ? pressScale(frame, B.press, fps) : 1;\n const hasWas = featured && plan.was !== undefined;\n\n const priceSize = compact ? 48 : 64;\n const lh = Math.round(priceSize * 1.04);\n const strap = 26;\n const blockH = hasWas || !compact ? lh + strap : lh;\n const oldScale = interpolate(settle, [0, 1], [1, 0.32]);\n const oldY = interpolate(settle, [0, 1], [strap, 0]);\n const liftY = featured ? -10 * lift : 6 * recede;\n\n const price = (value: number | string, faded = false) => (\n <span\n style={{\n fontSize: priceSize,\n fontWeight: 300,\n letterSpacing: \"-0.045em\",\n lineHeight: `${lh}px`,\n fontVariantNumeric: \"tabular-nums\",\n color: faded ? pal.faint : pal.text,\n }}\n >\n {currency}\n {value}\n </span>\n );\n\n const period = (o = 1) => (\n <span\n style={{\n fontFamily: mono.fontFamily,\n fontSize: 16,\n lineHeight: \"20px\",\n color: pal.faint,\n marginLeft: 10,\n marginBottom: 8,\n alignSelf: \"flex-end\",\n opacity: o,\n whiteSpace: \"nowrap\",\n }}\n >\n {plan.period}\n </span>\n );\n\n const priceBlock = (\n <div\n style={{\n position: \"relative\",\n height: blockH,\n width: compact ? 200 : undefined,\n flexShrink: 0,\n }}\n >\n {hasWas ? (\n <>\n <div\n style={{\n position: \"absolute\",\n left: 0,\n top: oldY,\n transformOrigin: \"0 0\",\n transform: `scale(${oldScale})`,\n display: \"flex\",\n alignItems: \"center\",\n whiteSpace: \"nowrap\",\n }}\n >\n <span style={{ position: \"relative\" }}>\n {price(plan.was as number | string, settle > 0.5)}\n <span\n style={{\n position: \"absolute\",\n left: -4,\n top: \"52%\",\n height: 3 / Math.max(0.4, oldScale),\n width: `calc(${strike * 100}% + ${8 * strike}px)`,\n background: accent,\n borderRadius: 4,\n transformOrigin: \"0 50%\",\n }}\n />\n </span>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 0,\n top: strap,\n display: \"flex\",\n alignItems: \"center\",\n opacity: interpolate(frame, [B.roll + 1, B.roll + 5], [0, 1], {\n ...clamp,\n easing: ENTER,\n }),\n }}\n >\n <span\n style={{\n display: \"inline-flex\",\n fontSize: priceSize,\n fontWeight: 300,\n letterSpacing: \"-0.045em\",\n lineHeight: `${lh}px`,\n fontVariantNumeric: \"tabular-nums\",\n color: pal.text,\n }}\n >\n <span style={{ opacity: settle }}>{currency}</span>\n <RollingNumber\n value={String(plan.price)}\n frame={frame}\n start={B.roll + 2}\n lineHeight={lh}\n />\n </span>\n {period(settle)}\n </div>\n <div\n style={{\n position: \"absolute\",\n right: 0,\n top: -2,\n height: 28,\n padding: \"0 9px\",\n borderRadius: 6,\n background: accent,\n color: \"#fff\",\n fontSize: 16,\n lineHeight: \"28px\",\n whiteSpace: \"nowrap\",\n fontVariantNumeric: \"tabular-nums\",\n opacity: interpolate(tag, [0, 0.25], [0, 1], clamp),\n transformOrigin: \"100% 50%\",\n transform: `translateY(${(1 - tag) * -14}px) rotate(${(1 - tag) * -8 - 2}deg) scale(${0.8 + 0.2 * tag})`,\n }}\n >\n {discountLabel}\n </div>\n </>\n ) : (\n <div\n style={{\n position: \"absolute\",\n left: compact ? undefined : 0,\n right: compact ? 0 : undefined,\n bottom: 0,\n display: \"flex\",\n alignItems: \"center\",\n }}\n >\n {price(plan.price)}\n {period()}\n </div>\n )}\n </div>\n );\n\n const button = (\n <div\n style={{\n height: 46,\n borderRadius: 10,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: 8,\n fontSize: 16,\n flexShrink: 0,\n background: featured ? (fill > 0 ? accent : pal.ink) : \"transparent\",\n color: featured ? (fill > 0 ? \"#fff\" : pal.inkText) : pal.text,\n boxShadow: featured\n ? `inset 0 1px 0 rgba(255,255,255,${0.18 * fill})`\n : `inset 0 0 0 1px ${pal.dark ? \"rgba(255,255,255,0.14)\" : \"rgba(22,23,27,0.14)\"}`,\n transform: `scale(${press})`,\n }}\n >\n {plan.cta}\n {featured ? <Arrow /> : null}\n </div>\n );\n\n const ring =\n featured && lift > 0.01\n ? `0 0 0 ${1 + 0.5 * lift}px ${withAlpha(accent, 0.25 + 0.75 * lift)}`\n : `0 0 0 1px ${pal.ring}`;\n\n return (\n <div\n style={{\n position: \"relative\",\n width,\n height,\n flexShrink: 0,\n opacity: fade * (1 - 0.32 * recede),\n transform: `translateY(${(1 - rise) * 56 + liftY}px) scale(${(0.96 + 0.04 * rise) * (1 + 0.025 * (featured ? lift : -recede * 0.6))})`,\n zIndex: featured ? 2 : 1,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n borderRadius: 18,\n background: pal.card,\n backdropFilter: pal.dark ? \"blur(24px)\" : undefined,\n boxShadow: `${ring}, ${pal.depth}`,\n padding: compact ? \"22px 26px\" : \"24px 26px\",\n boxSizing: \"border-box\",\n display: \"flex\",\n flexDirection: compact ? \"row\" : \"column\",\n alignItems: compact ? \"center\" : \"stretch\",\n gap: compact ? 24 : 0,\n }}\n >\n <div style={{ flex: compact ? 1 : undefined, minWidth: 0 }}>\n <div\n style={{\n display: \"flex\",\n alignItems: \"baseline\",\n justifyContent: \"space-between\",\n fontSize: 22,\n color: pal.text,\n letterSpacing: \"-0.01em\",\n }}\n >\n {plan.name}\n {featured ? (\n <span\n style={{\n fontFamily: mono.fontFamily,\n fontSize: 16,\n color: accent,\n opacity: lift,\n }}\n >\n {badgeLabel}\n </span>\n ) : null}\n </div>\n <div\n style={{\n fontSize: 16,\n lineHeight: 1.4,\n color: pal.muted,\n marginTop: 6,\n height: compact ? undefined : 45,\n whiteSpace: compact ? \"nowrap\" : undefined,\n overflow: compact ? \"hidden\" : undefined,\n textOverflow: compact ? \"ellipsis\" : undefined,\n textWrap: \"pretty\",\n }}\n >\n {plan.description}\n </div>\n </div>\n {compact ? (\n priceBlock\n ) : (\n <>\n <div style={{ marginTop: 18 }}>{priceBlock}</div>\n <div style={{ marginTop: 18 }}>{button}</div>\n <div\n style={{\n height: 1,\n background: pal.rule,\n margin: \"22px 0 12px\",\n flexShrink: 0,\n }}\n />\n {plan.features.map((feat, j) => {\n const a = spring({\n frame: frame - (B.features + index * B.stagger + j * 2),\n fps,\n config: CARD,\n });\n return (\n <div\n key={feat}\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: 10,\n height: 30,\n fontSize: 16,\n color: pal.text,\n opacity: interpolate(a, [0, 0.6], [0, 1], clamp),\n transform: `translateY(${(1 - a) * 10}px)`,\n whiteSpace: \"nowrap\",\n }}\n >\n <Check color={featured ? accent : pal.faint} />\n {feat}\n </div>\n );\n })}\n </>\n )}\n </div>\n </div>\n );\n}\n\nexport function PricingReveal({\n plans = DEFAULT_PLANS,\n currency = \"$\",\n discountLabel = \"−35% launch week\",\n badgeLabel = \"Most picked\",\n eyebrow = \"Billed monthly · cancel anytime\",\n heading = \"Simple pricing for every launch.\",\n theme = \"light\",\n accent = \"#3B5BFD\",\n speed = 1,\n ground,\n groundParams,\n}: PricingRevealProps) {\n const frame = useCurrentFrame() * speed;\n const { width, height, fps } = useVideoConfig();\n const tall = height > width;\n const W = tall ? 720 : 1280;\n const H = tall ? 1280 : 720;\n const u = Math.min(width / W, height / H);\n const pal = palette(theme);\n\n const head = interpolate(frame, [B.head, B.head + 16], [0, 1], {\n ...clamp,\n easing: ENTER,\n });\n const meta = interpolate(frame, [B.head + 6, B.head + 20], [0, 1], {\n ...clamp,\n easing: LIGHT,\n });\n const camera = interpolate(frame, [0, 100], [1.035, 1], {\n ...clamp,\n easing: CAMERA,\n });\n\n const M = tall ? 48 : 72;\n const gap = tall ? 32 : 20;\n const cardW = tall ? W - M * 2 : (W - M * 2 - gap * 2) / 3;\n const fullH = tall ? 500 : 470;\n const compactH = 150;\n\n return (\n <AbsoluteFill\n style={{\n fontFamily: geist.fontFamily,\n overflow: \"hidden\",\n WebkitFontSmoothing: \"antialiased\",\n }}\n >\n <GshGround\n preset={ground ?? (pal.dark ? \"earthshine\" : \"paper-crease\")}\n params={groundParams}\n timeOffset={pal.dark ? 6 : 3}\n timeScale={0.4}\n />\n {pal.dark ? null : (\n <AbsoluteFill style={{ background: \"rgba(240,238,234,0.38)\" }} />\n )}\n <div\n style={{\n position: \"absolute\",\n left: (width - W * u) / 2,\n top: (height - H * u) / 2,\n width: W,\n height: H,\n transformOrigin: \"0 0\",\n transform: `scale(${u})`,\n }}\n >\n <AbsoluteFill\n style={{\n transform: `scale(${camera})`,\n transformOrigin: \"50% 60%\",\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: M,\n right: M,\n top: tall ? 96 : 58,\n display: \"flex\",\n flexDirection: tall ? \"column\" : \"row\",\n alignItems: tall ? \"flex-start\" : \"flex-end\",\n justifyContent: \"space-between\",\n gap: tall ? 20 : 24,\n }}\n >\n <div\n style={{\n fontFamily: serif.fontFamily,\n fontWeight: 400,\n fontSize: tall ? 64 : 54,\n lineHeight: 1.02,\n letterSpacing: \"-0.02em\",\n color: pal.text,\n maxWidth: tall ? 560 : 720,\n textWrap: \"balance\",\n clipPath: \"inset(-10% -5% -20% -5%)\",\n }}\n >\n <div\n style={{\n transform: `translateY(${(1 - head) * 40}px)`,\n opacity: head,\n }}\n >\n {heading}\n </div>\n </div>\n <div\n style={{\n fontFamily: mono.fontFamily,\n fontSize: 16,\n color: pal.muted,\n paddingBottom: tall ? 0 : 8,\n whiteSpace: \"nowrap\",\n opacity: meta,\n transform: `translateY(${(1 - meta) * 10}px)`,\n }}\n >\n {eyebrow}\n </div>\n </div>\n <div\n style={{\n position: \"absolute\",\n top: tall ? 340 : 186,\n left: M,\n right: M,\n display: \"flex\",\n flexDirection: tall ? \"column\" : \"row\",\n alignItems: \"flex-start\",\n gap,\n }}\n >\n {plans.map((plan, i) => {\n const compact = tall && !plan.featured;\n return (\n <PlanCard\n key={plan.name}\n plan={plan}\n index={i}\n pal={pal}\n accent={accent}\n currency={currency}\n discountLabel={discountLabel}\n badgeLabel={badgeLabel}\n frame={frame}\n fps={fps}\n width={cardW}\n height={compact ? compactH : fullH}\n compact={compact}\n />\n );\n })}\n </div>\n </AbsoluteFill>\n </div>\n </AbsoluteFill>\n );\n}\n",
"type": "registry:component",
"target": "components/remocn/pricing-reveal.tsx"
}
],
"type": "registry:component"
}