How a video is written
A document built up in three steps, from one sentence and one picture to a drawing that carries on across the story.
A video is one file, doc.tsx. Its skeleton (scenes, lines, parts and animations) is read by the engine as tags and literals;
what is inside a part is ordinary React that the engine runs. The idea says why; this page shows how.
1. A sentence and a picture
import {Doc, Scene, Line, Part, Animation, Appear} from '@visotalk/jsx';
export default <Doc id="demo" title="A short explainer" lang="en" theme="visotalk/dark" canvas="16x9">
<Scene id="intro">
<Line id="l1">The first thing we name is a label.</Line>
<Part id="tag" x={560} y={380} w={800} h={160}>
{() => <div style={{fontSize: 96, textAlign: 'center'}}>a label</div>}
</Part>
<Animation>
<Appear target="tag" line="l1" word="label"/>
</Animation>
</Scene>
</Doc>;- A
Lineis what is spoken, and it is shown as the caption. - A
Partis a box of React. It is invisible until anAppearshows it, and a scene's parts end with the scene. <Appear … word="label"/>shows the part on the word “label”, wherever the narration says it. You never write a time.
2. Many things, each on its own word
A part draws from data, and the elements inside it can be addressed one by one. Obj registers an element so an action can name it:
import {Obj} from '@visotalk/runtime';
const WAITS = [123, 33, 14];
<Scene id="waits">
<Line id="l1">The second billion took one hundred and twenty three years.</Line>
<Line id="l2" text="The third took only 33 years.">The third took only thirty three years.</Line>
<Part id="chart" x={160} y={220} w={1600} h={500}>{() => (
<div>{WAITS.map((years, i) => <Obj key={i} id={`bar${i}`} style={{height: 60, width: years * 10, background: 'var(--vt-data)'}}/>)}</div>
)}</Part>
<Animation>
<Appear target="bar0" line="l1" word="second billion"/>
<Appear target="bar1" line="l2" word="third"/>
</Animation>
</Scene>- The bars are a
.mapover data, not hand-placed shapes. - Numbers are spelled out in the spoken line and written as digits in the caption (
text=). - Where an action starts is exactly one of: a phrase of a line (
lineandword, withedge="end"for the end of it), a phrase named inside the line (<Mark id="rise">…</Mark>andmark="rise"), the start or end of a line, the end of another action (after="id"), or a time in the scene (at={2.5},at="start",at="end").offset={seconds}shifts any of them. - When a phrase occurs twice in a line, name which one with
nth={2}, or use a<Mark>.visotalk validate --anchorsshows what each anchor finds. after="id"starts an action when another one ends, so two actions stay in order when a duration changes. A chain always begins on a word.targetcan be a list (target={["a", "b"]}) withstagger={0.1}between them.
3. One drawing that carries on
Tween moves a number, and the part draws from it. One angle can move every tick of a dial and its hand, or the Moon around the Earth:
const angle = useProp('moon', 'angle', 0); // inside the part: the value now, 0 before the first tween<Tween target="moon" to={{angle: 90}} line="m7" word="week later" dur={2}/>
<Tween target="moon" to={{angle: 180}} line="m8" word="between" dur={2.2}/>
<Set target="phase-name" to={{text: 'Full moon'}} line="m8" word="full moon"/>A Tween takes dur, an easing (easeInOut, easeOutQuart, easeOutBack(2.2), cubic-bezier(…) and others), repeat and yoyo (a breathing bar, a button that
is pressed and comes back), and it moves colours (to={{fill: '#426894'}}) and lengths (to={{w: '40%'}}) as well as numbers. Tween and Set keep changed props in to={{...}}, separate from their timing and target attributes. x, y, scale and rotate move the target
itself with no code in the part.
The picture continues from sentence to sentence instead of being redrawn. A part declared in <Doc> stays across scenes, with the
numbers the document gave it; a scene's part is declared again in the next scene and starts from its base props. The
moon-phases example is built this way.
Words a person may edit
A few words a part draws can be left to a person to edit, in the web app or in the document: useText('title', 'The words as written') in the part, and
<Doc texts={{title: '…'}}> holds what they wrote in its place. Use it for the few words worth editing, not for every label.
Music and sounds
A bed of music or an effect is an <Asset kind="audio"> played by a <Sound> in a scene, beside its <Animation>:
<Sound asset="bed" at="start" loop volume={-8} duck={4} fadeIn={1.2} fadeOut={4}/>
<Sound asset="tick" line="l2" word="five" volume={-3}/>It starts where an action may (a word, at, the scene's edges). volume and duck are in dB: the narration is never touched, volume is how far
under its file the sound sits, and duck how much further it steps back while someone speaks. loop without dur runs to the end of the film.
render mixes the sound with the narration.
Voice, language and captions
- The voice is a local Kokoro model unless the document names another:
<Doc voice="minimax:English_captivating_female1" speed={1}>(elevenlabs:,volcengine:andopenai:work the same), or a module of your own (voice="./my-voice.mjs:name"). Alexiconfixes how a word is pronounced. The CLI page has the details. - The language is
langon<Doc>. English gets word times from the aligner; Mandarin is spoken too, and in Chinese, Japanese and Thai a phrase is any run of characters. - Captions come from the lines.
exports={{captions: 'burned'}}paints them on the picture (the default);'sidecar'leaves them off the picture and writescaptions.srt;'words'paints the spoken words in the lower half of a tall frame, each as it is said;'none'shows nothing. - The canvas is
canvas="16x9"or"9x16"; a part that must fit either readsuseCanvas().
Another language
A second language is doc.<lang>.json beside doc.tsx. It holds only what the language changes: every line, the phrase each
animation names in it, and optionally a title, a voice, fonts, captions, the words parts draw (useText) and media cut for it.
{
"lang": "fr",
"voice": {"voice": "elevenlabs:<a French voice>"},
"lines": {
"l1": {"text": "La première chose que nous nommons est une étiquette."}
},
"anchors": {
"l1": {"label": "étiquette"}
}
}<Appear target="tag" line="l1" word="label"/> now starts on "étiquette", wherever the French narration says it. Every command but
export takes --lang fr; the French video has its own narration and work folder. validate --lang fr reports a line or an
anchor the file leaves out. Anchor on words and scene edges, not on seconds, and end what spans a scene with until, so nothing
is timed by one language's length.
Real material
Images and video are declared as assets with their licence, and credits are generated from them:
<Asset id="launch" kind="image" src="media/rocket-launch.jpg"
license={{id: 'PD-USGov', attribution: 'Agency/Photographer', obligations: []}}
source="https://example.org/the-page"/>A clip is an <Asset kind="video"> drawn in a part with <Video asset="launch" … />; the player and the export both show the exact
source frame for the engine's clock. Liftoff opens on a real NASA clip. Keep assets in a media/ folder beside the document,
named in lower case with hyphens, as PNG, JPEG, GIF, WebP, MP4 or WebM: visotalk export refuses other names.
Sharing a talk
A talk travels as one file. visotalk export doc.tsx writes talk.visotalk: the document, the files it uses, its narration, captions and credits.
visotalk import talk.visotalk opens it in a new directory, checked like any document, and nothing in it runs. export --player writes the
finished talk instead, which plays and has no document in it, and visotalk play talk.visotalk serves either kind. For a quick review without
rendering, visotalk build doc.tsx --artifact writes a player page you can publish as a Claude artifact.
What the agent does with it
The skill gives the agent a way of working, not a procedure it is forced through. It asks for a video designed like a studio would, with principles (a thing is on screen only from the word that names it; one visible change per sentence; motion that means something; never what a slide deck would give) and a way that works:
- Gather the facts, then write the narration as short lines, one idea each, with numbers as words.
visotalk init doc.tsx --lines lines.jsongives a valid skeleton, with the narration being prepared in the background. - Decide what each scene shows before drawing it, draw one scene, and run
validate; every issue points atdoc.tsx:line:coland most carry a fix. - Look:
sheetfor a quick survey of every line,stillfor a full-size frame at any moment with what was measured on it. What the agent sees in one scene decides how it designs the next. qafor what the eye misses (overflow, clipping, text over text, a picture on screen for under two seconds, a weak anchor), thenrender.renderstops only for things that are wrong: an animation target no part registers, or narration that is only estimated.
The skill and its references (the syntax, drawing a part, material from the internet, explainers that report a source) are in
skills/visotalk. visotalk schema prints every tag, action and hook the validator knows.