Skip to main content
Drivers are the abstraction layer that connects Helios’s timeline to the rendering environment. They control how time advances and how animations synchronize.

Driver architecture

The TimeDriver interface

All drivers implement the TimeDriver interface:
See packages/core/src/drivers/TimeDriver.ts:15 for the full interface definition.

Driver selection

Helios automatically selects a driver based on configuration:
Driver selection logic at Helios.ts:542:

Built-in drivers

NoopDriver

The simplest driver—does nothing. Used when you don’t need animation synchronization.
Use cases:
  • Compositions with no CSS/WAAPI animations
  • Manual animation control only
  • Headless calculations without rendering
Implementation at packages/core/src/drivers/NoopDriver.ts:3:

DomDriver

Synchronizes CSS animations, WAAPI timelines, and media elements in the browser.
Features:
  • WAAPI animation seeking
  • Media element (<video>, <audio>) synchronization
  • Shadow DOM support
  • Audio track discovery and mixing
  • Stability checks (fonts, images, media)
Implementation details: See packages/core/src/drivers/DomDriver.ts:11 for the full implementation.

CdpTimeDriver (Renderer)

Uses Chrome DevTools Protocol to virtualize time for deterministic server-side rendering.
How it works:
  1. Pause virtual time: Freeze the browser’s internal clock
  2. Sync media elements: Manually seek <video>/<audio> to target time
  3. Advance virtual time: Resume clock for exact frame duration
  4. Wait for stability: Check for async operations to complete
See packages/renderer/src/drivers/CdpTimeDriver.ts:6 for implementation.
CDP virtual time is deterministic because the browser’s event loop is paused until the time budget expires. This means requestAnimationFrame callbacks and CSS animations all update to the exact target time before rendering continues.

Media element synchronization

Data attributes

Control media playback with custom attributes:
Attributes:
  • data-helios-track-id: Unique identifier for track control
  • data-helios-offset: When the track starts in composition time (seconds)
  • data-helios-seek: In-point in the media file (seconds)
  • data-helios-fade-in: Fade-in duration (seconds)
  • data-helios-fade-out: Fade-out duration (seconds)
  • data-helios-fade-easing: Easing function for fades

Audio track control

Final volume calculation:
See DomDriver.ts:461 for fade and volume logic.

Audio track discovery

DomDriver automatically discovers audio tracks:

Custom drivers

Create a custom driver to integrate with non-standard time sources.

Example: External clock driver

Example: MIDI timecode driver

Stability patterns

Custom stability checks

Register async operations that should block rendering:
See Helios.ts:876 for the stability check API.

Virtual time synchronization

When using bindToDocumentTimeline(), Helios polls __HELIOS_VIRTUAL_TIME__:
Stability waiting ensures Helios catches up to virtual time:

Tickers

Drivers use tickers to manage the playback loop. Tickers are separate from drivers to allow different timing strategies.

RafTicker (default)

Uses requestAnimationFrame for smooth browser playback:

TimeoutTicker

Uses setTimeout for Node.js or non-browser environments:

ManualTicker

Manually advance time for testing:
See packages/core/src/drivers/ for all ticker implementations.

Best practices

Choose the right driver

  • NoopDriver: Manual control, no animations
  • DomDriver: CSS/WAAPI animations, media elements
  • CdpTimeDriver: Server-side rendering only

Scope animations carefully

Preload media elements

This ensures media is ready before rendering starts.

Handle stability timeouts

For long-running async operations, increase the timeout:
Or split into smaller stability checks:

Next steps