Embedding the viewer

Viewer Component API

The Rotavue Viewer ships in two forms, both generated by the export step:

  1. Standalone export — a self-contained folder (index.html + tile pyramid + viewer.js) that works on any static host.
  2. <rotavue-viewer> web component — an embeddable custom element for pages and CMSs. Every exported folder now includes viewer-component.js and manifest.json.

Installation

Point a module script at the exported folder’s component file:

<script type="module" src="https://cdn.example.com/projects/my-shoe/viewer-component.js"></script>

Basic Usage

<rotavue-viewer src="https://cdn.example.com/projects/my-shoe"></rotavue-viewer>

The src attribute points to the exported project folder.

Attributes

AttributeTypeDefaultDescription
srcstring-Required. URL to the exported project folder.
auto-rotatebooleanfalseEnable automatic rotation on load.
rotation-speednumber30Auto-rotation speed in degrees per second.

zoom and inertia are planned attributes; wheel/pinch zoom is currently always enabled and the motion smoothing is fixed.

Methods

You can call methods on the DOM element:

const viewer = document.querySelector('rotavue-viewer');

// Play/Pause
viewer.play();
viewer.pause();

// Navigation
viewer.setFrame(10);
viewer.reset();

// State
const currentFrame = viewer.getCurrentFrame(); // { frame, row }

Events

EventDescription
loadFired when the manifest and initial images are loaded.
framechangeFired when the displayed frame changes (detail.frame, detail.row).
zoomchangeFired when the zoom level changes (detail.zoom).
errorFired if assets fail to load.
viewer.addEventListener('framechange', (e) => {
  console.log('Current frame:', e.detail.frame);
});

CSS Parts

Style internal elements using the ::part() pseudo-element:

  • ::part(canvas): The 2D canvas.
  • ::part(loader): The loading overlay (also used for error states).