diff --git a/runtimes/android/data-binding.mdx b/runtimes/android/data-binding.mdx index 1e34827a..3f44c8b3 100644 --- a/runtimes/android/data-binding.mdx +++ b/runtimes/android/data-binding.mdx @@ -507,6 +507,27 @@ import { Demos } from "/snippets/demos.jsx"; // Clean up external file when done externalFile.dispose() ``` + + You can also create a bindable artboard with a view model instance to control its state. + + ```kotlin + // Create the view model instance for the child artboard. + val childVmi = childFile.getViewModelByName("ChildVM").createBlankInstance() + val bindableArtboard = childFile.createBindableArtboardByName("Child", childVmi) + + // Get the artboard property from the main artboard. + val vmi = rive.file!!.firstArtboard.viewModelInstance!! + val artboardProperty = vmi.getArtboardProperty("Artboard property") + + // Set the bound artboard VMIs state. + childVmi.getNumberProperty("rotation").value = 90f + + // Set the bound artboard on the main artboard. + artboardProperty.set(bindableArtboard) + + // Release the reference we hold from creation. + bindableArtboard.release() + ``` @@ -544,4 +565,4 @@ import { Demos } from "/snippets/demos.jsx"; See the [data binding overview example](https://github.com/rive-app/rive-android/blob/master/app/src/main/java/app/rive/runtime/example/LegacyDataBindingActivity.kt). - \ No newline at end of file +