RenderingVideo Docs
Code Element
Render source code snippets in JSON videos
Code Element
Use code to show source snippets in technical explainers, API walkthroughs, and before/after code videos.
Shape
interface CodeClip extends BaseClip {
type: "code";
code: string;
language?: string;
fontFamily?: string;
fontSize?: number;
lineHeight?: number;
selection?: unknown;
}
Fields
code: source text, requiredlanguage: language id reserved for syntax highlightingfontFamily: overridesstyle.fontFamilyfontSize: overridesstyle.fontSizelineHeight: overridesstyle.lineHeightselection: forwarded to the RevideoCodecomponent
Example
{
"type": "code",
"start": 0,
"duration": 4,
"code": "const video = renderJson({ effects: ['code'] });",
"transform": {
"x": "50%",
"y": "50%",
"width": 900,
"height": 360
},
"style": {
"fontSize": 42,
"fill": "#dbeafe"
},
"transition": {
"type": "blur",
"duration": 0.4
}
}