import { Color, CommonDisplayableConfig } from "../../types"; import { Chained, Proxied } from "../../action/chain"; import { LogicAction } from "../../action/logicAction"; import type { TransformDefinitions } from "../../elements/transform/type"; import { Displayable } from "../../elements/displayable/displayable"; import { EventfulDisplayable } from "../../../player/elements/displayable/type"; import { Layer } from "../../elements/layer"; export type TextConfig = { alignX: "left" | "center" | "right"; alignY: "top" | "center" | "bottom"; className?: string; layer: Layer | undefined; }; export type TextState = { fontSize: number; display: boolean; text: string; }; export interface ITextUserConfig extends CommonDisplayableConfig { /** * Where to align the text horizontally * @default "center" */ alignX: "left" | "center" | "right"; /** * Where to align the text vertically * @default "center" */ alignY: "top" | "center" | "bottom"; className?: string; /** * The font size of the text, see [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size) * * **Only supports px unit** * @default 16 */ fontSize: number; /** * The color of the text, supports {@link Color} and hex string * @default "#000000" */ fontColor: Color; /** * The text content */ text: string; /** * Layer of the text */ layer?: Layer; } export declare class Text extends Displayable implements EventfulDisplayable { constructor(config: Partial); constructor(text: string, config?: Partial); /** * Set the text of the Text * @chainable * @example * ```ts * text.setText("After that, another story happened..."); * ``` */ setText(text: string): Proxied>; /** * Set the font color of the Text * @chainable * @example * ```ts * element.setFontColor("#f00", 1000, "easeInOut"); * ``` */ setFontColor(color: Color, duration?: number, easing?: TransformDefinitions.EasingDefinition): Proxied>; /** * Set the font size of the Text * @chainable * @example * ```ts * element.setFontSize(20, 1000, "easeInOut"); * ``` */ setFontSize(fontSize: number, duration?: number, easing?: TransformDefinitions.EasingDefinition): Proxied>; /** * Override the layer used to render this text. * @param layer - The layer to assign to the text. */ useLayer(layer: Layer): this; }