label
Label API documentation
Functions
label.get_text(url: string | Hash | Url): string
- Deprecated since 1.13.2
Gets the text from a label component
This function is deprecated. Use go.get("#label", "text") instead.
export default defineScript({
init() {
const text = go.get<label.Properties>()("#label", "text");
print(text);
},
});function init(self)
local text = go.get("#label", "text")
print(text)
endParameters
url:string | Hash | Url— the label to get the text from
Returns
text:string— the label text
label.set_text(url: string | Hash | Url, text: string | number): void
- Deprecated since 1.13.2
Sets the text of a label component
This function is deprecated. Use go.set("#label", "text", value) instead.
This method uses the message passing that means the value will be set after dispatch messages step.
More information is available in the Application Lifecycle manual.
export default defineScript({
init() {
go.set<label.Properties>()("#label", "text", "Hello World!");
},
});function init(self)
go.set("#label", "text", "Hello World!")
endParameters
url:string | Hash | Url— the label that should have a constant settext:string | number— the text
Properties
color: Vector4
The color of the label. The type of the property is vector4.
font: Hash
The font used when rendering the label. The type of the property is hash.
leading: number
The leading of the label. This value is used to scale the line spacing of text. The type of the property is number.
line_break: boolean
The line break of the label. This value is used to adjust the vertical spacing of characters in the text. The type of the property is boolean.
material: Hash
The material used when rendering the label. The type of the property is hash.
outline: Vector4
The outline color of the label. The type of the property is vector4.
scale: Vector3
The scale of the label. go.get returns and go.set takes a vector3; go.animate also takes a number, which sets a uniform scale.
shadow: Vector4
The shadow color of the label. The type of the property is vector4.
size: Vector3
Returns the size of the label. The size will constrain the text if line break is enabled. The type of the property is vector3.
tracking: number
The tracking of the label. This value is used to adjust the vertical spacing of characters in the text. The type of the property is number.