Skip to main content
Glama

Capture Animation

capture_animation

Use this when you need to render a script's animation timeline to a video, or a 360° turntable of a model for sharing. Capture a kernelCAD script's animationView({...}) timeline to an MP4 (ffmpeg) or a PNG frame sequence, verifying the sampled poses for part interference. FILE ONLY: pass { file } (a .kcad.ts path) — there is no { code } mode, because the capture engine renders from a file on disk (its relative lib.fromSTEP imports resolve against the script directory). MP4 by default; pass { frames_dir } to write frame-0000.png... and skip ffmpeg entirely (mutually exclusive with output_path). Animation-pose interference verification runs by default (keyframe times + segment midpoints) BEFORE any browser/ffmpeg cost; { no_verify: true } skips it and { verify_every: n } additionally samples every n-th frame time. Pass { focus } or { hide } (arrays of feature ids or assembly part names, mutually exclusive) to isolate parts in the rendered frames — same semantics as kernelcad render --focus/--hide; visibility is render-only and does NOT affect the pose verification. Collisions DO NOT fail the call — the artifact is still written as evidence with ok: true; read verified: false + the collisions[] array. TURNTABLE MODE: pass { turntable: true } for a seamless 360° orbit of the model (no animationView record needed) — a share-ready loop for a README, social post or product page. It uses the 'publish' studio look by default (same as render_preview preset: 'publish': key/fill/rim lights, soft contact shadow, clean backdrop, 30° lens, constant auto-framing over the whole orbit, light rig turns with the camera); { preset: 'default' } keeps the engineering look. Knobs: width/height (default 1080×1080, max 2048, even for MP4), duration_ms (one revolution, default 6000), fps (default 30), elevation_deg (default 22), background ('white' default, 'light', 'dark', 'black', '#rrggbb', or 'transparent' with frames_dir only), shadow (default true), environment. output_path ending in .gif writes a looping GIF; otherwise MP4. Frame i sits at az 30° + 360°·i/N (the 360° endpoint is excluded, so the loop is seamless). A turntable has no poses to verify: it reports verify_skipped: true. ENVIRONMENT: needs playwright chromium (npx playwright install chromium) and ffmpeg for MP4/GIF (frames_dir needs neither); the bundled static player is served automatically, no dev server required. Returns { ok, output_path, frame_count, duration_ms, fps, verified, verify_skipped?, collisions: [{ t_ms, a, b, volume_mm3 }], diagnostics }.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fpsNoOverride the animationView record's fps.
fileYesPath to a .kcad.ts script with an animationView({...}) record (any script in turntable mode). Required (no inline { code } mode). Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project.
hideNoHide matching feature ids / assembly part names in the rendered frames. Mutually exclusive with focus. Render-only; does not affect pose verification.
focusNoShow only matching feature ids / assembly part names in the rendered frames. Mutually exclusive with hide. Render-only; does not affect pose verification.
widthNoTurntable frame width in px (default 1080; even for MP4).
heightNoTurntable frame height in px (default 1080; even for MP4).
presetNoTurntable look: 'publish' (default; studio product shot) or 'default' (engineering look).
shadowNoTurntable + publish: soft contact shadow under the model (default true).
no_verifyNoSkip the animation-pose interference verification (default: verify on).
turntableNoSeamless 360° orbit of the model instead of the animationView timeline.
backgroundNoTurntable + publish: 'white' (default), 'light', 'dark', 'black', '#rrggbb', or 'transparent' (frames_dir only — MP4/GIF have no usable alpha).
frames_dirNoPNG-sequence mode directory: write frame-0000.png... and skip ffmpeg. Mutually exclusive with output_path.
duration_msNoTurntable: one full revolution in ms (default 6000).
environmentNoTurntable: HDRI environment override ('studio', 'softbox', 'neutral', 'outdoor', 'warehouse', a URL, or 'none').
output_pathNoMP4 output path (.gif → looping GIF); default <scriptDir>/<basename>-animation.mp4 (-turntable.mp4 in turntable mode). Mutually exclusive with frames_dir.
verify_everyNoAdditionally verify at every n-th frame time of the fps schedule (unioned with the keyframe sample set).
elevation_degNoTurntable: camera elevation above the horizon in degrees (default 22).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • removedOutput schema / properties
      Removed value: -{
      -  "collisions": {
      -    "description": "Colliding poses { t_ms, a, b, volume_mm3 }.",
      -    "items": {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  "diagnostics": {
      -    "items": {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  "duration_ms": {
      -    "type": "number"
      -  },
      -  "error": {
      -    "type": "string"
      -  },
      -  "errorCode": {
      -    "type": "string"
      -  },
      -  "errorHint": {
      -    "type": "string"
      -  },
      -  "failure_kind": {
      -    "type": "string"
      -  },
      -  "fps": {
      -    "type": "number"
      -  },
      -  "frame_count": {
      -    "type": "number"
      -  },
      -  "ok": {
      -    "type": "boolean"
      -  },
      -  "output_path": {
      -    "description": "Written MP4 path (MP4 mode).",
      -    "type": "string"
      -  },
      -  "verified": {
      -    "description": "Whether pose-interference verification passed.",
      -    "type": "boolean"
      -  },
      -  "verify_skipped": {
      -    "type": "boolean"
      -  }
      -}
    • removedOutput schema / required
      Removed value: -[
      -  "ok",
      -  "diagnostics"
      -]
  2. Changed11 schema fields changed
    • addedInput schema / properties / background
      Added value: +{
      +  "description": "Turntable + publish: 'white' (default), 'light', 'dark', 'black', '#rrggbb', or 'transparent' (frames_dir only — MP4/GIF have no usable alpha).",
      +  "type": "string"
      +}
    • addedInput schema / properties / duration_ms
      Added value: +{
      +  "description": "Turntable: one full revolution in ms (default 6000).",
      +  "maximum": 60000,
      +  "minimum": 500,
      +  "type": "number"
      +}
    • addedInput schema / properties / elevation_deg
      Added value: +{
      +  "description": "Turntable: camera elevation above the horizon in degrees (default 22).",
      +  "maximum": 89,
      +  "minimum": -89,
      +  "type": "number"
      +}
    • addedInput schema / properties / environment
      Added value: +{
      +  "description": "Turntable: HDRI environment override ('studio', 'softbox', 'neutral', 'outdoor', 'warehouse', a URL, or 'none').",
      +  "type": "string"
      +}
    • changedInput schema / properties / file / description
      Previous value: -"Path to a .kcad.ts script with an animationView({...}) record. Required (no inline { code } mode). Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project."New value: +"Path to a .kcad.ts script with an animationView({...}) record (any script in turntable mode). Required (no inline { code } mode). Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project."
    • addedInput schema / properties / height
      Added value: +{
      +  "description": "Turntable frame height in px (default 1080; even for MP4).",
      +  "maximum": 2048,
      +  "minimum": 64,
      +  "type": "integer"
      +}
    • changedInput schema / properties / output_path / description
      Previous value: -"MP4 output path; default <scriptDir>/<basename>-animation.mp4. Mutually exclusive with frames_dir."New value: +"MP4 output path (.gif → looping GIF); default <scriptDir>/<basename>-animation.mp4 (-turntable.mp4 in turntable mode). Mutually exclusive with frames_dir."
    • addedInput schema / properties / preset
      Added value: +{
      +  "description": "Turntable look: 'publish' (default; studio product shot) or 'default' (engineering look).",
      +  "enum": [
      +    "default",
      +    "publish"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / shadow
      Added value: +{
      +  "description": "Turntable + publish: soft contact shadow under the model (default true).",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / turntable
      Added value: +{
      +  "default": false,
      +  "description": "Seamless 360° orbit of the model instead of the animationView timeline.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / width
      Added value: +{
      +  "description": "Turntable frame width in px (default 1080; even for MP4).",
      +  "maximum": 2048,
      +  "minimum": 64,
      +  "type": "integer"
      +}
  3. Changed1 schema field changed
    • changedInput schema / properties / file / description
      Previous value: -"Path to a .kcad.ts script with an animationView({...}) record. Required (no inline { code } mode)."New value: +"Path to a .kcad.ts script with an animationView({...}) record. Required (no inline { code } mode). Hosted server: cannot read files from your machine — pass `code`, or `project:<slug>` for a saved project."
  4. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "collisions": {
      +      "description": "Colliding poses { t_ms, a, b, volume_mm3 }.",
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "diagnostics": {
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "duration_ms": {
      +      "type": "number"
      +    },
      +    "error": {
      +      "type": "string"
      +    },
      +    "errorCode": {
      +      "type": "string"
      +    },
      +    "errorHint": {
      +      "type": "string"
      +    },
      +    "failure_kind": {
      +      "type": "string"
      +    },
      +    "fps": {
      +      "type": "number"
      +    },
      +    "frame_count": {
      +      "type": "number"
      +    },
      +    "ok": {
      +      "type": "boolean"
      +    },
      +    "output_path": {
      +      "description": "Written MP4 path (MP4 mode).",
      +      "type": "string"
      +    },
      +    "verified": {
      +      "description": "Whether pose-interference verification passed.",
      +      "type": "boolean"
      +    },
      +    "verify_skipped": {
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "ok",
      +    "diagnostics"
      +  ],
      +  "type": "object"
      +}
  5. Added

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.