Skip to main content
It is possible to have finer control over your Rive animation at runtime by extending RiveRenderObject. This allows you to override low-level methods such as advance, beforeDraw, and draw to have more control and optionally perform additional operations. See below for example usage.
Note that this is a low-level API, and under most circumstances, it is preferable to make use of RiveAnimation or Rive widgets instead.

Example Code

The following is a basic example that demonstrates how to paint a Rive animation and advance a state machine using a custom RenderObject.
The artboard can be controlled and configured as it normally would, through a StateMachineController (or any other animation controller).

Example Usage

  • Dynamically update component colors at runtime - Make use of a custom Rive render object to change a shape’s fill color, accessing it by name. This is helpful for when a color’s opacity is animating, but the color needs to be changed at runtime.
  • Track a Rive component in Flutter - Track a Rive component’s position at runtime and overlay a Flutter widget or perform additional painting operations.

Additional Documentation

For additional information on RenderObjects, see the official Flutter examples: