Constructor
# new Text(x, y, text, scale, anchor, vAnchor) → {Text}
Initiates a new Text object.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
x |
number
|
The x position in the parent container or viewport |
|
y |
number
|
The y position in the parent container or viewport |
|
text |
string
|
The actual text content of the Text element. |
|
scale |
number
|
The scale of the text element |
|
anchor |
HorizontalTextAnchor
|
Text.Anchor.START | Aligns the text horizontally. |
vAnchor |
VerticalTextAnchor
|
Text.VerticalAnchor.BOTTOM | Aligns the text vertically. |
- See:
-
- See https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/text-anchor for more information about the horizontal anchor and https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/dominant-baseline for the vertical anchor.
The new Text object.
Members
Methods
# setText(t) → {void}
Set the text content of this element.
Parameters:
Name | Type | Description |
---|---|---|
t |
string
|
The new text content |
void