Text
⚠️
This page is under construction.
⚠️
Beta feature, subject to change.
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.setBackground("#000", new Fade(1000));
t1
.show({
duration: 1000,
ease: "easeInOut",
});
Public Method
constructor
Overload 1 of 2
config: Partial<TextConfig>
- TextConfig
Overload 2 of 2
text: string
- The content of the textconfig?: Partial<TextConfig>
- TextConfig
Chainable Method
applyTransform
transform: Transform<TransformDefinitions.TextTransformProps>
- See Transform<TransformDefinitions.TextTransformProps>
applyTransition
transition: ITextTransition
- See ITextTransition
show
Overload 1 of 3
Show the image immediately
text.show();
Overload 2 of 3
Show the image with custom transform
Note: You need to add "opacity: 1" in the props to make the image visible
text.show(new Transform<TransformDefinitions.TextTransformProps>([
{
props: {
opacity: 1,
},
options: {
duration: 1000,
ease: "easeInOut",
},
}
]));
options: Transform<TransformDefinitions.TextTransformProps>
- See Transform<TransformDefinitions.TextTransformProps>
Overload 3 of 3
Show with transform config
text.show({
duration: 1000,
ease: "easeInOut",
});
options: Partial<TransformDefinitions.CommonTransformProps>
- See TransformDefinitions.CommonTransformProps
hide
Overload 1 of 3
Hide the image immediately
text.hide();
Overload 2 of 3
Hide the image with custom transform
Note: You need to add "opacity: 0" in the props to make the image invisible
text.hide(new Transform<TransformDefinitions.TextTransformProps>([
{
props: {
opacity: 0,
},
options: {
duration: 1000,
ease: "easeInOut",
},
}
]));
options: Transform<TransformDefinitions.TextTransformProps>
- See Transform<TransformDefinitions.TextTransformProps>
Overload 3 of 3
Hide with transform config
text.hide({
duration: 1000,
ease: "easeInOut",
});
options: Partial<TransformDefinitions.CommonTransformProps>
- See TransformDefinitions.CommonTransformProps
setText
text: string
- The content of the text
setFontSize
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