Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ XR Studio

DynamicText2D

  • Last UpdatedFeb 19, 2025
  • 3 minute read

The DynamicText2D node displays dynamic text in a 2D label.

DynamicText2D supports:

  • Dynamic font customization for each displayed character.

  • Text timing.

  • Current character-based setfield calls.

DynamicText2D node inherits from RectBase2D.

Platform support

This node is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-Portable WASM platforms.

XR-WIN

XR-P-WIN

XR-P-IOS

XR-P-AND

XR-P-WASM

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Text alignment

When the DynamicText2D text features one of the following special combination of characters, a custom behavior is triggered.

Expression

Behavior

{f:Arial,Bold,20}

Font change.

{t:1}

A charTime change.

{d}

Font, color, and charTime reset to default values.

{c:0 0 0}

Color change (RGB normalized float space).

{C:0 255 0}

Color change (RGB 255 space).

{x:testfnc.execute:cube}

Calls a setfield with specified value.

Note: Each single word can have only one style. It’s not possible to have a word half bold and half regular, or half red and half blue. If any of the style-related behavior ({t:x},{c:x y z},{C:x y z} and {d}) is placed inside a single word, it will cause the word to be split in two.

Text timing

When the text field is assigned content, the DynamicText2D starts writing it.

  • Every character displays every charTime seconds passed.

  • When all the content has been written, the event textFinished is triggered.

Code example

This is a code example for DynamicText2D.

<DynamicText2D name="text" position="150 550" size="200 200" visible="true" font="Arial,Regular|Antialias,20" text="This {f:Arial,Bold,20}is a {t:1}te{t:5}{t:0.5}xt\n{d}{c:0 0 0}Text {C:0 255 0}text{x:testfnc.execute:cube}"/>

DynamicText2D fields

These are the fields for DynamicText2D node. Only the node-specific fields are indicated, not fields obtained by inheritance.

Field inheritance: NodeBase > RectBase2D > DynamicText2D

Fields

Type

Use

Default value

Description

charTime

sfloat

Optional

0.04

Timing in seconds between the writing of each character. It can be dynamically changed using the expression {t:new charTime value}.

clear

sevent

Optional

None

Clears the text.

color

svec3

Optional

1 1 1

RGB text color. Dynamically customizable using the expressions {c:new color in normalized RGB color-space} or {C:new color in RGB 255 color-space}.

dynamicFontScaling

sbool

Optional

true

Improves the quality of text by applying Dynamic Font Scaling rendering.

font

sstring

Optional

Arial,Regular,20

The text font.

goToEnd

sevent

Optional

None

Ends text writing. All events are called anyway, but if there are multiple setfields on the same field, only one is executed.

text

sstring

Optional

Displayed text

The displayed text. It supports newline and ('\n'). Dynamically customizable using the expression {f:new font}.

textFinished

sevent

Optional

None

Triggered when the last character of text has been written.

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in