Code API reference
Version 1.0.0 · Package API 1 · Code usage guide
Plugins
code.python(python): Python authoring components.code.syntax(data-source): Semantic syntax highlighting through the host-configured Animate syntax service.
Import these symbols from manifest.code.
MoveXStart(entities: EntitySelection, value: float, time: Duration=0.5, interpolation: InterpolationMode=Interpolation.SmoothStep)
Animate the x_start endpoint of one or more CurrentLine markers.
value is a resolved horizontal coordinate. time is seconds or a TimeUnit.
MoveXEnd(entities: EntitySelection, value: float, time: Duration=0.5, interpolation: InterpolationMode=Interpolation.SmoothStep)
Animate the x_end endpoint of one or more CurrentLine markers.
value is a resolved horizontal coordinate. time is seconds or a TimeUnit.
CurrentLine(grid: TextGrid, initial_position_y: float, color: RGBColor=(48, 48, 48), id: str | None=None)
A rectangle behind a TextGrid row.
Args
grid— TextGrid supplying row size and viewport resolution.initial_position_y— Zero-based row coordinate.color— RGB fill color.id— Optional explicit identity.
Move its position in grid rows; x_start/x_end control resolved horizontal bounds.
insert_highlighted(manifest: Video2dManifest, colors: Mapping[str, RGBColor], grid: TextGrid, text: str, language: str='js', position: Vector2 | None=None, prefix: str='', postfix: str='', opacity: float=1) -> list[Character]
Insert syntax-colored text through the code.syntax data source.
Args
manifest— Manifest declaring Code and a configured data broker.grid— Destination TextGrid.text— Source text to highlight.colors— Explicit palette mapping every returned token category to an RGB color.language— Case-insensitive grammar ID or alias, such as js, ts, py, cpp, or bash.position— Optional cursor cell position.prefix— Leading syntax context, excluded from inserted text.postfix— Trailing syntax context, excluded from inserted text.opacity— Initial character opacity.
Returns
The inserted Character list. Token colors come only from the supplied palette. Missing categories raise KeyError.
Raises
RuntimeError— No host broker is configured or the service request fails.