Text Runs
In this lesson, you'll learn how to edit the text contents inside Rive animations using text runs. Below is the source code used in this lesson -
Download
Text Runs
To edit the text content inside a Rive animation you need the text run i.e. an instance of TextValueRun
. You can go ahead and create a field for the same -
Now inside the RiveAnimation
widget, use the onInit
callback to get the artboard
. Using the artboard
, you can get the text run with the component<TextValueRun>()
method and the text run's name
Now to edit the text, you can access the text
attribute of the TextValueRun
instance and set it as a string
To make it easier to get a hold of text runs, you can create an extension on the Artboard
like below.