View raw

Source root fields#

Top-level fields on the project object. Everything that isn't on an element lives here.

interface Source {
  clipkit_version?: string;
  output_format?: "tok-str">'mp4' | "tok-str">'gif';
  width?: number;
  height?: number;
  duration?: number | "tok-str">'auto';
  frame_rate?: number;
  background_color?: string;
  fonts?: FontFace[];
  "tok-cmt">// Scene (3D / lighting) — all optional; omit for flat, unlit 2D
  motion_blur?: { samples?: number; shutter?: number };
  camera?: Camera;
  lights?: Light[];
  environment?: Environment;
  bloom?: { threshold?: number; knee?: number; intensity?: number; radius?: number };
  elements: Element[];
}

Fields#

FieldTypeDefaultDescription
clipkit_versionstring"1.0"The Clipkit Protocol version this Source conforms to. SHOULD be present on documents produced by tooling. Runtimes attempt to render any 1.x document and warn about 2.x+.
output_format'mp4' | 'gif''mp4'What the renderer should produce. Clipkit is video-only: mp4 (H.264 + AAC) is the default; gif is animated (audio dropped).
widthnumber1920Output canvas width in pixels.
heightnumber1080Output canvas height in pixels.
durationnumber | 'auto''auto'Output duration in seconds. 'auto' uses the last element's time + duration.
frame_ratenumber30Output frame rate (fps). The renderer encodes every frame; higher = smoother + bigger.
background_colorstring (hex)'#000000'Solid background color applied behind all elements. Use a full-canvas shape element if you need a gradient.
fontsFontFace[]Font faces the runtime registers before rendering, so the Source doesn't depend on host-installed fonts. See Fonts below.
stylesRecord<string, Style>Named appearance bundles (font/fill/stroke/gradient/radius/opacity) that image/text/shape elements reference via style: "name" — declare once, reference by name, like fonts. Merge: defaults < style < the element's own fields; no cascade. PROTOCOL §2.3.
motion_blurobjectSub-frame motion blur. See Scene (3D / lighting) below.
cameraCameraScene camera (perspective + pose). Omit for flat 2D. See below.
lightsLight[]Scene lights for PBR materials. Omit for unlit. See below.
environmentEnvironmentEnvironment map for material reflections. See below.
bloomobjectPost-process bloom (glow on bright areas). See below.
elementsElement[]requiredThe scene contents (at least one). See common element fields for what's on every element.

Scene (3D / lighting)#

These root fields turn on Clipkit's 2.5D camera, PBR lighting, and post-process passes. Every one is optional — omit them all and the scene renders flat and unlit. For the math and the full pose/lighting model, see PROTOCOL.md §4.4 (camera) and §4.8 (lights & material).

motion_blur#

Renders each frame as a blend of sub-frame samples taken across the shutter window.

FieldTypeDefaultDescription
samplesnumber (int, 1–32)8Sub-frame samples blended per output frame. More = smoother blur, slower render.
shutternumber (0–1)0.5Shutter open time as a fraction of the frame interval. 0.5 = 180° shutter.

camera#

Adds a perspective projection and a movable pose. With no camera the scene is pure flat 2D and z only re-sorts elements. perspective is the only required field. Pose components (x/y/z, rotations) accept keyframes or expressions.

FieldTypeDefaultDescription
perspectivenumber (>0)requiredFocal distance in px. Smaller = stronger perspective foreshortening.
origin_xnumber | stringcanvas centerVanishing-point x (px or string).
origin_ynumber | stringcanvas centerVanishing-point y (px or string).
xnumber0Camera dolly x in px.
ynumber0Camera dolly y in px.
znumber0Camera dolly toward the scene in px; +z = closer.
x_rotationnumber0Camera pitch in degrees.
y_rotationnumber0Camera yaw in degrees.
z_rotationnumber0Camera roll in degrees.
sort'depth' | 'paint''depth'Compositing order: 'depth' (2.5D by z) or 'paint' (fixed layer order, layer 1 on top).

lights#

An array of lights for PBR material elements. Each entry is one of two types (discriminated on type):

ambient — flat fill from every direction.

FieldTypeDefaultDescription
type'ambient'required
colorstring (hex)'#FFFFFF'Ambient light color.
intensitynumber1Ambient brightness multiplier.

directional — a sun-like light with a direction.

FieldTypeDefaultDescription
type'directional'required
azimuthnumber (deg)0Compass direction of the light.
elevationnumber (deg)45Height of the light above the screen plane.
colorstring (hex)'#FFFFFF'Directional light color.
intensitynumber1Directional brightness multiplier.

environment#

An environment map sampled for material reflections — one of two types:

FieldTypeDescription
type: 'gradient', stopsGradientStop[] (2–6)Sky gradient stops, sampled by the reflection ray's vertical component.
type: 'image', srcstringEquirectangular environment image URL.

bloom#

A post-process pass that adds a glow to bright pixels.

FieldTypeDefaultDescription
thresholdnumber (0–1)0.75Luma above which pixels bloom.
kneenumber0.1Soft-knee width around the threshold.
intensitynumber1Bloom strength multiplier.
radiusnumber (px)24Bloom blur sigma.

Fonts#

Each entry registers one face, exactly like a CSS @font-face rule:

interface FontFace {
  family: string;                 "tok-cmt">// name text elements reference
  weight?: number | string;       "tok-cmt">// CSS font-weight; variable fonts may use a range ("100 900")
  style?: "tok-str">'normal' | "tok-str">'italic';
  src: string;                    "tok-cmt">// absolute / relative URL or data: URI
  unicode_range?: string;         "tok-cmt">// CSS unicode-range, e.g. "U+0000-00FF"
}

Multiple entries may share a family — different weights, styles, or unicode_range subsets. Subsetted webfonts (one file per script under identical descriptors) need their unicode_range carried through, or every subset competes for every codepoint and text can fall back to the wrong file's glyphs. The snapshot importer captures all of this automatically.

Examples#

Minimal 16:9, 6 seconds, 30 fps#

{
  "clipkit_version": "1.0",
  "width": 1920,
  "height": 1080,
  "duration": 6,
  "frame_rate": 30,
  "elements": [ /* ... */ ]
}

Vertical 9:16 for Stories / TikTok#

{
  "clipkit_version": "1.0",
  "width": 1080,
  "height": 1920,
  "duration": 8,
  "frame_rate": 30,
  "elements": [ /* ... */ ]
}

Notes#

  • Aspect ratio is implicit — the Source has no aspect_ratio field; set width and height directly. (aspect_ratio does exist as an element field, where it derives a missing box dimension from the other one — see common element fields.)
  • duration: 'auto' is the recommended default while you're iterating; pin a number once the timing is final so adding a hidden element doesn't extend the output.
  • background_color is rendered before any element. Elements with opacity < 1 show this color through.