LoadComplete fired when transitioning from a complete timeline animation state to an idle state. You can subscribe to Rive events with a callback that the runtime may invoke, and from there, your callback can handle extra functionality at just the right moment when the event fired.
Other practical use cases for events:
- Coordinating audio playback at specific moments in an animation, see Audio Events
- Opening a URL when specific interactions have occurred
- Adding haptic feedback on meaningful touch interactions
- Implementing functionality on Buttons and other UI elements
- Send semantic information
- Communicate any information your runtime needs at the right moment
Subscribing to Events
When you subscribe to Rive events at runtime, you subscribe to all Rive events that may be emitted from a state machine, and you can parse through each event by name or type to execute conditional logic. Let’s use a 5-star rater Rive example to set any text supplied with events and open a URL if one is given.Accessing Events
The following code demonstrates accessing all Rive events reported from an active state machine.- Components
- Legacy API
With a reference to the Rive Widget, you can subscribe to the
OnRiveEventReported event in your scripts:float and a message of type string are retrieved from the event data (custom properties).
- Properties that can be read are bool, string, and float.
- Access a dictionary of all properties with:
reportedEvent.Properties.