Text
⚠️
This page is under construction.
⚠️
Beta feature, subject to change.
This class extends Displayble
Text allows you to display text on the screen.
For example:
const t1 = new Text("After that, another story happened...", {
position: CommonPosition.Positions.Center,
fontColor: "#f00",
fontSize: 20,
});
// turn the background to black with fade effect
// then show a text "After that, another story happened..."
scene2.action([
scene2.setBackground("#000", new Fade(1000)),
t1.show({
duration: 1000,
ease: "easeInOut",
}),
// wait for 1000 milliseconds
Control.sleep(1000),
// hide the text
t1.hide({
duration: 1000,
ease: "easeInOut",
}),
]);
Public Method
constructor
Overload 1 of 2
config: Partial<ITextUserConfig>
- ITextUserConfig
Overload 2 of 2
text: string
- The content of the textconfig?: Partial<ITextUserConfig>
- ITextUserConfig
useLayer
set the Layer of the text
layer: Layer
- The layer to use- Returns
this
Chainable Method
setText
text: string
- The content of the text
setFontSize
// set the font size of the text to 20 pixels with transition
element.setFontSize(20, 1000, "easeInOut");
fontSize: number
- The font size of the text in pixelsduration?: number
- The duration of the transition in millisecondseasing?: TransformDefinitions.EasingDefinition
- The easing function of the transition, see TransformDefinitions.EasingDefinition
setFontColor
// set the font color of the text to red with transition
element.setFontColor("#f00", 1000, "easeInOut");
color: Color
- See Colorduration?: number
- The duration of the transition in millisecondseasing?: TransformDefinitions.EasingDefinition
- The easing function of the transition, see TransformDefinitions.EasingDefinition