Text
Information on designing and animating Text
Read/Update Text Runs at Runtime
If you intend to update a text run at runtime it’s important to manually enter a unique name for the run in the editor: And then export the name: right-click and select Export name You can identify an exported component if it’s surrounded by square brackets. This makes it possible for the run to be “discoverable” at runtime by its name. For more information, see Exporting for Runtime.Text runs can also be updated on components at runtime, see Read/Update
Nested Text Runs at Runtime below.
Reading Text
To read a given text run text value at any given time, reference the.getTextRunValue() API on the RiveViewModel:
nil if the text run could not be queried.
Setting Text
To set a given text run value at any given time, reference the.setTextRunValue() API on the RiveViewModel:
textValue, with a String value that you want to set the new text value for.
If the supplied
textRunName Rive text run cannot be queried on the active artboard, Rive will throw a RiveError.textValueRunError that you may need to catch and handle gracefully in your application.Example Usage
Read/Update Nested Text Runs at Runtime
It’s possible to set nested text runs at runtime—text that is not on the main artboard but on a Component. To set a nested text run, you’ll need to take note of the path where the input exists at an artboard level. For example, to get/set the text run named button_text on the Button artboard, you need to provide the correct path. Setting Nested Text Runs The artboard names here are:- Main -> NestedArtboard -> Button
- ArtboardWithUniqueName -> ButtonWithUniqueName
ArtboardWithUniqueName/ButtonWithUniqueName
Export
component name