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": [],
"dimensions": {
"width": 340,
"height": 100
},
"displayName": "Marker Highlight",
"initialProps": null,
"slug": "marker-highlight",
"sourceCode": "import { Interactive, Sequence, interpolate, interpolateColors, spring, useCurrentFrame, useVideoConfig, type InteractiveBaseProps, type InteractiveTransformProps, type InteractivitySchema, type SequenceControls } from \"remotion\";\nimport { forwardRef, useImperativeHandle, useRef, type ComponentProps } from \"react\";\n\ninterface MarkerHighlightProps {\n before?: string;\n highlight: string;\n after?: string;\n markerColor?: string;\n baseColor?: string;\n highlightedTextColor?: string;\n fontSize?: number;\n fontWeight?: number;\n speed?: number;\n className?: string;\n}\n\nfunction MarkerHighlightBase({\n before = \"\",\n highlight,\n after = \"\",\n markerColor = \"#facc15\",\n baseColor = \"#171717\",\n highlightedTextColor = \"#171717\",\n fontSize = 72,\n fontWeight = 600,\n speed = 1,\n className,\n}: MarkerHighlightProps) {\n const frame = useCurrentFrame() * speed;\n const { fps } = useVideoConfig();\n\n const markerScale = spring({\n frame: frame - 15,\n fps,\n config: { damping: 14 },\n });\n\n const textColor = interpolateColors(\n interpolate(markerScale, [0.5, 0.8], [0, 1], {\n extrapolateLeft: \"clamp\",\n extrapolateRight: \"clamp\",\n }),\n [0, 1],\n [baseColor, highlightedTextColor],\n );\n\n return (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n background: \"white\",\n }}\n >\n <span\n className={className}\n style={{\n fontSize,\n fontWeight,\n color: baseColor,\n letterSpacing: \"-0.03em\",\n fontFamily:\n \"var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif\",\n }}\n >\n {before}\n <span style={{ position: \"relative\", display: \"inline-block\" }}>\n <span\n aria-hidden\n style={{\n position: \"absolute\",\n inset: \"0 -0.1em\",\n background: markerColor,\n transformOrigin: \"left center\",\n scale: `${markerScale} 1`,\n zIndex: 0,\n }}\n />\n <span style={{ position: \"relative\", zIndex: 1, color: textColor }}>\n {highlight}\n </span>\n </span>\n {after}\n </span>\n </div>\n );\n}\n\nconst elementSchema = {\n ...Interactive.baseSchema,\n before: {\n type: \"text-content\",\n default: \"Made for \",\n description: \"Before\",\n },\n highlight: {\n type: \"text-content\",\n default: \"builders\",\n description: \"Highlight\",\n },\n after: {\n type: \"text-content\",\n default: \".\",\n description: \"After\",\n },\n markerColor: {\n type: \"color\",\n default: \"#facc15\",\n description: \"Marker color\",\n },\n baseColor: {\n type: \"color\",\n default: \"#171717\",\n description: \"Base color\",\n },\n highlightedTextColor: {\n type: \"color\",\n default: \"#171717\",\n description: \"Highlighted text color\",\n },\n fontSize: {\n type: \"number\",\n min: 12,\n max: 160,\n step: 1,\n default: 72,\n description: \"Font size\",\n hiddenFromList: false,\n },\n fontWeight: {\n type: \"enum\",\n default: \"600\",\n variants: {\n \"400\": {},\n \"500\": {},\n \"600\": {},\n \"700\": {},\n },\n description: \"Font weight\",\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 width: {\n type: \"number\",\n default: 340,\n min: 10,\n step: 10,\n description: \"Width\",\n },\n height: {\n type: \"number\",\n default: 100,\n min: 10,\n step: 10,\n description: \"Height\",\n },\n ...Interactive.transformSchema,\n} as const satisfies InteractivitySchema;\n\nconst ELEMENT_PROP_KEYS = new Set([\"before\",\"highlight\",\"after\",\"markerColor\",\"baseColor\",\"highlightedTextColor\",\"fontSize\",\"fontWeight\",\"speed\"]);\n\nconst ELEMENT_PROP_DEFAULTS: Record<string, unknown> = {\n before: \"Made for \",\n highlight: \"builders\",\n after: \".\",\n markerColor: \"#facc15\",\n baseColor: \"#171717\",\n highlightedTextColor: \"#171717\",\n fontSize: 72,\n fontWeight: \"600\",\n speed: 1,\n};\n\ntype MarkerHighlightElementProps = InteractiveBaseProps &\n InteractiveTransformProps & { readonly width?: number; readonly height?: number } &\n ComponentProps<typeof MarkerHighlightBase>;\n\nconst MarkerHighlightInner = forwardRef<\n HTMLDivElement,\n MarkerHighlightElementProps & { readonly controls: SequenceControls | undefined }\n>(({ controls, name, style, width = 340, height = 100, ...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 ?? \"<MarkerHighlight>\"}\n outlineRef={outlineRef}\n >\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <div\n ref={outlineRef}\n style={{\n position: \"relative\",\n width,\n height,\n ...style,\n }}\n >\n <MarkerHighlightBase\n {...(componentProps as unknown as ComponentProps<typeof MarkerHighlightBase>)}\n />\n </div>\n </div>\n </Sequence>\n );\n});\n\nexport const MarkerHighlight = Interactive.withSchema({\n Component: MarkerHighlightInner,\n componentName: \"<MarkerHighlight>\",\n componentIdentity: null,\n schema: elementSchema,\n supportsEffects: false,\n});\n",
"durationInFrames": 90,
"installationMode": "component-owned-sequence"
},
"durationInFrames": 90
}