create_motion_graphic_from_code
Read create-motion-graphics Skill first.
Create a new Motion Graphic asset from inline React/JSX code supplied in this tool call.
For captions use edit_captions action="renderer" with code/properties; read useSpecialEffects().caption_v1.
JSX: const Component = ({item}) => {...}. Only functions at top level; keep constants inside. Read item.props; globals directly, not Remotion.*. No useItem().
For direct-authored MGs, choose a visual mechanism for the edit. Before a batch, name each MG's viewer job. Reuse only an intentionally recurring component with the same editorial job, information structure and visual form; otherwise share palette/type/motion across separate assets. Text/custom style alone is not batch permission: create one representative MG for user approval. Compare composed settled frames side by side; repeated surfaces/anchors/rhythms must serve a recurring viewer job.
Complete entrance, hold and exit motion within the intended timeline span.
Size: width/height define the natural box around visible content. No transparent timeline-sized wrapper for overlay placement; timeline dimensions are for full-frame MGs only. Place/scale with edit_item.
Fonts: only exact search_fonts family names; machine fonts (Arial, Comic Sans MS, PingFang SC) fail cloud export.
Web 3D (not Desktop): use injected Remotion ThreeCanvas with explicit width/height, THREE math/material constants and supported Drei helpers; no imports. Read the create-motion-graphics Three.js reference for helpers and lighting/camera recipes. useGLTF needs a stable public ChatCut S3 HTTPS model URL; prefer self-contained GLB with CORS. No temporary/signed URLs or local paths. Drive all motion, including camera/model animation, with useCurrentFrame()/fps; never useFrame, clocks, controls or timers.
Public-safe: no repo/local files, attachment paths, servers, or backend paths. Creates the asset only; patch existing MGs with edit_asset inline json.code.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>",
"height": "<height>",
"name": "<name>",
"width": "<width>"
},
"name": "create_motion_graphic_from_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Inline pure JavaScript/JSX, no imports/exports or file path. Exactly one top-level const Component = ({item}) => {...}; only component/helper functions at top level. Keep constants, runtime lookups and scene resources inside functions; memoize resources with React.useMemo. Read editable values from item.props. Call injected useCurrentFrame(), useVideoConfig(), interpolate(), spring() and ThreeCanvas directly, never Remotion.*. React hooks use React.useMemo/React.useEffect; there is no useItem(). No window/global. | |
| name | Yes | Asset display name. | |
| width | Yes | Motion Graphic natural box width in pixels. | |
| height | Yes | Motion Graphic natural box height in pixels. | |
| projectId | No | Project for this call (full ID or unambiguous prefix). Explicit-timeline calls never change the target of later calls; legacy project selection applies otherwise. | |
| properties | No | Editable Motion Graphic properties: objects with key, label, type, defaultValue. Use a provided or approved image of a subject (character, product, logo or photo) as an image property whose defaultValue is that asset instead of redrawing it; if it cannot be used as is, tell the user first. | |
| timelineId | No | ||
| description | No | ||
| renderContract | No | Optional legacy hint. Shared web validation grants the stamp; this value is not required and cannot bypass validation. | |
| durationInFrames | No | Motion Graphic duration in active-timeline frames. Mutually exclusive with durationInSeconds. | |
| durationInSeconds | No | Motion Graphic duration in seconds. Mutually exclusive with durationInFrames. | |
| chatcutSpecialEffectUsed | No | Optional Web-only media-analysis declarations. Omit for ordinary MG/effect/caption work and preserve existing values on unrelated revisions. Transitions and Desktop do not support these readers. caption_v1 is private to caption-owned code. |