Class: Label

og/entity/Label~Label

Billboard text label.

new Label(options)

Name Type Description
options Object optional Label options:
Name Type Description
position Vec3 | Array.<number> optional Billboard spatial position.
rotation number optional Screen angle rotaion.
color Vec4 | string | Array.<number> optional Billboard color.
alignedAxis Vec3 | Array.<number> optional Billboard aligned vector.
offset Vec3 | Array.<number> optional Billboard center screen offset.
visibility boolean optional Visibility.
text string optional Text string.
face string optional HTML5 font face.
size number optional Font size in pixels.
style string optional HTML5 font style. Example 'normal', 'italic'.
weight string optional HTML5 font weight. Example 'normal', 'bold'.
outline number optional Text outline size. 0 - no outline, 1 - maximum outline. Default 0.58.
outlineColor Vec4 | string | Array.<number> optional Outline color.
align Label.ALIGN optional Text horizontal align: "left", "right" and "center".

Extends

  • BaseBillboard

Methods

assignFontAtlas(fontAtlas)

Assigns font atlas and update.
Name Type Description
fontAtlas utils.FontAtlas Font atlas.

getAlign(){Label.ALIGN}

Gets label text current alignment.
Returns:
Type Description
Label.ALIGN

getFace(){string}

Gets current font face.
Returns:
Type Description
string

getOutline(){number}

Gets text current outline size.
Returns:
Type Description
number

getOutlineColor(){Vec4}

Gets outline color vector.
Returns:
Type Description
Vec4

getOutlineOpacity(){number}

Gets outline opacity value.
Returns:
Type Description
number

getSize(){number}

Gets label size in pixels.
Returns:
Type Description
number

getText(){string}

Gets current text string.
Returns:
Type Description
string

setAlign(align)

Sets label text align. Could be center, left or right. Left is default.
Name Type Description
align Label.ALIGN Text align.

setFace(face)

Sets font face family.
Name Type Description
face string Font face family.

setOpacity(a)

Sets label opacity.
Name Type Description
a number Label opacity.

setOutline(outline)

Sets text outline border size. Where 0 - is no outline and 1 - is the maximum outline size.
Name Type Description
outline number Text outline size.

setOutlineColor(r, g, b, a)

Sets text outline color.
Name Type Description
r number Red.
g number Green.
b number Blue.
a number Alpha.

setOutlineColor4v(rgba)

Sets text outline color.
Name Type Description
rgba Vec4 Color vector.

setOutlineColorHTML(color)

Sets text outline color HTML string.
Name Type Description
color string HTML string color.

setOutlineOpacity(opacity)

Sets outline opacity. Actually outline color alpha value.
Name Type Description
opacity number Outline opacity.

setSize(size)

Sets label font size in pixels.
Name Type Description
size number Label size in pixels.

setText(text)

Sets lablel text.
Name Type Description
text string Text string. It can't be bigger than maximum labelHandler _maxLetters value.

asyncupdate()

Updates label parameters.