Getting Started
Adding Rive to your Bevy games.
Example Project
To quickly experiment with rive-bevy, run one of our example projects.
There are a number of demos/games in the examples folder that showcase various Rive features.
Installation
Add the Rive Bevy GitHub repository as a dependency to your Cargo.toml
file:
Import dependencies:
Register the Rive plugin:
Assets
All Rive assets (.riv
files) should be added to the assets
folder, and can be loaded with Bevy’s AssetServer:
Loading Animations
You can choose to load a LinearAnimation or StateMachine from the provided Rive asset.
LinearAnimation:
StateMachine:
Rendering
Rive-Bevy renders to an Image Texture that you can display in your scene by attaching it to a SpriteBundle for 2D or a StandardMaterial for 3D.
2D Scene / UI
The following example demonstrates drawing a StateMachine
to a SpriteBundle
in a 2D scene and enables user interaction via a mouse to drive Rive Listeners.
Image
and resize
it to be the same aspect ratio as your Rive artboard. Note that an Artboard my have clipping disabled and elements could be drawn outside of the bounds. In that case you’d want to size the Image to take up the drawable area.SpriteBundle
providing the image as a texture.StateMachine
, optionally provide the handle
(state machine name) and artboard_handle
(artboard name).SceneTarget
, optionally provide the sprite
argument which enables mouse inputs to pass to the scene. This is only relevant for State Machine animations as Linear Animations cannot interact with Rive listeners.3D Scene
The following demonstrates drawing a StateMachine
to a StandardMaterial
in a 3D scene and enables user interaction via a mouse to drive Rive Listeners.
Additional Resources
Was this page helpful?