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": 300,
"height": 130
},
"displayName": "RGB Glitch Text",
"initialProps": null,
"slug": "rgb-glitch-text",
"sourceCode": "import { Interactive, Sequence, random, useCurrentFrame, type InteractiveBaseProps, type InteractiveTransformProps, type InteractivitySchema, type SequenceControls } from \"remotion\";\nimport { forwardRef, useImperativeHandle, useRef, type ComponentProps } from \"react\";\n\ninterface RGBGlitchTextProps {\n text: string;\n fontSize?: number;\n color?: string;\n fontWeight?: number;\n glitchAt?: number;\n glitchDuration?: number;\n intensity?: number;\n seed?: string;\n speed?: number;\n className?: string;\n}\n\nfunction RGBGlitchTextBase({\n text,\n fontSize = 96,\n color = \"#171717\",\n fontWeight = 700,\n glitchAt = 20,\n glitchDuration = 8,\n intensity = 6,\n seed = \"glitch\",\n speed = 1,\n className,\n}: RGBGlitchTextProps) {\n const frame = useCurrentFrame() * speed;\n\n const isGlitching = frame >= glitchAt && frame < glitchAt + glitchDuration;\n\n const offset = (axisSeed: string, scale: number) =>\n (random(`${seed}-${axisSeed}-${frame}`) * 2 - 1) * scale;\n\n const rX = isGlitching ? offset(\"r-x\", intensity) : 0;\n const rY = isGlitching ? offset(\"r-y\", intensity * 0.4) : 0;\n const gX = isGlitching ? offset(\"g-x\", intensity) : 0;\n const gY = isGlitching ? offset(\"g-y\", intensity * 0.4) : 0;\n const bX = isGlitching ? offset(\"b-x\", intensity) : 0;\n const bY = isGlitching ? offset(\"b-y\", intensity * 0.4) : 0;\n\n const copyOpacity = isGlitching ? 1 : 0;\n\n const baseStyle: React.CSSProperties = {\n position: \"absolute\",\n top: 0,\n left: 0,\n fontSize,\n fontWeight,\n letterSpacing: \"-0.03em\",\n fontFamily:\n \"var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif\",\n whiteSpace: \"pre\",\n mixBlendMode: \"multiply\",\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: \"#fafafa\",\n }}\n >\n <div\n className={className}\n style={{ position: \"relative\", display: \"inline-block\" }}\n >\n <span\n style={{\n position: \"relative\",\n fontSize,\n fontWeight,\n color,\n letterSpacing: \"-0.03em\",\n fontFamily:\n \"var(--font-geist-sans), -apple-system, BlinkMacSystemFont, sans-serif\",\n whiteSpace: \"pre\",\n }}\n >\n {text}\n </span>\n <span\n style={{\n ...baseStyle,\n color: \"#ff0040\",\n opacity: copyOpacity,\n translate: `${rX}px ${rY}px`,\n }}\n >\n {text}\n </span>\n <span\n style={{\n ...baseStyle,\n color: \"#00ff80\",\n opacity: copyOpacity,\n translate: `${gX}px ${gY}px`,\n }}\n >\n {text}\n </span>\n <span\n style={{\n ...baseStyle,\n color: \"#0080ff\",\n opacity: copyOpacity,\n translate: `${bX}px ${bY}px`,\n }}\n >\n {text}\n </span>\n </div>\n </div>\n );\n}\n\nconst elementSchema = {\n ...Interactive.baseSchema,\n text: {\n type: \"text-content\",\n default: \"GLITCH\",\n description: \"Text\",\n },\n fontSize: {\n type: \"number\",\n min: 12,\n max: 200,\n step: 1,\n default: 96,\n description: \"Font size\",\n hiddenFromList: false,\n },\n color: {\n type: \"color\",\n default: \"#171717\",\n description: \"Color\",\n },\n fontWeight: {\n type: \"enum\",\n default: \"700\",\n variants: {\n \"400\": {},\n \"500\": {},\n \"600\": {},\n \"700\": {},\n },\n description: \"Font weight\",\n },\n glitchAt: {\n type: \"number\",\n min: 0,\n max: 120,\n step: 1,\n default: 20,\n description: \"Glitch at (frame)\",\n hiddenFromList: false,\n },\n glitchDuration: {\n type: \"number\",\n min: 1,\n max: 60,\n step: 1,\n default: 8,\n description: \"Glitch duration\",\n hiddenFromList: false,\n },\n intensity: {\n type: \"number\",\n min: 0,\n max: 30,\n step: 1,\n default: 6,\n description: \"Intensity (px)\",\n hiddenFromList: false,\n },\n seed: {\n type: \"text-content\",\n default: \"glitch\",\n description: \"Seed\",\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: 300,\n min: 10,\n step: 10,\n description: \"Width\",\n },\n height: {\n type: \"number\",\n default: 130,\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([\"text\",\"fontSize\",\"color\",\"fontWeight\",\"glitchAt\",\"glitchDuration\",\"intensity\",\"seed\",\"speed\"]);\n\nconst ELEMENT_PROP_DEFAULTS: Record<string, unknown> = {\n text: \"GLITCH\",\n fontSize: 96,\n color: \"#171717\",\n fontWeight: \"700\",\n glitchAt: 20,\n glitchDuration: 8,\n intensity: 6,\n seed: \"glitch\",\n speed: 1,\n};\n\ntype RGBGlitchTextElementProps = InteractiveBaseProps &\n InteractiveTransformProps & { readonly width?: number; readonly height?: number } &\n ComponentProps<typeof RGBGlitchTextBase>;\n\nconst RGBGlitchTextInner = forwardRef<\n HTMLDivElement,\n RGBGlitchTextElementProps & { readonly controls: SequenceControls | undefined }\n>(({ controls, name, style, width = 300, height = 130, ...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 ?? \"<RGBGlitchText>\"}\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 <RGBGlitchTextBase\n {...(componentProps as unknown as ComponentProps<typeof RGBGlitchTextBase>)}\n />\n </div>\n </div>\n </Sequence>\n );\n});\n\nexport const RGBGlitchText = Interactive.withSchema({\n Component: RGBGlitchTextInner,\n componentName: \"<RGBGlitchText>\",\n componentIdentity: null,\n schema: elementSchema,\n supportsEffects: false,\n});\n",
"durationInFrames": 90,
"installationMode": "component-owned-sequence"
},
"durationInFrames": 90
}