new BitmapText (…args) Deprecated`` : since 8.0.0 overrides
Name | Type | Description |
---|---|---|
args |
[TextOptions] | [TextStyle, Partial<TextString>] |
Extends
Inherited Properties
From class Text
The anchor sets the origin point of the text.
The default is (0,0)
, this means the text's origin is the top left.
Setting the anchor to (0.5,0.5)
means the text's origin is centered.
Setting the anchor to (1,1)
would mean the text's origin point will be the bottom right corner.
If you pass only single parameter, it will set both x and y to the same value as shown in the example below.
Example
import { Text } from 'pixi.js';
const text = new Text('hello world');
text.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).
roundPixels inherited
Whether or not to round the x/y position of the sprite.
style AnyTextStyle inherited
The style of the text. If setting the style
can also be partial TextStyle.
text string inherited
The copy for the text object. To split a line you can use '\n'.