Loading...
Loading...
Agent tooling for Motion Canvas — seek, screenshot, scene graph inspection, settings control, and rendering via HTTP API. Requires a browser with the editor open.
npx skill4agent add videozero/skills motion-canvas-agentAgent (curl/script) ──HTTP──▶ Vite Server (agent-plugin.ts) ──HMR WS──▶ Browser (agent-client.ts)
│ │
▼ ▼
screenshots/ Player + Renderer
(PNG files) + ProjectMetadataassets/agent-plugin.tsassets/agent-client.tssrc/import {defineConfig} from 'vite';
import motionCanvas from '@motion-canvas/vite-plugin';
import {agentPlugin} from './agent-plugin';
export default defineConfig({
plugins: [
motionCanvas(),
agentPlugin({screenshotDir: './screenshots'}),
],
});import {makeProject} from '@motion-canvas/core';
import {agentClient} from './agent-client';
export default makeProject({
plugins: [agentClient()],
scenes: [...],
});npm start
# Open http://localhost:9000 in a browserhttp://localhost:9000/__agent| Method | Endpoint | Body | Response |
|---|---|---|---|
| | — | |
| | | |
| | — | |
| | — | |
| | — | |
| | — | |
| Method | Endpoint | Body | Response |
|---|---|---|---|
| | | |
| | — | |
| Method | Endpoint | Body | Response |
|---|---|---|---|
| | — | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| Method | Endpoint | Body | Response |
|---|---|---|---|
| | | |
| | — | |
| Method | Endpoint | Body | Response |
|---|---|---|---|
| | — | |
| | — | |
| | — | |
| Method | Endpoint | Body | Response |
|---|---|---|---|
| | — | |
| | — | |
GET /__agent/scene-graph{
"scene": "my-scene",
"graph": {
"type": "View2D",
"key": "my-scene/View2D[1]",
"position": {"x": 960, "y": 540},
"size": {"width": 1920, "height": 1080},
"children": [
{
"type": "Rect",
"position": {"x": 0, "y": 0},
"size": {"width": 400, "height": 300},
"fill": "#1E293B",
"children": [
{
"type": "Txt",
"text": "Hello World"
}
]
}
]
}
}typekeypositionsizeopacityfilltextchildren# 1. Check connection
curl -s localhost:9000/__agent/status
# 2. Set resolution
curl -s -X POST localhost:9000/__agent/settings/size \
-H "Content-Type: application/json" -d '{"width": 1920, "height": 1080}'
# 3. Seek to a frame
curl -s -X POST localhost:9000/__agent/seek \
-H "Content-Type: application/json" -d '{"frame": 60}'
# 4. Screenshot
curl -s -X POST localhost:9000/__agent/screenshot \
-H "Content-Type: application/json" -d '{"name": "check-1"}'
# → Read ./screenshots/check-1.png
# 5. Inspect scene graph
curl -s localhost:9000/__agent/scene-graph
# 6. Check which scene we're in
curl -s localhost:9000/__agent/scenes
# 7. Check errors
curl -s localhost:9000/__agent/errors
# 8. Change background
curl -s -X POST localhost:9000/__agent/settings/background \
-H "Content-Type: application/json" -d '{"color": "#000000"}'
# 9. Trigger render
curl -s -X POST localhost:9000/__agent/render--host 0.0.0.0screenshotDiragentClient()Plugin.player()Plugin.renderer()Plugin.project()sharedpreviewrendering.get().set()render(settings)abort()scene.getView().peekChildren()| File | Copy to | Purpose |
|---|---|---|
| Project root | Vite plugin — HTTP endpoints + WS relay |
| | Runtime plugin — Player/Renderer/Project control + canvas capture |