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": "@paper-design/shaders-react",
"version": "0.0.76"
}
],
"dimensions": null,
"displayName": "Shader Grain Gradient",
"initialProps": null,
"slug": "shader-grain-gradient",
"sourceCode": "import { GrainGradient, type GrainGradientProps } from \"@paper-design/shaders-react\";\nimport { forwardRef, useCallback, useImperativeHandle, useRef, useState, type ComponentProps } from \"react\";\nimport { Interactive, Sequence, continueRender, delayRender, useCurrentFrame, useVideoConfig, type InteractiveBaseProps, type InteractiveTransformProps, type InteractivitySchema, type SequenceControls } from \"remotion\";\n\nconst NEUTRAL_COLORS = [\"#3a3a52\", \"#4a4a68\", \"#5a5a7e\"];\n\ninterface ShaderGrainGradientProps\n extends Omit<GrainGradientProps, \"frame\" | \"ref\"> {}\n\nfunction ShaderGrainGradientBase({\n speed = 1,\n colors = NEUTRAL_COLORS,\n colorBack = \"#12121a\",\n softness = 0.6,\n intensity = 0.2,\n noise = 0.15,\n className,\n ...rest\n}: ShaderGrainGradientProps) {\n const frame = useCurrentFrame();\n const { fps, width, height } = useVideoConfig();\n\n const [handle] = useState(() => delayRender(\"shader-grain-gradient\"));\n const gate = useCallback(\n (element: HTMLDivElement | null) => {\n if (!element) return;\n requestAnimationFrame(() =>\n requestAnimationFrame(() => continueRender(handle)),\n );\n },\n [handle],\n );\n\n return (\n <div\n ref={gate}\n className={className}\n style={{ position: \"absolute\", inset: 0 }}\n >\n <GrainGradient\n speed={0}\n frame={(frame / fps) * speed * 1000}\n colors={colors}\n colorBack={colorBack}\n softness={softness}\n intensity={intensity}\n noise={noise}\n fit=\"cover\"\n width={width}\n height={height}\n {...rest}\n />\n </div>\n );\n}\n\nconst elementSchema = {\n ...Interactive.baseSchema,\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 softness: {\n type: \"number\",\n min: 0,\n max: 1,\n step: 0.05,\n default: 0.6,\n description: \"Softness\",\n hiddenFromList: false,\n },\n intensity: {\n type: \"number\",\n min: 0,\n max: 1,\n step: 0.05,\n default: 0.2,\n description: \"Intensity\",\n hiddenFromList: false,\n },\n noise: {\n type: \"number\",\n min: 0,\n max: 1,\n step: 0.05,\n default: 0.15,\n description: \"Noise\",\n hiddenFromList: false,\n },\n colorBack: {\n type: \"color\",\n default: \"#12121a\",\n description: \"Background\",\n },\n ...Interactive.transformSchema,\n} as const satisfies InteractivitySchema;\n\nconst ELEMENT_PROP_KEYS = new Set([\"speed\",\"softness\",\"intensity\",\"noise\",\"colorBack\"]);\n\nconst ELEMENT_PROP_DEFAULTS: Record<string, unknown> = {\n speed: 1,\n softness: 0.6,\n intensity: 0.2,\n noise: 0.15,\n colorBack: \"#12121a\",\n};\n\ntype ShaderGrainGradientElementProps = InteractiveBaseProps &\n InteractiveTransformProps &\n ComponentProps<typeof ShaderGrainGradientBase>;\n\nconst ShaderGrainGradientInner = forwardRef<\n HTMLDivElement,\n ShaderGrainGradientElementProps & { 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 ?? \"<ShaderGrainGradient>\"}\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 <ShaderGrainGradientBase\n {...(componentProps as unknown as ComponentProps<typeof ShaderGrainGradientBase>)}\n />\n </div>\n </Sequence>\n );\n});\n\nexport const ShaderGrainGradient = Interactive.withSchema({\n Component: ShaderGrainGradientInner,\n componentName: \"<ShaderGrainGradient>\",\n componentIdentity: null,\n schema: elementSchema,\n supportsEffects: false,\n});\n",
"durationInFrames": 150,
"installationMode": "component-owned-sequence"
},
"durationInFrames": 150
}