Skip to main content
A composition in Helios is a combination of HTML/CSS/JavaScript and configuration that defines what should be rendered into a video.

Composition basics

At its core, a composition is:
  1. Configuration: Duration, FPS, dimensions, and other metadata
  2. Content: HTML, CSS, and JavaScript that renders the visual output
  3. Timeline: Optional tracks and clips for multi-layer compositions

Creating a composition

See packages/core/src/types.ts:11 for the full HeliosConfig interface.

Configuration options

Required properties

Duration of the composition in seconds (not frames).
  • Must be non-negative
  • Can be changed dynamically with setDuration()
  • Frames are calculated as duration * fps

Optional properties

Input props and schemas

Compositions can accept user-defined data through inputProps. This is useful for creating reusable templates.

Basic input props

Schema validation

Define a schema to validate and provide defaults for input props:
The schema is automatically validated on construction and when calling setInputProps(). See packages/core/src/schema.ts for the full validation API.

Timeline and clips

Helios supports multi-track timelines for complex compositions.

Timeline structure

See packages/core/src/types.ts:31 for timeline type definitions.

Active clip tracking

Helios automatically computes which clips are active at the current time:
The computation happens at Helios.ts:508:

Composition file structure

For server-side rendering, compositions are typically standalone HTML files:
The bindToDocumentTimeline() call is critical for server-side rendering. It tells Helios to read from document.timeline.currentTime (or __HELIOS_VIRTUAL_TIME__ in headless mode) instead of driving its own playback loop.
See Helios.ts:1085 for the timeline binding implementation.

Captions and markers

Captions

Helios supports SRT and WebVTT caption formats:
Or pass parsed cue objects:
See packages/core/src/captions.ts for parsing implementation.

Markers

Markers are named points on the timeline:

Playback range

Render or preview only a portion of the composition:
When a playback range is active:
  • play() starts at the range start
  • Playback stops at the range end
  • Looping wraps within the range

Composition patterns

React composition

Canvas composition

Multi-scene composition

Best practices

Use absolute positioning

Preload assets

Use CSS animations for simple motion

Bind to document timeline for rendering

Without bindToDocumentTimeline(), the renderer won’t be able to control the composition’s timeline via CDP virtual time.

Next steps