Combining Inputs and View Models

I’m looking for some advice. The JS game for which I’m creating assets will use Inputs to ask the Rive instance to play certain animations.

When I started animating, I was using a View Model, and nested View Models to trigger animations from parent Artboards etc, however it’s not working as I’d expected.

My kludge looks like the below flow, which seems cumbersome but simpler to implement than changes to the JS layer. Should this work, despite the roundabout logic of it?

  • JS invokes Trigger Input

  • Trigger Input used as Conditional in State Machine Flow

  • State Machine transition with this conditional invokes an Event object on the Artboard

  • Event has a Listener which invokes a trigger in the appropriate View Model to play an embedded animation

It works in the editor, and I’ve confirmed the JS is calling the Trigger Input by animating something on a Timeline in the State Machine (which is otherwise unnecessary because I’m only using the transitions, conditionals and events to trigger a VM model).

I know the advice is to migrate to Data Binding. Can this work as it is?