rive-flutter icon indicating copy to clipboard operation
rive-flutter copied to clipboard

How to know which Animation is pressed?

Open llorenzo opened this issue 3 years ago • 1 comments

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 avatar Jun 02 '21 17:06 llorenzo

@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

zplata avatar Jan 18 '22 23:01 zplata

Closing this, feel free to reopen if needed.

HayesGordon avatar Feb 01 '23 13:02 HayesGordon