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": null,
"displayName": "Drift",
"initialProps": null,
"slug": "drift",
"sourceCode": "import { AbsoluteFill, 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\ninterface DriftProps {\n children: React.ReactNode;\n grow?: number;\n}\n\nfunction DriftBase({ children, grow = 0.035 }: DriftProps) {\n const frame = useCurrentFrame();\n const { durationInFrames } = useVideoConfig();\n const scale = interpolate(frame, [0, durationInFrames], [1, 1 + grow]);\n return <AbsoluteFill style={{ scale: `${scale}` }}>{children}</AbsoluteFill>;\n}\n\nconst elementSchema = {\n ...Interactive.baseSchema,\n grow: {\n type: \"number\",\n min: -0.1,\n max: 0.15,\n step: 0.005,\n default: 0.035,\n description: \"Grow\",\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([\"grow\",\"speed\"]);\n\nconst ELEMENT_PROP_DEFAULTS: Record<string, unknown> = {\n grow: 0.035,\n speed: 1,\n};\n\ntype DriftElementProps = InteractiveBaseProps &\n InteractiveTransformProps &\n ComponentProps<typeof DriftBase>;\n\nconst DriftInner = forwardRef<\n HTMLDivElement,\n DriftElementProps & { 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 ?? \"<Drift>\"}\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 <DriftBase\n {...(componentProps as unknown as ComponentProps<typeof DriftBase>)}\n />\n </div>\n </Sequence>\n );\n});\n\nexport const Drift = Interactive.withSchema({\n Component: DriftInner,\n componentName: \"<Drift>\",\n componentIdentity: null,\n schema: elementSchema,\n supportsEffects: false,\n});\n",
"durationInFrames": 90,
"installationMode": "component-owned-sequence"
},
"durationInFrames": 90
}