Create dynamic raster image selector with Data Binding Enums
This is a temporary workaround until the rive adds support for Data Binding raster images directly. I worked out this solution in a process of creating a dynamic infographic with multiple popups with images where the client wanted to have the ability to update them at runtime.
My setup involved a View Model for a popup layout with an image placeholder field, and a number of instances of the popup. Each popup featured data bound text fields and an Image Picker enum which I created. The enum had enough fields to cover all the popups with names that corresponded to the popup instance names.
inside the Popup artboard, in the Image Placeholder group I added a Solo layer, where I added the same number solo’s as there are images
Then I’ve created a separate Timeline for each Image where I keyed the one Solo Image on each timeline. Finally, I added a State Machine layer called Image Picker, and created an “Any State” interaction where I set the conditions for transition from Any State to a particular image is the selection of the corresponding Enum value
and voila - you can change images between the popups using the Image Picker Dropdown (Enum) and you can update the images at runtime using Asset Loader API.