rive-flutter
rive-flutter copied to clipboard
How to know which Animation is pressed?
I have many Animations in a StateMachine. I want to trigger an animation only when I press on that animation in a Flutter application. Any Idea?
@llorenzo this might be something you design into your state machine in the Rive editor. For example, if you start in an idle
animation state, you can create a transition from idle
to Animation A
and an input trigger called for example, onClickAnimationA
, and define that the transition only happens when that trigger is fired.
On the Flutter end, I'd check out this example in our examples
folder that shows how the trigger is fired on the onTap
GestureDetector callback: https://github.com/rive-app/rive-flutter/blob/master/example/lib/simple_state_machine.dart
Closing this, feel free to reopen if needed.