Skip to main content

Sample projects

The CLI ships eight example projects. rive samples opens a picker and copies the one you choose into a directory you name: Each directory is a project in its own right. Where no picker can draw, as in CI, rive samples prints the list with descriptions and a ready cp line:

Headless rendering

--screenshot builds the project, renders one frame without opening a window, and writes a PNG. It needs no login, which makes it the check to run in CI.
A capture with no --advance is the authored rest pose, not the animation’s opening frame, because the state machine has not run yet. Start previews at --advance=1.
--screenshot resolves its path against the current directory, not the project directory, and a missing directory fails with only screenshot failed: <path>. Create the directory first.

Driving a scene

A screenshot of a resting scene tells you nothing about whether it responds to anything. Two flags drive it before the capture. --data sets a view model property. The path is relative to the instance bound to the artboard, and each segment is a property name:
--pointer simulates a pointer at artboard coordinates. click is a move, a press and a release with a frame between each, because a state machine only sees a gesture when it next runs:
Both flags repeat, so you can set several values or play a sequence of gestures.
Quote a drag value. The > between the two points is a shell redirection otherwise:

Checking responsiveness

A layout tree and a hand-positioned screen look identical in a single screenshot. Shoot the same file at two sizes and see whether anything moved:
--viewport resizes the artboard itself, rather than scaling or cropping what it renders. Layouts reflow into the new size, which is what makes this a real responsiveness check. Content at fixed coordinates stays where it is, so a design with no layout components looks cropped at a smaller viewport and gains empty space at a larger one.

In CI

--verify compiles everything and writes nothing. --test runs the project’s Luau tests. Both exit non-zero on failure, and --format=json gives you one JSON object on stdout with logs kept on stderr:
Each kind of failure has its own exit code, so a pipeline can branch without parsing output. See Exit Codes.
Publishing needs a browser sign-in, which a CI runner usually cannot do. Every other mode works there. You can author, compile, test and capture in CI, then publish from a machine that is signed in.

Measuring performance

--bench builds the project, times a number of frames without opening a window, and reports advance and render statistics along with WASM memory growth: