Skip to main content

Rive

Render Rive animations in your Flet app with the flet-rive extension.

Platform Support

PlatformWindowsmacOSLinuxiOSAndroidWeb
Supported✅ (x64 only)

Usage

Add flet-rive to your project dependencies:

uv add flet-rive
Hosting Rive files

Host .riv files locally or load them from a CDN. Use placeholder to keep layouts responsive while animations load.

Example

import flet as ft
import flet_rive as ftr


def main(page: ft.Page):
page.add(
ft.SafeArea(
content=ft.Column(
controls=[
ftr.Rive(
src="https://cdn.rive.app/animations/vehicles.riv",
placeholder=ft.ProgressBar(),
width=300,
height=200,
),
ftr.Rive(
src="vehicles.riv",
placeholder=ft.ProgressBar(),
width=300,
height=200,
),
],
)
)
)


if __name__ == "__main__":
ft.run(main)

Description

Displays rive animations.

Inherits: LayoutControl

Properties

Properties

alignmentclass-attributeinstance-attribute

alignment: Optional[Alignment] = None

Alignment for the animation in the Rive control.

animationsclass-attributeinstance-attribute

animations: list[str] = field(default_factory=list)

List of animations to play; default animation is played if empty.

artboardclass-attributeinstance-attribute

artboard: Optional[str] = None

The name of the artboard to use. If not specified, the default artboard of the provided src is used.

clip_rectclass-attributeinstance-attribute

clip_rect: Optional[Rect] = None

Clip the artboard to this rect.

If not supplied it'll default to the constraint size provided by the parent control. Unless the Artboard has clipping disabled, then no clip will be applied.

enable_antialiasingclass-attributeinstance-attribute

enable_antialiasing: bool = True

Whether to enable anti-aliasing when rendering.

fitclass-attributeinstance-attribute

fit: Optional[BoxFit] = None

The animation's fit.

headersclass-attributeinstance-attribute

headers: Optional[dict[str, str]] = None

Headers for network requests.

placeholderclass-attributeinstance-attribute

placeholder: Optional[Control] = None

Control displayed while the Rive is loading.

speed_multiplierclass-attributeinstance-attribute

speed_multiplier: Number = 1.0

A multiplier for controlling the speed of the Rive animation playback.

srcinstance-attribute

src: str

The source of your rive animation.

Can either be a URL or a path to a local asset file.

state_machinesclass-attributeinstance-attribute

state_machines: list[str] = field(default_factory=list)

List of state machines to play; none will play if empty.

use_artboard_sizeclass-attributeinstance-attribute

use_artboard_size: bool = False

Determines whether to use the inherent size of the artboard, i.e. the absolute size defined by the artboard, or size the control based on the available constraints only (sized by parent).