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": "press-warp-dive",
"title": "Press Warp Dive",
"description": "A button press warps and dives into a video player, landing on the next scene.",
"dependencies": [
"remotion",
"@remotion/google-fonts",
"@remotion/transitions"
],
"registryDependencies": ["@remocn/gsh"],
"files": [
{
"path": "registry/remocn/press-warp-dive/index.tsx",
"content": "\"use client\";\n\nimport { loadFont as loadFigtree } from \"@remotion/google-fonts/Figtree\";\nimport {\n linearTiming,\n type TransitionPresentation,\n type TransitionPresentationComponentProps,\n TransitionSeries,\n} from \"@remotion/transitions\";\nimport type React from \"react\";\nimport { useId, useMemo } from \"react\";\nimport {\n AbsoluteFill,\n Easing,\n Img,\n interpolate,\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 figtree = loadFigtree(\"normal\", {\n weights: [\"300\", \"400\"],\n subsets: [\"latin\"],\n});\n\nconst CLAMP = {\n extrapolateLeft: \"clamp\",\n extrapolateRight: \"clamp\",\n} as const;\n\nconst ENTER = Easing.bezier(0.32, 0.72, 0, 1);\nconst MOVE = Easing.bezier(0.65, 0, 0.35, 1);\nconst SUCK = Easing.bezier(0.55, 0, 1, 0.45);\nconst DIVE = Easing.bezier(0.7, 0, 0.84, 0);\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 };\n\nconst mix = (a: number, b: number, t: number) => a + (b - a) * t;\n\nconst MAP_SIZE = 256;\nconst H_MAX = 0.25 * 0.75 ** 3;\n\nfunction pinchMap(): string {\n if (typeof document === \"undefined\") return \"\";\n const canvas = document.createElement(\"canvas\");\n canvas.width = MAP_SIZE;\n canvas.height = MAP_SIZE;\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) return \"\";\n const img = ctx.createImageData(MAP_SIZE, MAP_SIZE);\n for (let j = 0; j < MAP_SIZE; j++) {\n for (let i = 0; i < MAP_SIZE; i++) {\n const u = ((i + 0.5) / MAP_SIZE) * 2 - 1;\n const v = ((j + 0.5) / MAP_SIZE) * 2 - 1;\n const d = Math.hypot(u, v);\n const k = (j * MAP_SIZE + i) * 4;\n let r = 0.5;\n let g = 0.5;\n if (d > 1e-4 && d < 1) {\n const h = (d * (1 - d) ** 3) / H_MAX;\n r = 0.5 + 0.5 * (u / d) * h;\n g = 0.5 + 0.5 * (v / d) * h;\n }\n img.data[k] = Math.round(r * 255);\n img.data[k + 1] = Math.round(g * 255);\n img.data[k + 2] = 128;\n img.data[k + 3] = 255;\n }\n }\n ctx.putImageData(img, 0, 0);\n return canvas.toDataURL(\"image/png\");\n}\n\nexport type PressWarpDiveProps = {\n point?: [number, number];\n buttonRadius?: number;\n reach?: number;\n pinch?: number;\n dive?: number;\n orb?: string;\n rim?: string;\n};\n\nexport const pressWarpDiveDefaults: Required<PressWarpDiveProps> = {\n point: [0.5, 0.5],\n buttonRadius: 0.028,\n reach: 0.8,\n pinch: 1,\n dive: 3.2,\n orb: \"#3b5bfd\",\n rim: \"rgba(255,255,255,0.55)\",\n};\n\nfunction diveState(\n p: number,\n W: number,\n H: number,\n o: Required<PressWarpDiveProps>,\n) {\n const m = Math.min(W, H);\n const px = o.point[0] * W;\n const py = o.point[1] * H;\n const pinch = interpolate(p, [0, 0.62], [0, 1], { ...CLAMP, easing: SUCK });\n const dive = interpolate(p, [0, 0.8], [0, 1], { ...CLAMP, easing: DIVE });\n const s = o.dive ** dive;\n const reach = Math.hypot(Math.max(px, W - px), Math.max(py, H - py));\n const grow = interpolate(p, [0.42, 0.84], [0, 1], { ...CLAMP, easing: DIVE });\n const orbR = mix(o.buttonRadius * m * 0.75, reach * 1.04, grow);\n return {\n px,\n py,\n s,\n pinch,\n rp: o.reach * m,\n orbOn: p >= 0.42,\n orbR,\n tint: interpolate(p, [0.56, 0.92], [1, 0], { ...CLAMP, easing: MOVE }),\n shade: interpolate(grow, [0.55, 1], [1, 0], CLAMP),\n blur: interpolate(dive, [0.4, 1], [0, 4], CLAMP),\n };\n}\n\nconst PressWarpDivePresentation: React.FC<\n TransitionPresentationComponentProps<PressWarpDiveProps>\n> = ({\n children,\n presentationProgress,\n presentationDirection,\n passedProps,\n}) => {\n const { width: W, height: H } = useVideoConfig();\n const o = { ...pressWarpDiveDefaults, ...passedProps };\n const st = diveState(presentationProgress, W, H, o);\n const map = useMemo(() => pinchMap(), []);\n const filterId = `press-warp-${useId().replace(/:/g, \"\")}`;\n\n if (presentationDirection === \"exiting\") {\n const warp = st.pinch > 0.002 && map !== \"\";\n const scale = 0.8 * st.rp * o.pinch * st.pinch;\n return (\n <AbsoluteFill\n style={{\n transformOrigin: `${st.px}px ${st.py}px`,\n transform: `scale(${st.s.toFixed(4)})`,\n filter: st.blur > 0.05 ? `blur(${st.blur.toFixed(2)}px)` : undefined,\n }}\n >\n {warp ? (\n <svg\n width={0}\n height={0}\n style={{ position: \"absolute\" }}\n aria-hidden\n >\n <defs>\n <filter\n id={filterId}\n x={0}\n y={0}\n width={W}\n height={H}\n filterUnits=\"userSpaceOnUse\"\n primitiveUnits=\"userSpaceOnUse\"\n colorInterpolationFilters=\"sRGB\"\n >\n <feFlood floodColor=\"rgb(128,128,128)\" result=\"flat\" />\n <feImage\n href={map}\n x={st.px - st.rp}\n y={st.py - st.rp}\n width={st.rp * 2}\n height={st.rp * 2}\n preserveAspectRatio=\"none\"\n result=\"map\"\n />\n <feComposite\n in=\"map\"\n in2=\"flat\"\n operator=\"over\"\n result=\"field\"\n />\n <feDisplacementMap\n in=\"SourceGraphic\"\n in2=\"field\"\n scale={scale}\n xChannelSelector=\"R\"\n yChannelSelector=\"G\"\n />\n </filter>\n </defs>\n </svg>\n ) : null}\n <AbsoluteFill\n style={{ filter: warp ? `url(#${filterId})` : undefined }}\n >\n {children}\n </AbsoluteFill>\n </AbsoluteFill>\n );\n }\n\n const clip = `circle(${st.orbR.toFixed(2)}px at ${st.px.toFixed(2)}px ${st.py.toFixed(2)}px)`;\n return (\n <AbsoluteFill style={{ opacity: st.orbOn ? 1 : 0 }}>\n <AbsoluteFill style={{ clipPath: clip, WebkitClipPath: clip }}>\n {children}\n <AbsoluteFill\n style={{\n background: `linear-gradient(150deg, transparent 8%, ${o.orb} 78%)`,\n opacity: st.tint,\n pointerEvents: \"none\",\n }}\n />\n </AbsoluteFill>\n <div\n style={{\n position: \"absolute\",\n left: st.px - st.orbR,\n top: st.py - st.orbR,\n width: st.orbR * 2,\n height: st.orbR * 2,\n borderRadius: \"50%\",\n opacity: st.shade,\n boxShadow: `inset 0 0 0 1.5px ${o.rim}, inset 0 ${(-st.orbR * 0.18).toFixed(1)}px ${(st.orbR * 0.32).toFixed(1)}px rgba(0,0,0,0.3), inset 0 ${(st.orbR * 0.1).toFixed(1)}px ${(st.orbR * 0.18).toFixed(1)}px rgba(255,255,255,0.28)`,\n }}\n />\n </AbsoluteFill>\n );\n};\n\nexport function pressWarpDive(\n props: PressWarpDiveProps = {},\n): TransitionPresentation<PressWarpDiveProps> {\n return { component: PressWarpDivePresentation, props };\n}\n\ntype Palette = {\n ink: string;\n muted: string;\n faint: string;\n accent: string;\n panel: string;\n row: string;\n hairline: string;\n highlight: string;\n shadow: string;\n cursor: string;\n cursorEdge: string;\n rim: string;\n backdrop: string;\n groundA: Partial<GradientParams>;\n groundB: Partial<GradientParams>;\n headB: string;\n};\n\nconst THEMES: Record<\"dark\" | \"light\", Palette> = {\n dark: {\n ink: \"#f2f4fb\",\n muted: \"rgba(226,230,245,0.62)\",\n faint: \"rgba(226,230,245,0.36)\",\n accent: \"#3b5bfd\",\n panel: \"rgba(14,16,26,0.9)\",\n row: \"rgba(255,255,255,0.06)\",\n hairline: \"rgba(255,255,255,0.1)\",\n highlight: \"inset 0 1px 0 rgba(255,255,255,0.07)\",\n shadow: \"0,2,14\",\n cursor: \"#ffffff\",\n cursorEdge: \"#0b0d16\",\n rim: \"rgba(255,255,255,0.5)\",\n backdrop: \"#03040a\",\n headB: \"#ffffff\",\n groundA: {\n kind: \"mist\",\n colors: [\"#2a3a8c\", \"#141d52\", \"#080b22\", \"#020308\"],\n background: \"#020308\",\n speed: 0.6,\n loopSeconds: 16,\n scale: 0.8,\n warp: 0.35,\n blur: 0.8,\n grain: 0.12,\n seed: 21,\n },\n groundB: {\n kind: \"mesh\",\n colors: [\"#dfe5ff\", \"#7b8cff\", \"#3b5bfd\", \"#7d4dff\"],\n background: \"#1d2bb8\",\n speed: 1.1,\n loopSeconds: 14,\n scale: 1,\n warp: 0.5,\n blur: 0.7,\n grain: 0.1,\n seed: 6,\n },\n },\n light: {\n ink: \"#14161d\",\n muted: \"rgba(20,22,29,0.56)\",\n faint: \"rgba(20,22,29,0.34)\",\n accent: \"#2f4ff0\",\n panel: \"rgba(255,255,255,0.96)\",\n row: \"rgba(24,30,60,0.05)\",\n hairline: \"rgba(20,24,40,0.09)\",\n highlight: \"inset 0 1px 0 rgba(255,255,255,0.95)\",\n shadow: \"60,58,50\",\n cursor: \"#14161d\",\n cursorEdge: \"#ffffff\",\n rim: \"rgba(255,255,255,0.7)\",\n backdrop: \"#f1efea\",\n headB: \"#0f1440\",\n groundA: {\n kind: \"mist\",\n colors: [\"#e9e4da\", \"#f6f3ee\", \"#dcd6cb\", \"#c9cfee\"],\n background: \"#f2efe9\",\n speed: 0.6,\n loopSeconds: 16,\n scale: 0.8,\n warp: 0.35,\n blur: 0.75,\n grain: 0.22,\n seed: 12,\n },\n groundB: {\n kind: \"mesh\",\n colors: [\"#ffffff\", \"#b4c2ff\", \"#6f88ff\", \"#dcd0ff\"],\n background: \"#cfd8ff\",\n speed: 1.1,\n loopSeconds: 14,\n scale: 1,\n warp: 0.5,\n blur: 0.7,\n grain: 0.16,\n seed: 6,\n },\n },\n};\n\nconst A_LEN = 78;\nconst B_LEN = 90;\nconst T_LEN = 30;\nexport const PRESS_WARP_DIVE_DURATION = A_LEN + B_LEN - T_LEN;\n\nconst A_BEATS = {\n head: -6,\n card: -4,\n suggest: 6,\n type: 6,\n typeEnd: 30,\n cursor: 18,\n press: 42,\n release: 48,\n} as const;\nconst B_BEATS = { emerge: 27, head: 34, rows: 38, play: 50 } as const;\n\ntype Rect = [number, number, number, number];\n\nfunction layout(W: number, H: number) {\n const tall = H > W * 1.1;\n const u = tall ? W / 600 : H / 720;\n const card: Rect = tall\n ? [0.06 * W, 0.335 * H, 0.88 * W, 0.17 * H]\n : [0.21 * W, 0.42 * H, 0.58 * W, 0.28 * H];\n const pad = 18 * u;\n const br = 21 * u;\n const button = {\n x: card[0] + card[2] - pad - br,\n y: card[1] + card[3] - pad - br,\n r: br,\n };\n return {\n tall,\n u,\n card,\n pad,\n button,\n headY: tall ? 0.275 * H : 0.3 * H,\n suggY: tall ? 0.535 * H : 0.765 * H,\n headFs: tall ? W * 0.078 : W * 0.042,\n };\n}\n\nfunction Icon({ d, size, color }: { d: string; size: number; color: string }) {\n return (\n <svg viewBox=\"0 0 24 24\" width={size} height={size} aria-hidden>\n <path\n d={d}\n fill=\"none\"\n stroke={color}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\nconst ICONS = {\n plus: \"M12 5v14M5 12h14\",\n chevron: \"M7 10l5 5 5-5\",\n wave: \"M5 10v4M9 7v10M13 9v6M17 6v12M21 10v4\",\n send: \"M12 19V5M6 11l6-6 6 6\",\n play: \"M9 7l9 5-9 5z\",\n share: \"M12 4v11M7.5 8.5L12 4l4.5 4.5M5 13v5.5h14V13\",\n film: \"M4 6.5h16v11H4zM8 6.5v11M16 6.5v11\",\n spark: \"M12 4l1.8 4.6L18.5 10l-4.7 1.6L12 16l-1.8-4.4L5.5 10l4.7-1.4z\",\n notes: \"M6 4.5h12v15H6zM9 9h6M9 12.5h6M9 16h3.5\",\n phone:\n \"M8 3.5h8a1.5 1.5 0 011.5 1.5v14a1.5 1.5 0 01-1.5 1.5H8A1.5 1.5 0 016.5 19V5A1.5 1.5 0 018 3.5zM11 17.5h2\",\n arrow: \"M9 6l6 6-6 6\",\n};\n\nconst SUGGESTIONS = [\n { icon: ICONS.spark, label: \"Feature walkthrough\" },\n { icon: ICONS.notes, label: \"Release notes\" },\n { icon: ICONS.phone, label: \"Teaser for socials\" },\n];\n\nfunction Cursor({\n size,\n fill,\n edge,\n}: {\n size: number;\n fill: string;\n edge: string;\n}) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n width={size}\n height={size}\n aria-hidden\n style={{ display: \"block\" }}\n >\n <path\n d=\"M4 2.5l15 8.6-6.6 1.6-3 6.4z\"\n fill={fill}\n stroke={edge}\n strokeWidth=\"1.4\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\nfunction Headline({\n text,\n y,\n fs,\n color,\n appear,\n}: {\n text: string;\n y: number;\n fs: number;\n color: string;\n appear: number;\n}) {\n return (\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n top: y,\n transform: \"translateY(-50%)\",\n display: \"flex\",\n justifyContent: \"center\",\n overflow: \"hidden\",\n paddingBottom: fs * 0.2,\n }}\n >\n <div\n style={{\n fontFamily: figtree.fontFamily,\n fontWeight: 300,\n fontSize: fs,\n letterSpacing: \"-0.03em\",\n lineHeight: 1.12,\n color,\n transform: `translateY(${((1 - appear) * 105).toFixed(2)}%)`,\n filter:\n appear < 0.99\n ? `blur(${((1 - appear) * 6).toFixed(2)}px)`\n : undefined,\n }}\n >\n {text}\n </div>\n </div>\n );\n}\n\nfunction SceneA({\n palette,\n heading,\n prompt,\n ground,\n groundParams,\n}: {\n palette: Palette;\n heading: string;\n prompt: string;\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n}) {\n const frame = useCurrentFrame();\n const { width: W, height: H, fps } = useVideoConfig();\n const L = layout(W, H);\n const { u } = L;\n const [cx, cy, cw, ch] = L.card;\n const head = interpolate(frame, [A_BEATS.head, A_BEATS.head + 14], [0, 1], {\n ...CLAMP,\n easing: ENTER,\n });\n const card = spring({ frame: frame - A_BEATS.card, fps, config: CARD });\n const typed = Math.floor(\n interpolate(\n frame,\n [A_BEATS.type, A_BEATS.typeEnd],\n [0, prompt.length],\n CLAMP,\n ),\n );\n const done = typed >= prompt.length;\n const caret = !done || Math.floor((frame - A_BEATS.typeEnd) / 7) % 2 === 0;\n const travel = spring({ frame: frame - A_BEATS.cursor, fps, config: HEAVY });\n const pressDown = interpolate(\n frame,\n [A_BEATS.press, A_BEATS.press + 4],\n [0, 1],\n {\n ...CLAMP,\n easing: MOVE,\n },\n );\n const pressUp = spring({\n frame: frame - A_BEATS.release + 2,\n fps,\n config: CHIP,\n });\n const press = pressDown * (1 - pressUp);\n const btn = L.button;\n const startX = L.tall ? W * 0.84 : W * 0.9;\n const startY = L.tall ? H * 0.86 : H * 0.94;\n const curX = mix(startX, btn.x + btn.r * 0.1, travel);\n const curY = mix(startY, btn.y + btn.r * 0.15, travel);\n const curSize = 30 * u;\n const push = interpolate(frame, [0, A_LEN], [1, 1.04], CLAMP);\n const fs = (L.tall ? 25 : 21) * u;\n const small = (L.tall ? 21 : 16.5) * u;\n\n return (\n <AbsoluteFill>\n <GshGround\n preset={ground}\n params={ground ? groundParams : { ...palette.groundA, ...groundParams }}\n timeOffset={6}\n timeScale={0.6}\n />\n <AbsoluteFill\n style={{\n transformOrigin: `${btn.x}px ${btn.y}px`,\n transform: `scale(${push.toFixed(4)})`,\n }}\n >\n <Headline\n text={heading}\n y={L.headY}\n fs={L.headFs}\n color={palette.ink}\n appear={head}\n />\n <div\n style={{\n position: \"absolute\",\n left: cx,\n top: cy,\n width: cw,\n height: ch,\n borderRadius: 22 * u,\n backgroundColor: palette.panel,\n boxShadow: `inset 0 0 0 1px ${palette.hairline}, ${palette.highlight}, 0 2px 4px rgba(${palette.shadow},0.12), 0 16px 36px rgba(${palette.shadow},0.2), 0 40px 90px rgba(${palette.shadow},0.26)`,\n fontFamily: figtree.fontFamily,\n color: palette.ink,\n opacity: interpolate(card, [0, 0.3], [0, 1], CLAMP),\n transform: `translateY(${((1 - card) * 26 * u).toFixed(2)}px) scale(${(0.97 + 0.03 * card).toFixed(4)})`,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: L.pad + 4 * u,\n right: L.pad + 4 * u,\n top: L.pad + 2 * u,\n fontSize: fs,\n fontWeight: 300,\n letterSpacing: \"-0.01em\",\n lineHeight: 1.32,\n color: typed > 0 ? palette.ink : palette.faint,\n }}\n >\n {typed > 0 ? prompt.slice(0, typed) : \"Describe your launch film\"}\n <span\n style={{\n display: \"inline-block\",\n width: Math.max(2, 2 * u),\n height: fs * 1.05,\n marginLeft: 2 * u,\n verticalAlign: \"-0.18em\",\n backgroundColor: palette.accent,\n opacity: caret ? 1 : 0,\n }}\n />\n </div>\n <div\n style={{\n position: \"absolute\",\n left: L.pad,\n bottom: L.pad,\n height: btn.r * 2,\n display: \"flex\",\n alignItems: \"center\",\n gap: 8 * u,\n fontSize: small,\n color: palette.muted,\n }}\n >\n <div\n style={{\n width: 36 * u,\n height: 36 * u,\n borderRadius: 99,\n boxShadow: `inset 0 0 0 1px ${palette.hairline}`,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <Icon d={ICONS.plus} size={17 * u} color={palette.muted} />\n </div>\n {[\"Film\", \"16:9\"].map((c) => (\n <div\n key={c}\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: 4 * u,\n padding: `${7 * u}px ${12 * u}px`,\n borderRadius: 99,\n backgroundColor: palette.row,\n boxShadow: `inset 0 0 0 1px ${palette.hairline}`,\n }}\n >\n {c}\n <Icon d={ICONS.chevron} size={14 * u} color={palette.faint} />\n </div>\n ))}\n </div>\n <div\n style={{\n position: \"absolute\",\n right: L.pad + btn.r * 2 + 12 * u,\n bottom: L.pad + btn.r - 10 * u,\n }}\n >\n <Icon d={ICONS.wave} size={20 * u} color={palette.muted} />\n </div>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: L.tall ? cx : 0,\n width: L.tall ? cw : W,\n top: L.suggY,\n display: \"flex\",\n flexDirection: L.tall ? \"column\" : \"row\",\n justifyContent: \"center\",\n gap: (L.tall ? 12 : 10) * u,\n fontFamily: figtree.fontFamily,\n fontSize: small,\n color: palette.muted,\n }}\n >\n {SUGGESTIONS.map((sg, i) => {\n const k = spring({\n frame: frame - A_BEATS.suggest - i * 3,\n fps,\n config: CARD,\n });\n return (\n <div\n key={sg.label}\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: 10 * u,\n padding: L.tall\n ? `${16 * u}px ${18 * u}px`\n : `${9 * u}px ${15 * u}px`,\n borderRadius: L.tall ? 16 * u : 99,\n backgroundColor: palette.panel,\n boxShadow: `inset 0 0 0 1px ${palette.hairline}, ${palette.highlight}, 0 8px 22px rgba(${palette.shadow},0.16)`,\n opacity: interpolate(k, [0, 0.4], [0, 1], CLAMP),\n transform: `translateY(${((1 - k) * 14 * u).toFixed(2)}px)`,\n }}\n >\n <Icon d={sg.icon} size={18 * u} color={palette.muted} />\n <span style={{ flex: L.tall ? 1 : undefined }}>{sg.label}</span>\n {L.tall ? (\n <Icon d={ICONS.arrow} size={16 * u} color={palette.faint} />\n ) : null}\n </div>\n );\n })}\n </div>\n <div\n style={{\n position: \"absolute\",\n left: btn.x - btn.r,\n top: btn.y - btn.r + (1 - card) * 26 * u,\n width: btn.r * 2,\n height: btn.r * 2,\n borderRadius: 99,\n backgroundColor: done ? palette.accent : palette.row,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n opacity: interpolate(card, [0, 0.3], [0, 1], CLAMP),\n transform: `scale(${(1 - 0.12 * press).toFixed(4)})`,\n boxShadow: done\n ? `inset 0 1px 0 rgba(255,255,255,0.3), 0 4px 12px rgba(${palette.shadow},0.25)`\n : `inset 0 0 0 1px ${palette.hairline}`,\n }}\n >\n <Icon\n d={ICONS.send}\n size={19 * u}\n color={done ? \"#ffffff\" : palette.faint}\n />\n </div>\n <div\n style={{\n position: \"absolute\",\n left: curX - curSize * 0.16,\n top: curY - curSize * 0.1,\n transform: `scale(${(1 - 0.14 * press).toFixed(4)})`,\n transformOrigin: \"16% 10%\",\n filter: `drop-shadow(0 ${3 * u}px ${5 * u}px rgba(0,0,0,0.28))`,\n opacity: interpolate(travel, [0, 0.15], [0, 1], CLAMP),\n }}\n >\n <Cursor\n size={curSize}\n fill={palette.cursor}\n edge={palette.cursorEdge}\n />\n </div>\n </AbsoluteFill>\n </AbsoluteFill>\n );\n}\n\nfunction SceneB({\n palette,\n heading,\n title,\n image,\n ground,\n groundParams,\n}: {\n palette: Palette;\n heading: string;\n title: string;\n image: string;\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n}) {\n const frame = useCurrentFrame();\n const { width: W, height: H, fps } = useVideoConfig();\n const tall = H > W * 1.1;\n const u = tall ? W / 600 : H / 720;\n const emerge = spring({ frame: frame - B_BEATS.emerge, fps, config: HEAVY });\n const head = interpolate(frame, [B_BEATS.head, B_BEATS.head + 14], [0, 1], {\n ...CLAMP,\n easing: ENTER,\n });\n const play = interpolate(frame, [B_BEATS.play, B_LEN], [0, 0.42], CLAMP);\n const cardW = tall ? W * 0.88 : W * 0.5;\n const thumbH = (cardW - 20 * u) * (9 / 16);\n const cardTop = tall ? H * 0.36 : H * 0.29;\n const fs = (tall ? 22 : 18) * u;\n const small = (tall ? 19 : 15) * u;\n const secs = Math.floor(play * 30);\n const push = interpolate(frame, [B_BEATS.emerge, B_LEN], [1, 1.03], CLAMP);\n const rowIn = (i: number) =>\n spring({ frame: frame - B_BEATS.rows - i * 3, fps, config: CARD });\n\n return (\n <AbsoluteFill>\n <GshGround\n preset={ground}\n params={ground ? groundParams : { ...palette.groundB, ...groundParams }}\n timeOffset={2}\n timeScale={0.8}\n />\n <AbsoluteFill\n style={{\n transform: `scale(${(push * mix(1.45, 1, emerge)).toFixed(4)})`,\n opacity: interpolate(emerge, [0, 0.25], [0, 1], CLAMP),\n filter:\n emerge < 0.98\n ? `blur(${((1 - emerge) * 12).toFixed(2)}px)`\n : undefined,\n }}\n >\n <Headline\n text={heading}\n y={tall ? H * 0.28 : H * 0.17}\n fs={tall ? W * 0.075 : W * 0.04}\n color={palette.headB}\n appear={head}\n />\n <div\n style={{\n position: \"absolute\",\n left: (W - cardW) / 2,\n top: cardTop,\n width: cardW,\n padding: 10 * u,\n borderRadius: 24 * u,\n backgroundColor: palette.panel,\n boxShadow: `inset 0 0 0 1px ${palette.hairline}, ${palette.highlight}, 0 2px 4px rgba(${palette.shadow},0.14), 0 18px 40px rgba(${palette.shadow},0.24), 0 44px 100px rgba(${palette.shadow},0.3)`,\n fontFamily: figtree.fontFamily,\n color: palette.ink,\n }}\n >\n <div\n style={{\n position: \"relative\",\n height: thumbH,\n borderRadius: 15 * u,\n overflow: \"hidden\",\n }}\n >\n <Img\n src={image}\n style={{\n width: \"100%\",\n height: \"100%\",\n objectFit: \"cover\",\n transform: `scale(${(1.06 - play * 0.08).toFixed(4)})`,\n }}\n />\n <div\n style={{\n position: \"absolute\",\n left: \"50%\",\n top: \"50%\",\n width: 58 * u,\n height: 58 * u,\n marginLeft: -29 * u,\n marginTop: -29 * u,\n borderRadius: 99,\n backgroundColor: \"rgba(255,255,255,0.9)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n boxShadow: \"0 6px 18px rgba(0,0,0,0.22)\",\n transform: `scale(${(0.6 + 0.4 * rowIn(0)).toFixed(4)})`,\n opacity: rowIn(0),\n }}\n >\n <svg\n viewBox=\"0 0 24 24\"\n width={26 * u}\n height={26 * u}\n aria-hidden\n >\n <path d={ICONS.play} fill=\"#14161d\" />\n </svg>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 14 * u,\n right: 14 * u,\n bottom: 12 * u,\n display: \"flex\",\n alignItems: \"center\",\n gap: 10 * u,\n fontSize: small,\n color: \"#ffffff\",\n opacity: rowIn(1),\n }}\n >\n <span style={{ fontVariantNumeric: \"tabular-nums\" }}>\n 0:{secs.toString().padStart(2, \"0\")}\n </span>\n <div\n style={{\n flex: 1,\n height: 4 * u,\n borderRadius: 99,\n backgroundColor: \"rgba(255,255,255,0.35)\",\n overflow: \"hidden\",\n }}\n >\n <div\n style={{\n width: `${(play * 100).toFixed(2)}%`,\n height: \"100%\",\n backgroundColor: \"#ffffff\",\n }}\n />\n </div>\n <span>0:30</span>\n </div>\n </div>\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: 12 * u,\n padding: `${14 * u}px ${8 * u}px ${6 * u}px`,\n opacity: interpolate(rowIn(2), [0, 0.4], [0, 1], CLAMP),\n transform: `translateY(${((1 - rowIn(2)) * 10 * u).toFixed(2)}px)`,\n }}\n >\n <div\n style={{\n width: 38 * u,\n height: 38 * u,\n borderRadius: 10 * u,\n backgroundColor: palette.row,\n boxShadow: `inset 0 0 0 1px ${palette.hairline}`,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <Icon d={ICONS.film} size={19 * u} color={palette.ink} />\n </div>\n <div\n style={{\n flex: 1,\n display: \"flex\",\n flexDirection: \"column\",\n gap: 2 * u,\n }}\n >\n <span\n style={{\n fontSize: fs,\n fontWeight: 400,\n letterSpacing: \"-0.01em\",\n }}\n >\n {title}\n </span>\n <span style={{ fontSize: small, color: palette.muted }}>\n 30 s · 1080p · 3 formats\n </span>\n </div>\n <div\n style={{\n display: \"flex\",\n alignItems: \"center\",\n gap: 6 * u,\n padding: `${9 * u}px ${16 * u}px`,\n borderRadius: 99,\n backgroundColor: palette.accent,\n color: \"#ffffff\",\n fontSize: small,\n boxShadow: \"inset 0 1px 0 rgba(255,255,255,0.25)\",\n }}\n >\n <Icon d={ICONS.share} size={16 * u} color=\"#ffffff\" />\n Share\n </div>\n </div>\n </div>\n {tall ? (\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n top: H * 0.765,\n display: \"flex\",\n justifyContent: \"center\",\n gap: 10 * u,\n fontFamily: figtree.fontFamily,\n fontSize: small,\n color: palette.headB,\n }}\n >\n {[\"16:9\", \"9:16\", \"1:1\"].map((f, i) => {\n const k = rowIn(3 + i);\n return (\n <div\n key={f}\n style={{\n padding: `${10 * u}px ${20 * u}px`,\n borderRadius: 99,\n backgroundColor: palette.panel,\n color: palette.ink,\n boxShadow: `inset 0 0 0 1px ${palette.hairline}, 0 8px 22px rgba(${palette.shadow},0.2)`,\n opacity: interpolate(k, [0, 0.4], [0, 1], CLAMP),\n transform: `translateY(${((1 - k) * 12 * u).toFixed(2)}px)`,\n }}\n >\n {f}\n </div>\n );\n })}\n </div>\n ) : null}\n </AbsoluteFill>\n </AbsoluteFill>\n );\n}\n\nexport interface PressWarpDiveDemoProps {\n theme?: \"dark\" | \"light\";\n accent?: string;\n heading?: string;\n prompt?: string;\n headingB?: string;\n title?: string;\n image?: string;\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n groundB?: GshPresetId;\n groundParamsB?: Partial<GradientParams>;\n transition?: PressWarpDiveProps;\n}\n\nexport function PressWarpDiveDemo({\n theme = \"dark\",\n accent,\n heading = \"What are we launching?\",\n prompt = \"A 30-second launch film for our new editor\",\n headingB = \"Your film is ready\",\n title = \"Launch film, v2\",\n image = staticFile(\"reel/reel-5.jpg\"),\n ground,\n groundParams,\n groundB,\n groundParamsB,\n transition,\n}: PressWarpDiveDemoProps) {\n const { width: W, height: H } = useVideoConfig();\n const base = THEMES[theme];\n const palette = accent ? { ...base, accent } : base;\n const L = layout(W, H);\n return (\n <AbsoluteFill style={{ backgroundColor: palette.backdrop }}>\n <TransitionSeries>\n <TransitionSeries.Sequence durationInFrames={A_LEN}>\n <SceneA\n palette={palette}\n heading={heading}\n prompt={prompt}\n ground={ground}\n groundParams={groundParams}\n />\n </TransitionSeries.Sequence>\n <TransitionSeries.Transition\n presentation={pressWarpDive({\n point: [L.button.x / W, L.button.y / H],\n buttonRadius: L.button.r / Math.min(W, H),\n orb: palette.accent,\n rim: palette.rim,\n ...transition,\n })}\n timing={linearTiming({ durationInFrames: T_LEN })}\n />\n <TransitionSeries.Sequence durationInFrames={B_LEN}>\n <SceneB\n palette={palette}\n heading={headingB}\n title={title}\n image={image}\n ground={groundB}\n groundParams={groundParamsB}\n />\n </TransitionSeries.Sequence>\n </TransitionSeries>\n </AbsoluteFill>\n );\n}\n",
"type": "registry:component",
"target": "components/remocn/press-warp-dive.tsx"
}
],
"type": "registry:component"
}