Class: Label

og/entity/Label~Label

Billboard text label.

new Label(options)

Name Type Description
options Object optional Label options:
Name Type Description
position og.Vec3 | Array.<number> optional Billboard spatial position.
rotation number optional Screen angle rotaion.
color og.Vec4 | string | Array.<number> optional Billboard color.
alignedAxis og.Vec3 | Array.<number> optional Billboard aligned vector.
offset og.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 og.Vec4 | string | Array.<number> optional Outline color.
align og.Label.ALIGN optional Text horizontal align: "left", "right" and "center".

Extends

  • og.BaseBillboard

Methods

assignFontAtlas(fontAtlas)

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

getAlign(){og.Label.ALIGN}

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

getFace(){string}

Gets current font face.
Returns:
Type Description
string

getOutline(){number}

Gets text current outline size.
Returns:
Type Description
number

getOutlineColor(){og.Vec4}

Gets outline color vector.
Returns:
Type Description
og.Vec4

getOutlineOpacity(){number}

Gets outline opacity value.
Returns:
Type Description
number

getSize(){number}

Gets label size in pixels.
Returns:
Type Description
number

getStyle(){string}

Gets label font style.
Returns:
Type Description
string

getText(){string}

Gets current text string.
Returns:
Type Description
string

getWeight(){string}

Gets label font weight.
Returns:
Type Description
string

setAlign(align)

Sets label text align. Could be center, left or right. Left is default.
Name Type Description
align og.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 og.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.

setStyle(style)

Sets font HTML5 style. It's can be Italic or Normal values.
Name Type Description
style string HTML5 font style.

setText(text)

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

setWeight(weight)

Sets label font HTML5 weight style. It's can be bold or normal.
Name Type Description
weight string HTML5 font weight style.
Updates label parameters.