Skip to content

JSON DSL Overview

The @elucim/dsl package lets you describe Elucim scenes and presentations as JSON documents instead of JSX. This is ideal for AI-generated content, server-side authoring, and storing animations in databases or files.

Every DSL document is an ElucimDocument object:

interface ElucimDocument {
$schema?: string; // Optional JSON Schema URL for editor autocomplete
version: '1.0'; // DSL version (required)
root: RootNode; // Top-level node: scene, player, or presentation
}

The root can be a scene, player, or presentation node. Presentations contain slide children, and each slide typically wraps a player node.

{
"version": "1.0",
"root": {
"type": "player",
"width": 800,
"height": 600,
"fps": 30,
"durationInFrames": 90,
"background": "#0a0a1e",
"children": [
{
"type": "fadeIn",
"duration": 30,
"children": [
{
"type": "circle",
"cx": 400,
"cy": 300,
"r": 60,
"stroke": "#4fc3f7",
"strokeWidth": 3
}
]
}
]
}
}

Every node has a "type" field. The full set of supported types:

TypeDescription
sceneRoot scene with width, height, fps, durationInFrames, children
playerScene with playback controls (controls, loop, autoPlay)
presentationMulti-slide deck with transitions and HUD
slideIndividual slide with title, notes, background, children
sequenceTimed container — offsets children by from frame
groupGroups children without timing changes
TypeDescription
circleSVG circle (cx, cy, r, fill, stroke)
lineSVG line (x1, y1, x2, y2)
arrowLine with arrowhead (x1, y1, x2, y2, headSize)
rectRectangle (x, y, width, height, rx, ry)
polygonPolygon from a points array
textText label (x, y, content, fontSize)
TypeDescription
axes2D coordinate system with ticks and optional grid
functionPlotPlot a math expression as a curve
vectorArrow from origin to a point, with optional label
vectorFieldGrid of vectors computed from an expression
matrixBracketed matrix display
graphNode-and-edge graph visualization
latexLaTeX expression rendered via KaTeX
barChartLabeled bar chart
TypeDescription
fadeInFade children in over duration frames
fadeOutFade children out
drawProgressively draw SVG strokes
writeWrite-on text effect
transformAnimate translate, scale, rotate, opacity
morphMorph between color/opacity/scale states
staggerStagger children with a frame delay between each
parallelAnimate all children simultaneously

Presentations use "type": "presentation" at the root, with "slide" children. Each slide contains a "player" node for its animated content:

{
"version": "1.0",
"root": {
"type": "presentation",
"width": 900,
"height": 650,
"transition": "fade",
"transitionDuration": 10,
"showHud": true,
"slides": [
{
"type": "slide",
"title": "Slide One",
"notes": "Presenter notes here",
"children": [
{
"type": "player",
"width": 900,
"height": 650,
"fps": 30,
"durationInFrames": 120,
"children": [ /* ... */ ]
}
]
}
]
}
}