Using it in a template

Referencing a file from a template#

A rive component names its file with either asset or path. They resolve differently, so choose by how long the file must live and where the template will travel. This section tells you what each one finds.

ReferenceResolves toUse it for
"asset": "bell"The manifest asset bell is installed again if its source changed, and the stored copy plays.Anything shared. It survives the app moving its file, picks up a changed source and travels in a bundle.
"path": "spinner.riv"<app>/spinner.riv in the app's folder, checked and not copied.A file stored by hand, by an upload or by the Designer.
"path": "/abs/file.riv", "~/file.riv" or a file: URLThat file, checked and not copied.Local experiments. The template breaks on another Mac.

If both asset and path are set, asset is used and path is ignored. Asset ids match exactly.

For an asset, Herald looks in this order:

  1. The manifest asset of that id. It is installed, and if that fails but an earlier copy is still valid, the copy is used.
  2. The stored copy <id>.riv in the app's folder, when no manifest declares the id.
  3. Otherwise the component shows asset "x" is not declared by the manifest and is not installed.

A template that uses asset for an id its manifest does not declare still plays when the stored copy exists, but validation warns the manifest declares no asset 'x'. For a file you uploaded, use path with its file name.

The full list of properties is in the rive component reference.

Sizing and fit#

The animation always fills its box with contain fit and is centred, so the box decides what you see. This section shows which settings choose the box.

SettingEffect
height in pointsA fixed box height. The width is the height times the ratio.
aspectRatioWidth divided by height of the box. It defaults to the artboard's own ratio, or 4 to 1 when the artboard size is unknown.
NeitherThe box takes the width of its cell, with the height from the ratio. If the cell proposes nothing at all, the artboard's own size is used.

The box is limited to 1 to 2000 points on each side. A placeholder for a failed load is 44 points high. To avoid empty bands, give the box the artboard's ratio: leave out aspectRatio and the artboard's own ratio is used. Where the box sits inside its cell is set by the cell's alignment, described with the nine-point alignment of the component and in Grid and layout.

Edit this page on GitHub

Esc
Getting started
Guides