Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
{
"type": "remotion-element",
"version": 1,
"element": {
"assets": [],
"dependencies": [
{
"name": "@remotion/google-fonts",
"version": null
}
],
"dimensions": null,
"displayName": "Play of The Game",
"initialProps": null,
"slug": "play-of-the-game",
"sourceCode": "import { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport { loadFont } from \"@remotion/google-fonts/Saira\";\nimport { AbsoluteFill, Easing, Interactive, Sequence, interpolate, useCurrentFrame, useVideoConfig, type InteractiveBaseProps, type InteractiveTransformProps, type InteractivitySchema, type SequenceControls } from \"remotion\";\nimport { forwardRef, useImperativeHandle, useRef, type ComponentProps } from \"react\";\n\nconst { fontFamily: saira } = loadFont(\"normal\", {\n weights: [\"500\"],\n subsets: [\"latin\"],\n});\nconst { fontFamily: sairaItalic } = loadFont(\"italic\", {\n weights: [\"500\"],\n subsets: [\"latin\"],\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\n/** Full logo as on remocn.dev: R mark (0.76em tall, baseline-aligned) + \"emocn\" in Manrope 600. */\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\n/** Role badge: a hexagon with two rank-up chevrons. */\nfunction RoleGlyph({ size, color }: { size: number; color: string }) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 100 100\" aria-hidden>\n <path\n d=\"M50 5 L89 27.5 L89 72.5 L50 95 L11 72.5 L11 27.5 Z\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"6.5\"\n strokeLinejoin=\"miter\"\n />\n <path\n d=\"M29 55 L50 36 L71 55 M29 73 L50 54 L71 73\"\n fill=\"none\"\n stroke={color}\n strokeWidth=\"8\"\n strokeLinecap=\"square\"\n />\n </svg>\n );\n}\n\ninterface PlayOfTheGameProps {\n /** The banner call that slices in first. */\n title?: string;\n /** Small role label under the player (the player is always the remocn logo). */\n role?: string;\n /** The highlight stat, flashed in on its own plate. */\n stat?: string;\n /** The part of the stat filled with the gradient. Must appear inside `stat`. */\n highlight?: string;\n /** Small markers: the role tick. */\n accent?: string;\n theme?: \"dark\" | \"light\";\n speed?: number;\n}\n\n// Beat sheet (internal clock = frame + 4, 30fps, speed 1):\n// 0–12 angled \"swirl\" light bars streak in from the left and park at the\n// frame edges\n// 3–10 the angled banner slices open left to right behind a hot edge; the\n// title slides in inside it\n// 18–23 the player (the logo) slams in from 1.5× with echoes; frame 23 is\n// the impact (white flash, shake); the role badge slams 2f later\n// 28–36 role label wipes in under the player\n// 38–45 the stat plate flashes twice, then holds with the gradient word\n// 44–62 wide light bars sweep across behind everything; poster hold\nconst BARS_LEN = 12;\nconst BANNER_AT = 3;\nconst BANNER_LEN = 7;\nconst NAME_AT = 18;\nconst NAME_LEN = 5;\nconst GLYPH_AT = 20;\nconst ROLE_AT = 28;\nconst STAT_AT = 38;\nconst SWEEP_AT = 44;\nconst SWEEP_LEN = 18;\n\nconst SLAM = Easing.bezier(0.12, 0.9, 0.25, 1);\nconst OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst INOUT = Easing.bezier(0.6, 0, 0.3, 1);\nconst CLAMP = {\n extrapolateLeft: \"clamp\",\n extrapolateRight: \"clamp\",\n} as const;\n\n// gradients.sh \"swirl\": bg #07060a, [#ffe2c4, #ff9a4d, #d2456b, #3a1f6b].\nconst SWIRL = [\"#FFE2C4\", \"#FF9A4D\", \"#D2456B\", \"#3A1F6B\"] as const;\nconst BANNER = `linear-gradient(100deg, ${SWIRL[3]} 0%, ${SWIRL[2]} 34%, ${SWIRL[1]} 72%, #FFB676 100%)`;\nconst BAR = `linear-gradient(180deg, ${SWIRL[0]} 0%, ${SWIRL[1]} 30%, ${SWIRL[2]} 62%, ${SWIRL[3]} 100%)`;\nconst WORD = `linear-gradient(100deg, ${SWIRL[1]} 0%, #F06A5A 50%, ${SWIRL[2]} 100%)`;\n\nconst THEMES = {\n dark: {\n stage: \"#08080A\",\n ink: \"#F3F2EF\",\n dim: \"#8A8990\",\n plate: \"#17161B\",\n plateEdge: \"#2A2830\",\n plateInk: \"#F3F2EF\",\n flash: \"#FFF4EA\",\n word: WORD,\n },\n light: {\n stage: \"#F5F4F0\",\n ink: \"#121214\",\n dim: \"#7E7D77\",\n plate: \"#121214\",\n plateEdge: \"#121214\",\n plateInk: \"#F3F2EF\",\n flash: \"#121214\",\n word: WORD,\n },\n} as const;\n\n// Parked bars, as fractions of the width at mid-height.\nconst BARS = [\n { x: 0.03, w: 52, delay: 0 },\n { x: 0.082, w: 14, delay: 2 },\n { x: 0.108, w: 5, delay: 3 },\n { x: 0.885, w: 6, delay: 1 },\n { x: 0.91, w: 16, delay: 3 },\n { x: 0.965, w: 60, delay: 2 },\n];\n// Wide translucent bars for the late sweep.\nconst SWEEP = [\n { off: 0, w: 120, op: 1 },\n { off: 0.12, w: 26, op: 1 },\n { off: 0.2, w: 64, op: 1 },\n { off: 0.27, w: 8, op: 1 },\n];\n\nfunction ramp(t: number, from: number, len: number) {\n return interpolate(t, [from, from + len], [0, 1], CLAMP);\n}\n\n/** Decaying camera shake that starts at `at`, stepped per frame. */\nfunction shake(t: number, at: number, len: number, amp: number) {\n const d = Math.floor(t - at);\n if (d < 0 || d >= len) return { x: 0, y: 0 };\n const k = (1 - d / len) ** 2;\n return {\n x: amp * k * Math.sin(d * 2.4 + 0.6),\n y: amp * 0.6 * k * Math.cos(d * 3.1 + 0.3),\n };\n}\n\nfunction PlayOfTheGameBase({\n title = \"Play of the game\",\n role = \"Solo builder\",\n stat = \"Shipped in 6 hours\",\n highlight = \"6 hours\",\n accent = \"#3B5BFD\",\n theme = \"dark\",\n speed = 1,\n}: PlayOfTheGameProps) {\n const t = useCurrentFrame() * speed + 4;\n const { width: W, height: H } = useVideoConfig();\n const c = THEMES[theme];\n const u = Math.min(W / 1280, H / 720);\n\n const SLANT = Math.tan((14 * Math.PI) / 180);\n /** Full-height slanted bar centred on x at mid-height. */\n const barPoly = (x: number, w: number) => {\n const l = (H / 2) * SLANT;\n return `polygon(${x - w / 2 + l}px 0, ${x + w / 2 + l}px 0, ${x + w / 2 - l}px ${H}px, ${x - w / 2 - l}px ${H}px)`;\n };\n\n // ── Impact ────────────────────────────────────────────────────────────────\n const hitAt = NAME_AT + NAME_LEN;\n const sh = shake(t, hitAt, 11, 14 * u);\n const sh2 = shake(t, STAT_AT + 6, 6, 5 * u);\n const flash = t >= hitAt && t < hitAt + speed ? 1 : 0;\n\n // ── Banner ────────────────────────────────────────────────────────────────\n const banH = 128 * u;\n const banW = 0.8 * W;\n const banX = (W - banW) / 2;\n const banY = 0.12 * H;\n const banLean = banH * SLANT;\n const banP = OUT(ramp(t, BANNER_AT, BANNER_LEN));\n const titleP = OUT(ramp(t, BANNER_AT + 2, 14));\n const banEdge = banX - banLean + banP * (banW + 2 * banLean);\n const banTitleFs = 94 * u;\n\n // ── Player row ────────────────────────────────────────────────────────────\n const logoFs = 204 * u;\n const rowCy = 0.465 * H;\n const glyphSize = 150 * u;\n const nameScale = (d: number) => 1.5 - 0.5 * SLAM(ramp(d, NAME_AT, NAME_LEN));\n const glyphP = SLAM(ramp(t, GLYPH_AT, NAME_LEN));\n const roleP = OUT(ramp(t, ROLE_AT, 9));\n\n // ── Stat plate ────────────────────────────────────────────────────────────\n const statFs = 64 * u;\n const plateH = 108 * u;\n const plateY = 0.8 * H;\n const sd = t - STAT_AT;\n const blink =\n sd < 0\n ? \"off\"\n : sd < 2\n ? \"flash\"\n : sd < 4\n ? \"off\"\n : sd < 6\n ? \"flash\"\n : \"on\";\n const statP = OUT(ramp(t, STAT_AT, 12));\n const hiAt = stat.toLowerCase().indexOf(highlight.toLowerCase());\n const before = hiAt >= 0 ? stat.slice(0, hiAt) : stat;\n const hi = hiAt >= 0 ? stat.slice(hiAt, hiAt + highlight.length) : \"\";\n const after = hiAt >= 0 ? stat.slice(hiAt + highlight.length) : \"\";\n const plateW = Math.min(0.8 * W, (stat.length * 0.62 + 2.6) * statFs);\n const plateLean = plateH * SLANT;\n\n const sweep = INOUT(ramp(t, SWEEP_AT, SWEEP_LEN));\n\n return (\n <AbsoluteFill style={{ background: c.stage, overflow: \"hidden\" }}>\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n transform: `translate(${sh.x + sh2.x}px, ${sh.y + sh2.y}px)`,\n }}\n >\n {/* Late sweep: wide light bars pass behind everything. */}\n {sweep > 0 && sweep < 1\n ? SWEEP.map((b) => {\n const x = interpolate(\n sweep,\n [0, 1],\n [-0.25 * W - b.off * W, 1.3 * W - b.off * W],\n );\n return (\n <div\n key={b.off}\n style={{\n position: \"absolute\",\n inset: 0,\n clipPath: barPoly(x, b.w * u),\n background: BAR,\n opacity: b.op,\n }}\n />\n );\n })\n : null}\n\n {/* Parked bars at the frame edges, streaking in at the start. */}\n {BARS.map((b) => {\n const p = OUT(ramp(t, b.delay, BARS_LEN - 2));\n const x = interpolate(p, [0, 1], [-0.3 * W, b.x * W]);\n return (\n <div\n key={b.x}\n style={{\n position: \"absolute\",\n inset: 0,\n clipPath: barPoly(x, b.w * u * (1 + 1.4 * (1 - p))),\n background: BAR,\n opacity: p > 0 ? 1 : 0,\n }}\n />\n );\n })}\n\n {/* Banner: slices open behind a hot edge. */}\n {banP > 0 ? (\n <div\n style={{\n position: \"absolute\",\n left: 0,\n top: banY,\n width: W,\n height: banH,\n clipPath: `polygon(${banX + banLean}px 0, ${Math.min(banEdge + banLean, banX + banW + banLean)}px 0, ${Math.min(banEdge - banLean, banX + banW - banLean)}px 100%, ${banX - banLean}px 100%)`,\n }}\n >\n <div\n style={{ position: \"absolute\", inset: 0, background: BANNER }}\n />\n <div\n style={{\n position: \"absolute\",\n left: 0,\n width: W,\n top: 0,\n height: banH,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n transform: `translateX(${(1 - titleP) * -60 * u}px)`,\n opacity: titleP,\n fontFamily: sairaItalic,\n fontStyle: \"italic\",\n fontWeight: 500,\n fontSize: banTitleFs,\n lineHeight: 1,\n letterSpacing: \"-0.01em\",\n textTransform: \"uppercase\",\n color: \"#FFFFFF\",\n whiteSpace: \"nowrap\",\n paddingTop: 4 * u,\n }}\n >\n {title}\n </div>\n {banP < 1 ? (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n clipPath: `polygon(${banEdge + banLean - 18 * u}px 0, ${banEdge + banLean}px 0, ${banEdge - banLean}px 100%, ${banEdge - banLean - 18 * u}px 100%)`,\n background: SWIRL[0],\n }}\n />\n ) : null}\n </div>\n ) : null}\n\n {/* Player row: role badge + the logo. */}\n <div\n style={{\n position: \"absolute\",\n left: 0,\n width: W,\n top: rowCy - logoFs * 0.5,\n height: logoFs,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: 40 * u,\n }}\n >\n <div\n style={{\n width: glyphSize,\n height: glyphSize,\n opacity: ramp(t, GLYPH_AT, 2),\n transform: `rotate(${(1 - glyphP) * -40}deg) scale(${1.4 - 0.4 * glyphP})`,\n }}\n >\n <RoleGlyph size={glyphSize} color={c.ink} />\n </div>\n <div style={{ position: \"relative\" }}>\n {[4, 2, 0].map((lag) => {\n const ghost = lag > 0;\n if (ghost && t >= hitAt + lag) return null;\n const tt = t - lag;\n const op = ramp(tt, NAME_AT, 2) * (ghost ? 0.2 / lag : 1);\n return (\n <div\n key={lag}\n style={{\n position: ghost ? \"absolute\" : \"relative\",\n left: 0,\n top: 0,\n transform: `scale(${nameScale(tt)})`,\n opacity: op,\n paddingTop: logoFs * 0.04,\n }}\n >\n <RemocnLogo fontSize={logoFs} color={c.ink} />\n </div>\n );\n })}\n </div>\n </div>\n\n {/* Role label under the player. */}\n {roleP > 0 ? (\n <div\n style={{\n position: \"absolute\",\n left: 0,\n width: W,\n top: rowCy + logoFs * 0.5,\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n gap: 14 * u,\n clipPath: `inset(-30% ${50 - 50 * roleP}% -30% ${50 - 50 * roleP}%)`,\n fontFamily: saira,\n fontWeight: 500,\n fontSize: 22 * u,\n letterSpacing: \"0.3em\",\n textTransform: \"uppercase\",\n color: c.dim,\n }}\n >\n <div\n style={{\n width: 26 * u,\n height: 5 * u,\n background: accent,\n transform: \"skewX(-14deg)\",\n }}\n />\n {role}\n <div\n style={{\n width: 26 * u,\n height: 5 * u,\n background: accent,\n transform: \"skewX(-14deg)\",\n }}\n />\n </div>\n ) : null}\n\n {/* Stat plate: two flashes, then holds. */}\n {blink !== \"off\" ? (\n <div\n style={{\n position: \"absolute\",\n left: (W - plateW) / 2,\n top: plateY - plateH / 2,\n width: plateW,\n height: plateH,\n clipPath: `polygon(${plateLean}px 0, 100% 0, calc(100% - ${plateLean}px) 100%, 0 100%)`,\n background: blink === \"flash\" ? c.flash : c.plate,\n boxShadow: `inset 0 0 0 ${2 * u}px ${c.plateEdge}`,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <div\n style={{\n display: \"flex\",\n alignItems: \"baseline\",\n transform: `translateX(${(1 - statP) * 30 * u}px)`,\n fontFamily: sairaItalic,\n fontStyle: \"italic\",\n fontWeight: 500,\n fontSize: statFs,\n lineHeight: 1,\n letterSpacing: \"0.01em\",\n textTransform: \"uppercase\",\n color: blink === \"flash\" ? c.stage : c.plateInk,\n whiteSpace: \"pre\",\n paddingTop: 3 * u,\n }}\n >\n <span>{before}</span>\n <span\n style={{\n backgroundImage: blink === \"flash\" ? undefined : c.word,\n WebkitBackgroundClip: blink === \"flash\" ? undefined : \"text\",\n backgroundClip: blink === \"flash\" ? undefined : \"text\",\n color: blink === \"flash\" ? c.stage : \"transparent\",\n paddingRight: 4 * u,\n }}\n >\n {hi}\n </span>\n <span>{after}</span>\n </div>\n </div>\n ) : null}\n </div>\n\n {/* Impact flash. */}\n {flash > 0 ? (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n background: theme === \"dark\" ? \"#FFFFFF\" : SWIRL[0],\n opacity: 0.9 * flash,\n }}\n />\n ) : null}\n </AbsoluteFill>\n );\n}\n\nconst elementSchema = {\n ...Interactive.baseSchema,\n theme: {\n type: \"enum\",\n default: \"dark\",\n variants: {\n dark: {},\n light: {},\n },\n description: \"Theme\",\n },\n accent: {\n type: \"color\",\n default: \"#3B5BFD\",\n description: \"Accent\",\n },\n title: {\n type: \"text-content\",\n default: \"Play of the game\",\n description: \"Title\",\n },\n role: {\n type: \"text-content\",\n default: \"Solo builder\",\n description: \"Role\",\n },\n stat: {\n type: \"text-content\",\n default: \"Shipped in 6 hours\",\n description: \"Stat\",\n },\n highlight: {\n type: \"text-content\",\n default: \"6 hours\",\n description: \"Highlight\",\n },\n speed: {\n type: \"number\",\n default: 1,\n min: 0.25,\n max: 4,\n step: 0.25,\n description: \"Speed\",\n hiddenFromList: false,\n },\n ...Interactive.transformSchema,\n} as const satisfies InteractivitySchema;\n\nconst ELEMENT_PROP_KEYS = new Set([\"theme\",\"accent\",\"title\",\"role\",\"stat\",\"highlight\",\"speed\"]);\n\nconst ELEMENT_PROP_DEFAULTS: Record<string, unknown> = {\n theme: \"dark\",\n accent: \"#3B5BFD\",\n title: \"Play of the game\",\n role: \"Solo builder\",\n stat: \"Shipped in 6 hours\",\n highlight: \"6 hours\",\n speed: 1,\n};\n\ntype PlayOfTheGameElementProps = InteractiveBaseProps &\n InteractiveTransformProps &\n ComponentProps<typeof PlayOfTheGameBase>;\n\nconst PlayOfTheGameInner = forwardRef<\n HTMLDivElement,\n PlayOfTheGameElementProps & { readonly controls: SequenceControls | undefined }\n>(({ controls, name, style, ...rest }, ref) => {\n const outlineRef = useRef<HTMLDivElement>(null);\n useImperativeHandle(ref, () => outlineRef.current as HTMLDivElement, []);\n const componentProps: Record<string, unknown> = { ...ELEMENT_PROP_DEFAULTS };\n const sequenceProps: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(rest)) {\n if (ELEMENT_PROP_KEYS.has(key)) {\n if (value !== undefined) componentProps[key] = value;\n } else {\n sequenceProps[key] = value;\n }\n }\n return (\n <Sequence\n layout=\"none\"\n {...sequenceProps}\n controls={controls}\n name={name ?? \"<PlayOfTheGame>\"}\n outlineRef={outlineRef}\n >\n <div\n ref={outlineRef}\n style={{\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n ...style,\n }}\n >\n <PlayOfTheGameBase\n {...(componentProps as unknown as ComponentProps<typeof PlayOfTheGameBase>)}\n />\n </div>\n </Sequence>\n );\n});\n\nexport const PlayOfTheGame = Interactive.withSchema({\n Component: PlayOfTheGameInner,\n componentName: \"<PlayOfTheGame>\",\n componentIdentity: null,\n schema: elementSchema,\n supportsEffects: false,\n});\n",
"durationInFrames": 58,
"installationMode": "component-owned-sequence"
},
"durationInFrames": 58
}