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": "Blink Cut",
"initialProps": null,
"slug": "blink-cut",
"sourceCode": "import { loadFont as loadDisplay } from \"@remotion/google-fonts/BricolageGrotesque\";\nimport { loadFont as loadManrope } from \"@remotion/google-fonts/Manrope\";\nimport { AbsoluteFill, Easing, Interactive, Sequence, interpolate, useCurrentFrame, useVideoConfig, type InteractiveBaseProps, type InteractiveTransformProps, type InteractivitySchema, type SequenceControls } from \"remotion\";\nimport React, { forwardRef, useImperativeHandle, useRef, type ComponentProps } from \"react\";\n\nconst { fontFamily: display } = loadDisplay(\"normal\", {\n weights: [\"400\", \"500\"],\n subsets: [\"latin\"],\n});\nconst manrope = loadManrope(\"normal\", {\n weights: [\"600\"],\n subsets: [\"latin\"],\n});\n\ntype BlinkLayout =\n | \"giant\"\n | \"center\"\n | \"dot\"\n | \"corner\"\n | \"top-left\"\n | \"low-right\"\n | \"crop-right\"\n | \"crop-left\"\n | \"crop-bottom\";\n\ntype BlinkGround = \"base\" | \"invert\" | \"accent\";\n\ninterface BlinkWord {\n text: string;\n /** Where and how big the word sits. Defaults cycle through a fixed rhythm. */\n layout?: BlinkLayout;\n /** Background for this cut. */\n ground?: BlinkGround;\n /** How many beats (of `framesPerWord`) this word stays on screen. */\n beats?: number;\n}\n\ninterface BlinkCutProps {\n /** One- or two-syllable words, one per cut. Strings or per-word overrides. */\n words?: Array<string | BlinkWord>;\n /** Length of one beat. 5–7 reads at speed without strobing. */\n framesPerWord?: number;\n /** Wordmark on the closing lockup. */\n brand?: string;\n /** One line under the wordmark. Pass \"\" to hide. */\n line?: string;\n /** Replaces the default mark in the lockup. */\n logo?: React.ReactNode;\n accent?: string;\n /** Playback multiplier. */\n speed?: number;\n theme?: \"dark\" | \"light\";\n}\n\nconst DEFAULT_WORDS: BlinkWord[] = [\n { text: \"Cut\", layout: \"giant\", ground: \"base\" },\n { text: \"Fast\", layout: \"crop-right\", ground: \"base\" },\n { text: \"small\", layout: \"corner\", ground: \"base\" },\n { text: \"Loud\", layout: \"crop-bottom\", ground: \"invert\" },\n { text: \"Bold\", layout: \"top-left\", ground: \"base\" },\n { text: \"Sharp\", layout: \"center\", ground: \"accent\" },\n { text: \"Clean\", layout: \"low-right\", ground: \"base\" },\n { text: \"Snap\", layout: \"crop-left\", ground: \"invert\" },\n { text: \"Beat\", layout: \"giant\", ground: \"base\" },\n { text: \"quiet\", layout: \"dot\", ground: \"base\" },\n { text: \"Type\", layout: \"crop-bottom\", ground: \"accent\" },\n { text: \"Move\", layout: \"top-left\", ground: \"invert\" },\n { text: \"Hold\", layout: \"center\", ground: \"base\" },\n { text: \"Ship\", layout: \"giant\", ground: \"invert\" },\n { text: \"Now\", layout: \"crop-right\", ground: \"accent\" },\n];\n\nconst LAYOUT_CYCLE: BlinkLayout[] = [\n \"giant\",\n \"crop-right\",\n \"corner\",\n \"crop-bottom\",\n \"top-left\",\n \"center\",\n \"low-right\",\n \"crop-left\",\n \"dot\",\n];\nconst GROUND_CYCLE: BlinkGround[] = [\n \"base\",\n \"base\",\n \"invert\",\n \"base\",\n \"accent\",\n \"base\",\n \"invert\",\n];\n\nconst THEMES = {\n dark: { bg: \"#0A0A0B\", fg: \"#F5F4F0\", muted: \"#8A8984\" },\n light: { bg: \"#F5F4F0\", fg: \"#0A0A0B\", muted: \"#6E6C67\" },\n} as const;\n\nconst EASE_OUT = Easing.bezier(0.22, 1, 0.36, 1);\nconst CLAMP = {\n extrapolateLeft: \"clamp\",\n extrapolateRight: \"clamp\",\n} as const;\n\n/** Bricolage Grotesque 500 advance per character at display tracking, in em. */\nconst ADVANCE = 0.54;\n\n/** gradients.sh \"beam\": the closest palette to the remocn accent family. */\nconst BEAM = {\n bg: \"#02030a\",\n colors: [\"#f4f7ff\", \"#8fb4ff\", \"#3d5bff\", \"#1a1660\"],\n} as const;\n\n/** A beam mesh ground. `seed` moves the blobs per cut, `t` drifts them a little. */\nfunction beamGround(seed: number, t: number, accent: string) {\n const [, c1, , c3] = BEAM.colors;\n // The accent prop takes the palette's own blue slot (#3d5bff by default).\n const c2 = accent;\n const sx = ((seed * 37) % 23) - 11;\n const d = t * 4;\n return [\n `radial-gradient(70% 85% at ${78 - sx * 0.6 - d}% ${84 - d}%, color-mix(in oklab, ${c1} 70%, transparent) 0%, transparent 66%)`,\n `radial-gradient(95% 110% at ${18 + sx * 0.4}% ${88 + d}%, ${c2} 0%, transparent 70%)`,\n `radial-gradient(85% 95% at ${86 + d}% ${16 + sx * 0.3}%, ${c3} 0%, transparent 72%)`,\n `linear-gradient(160deg, ${c3} 0%, ${c2} 100%)`,\n ].join(\", \");\n}\n\n/** The same palette as a clip fill for type on the light stage. */\nfunction beamInk(seed: number, t: number, accent: string) {\n const [, c1, , c3] = BEAM.colors;\n const c2 = accent;\n const a = 104 + ((seed * 29) % 30) + t * 6;\n return `linear-gradient(${a}deg, ${c3} 0%, ${c2} 46%, color-mix(in oklab, ${c1} 70%, ${c2}) 100%)`;\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, tracking-tight. */\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\ninterface Spec {\n size: number;\n weight: number;\n tracking: string;\n style: React.CSSProperties;\n}\n\nfunction layoutSpec(\n layout: BlinkLayout,\n text: string,\n W: number,\n H: number,\n): Spec {\n const fit = (target: number, maxWidth: number) =>\n Math.min(target, maxWidth / Math.max(1, text.length * ADVANCE));\n const pad = H * 0.075;\n switch (layout) {\n case \"giant\":\n return {\n size: fit(H * 0.56, W * 0.86),\n weight: 500,\n tracking: \"-0.04em\",\n style: { left: 0, right: 0, top: \"50%\", textAlign: \"center\" },\n };\n case \"center\":\n return {\n size: fit(H * 0.17, W * 0.7),\n weight: 500,\n tracking: \"-0.03em\",\n style: { left: 0, right: 0, top: \"50%\", textAlign: \"center\" },\n };\n case \"dot\":\n return {\n size: H * 0.036,\n weight: 400,\n tracking: \"-0.01em\",\n style: { left: 0, right: 0, top: \"50%\", textAlign: \"center\" },\n };\n case \"corner\":\n return {\n size: H * 0.042,\n weight: 400,\n tracking: \"-0.01em\",\n style: { left: pad * 1.2, bottom: pad },\n };\n case \"top-left\":\n return {\n size: fit(H * 0.26, W * 0.6),\n weight: 500,\n tracking: \"-0.035em\",\n style: { left: pad * 1.1, top: pad * 0.7 },\n };\n case \"low-right\":\n return {\n size: fit(H * 0.13, W * 0.5),\n weight: 500,\n tracking: \"-0.03em\",\n style: { right: pad * 1.2, bottom: pad * 0.9, textAlign: \"right\" },\n };\n case \"crop-right\":\n return {\n size: H * 0.98,\n weight: 500,\n tracking: \"-0.04em\",\n style: { left: W * 0.36, top: \"54%\" },\n };\n case \"crop-left\":\n return {\n size: H * 0.98,\n weight: 500,\n tracking: \"-0.04em\",\n style: { right: W * 0.38, top: \"46%\", textAlign: \"right\" },\n };\n case \"crop-bottom\":\n return {\n size: fit(H * 1.05, W * 0.94),\n weight: 500,\n tracking: \"-0.04em\",\n style: { left: 0, right: 0, top: H * 0.3, textAlign: \"center\" },\n };\n }\n}\n\nconst CENTERED: BlinkLayout[] = [\n \"giant\",\n \"center\",\n \"dot\",\n \"crop-right\",\n \"crop-left\",\n];\n\nfunction BlinkCutBase({\n words = DEFAULT_WORDS,\n framesPerWord = 6,\n brand = \"remocn\",\n line = \"Launch films, built in Remotion.\",\n logo,\n accent = \"#3B5BFD\",\n speed = 1,\n theme = \"dark\",\n}: BlinkCutProps) {\n const frame = useCurrentFrame() * speed;\n const { width: W, height: H } = useVideoConfig();\n const c = THEMES[theme];\n const beat = Math.max(1, Math.round(framesPerWord));\n\n const cuts = words.map((w, i) => {\n const word = typeof w === \"string\" ? { text: w } : w;\n return {\n text: word.text,\n layout: word.layout ?? LAYOUT_CYCLE[i % LAYOUT_CYCLE.length],\n ground: word.ground ?? GROUND_CYCLE[i % GROUND_CYCLE.length],\n length: beat * Math.max(1, Math.round(word.beats ?? 1)),\n };\n });\n\n let start = 0;\n let active = -1;\n let local = 0;\n let activeLength = beat;\n for (let i = 0; i < cuts.length; i++) {\n if (frame >= start && frame < start + cuts[i].length) {\n active = i;\n local = frame - start;\n activeLength = cuts[i].length;\n }\n start += cuts[i].length;\n }\n const lockupStart = start;\n let background: string = c.bg;\n let content: React.ReactNode = null;\n\n const dark = theme === \"dark\";\n\n if (active === -1) {\n const t = Math.max(0, frame - lockupStart);\n const lineIn = interpolate(t, [6, 18], [0, 1], {\n ...CLAMP,\n easing: EASE_OUT,\n });\n // The beam glow rises a touch under the lockup and keeps drifting.\n const rise =\n 6 -\n interpolate(t, [0, 24], [0, 6], {\n ...CLAMP,\n easing: EASE_OUT,\n }) -\n t * 0.04;\n const [c0, c1, , c3] = BEAM.colors;\n const c2 = accent;\n const ground = dark\n ? [\n `radial-gradient(64% 44% at 50% ${104 + rise}%, color-mix(in oklab, ${c0} 50%, transparent) 0%, color-mix(in oklab, ${c1} 55%, transparent) 22%, color-mix(in oklab, ${c2} 50%, transparent) 50%, transparent 78%)`,\n `radial-gradient(120% 70% at 50% ${118 + rise}%, color-mix(in oklab, ${c3} 95%, transparent) 0%, transparent 72%)`,\n `linear-gradient(180deg, ${c.bg} 0%, ${BEAM.bg} 100%)`,\n ].join(\", \")\n : [\n `radial-gradient(64% 46% at 50% ${100 + rise}%, color-mix(in oklab, ${c2} 70%, transparent) 0%, color-mix(in oklab, ${c1} 55%, transparent) 30%, color-mix(in oklab, ${c0} 40%, transparent) 56%, transparent 80%)`,\n `linear-gradient(${c.bg}, ${c.bg})`,\n ].join(\", \");\n const isRemocn = !logo && brand.toLowerCase() === \"remocn\";\n background = ground;\n content = (\n <AbsoluteFill style={{ alignItems: \"center\", justifyContent: \"center\" }}>\n <div\n style={{\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: H * 0.045,\n }}\n >\n {isRemocn ? (\n <RemocnLogo fontSize={H * 0.17} color={c.fg} />\n ) : (\n <div\n style={{ display: \"flex\", alignItems: \"center\", gap: H * 0.022 }}\n >\n {logo}\n <div\n style={{\n fontFamily: display,\n fontWeight: 500,\n fontSize: H * 0.135,\n letterSpacing: \"-0.035em\",\n lineHeight: 1,\n color: c.fg,\n }}\n >\n {brand}\n </div>\n </div>\n )}\n {line ? (\n <div\n style={{\n fontFamily: display,\n fontWeight: 400,\n fontSize: H * 0.036,\n letterSpacing: \"-0.01em\",\n color: c.muted,\n opacity: lineIn,\n transform: `translateY(${(1 - lineIn) * H * 0.012}px)`,\n }}\n >\n {line}\n </div>\n ) : null}\n </div>\n </AbsoluteFill>\n );\n } else {\n const cut = cuts[active];\n const isAccent = cut.ground === \"accent\";\n const p = local / activeLength;\n background =\n isAccent && dark\n ? beamGround(active, p, accent)\n : cut.ground === \"invert\"\n ? c.fg\n : c.bg;\n const ink: React.CSSProperties =\n isAccent && !dark\n ? {\n backgroundImage: beamInk(active, p, accent),\n WebkitBackgroundClip: \"text\",\n backgroundClip: \"text\",\n color: \"transparent\",\n }\n : {\n color:\n cut.ground === \"invert\" ? c.bg : isAccent ? BEAM.colors[0] : c.fg,\n };\n const spec = layoutSpec(cut.layout, cut.text, W, H);\n // A hair of drift keeps each cut alive without softening the hard edit.\n const drift = interpolate(local, [0, activeLength], [0, 1], CLAMP);\n const scale = 1 + drift * (CENTERED.includes(cut.layout) ? 0.025 : 0.015);\n const vertical =\n spec.style.top !== undefined && spec.style.bottom === undefined\n ? typeof spec.style.top === \"string\"\n ? \"translateY(-50%)\"\n : \"\"\n : \"\";\n const origin =\n cut.layout === \"corner\" || cut.layout === \"top-left\"\n ? \"left center\"\n : cut.layout === \"low-right\"\n ? \"right center\"\n : \"center center\";\n content = (\n <div\n style={{\n position: \"absolute\",\n ...spec.style,\n fontFamily: display,\n fontWeight: spec.weight,\n fontSize: spec.size,\n letterSpacing: spec.tracking,\n lineHeight: 0.9,\n ...ink,\n whiteSpace: \"nowrap\",\n transform: `${vertical} scale(${scale})`,\n transformOrigin: origin,\n }}\n >\n {cut.text}\n </div>\n );\n }\n\n return (\n <AbsoluteFill style={{ background, overflow: \"hidden\" }}>\n {content}\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 brand: {\n type: \"text-content\",\n default: \"remocn\",\n description: \"Brand\",\n },\n line: {\n type: \"text-content\",\n default: \"Launch films, built in Remotion.\",\n description: \"Line\",\n },\n framesPerWord: {\n type: \"number\",\n default: 6,\n min: 0,\n max: 18,\n step: 1,\n description: \"Frames per word\",\n hiddenFromList: false,\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\",\"brand\",\"line\",\"framesPerWord\",\"speed\"]);\n\nconst ELEMENT_PROP_DEFAULTS: Record<string, unknown> = {\n theme: \"dark\",\n accent: \"#3B5BFD\",\n brand: \"remocn\",\n line: \"Launch films, built in Remotion.\",\n framesPerWord: 6,\n speed: 1,\n};\n\ntype BlinkCutElementProps = InteractiveBaseProps &\n InteractiveTransformProps &\n ComponentProps<typeof BlinkCutBase>;\n\nconst BlinkCutInner = forwardRef<\n HTMLDivElement,\n BlinkCutElementProps & { 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 ?? \"<BlinkCut>\"}\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 <BlinkCutBase\n {...(componentProps as unknown as ComponentProps<typeof BlinkCutBase>)}\n />\n </div>\n </Sequence>\n );\n});\n\nexport const BlinkCut = Interactive.withSchema({\n Component: BlinkCutInner,\n componentName: \"<BlinkCut>\",\n componentIdentity: null,\n schema: elementSchema,\n supportsEffects: false,\n});\n",
"durationInFrames": 108,
"installationMode": "component-owned-sequence"
},
"durationInFrames": 108
}