UIImage
Defined in: ui/src/UIImage.ts:41
Displays a texture as a UI element.
Size it on one axis and the other follows the texture’s aspect ratio, even
where a flex parent would stretch it. Size both axes and the texture
stretches to that box. Size neither and it measures at the texture’s own
pixel size, and its parent can stretch it like any other flex child. A
flexGrow, flex or flexBasis sizes the main axis as well, so with one
of those set the texture stretches as if both axes were sized.
The sprite sits inside a plain container, UIImage.displayObject,
whose own space is measured in layout pixels. Layout stretches the sprite
inside it, so the element’s scale and rotation stay the game’s.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new UIImage(
props):UIImage
Defined in: ui/src/UIImage.ts:53
Parameters
Section titled “Parameters”Returns
Section titled “Returns”UIImage
Overrides
Section titled “Overrides”Properties
Section titled “Properties”_transform
Section titled “_transform”
readonly_transform:ElementTransform
Defined in: ui/src/UIElementBase.ts:20
Internal
Inherited from
Section titled “Inherited from”displayObject
Section titled “displayObject”
readonlydisplayObject:DisplayContainer
Defined in: ui/src/UIImage.ts:44
Overrides
Section titled “Overrides”sprite
Section titled “sprite”
readonlysprite:Sprite
Defined in: ui/src/UIImage.ts:43
The sprite drawing the texture, stretched to the layout box.
yogaNode
Section titled “yogaNode”
readonlyyogaNode:Node
Defined in: ui/src/UIImage.ts:45
Overrides
Section titled “Overrides”Accessors
Section titled “Accessors”rotation
Section titled “rotation”Get Signature
Section titled “Get Signature”get rotation():
number
Defined in: ui/src/UIElementBase.ts:50
See LayoutProps.rotation.
Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set rotation(
value):void
Defined in: ui/src/UIElementBase.ts:54
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Get Signature
Section titled “Get Signature”get scale():
Readonly<{x:number;y:number; }>
Defined in: ui/src/UIElementBase.ts:41
See LayoutProps.scale.
Returns
Section titled “Returns”Readonly<{ x: number; y: number; }>
Set Signature
Section titled “Set Signature”set scale(
value):void
Defined in: ui/src/UIElementBase.ts:45
Parameters
Section titled “Parameters”number | { x: number; y: number; }
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”transformOrigin
Section titled “transformOrigin”Get Signature
Section titled “Get Signature”get transformOrigin():
Readonly<{x:number;y:number; }>
Defined in: ui/src/UIElementBase.ts:32
See LayoutProps.transformOrigin.
Returns
Section titled “Returns”Readonly<{ x: number; y: number; }>
Set Signature
Section titled “Set Signature”set transformOrigin(
value):void
Defined in: ui/src/UIElementBase.ts:36
Parameters
Section titled “Parameters”number | { x: number; y: number; }
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”visible
Section titled “visible”Get Signature
Section titled “Get Signature”get visible():
boolean
Defined in: ui/src/UIImage.ts:157
Returns
Section titled “Returns”boolean
Set Signature
Section titled “Set Signature”set visible(
v):void
Defined in: ui/src/UIImage.ts:161
Parameters
Section titled “Parameters”boolean
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”zIndex
Section titled “zIndex”Get Signature
Section titled “Get Signature”get zIndex():
number
Defined in: ui/src/UIElementBase.ts:59
See LayoutProps.zIndex.
Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set zIndex(
value):void
Defined in: ui/src/UIElementBase.ts:63
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”_inspectState()
Section titled “_inspectState()”_inspectState():
object
Defined in: ui/src/UIImage.ts:195
Internal
What the Inspector reports for this image: 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.
Returns
Section titled “Returns”object
focusable
Section titled “focusable”focusable:
boolean
focused
Section titled “focused”focused:
boolean
applyLayout()
Section titled “applyLayout()”applyLayout():
void
Defined in: ui/src/UIImage.ts:127
Scale sprite to match Yoga computed size.
Returns
Section titled “Returns”void
applyTransformProps()
Section titled “applyTransformProps()”
protectedapplyTransformProps(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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”UIElementBase.applyTransformProps
destroy()
Section titled “destroy()”destroy():
void
Defined in: ui/src/UIImage.ts:200
Idempotent — a second call is a no-op.
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”update()
Section titled “update()”update(
p):void
Defined in: ui/src/UIImage.ts:166
Parameters
Section titled “Parameters”Partial<UIImageProps>
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”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.