Product videos as code

Why Video Studio describes every scene as a small canvas function — and the determinism check that keeps preview and export identical.

Short product videos are everywhere: a launch teaser, a feature walkthrough, a clip for the changelog. They are also a chore. You either learn a video editor or wait for someone who knows one. And when the UI changes next month, you start over.

Video Studio, a Labs feature in PaneScale, takes a different approach: a video is code. And because it is code, a coding agent can write and edit it with you.

Scenes are functions

A video is a timeline of scenes. Each scene is the body of a small function that draws one frame on a canvas:

A scene
ctx.fillStyle = theme.bg;
ctx.fillRect(0, 0, w, h);
const k = u.easeOut(u.clamp(t * 2, 0, 1));
ctx.fillStyle = theme.text;
ctx.font = `600 ${h * 0.09}px Inter`;
ctx.textAlign = 'center';
ctx.fillText('Every agent, one window', w / 2, h / 2 + (1 - k) * 40);

t runs from 0 to 1 over the scene. w and h are the frame size, theme holds the colors, and u has helpers — easing, word-by-word text, counters, device frames for a browser or a phone, a typing terminal, a clicking cursor. A scene can draw text, shapes, charts, typing code — anything a canvas can draw.

Why this works well with agents

Agents are good at writing small, self-contained functions with a clear contract. “Make the title slide in from the left and hold for a second” is a precise change to a twenty-line function. Ask for it, review the result in the preview, and undo it if you don’t like it — every agent edit can be reverted.

Thirteen templates — from a logo reveal and a kinetic title to a browser mockup with a clicking cursor and an end card — give the agent and you a starting point. For bigger changes the agent writes a short plan first, and you watch the new scenes land on the timeline while it works.

The determinism check

There is one property a scene must have: drawing the same moment twice must produce the same picture. If a scene uses Math.random() or the current time, the preview you approved and the video you export will differ.

So before export, Video Studio renders every scene twice at the same moment and compares the pixels. If they differ, the scene fails the check with a clear explanation. Alongside it run checks for syntax, runtime errors at the start, middle and end of each scene, scenes that look like a still image, and formats that are too long for social media. The result is a score out of 100.

Captions that stay readable

Captions are burned into the video, because many people watch without sound — kinetic, plain or in a big social style. The checks warn when a caption is on screen for less time than its words need, or when text has too little contrast.

Export without extra tools

Export encodes the timeline frame by frame inside the app — faster than real time, with motion blur — and writes MP4 (H.264 with AAC sound), WebM or a looping GIF. No ffmpeg to install. The same timeline re-composes for 16:9, 9:16, 1:1 and 4:5, so one run can export every format, from 720p to 2160p. Any single frame can also be saved as a PNG for a thumbnail.

When the UI changes

That is the best part. When your product changes, you don’t re-record anything. You ask the agent to update the scenes — and the next video is one export away.

Read the Video Studio docs or the scene API.

Why not record the screen?

Screen recordings are the obvious alternative, and they have their place — the feature films on this website are recorded in the real app. But for short marketing clips they have three weaknesses:

  • They go stale. A recording shows the interface on the day it was made. Rename a button and every recording with that button is wrong.
  • They are hard to edit. Changing one word in a title card means opening an editor, finding the frame and exporting again — for every format you need.
  • They are not reviewable. Two versions of a video can only be compared by watching both. Two versions of a scene function can be compared as a diff.

Code-based video turns all three around: a scene is updated like any other source file, edited by an agent in seconds, and reviewed line by line.

A short session, start to finish

  1. Start from a template — a kinetic title, a browser mockup with a clicking cursor, an end card.
  2. Ask the agent for the story: “Three scenes: the problem, the grid with four agents, the download.” For bigger changes it writes a short plan first, and the scenes appear on the timeline as it works.
  3. Watch the preview and ask for changes — “hold the second scene a second longer”, “make the title slide in from the left”. Each edit can be undone.
  4. Run the checks. Determinism, runtime errors, still-looking scenes, caption timing and contrast, format length — summarized as a score out of 100.
  5. Export every format at once: 16:9 for the website, 9:16 and 1:1 for social media, a PNG frame for the thumbnail.

The whole loop stays inside one app, and nothing leaves your computer.

Questions about Video Studio

Do I need to know canvas programming?

No. The agent writes the scenes, and the helpers cover the common needs — easing, word-by-word text, counters, device frames, a typing terminal, a clicking cursor. Knowing a little JavaScript helps when you want to adjust a detail yourself, because each scene is short and readable.

Can it use my own fonts and colors?

Scenes draw with a theme that holds the colors, and fonts are set like on any canvas. Matching your brand is a matter of setting the theme once and asking the agent to use it.

Is Video Studio always on?

It is a Labs feature that is on by default. If you don’t need it, switch it off in Settings → Labs and its tab disappears.

Sources

More articles

What a good morning report looks like

An overnight run is only as useful as what it leaves behind. The rules behind PaneScale’s morning report, and how to review one in ten minutes.

A grid you can drag into any shape

Design notes on the resizable terminal grid in PaneScale 0.2 — seams, crossings, snapping and why the shape is saved per workspace.