Skip to content

UISplitText

Defined in: ui/src/UISplitText.ts:88

UI element that renders text split into per-character / per-word / per-line display objects for animated text — typewriter reveals, per-letter colour / wave, staggered line entrances. The UI sibling of @yagejs/renderer’s SplitTextComponent; wraps Pixi v8’s experimental SplitText / SplitBitmapText and lays the whole block out as one Yoga element.

Unlike UIText it does not support truncate or word-wrap to the Yoga slot — pre-break long copy with \n, or use UIText for flowing paragraphs. Animate the exposed segments yourself (e.g. with the engine’s Tween / Process); onSplit fires whenever a setText re-split invalidates the previous chars so you can rebind.

SplitText is experimental in Pixi; char spacing can differ slightly from Text (kerning is lost once glyphs are split).

new UISplitText(props): UISplitText

Defined in: ui/src/UISplitText.ts:113

UISplitTextProps

UISplitText

UIElementBase.constructor

readonly _transform: ElementTransform

Defined in: ui/src/UIElementBase.ts:20

Internal

UIElementBase._transform


readonly displayObject: DisplayContainer

Defined in: ui/src/UISplitText.ts:89

UIElementBase.displayObject


readonly isBitmap: boolean

Defined in: ui/src/UISplitText.ts:94

Whether this renders with a bitmap font (SplitBitmapText).


readonly splitText: SplitText | SplitBitmapText

Defined in: ui/src/UISplitText.ts:92

The underlying Pixi SplitText / SplitBitmapText.


readonly yogaNode: Node

Defined in: ui/src/UISplitText.ts:90

UIElementBase.yogaNode

get charAnchor(): SegmentAnchor

Defined in: ui/src/UISplitText.ts:277

SegmentAnchor

set charAnchor(anchor): void

Defined in: ui/src/UISplitText.ts:274

Transform origin (0–1) each character rotates / scales about.

SegmentAnchor

void


get chars(): (Text | BitmapText)[]

Defined in: ui/src/UISplitText.ts:193

Per-glyph display objects, in reading order.

(Text | BitmapText)[]


get lineAnchor(): SegmentAnchor

Defined in: ui/src/UISplitText.ts:293

SegmentAnchor

set lineAnchor(anchor): void

Defined in: ui/src/UISplitText.ts:290

Transform origin (0–1) each line rotates / scales about.

SegmentAnchor

void


get lines(): DisplayContainer[]

Defined in: ui/src/UISplitText.ts:203

Line-group containers.

DisplayContainer[]


get rotation(): number

Defined in: ui/src/UIElementBase.ts:50

See LayoutProps.rotation.

number

set rotation(value): void

Defined in: ui/src/UIElementBase.ts:54

number

void

UIElementBase.rotation


get scale(): Readonly<{ x: number; y: number; }>

Defined in: ui/src/UIElementBase.ts:41

See LayoutProps.scale.

Readonly<{ x: number; y: number; }>

set scale(value): void

Defined in: ui/src/UIElementBase.ts:45

number | { x: number; y: number; }

void

UIElementBase.scale


get segments(): TextSegments

Defined in: ui/src/UISplitText.ts:208

The current segments as one object — handy for onSplit callbacks.

TextSegments


get transformOrigin(): Readonly<{ x: number; y: number; }>

Defined in: ui/src/UIElementBase.ts:32

See LayoutProps.transformOrigin.

Readonly<{ x: number; y: number; }>

set transformOrigin(value): void

Defined in: ui/src/UIElementBase.ts:36

number | { x: number; y: number; }

void

UIElementBase.transformOrigin


get visible(): boolean

Defined in: ui/src/UISplitText.ts:302

boolean

set visible(v): void

Defined in: ui/src/UISplitText.ts:305

boolean

void

UIElementBase.visible


get wordAnchor(): SegmentAnchor

Defined in: ui/src/UISplitText.ts:285

SegmentAnchor

set wordAnchor(anchor): void

Defined in: ui/src/UISplitText.ts:282

Transform origin (0–1) each word rotates / scales about.

SegmentAnchor

void


get words(): DisplayContainer[]

Defined in: ui/src/UISplitText.ts:198

Word-group containers.

DisplayContainer[]


get zIndex(): number

Defined in: ui/src/UIElementBase.ts:59

See LayoutProps.zIndex.

number

set zIndex(value): void

Defined in: ui/src/UIElementBase.ts:63

number

void

UIElementBase.zIndex

_inspectState(): object

Defined in: ui/src/UISplitText.ts:346

Internal

What the Inspector reports for this split text: whether it takes part in focus navigation, which is off unless the game asked for it, and whether it holds focus right now. A test reads this instead of a screenshot.

object

focusable: boolean

focused: boolean


applyLayout(): void

Defined in: ui/src/UISplitText.ts:298

Follow the box layout gave this block, which is what the outline rings.

void


protected applyTransformProps(props): void

Defined in: ui/src/UIElementBase.ts:27

Apply the four transform props present in props. A present key holding undefined resets that prop to its default. Throws before writing anything if a value is not finite.

LayoutProps

void

UIElementBase.applyTransformProps


destroy(): void

Defined in: ui/src/UISplitText.ts:351

Idempotent — a second call is a no-op.

void

UIElementBase.destroy


onSplit(listener): () => void

Defined in: ui/src/UISplitText.ts:223

Subscribe to (re)splits. The listener fires after every setText / setStyle / resplit — i.e. whenever the segment objects may have changed. A setText (content) change destroys and recreates chars, so animations bound to the old ones must be rebound here; a setStyle change reuses the same chars. Returns an unsubscribe function.

SplitListener

() => void


resplit(): void

Defined in: ui/src/UISplitText.ts:267

Re-split now (only needed when constructed with autoSplit: false). An empty text has nothing to split and leaves the segments empty.

void


setStyle(style): void

Defined in: ui/src/UISplitText.ts:249

Partial<TextStyle>

void


setText(s?): void

Defined in: ui/src/UISplitText.ts:239

string

void


update(p): void

Defined in: ui/src/UISplitText.ts:310

Partial<UISplitTextProps>

void

UIElementBase.update

Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/ui.md.