new Text()
Text component allows to display text on UI elements. This is a UI component, so it should be added to an entity with a UITransform component.
Name | Type | Default | Description |
---|---|---|---|
text | string | "Hello, | World!" - The text to display. |
font | Font | 20px | Arial bold - The font to use. |
align | Text. | Text.ALIGN_CENTER | The alignment of the text. |
color | Color | Color.white | The color of the text. |
- Source
Example
let text = new Text("Hello World!", new Font(), Text.ALIGN_LEFT, Color.white);
Extends
Members
(static, readonly) ALIGN :string
Align the text
Type:
Properties- string
Name | Type | Description |
---|---|---|
LEFT | string | |
CENTER | string | |
RIGHT | string | |
START | string | |
END | string |
- Source
align :string
Align the text.
Value | Description |
---|---|
Text.ALIGN_LEFT | Align the text to the left. |
Text.ALIGN_CENTER | Align the text to the center. |
Text.ALIGN_RIGHT | Align the text to the right. |
Text.ALIGN_START | Align the text to the start. |
Text.ALIGN_END | Align the text to the end. |
Type:
- string
- Source
blendMode
Blend mode of the object
- Inherited From
color :Color
The text color to be used.
Type:
- Source
filter
The filter applied to the object
- Inherited From
font :Font
Font the text should be displayed in. The all fonts supported by the browser/HTML5 canvas can be used. Example: "30px Arial bold"
Type:
- Source
(readonly) properties
The entity that this component is attached to.
- Inherited From
- Source
text :string
The text to display.
Type:
- string
- Source