The scene format
A scene is one JSON object: a canvas, a starting state, layers that read the state, and rules that change it. This page is the short version; every rule is in the full specification, in the source. A scene that breaks one is refused whole, with the path to the bad value, such as layers[2].tracks.y[1].frame.
A whole scene
This block writes a scene and checks it with a customer's row, so you can paste it into a terminal:
cat > hi.json <<'SCENE'
{
"format": "makinist/3",
"canvas": { "width": 1080, "height": 1080, "fps": 60, "duration_frames": 240 },
"background": "#0b0d12",
"state": { "name": "", "accent": "#2dd4bf", "done": 0 },
"layers": [
{ "id": "card", "kind": "rect",
"props": { "x": 140, "y": 340, "w": 800, "h": 400, "radius": 32, "fill": "#141821" },
"tracks": { "opacity": [{ "frame": 0, "value": 0 }, { "frame": 20, "value": 1 }],
"y": [{ "frame": 0, "value": 380 }, { "frame": 30, "value": 340, "ease": "back.out(1.2)" }] } },
{ "id": "hello", "kind": "text",
"props": { "x": 140, "y": 560, "size": 72, "width": 800, "fill": { "bind": "accent" } },
"text": { "template": "hi, {name}", "font": "Instrument Serif", "align": "center" } }
],
"on": [
{ "event": "key:space", "if": { "done": 0 }, "from": 30, "set": { "done": 1, "name": "you" }, "action": "start" }
]
}
SCENE
echo '{"name": "Inês", "accent": "#f472b6"}' > ines.json
makinist check hi.json --data ines.json
Canvas and time
canvas gives the size in pixels, the frames per second and the length in frames. Time is the frame number: every value at a frame is computed from the scene, the inputs so far and that number alone, with the same arithmetic everywhere, so a frame is identical on every machine and its hash proves it.
State and data rows
state holds named values, strings or numbers, at most 1024. A key's type never changes. A data row is a JSON object of state values, set at the first frame: {"name": "Inês", "accent": "#f472b6"}. One scene, one row per customer. A key the row does not give keeps the scene's value.
Layers
Layers draw in order, the first at the back. Each has an id, a kind and props:
rect:x,y,w,h,fill; optionalradiusandopacity.fillis a colour (#rrggbbor#rrggbbaa) or a linear gradient of 2 to 16 stops.text:x,y(the first line's baseline),size,fill; optionalwidth(the box it wraps in),line_height,opacity; andtext.template, where{key}inserts a state value, withtext.fontandtext.align(left,center,right).image:x,y,w,h; optionalradius,opacity;image.sha256andimage.fit(fill,contain,cover).chart:x,y,w,h,fill; optionalopacity,grow,gap,radius,width; andchart, below.
Any prop can be {"bind": "<key>"}, so a row decides it: a colour, a width, a photo.
Tracks
tracks animate numeric props with keyframes, {"frame": 30, "value": 340, "ease": "power2.out"}. Before the first keyframe the value is the first's, after the last it is the last's. The eases are linear, power2.out and back.out(s), with GSAP's curves. When a prop has a track, the track wins.
Images
An image is a PNG or JPEG of at most 4096 pixels a side, named by the SHA-256 of its bytes and kept as images/<hash> beside the scene. A scene never names a place to load from, only a hash, so it cannot reach the network, and the same hash always draws the same pixels. A row can choose the image by giving an image key a hash.
Fonts
Four fonts come with every player, so text measures and wraps the same everywhere: Inter Regular, Inter SemiBold (the default), Inter Display Bold and Instrument Serif.
Rules and answers
on rules turn inputs into state: {"event": "key:space", "set": {"done": 1}}. A tap or a click is key:space. A rule may have:
"if": {"done": 0}: it fires only while the state holds these values, so a button answers once;"from": 30: it fires only from that frame on, so a button answers only after it appears;"action": "start": a name the page turns into a link or anything else.
Every input is kept in the session's log with its frame, so a session replays exactly.
Asking
A scene with ask lets the viewer ask it a question. It gives the model its instructions, the state keys it may write, and for each the values it may choose; the model's answer is a change of state, checked like a row, so it can only move what the scene allows. The answer is logged, so the replay needs no model.
Numbers that move
tween names number keys that move to a new value instead of jumping: when a rule, a row or live data changes one, what is drawn goes from what was on the screen to the new value over its frames, with its ease. A change in the middle of a move goes on from where the number is, with no jump back. Rules, answers and the state a player reports read the value itself.
In a template, {key:N} writes a number with N decimals, 0 to 3, and {key:,N} groups it in threes: {fans:,0} writes 48,210. A text's count prop multiplies every such number, so a track of count from 0 to 1 counts it up.
cat > score.json <<'SCENE'
{
"format": "makinist/4",
"canvas": { "width": 1280, "height": 720, "fps": 60, "duration_frames": 300 },
"background": "#0b0d12",
"state": { "home": 0, "away": 0, "fans": 48210 },
"tween": { "home": { "frames": 30, "ease": "power2.out" }, "away": { "frames": 30, "ease": "power2.out" } },
"layers": [
{ "id": "score", "kind": "text",
"props": { "x": 340, "y": 360, "size": 160, "width": 600, "fill": "#ffffff" },
"text": { "template": "{home:0} – {away:0}", "font": "Inter Display Bold", "align": "center" } },
{ "id": "fans", "kind": "text",
"props": { "x": 340, "y": 460, "size": 32, "width": 600, "fill": "#a3acbd" },
"text": { "template": "{fans:,0} watching", "align": "center" },
"tracks": { "count": [{ "frame": 0, "value": 0 }, { "frame": 90, "value": 1, "ease": "power2.out" }] } }
]
}
SCENE
echo '[{"frame": 120, "set": {"home": 1}}]' > goal.json
makinist check score.json --log goal.json
Charts
A chart layer draws numbers in its box: chart.type is bar, line or area, and chart.values holds 1 to 64 numbers or number keys, so a row brings its own bars. chart.max is the value at the top of the box, a number or a key; without it the largest value is. Bars stand on the bottom edge, or start at the left one with "direction": "right", and chart.highlight draws the bar at a position, counted from 1, in another colour. grow scales every value, so a track of it from 0 to 1 grows the chart in. A bar's fill may be a gradient, laid on each bar.
cat > months.json <<'SCENE'
{
"format": "makinist/4",
"canvas": { "width": 1280, "height": 720, "fps": 60, "duration_frames": 300 },
"background": "#0b0d12",
"state": { "jan": 2, "feb": 1, "mar": 3, "apr": 6, "best": 4 },
"layers": [
{ "id": "months", "kind": "chart",
"props": { "x": 140, "y": 160, "w": 1000, "h": 400, "fill": "#2dd4bf", "radius": 8, "gap": 24 },
"chart": { "type": "bar", "values": [{ "bind": "jan" }, { "bind": "feb" }, { "bind": "mar" }, { "bind": "apr" }],
"highlight": { "index": { "bind": "best" }, "fill": "#f59e0b" } },
"tracks": { "grow": [{ "frame": 30, "value": 0 }, { "frame": 90, "value": 1, "ease": "back.out" }] } },
{ "id": "trend", "kind": "chart",
"props": { "x": 140, "y": 600, "w": 1000, "h": 80, "fill": "#818cf8", "width": 4 },
"chart": { "type": "line", "values": [{ "bind": "jan" }, { "bind": "feb" }, { "bind": "mar" }, { "bind": "apr" }] } }
]
}
SCENE
makinist check months.json
Text that comes in
A text's reveal prop draws that many characters, so a track of it types the text; the lines are laid out from the whole text first, so nothing moves while it types. Or text.animate brings the words or the lines in one after another: each starts stagger frames after the one before, takes frames to arrive, and rises from rise pixels below. A text has one of the two, not both.
cat > headline.json <<'SCENE'
{
"format": "makinist/4",
"canvas": { "width": 1280, "height": 720, "fps": 60, "duration_frames": 300 },
"background": "#0b0d12",
"state": { "line": "Every chance, live from the ground." },
"layers": [
{ "id": "typed", "kind": "text",
"props": { "x": 140, "y": 300, "size": 48, "width": 1000, "fill": "#ffffff" },
"text": { "template": "{line}", "font": "Instrument Serif" },
"tracks": { "reveal": [{ "frame": 0, "value": 0 }, { "frame": 90, "value": 35 }] } },
{ "id": "words", "kind": "text",
"props": { "x": 140, "y": 460, "size": 48, "width": 1000, "fill": "#ffffff" },
"text": { "template": "{line}", "animate": { "by": "word", "from": 120, "stagger": 6, "frames": 24, "ease": "power2.out", "rise": 24 } } }
]
}
SCENE
makinist check headline.json
Live data
A playing video can be given data while it plays. On a page, set on the player takes an object of state keys and values: player.set({ "home": 1, "minute": 23 }). In a terminal, makinist play --live reads one such object a line from standard input. Each is checked like a row, logged at the frame on screen and drawn at once, so a session with live data replays exactly, with no feed. One the scene refuses is reported with its path, set["home"]: expected an existing key and a value of its type, and changes nothing. The scene still fetches nothing: the page or the program sends the data.
echo '[{"frame": 90, "set": {"home": 1, "minute": 23, "h2": 7}}, {"frame": 400, "set": {"away": 1}}]' > feed.json
makinist check live.json --log feed.json
Signed scenes
A scene can be signed: an Ed25519 signature of the file's exact bytes, in base64, in <scene>.sig beside it, made with makinist sign. A player given keys, public keys separated by spaces, refuses a scene with no signature, a malformed one, or one no given key signed, and draws nothing.
<makinist-player scene="https://makini.st/scenes/ticket.json" keys="<public key>"></makinist-player>
Versions
A scene says its version in format: makinist/0 to makinist/4, each adding to the one before. Players read them all, and an older scene draws exactly as it always did: a scene of any earlier version plays unchanged in every later engine, and a version is never dropped before 1.0.