baochungit/defold-wrap/wrap.node
A chainable wrapper around a GUI node. new wraps a node or looks one up by id, and
each method calls the gui.* function of the same name with the wrapped node first:
setters return the wrapper, so calls chain, and getters return what the engine does.
- GitHub: baochungit/defold-wrap — pinned to
1.1.0- Pick a release from baochungit/defold-wrap releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as node from "wrap.node"
- Pick a release from baochungit/defold-wrap releases and add its Source code (zip) URL (or a packaged
Functions
new(node: string | Opaque<'node'>): Node
Wraps a GUI node.
Parameters
node:string | Opaque<'node'>— The node, or the idgui.get_nodelooks it up by.
Returns
Node
Types
type NodeTree = LuaTable<Hash, Opaque<'node'>> & { get: LuaTableGetMethod<string, Opaque<'node'>>; }
type HexColorLiteral<S extends string> = S extends `#${infer D}` ? HexDigitCount<D> extends 6 | 8 ? S : never : never
type HexColor = string & { readonly __brand: 'wrap.node.HexColor'; }
type AnimatedProperty = keyof gui.NodeProperties | gui.Prop | Hash
type AnimatedValue = number | Vector3 | Vector4 | Quaternion
Node
Node.get_id(): Hash
Returns the node's id, from gui.get_id.
Returns
Hash
Node.set_id(new_id: string | Hash): Node
Sets the node's id with gui.set_id.
Parameters
new_id:string | Hash— The new id.
Returns
Node
Node.get_index(): number
Returns the node's index among its siblings, from gui.get_index.
Returns
number
Node.delete(): Node
Deletes the node with gui.delete_node. The wrapper still holds the deleted node.
Returns
Node
Node.animate(property: AnimatedProperty, to: AnimatedValue, easing: gui.Easing | Vector, duration: number, delay?: number, complete_function?: (self: unknown, node: Opaque<'node'>) => void, playback?: gui.Playback): Node
Animates one property with gui.animate.
Parameters
property:AnimatedProperty— The property to animate.to:AnimatedValue— The value to animate it to.easing:gui.Easing | Vector— An easing constant, or a vector of easing samples.duration:number— The duration in seconds.delay?:number— The delay in seconds before the animation starts. Defaults to0.complete_function?:(self: unknown, node: Opaque<'node'>) => void— Called once the animation completes.playback?:gui.Playback— The playback mode. Defaults togui.PLAYBACK_ONCE_FORWARD.
Returns
Node
Node.animate(property: readonly AnimatedProperty[], to: readonly AnimatedValue[], easing: gui.Easing | Vector, duration: number, delay?: number, complete_function?: (self: unknown, node: Opaque<'node'>) => void, playback?: gui.Playback): Node
Animates several properties with gui.animate, each to the value at the same index
of to, all with the same easing, duration, delay and playback.
Parameters
property:readonly AnimatedProperty[]— The properties to animate.to:readonly AnimatedValue[]— The value to animate each property to, by index.easing:gui.Easing | Vector— An easing constant, or a vector of easing samples.duration:number— The duration in seconds.delay?:number— The delay in seconds before the animations start. Defaults to0.complete_function?:(self: unknown, node: Opaque<'node'>) => void— Called once the first property's animation completes.playback?:gui.Playback— The playback mode. Defaults togui.PLAYBACK_ONCE_FORWARD.
Returns
Node
Node.cancel_animations(property?: AnimatedProperty | readonly AnimatedProperty[]): Node
Cancels the node's animations with gui.cancel_animations.
Parameters
property?:AnimatedProperty | readonly AnimatedProperty[]— The property, or the properties, whose animations to cancel. When omitted, every animation of the node is canceled.
Returns
Node
Node.cancel_animation(property?: AnimatedProperty | readonly AnimatedProperty[]): Node
Cancels the node's animations, the same as cancel_animations.
Parameters
property?:AnimatedProperty | readonly AnimatedProperty[]— The property, or the properties, whose animations to cancel. When omitted, every animation of the node is canceled.
Returns
Node
Node.new_box_node(position?: Vector3 | Vector4, size?: Vector3): Opaque<'node'>
Creates a box node with gui.new_box_node as a child of this node, inheriting its
alpha, and returns the new node.
Parameters
position?:Vector3 | Vector4— The position. Defaults to the origin.size?:Vector3— The size. Defaults to zero.
Returns
Opaque<'node'>
Node.new_box(position?: Vector3 | Vector4, size?: Vector3): Node
Creates a box node as a child of this node, as new_box_node does, and returns it
wrapped.
Parameters
position?:Vector3 | Vector4— The position. Defaults to the origin.size?:Vector3— The size. Defaults to zero.
Returns
Node
Node.new_text_node(position?: Vector3 | Vector4, text?: string): Opaque<'node'>
Creates a text node with gui.new_text_node as a child of this node, inheriting its
alpha, and returns the new node.
Parameters
position?:Vector3 | Vector4— The position. Defaults to the origin.text?:string— The text. Defaults to an empty string.
Returns
Opaque<'node'>
Node.new_text(position?: Vector3 | Vector4, text?: string): Node
Creates a text node as a child of this node, as new_text_node does, and returns it
wrapped.
Parameters
position?:Vector3 | Vector4— The position. Defaults to the origin.text?:string— The text. Defaults to an empty string.
Returns
Node
Node.new_pie_node(position?: Vector3 | Vector4, size?: Vector3): Opaque<'node'>
Creates a pie node with gui.new_pie_node as a child of this node, inheriting its
alpha, and returns the new node.
Parameters
position?:Vector3 | Vector4— The position. Defaults to the origin.size?:Vector3— The size. Defaults to zero.
Returns
Opaque<'node'>
Node.new_pie(position?: Vector3 | Vector4, size?: Vector3): Node
Creates a pie node as a child of this node, as new_pie_node does, and returns it
wrapped.
Parameters
position?:Vector3 | Vector4— The position. Defaults to the origin.size?:Vector3— The size. Defaults to zero.
Returns
Node
Node.new_particlefx_node(position: Vector3 | Vector4 | undefined, particlefx: Hash | string): Opaque<'node'>
Creates a particle fx node with gui.new_particlefx_node as a child of this node,
inheriting its alpha, and returns the new node.
Parameters
position:Vector3 | Vector4 | undefined— The position,undefinedfor the origin.particlefx:Hash | string— The particle fx resource name.
Returns
Opaque<'node'>
Node.new_particlefx(position: Vector3 | Vector4 | undefined, particlefx: Hash | string): Node
Creates a particle fx node as a child of this node, as new_particlefx_node does,
and returns it wrapped.
Parameters
position:Vector3 | Vector4 | undefined— The position,undefinedfor the origin.particlefx:Hash | string— The particle fx resource name.
Returns
Node
Node.get_text(): string
Returns the text of a text node, from gui.get_text.
Returns
string
Node.set_text(text: string | number): Node
Sets the text of a text node with gui.set_text.
Parameters
text:string | number— The text.
Returns
Node
Node.get_line_break(): boolean
Returns whether a text node breaks lines, from gui.get_line_break.
Returns
boolean
Node.set_line_break(line_break: boolean): Node
Sets whether a text node breaks lines with gui.set_line_break.
Parameters
line_break:boolean— Whether to break lines.
Returns
Node
Node.get_blend_mode(): gui.Blend
Node.set_blend_mode(blend_mode: gui.Blend): Node
Sets the node's blend mode with gui.set_blend_mode.
Parameters
blend_mode:gui.Blend— The blend mode.
Returns
Node
Node.get_texture(): Hash
Returns the node's texture, from gui.get_texture.
Returns
Hash
Node.set_texture(texture: string | Hash): Node
Sets the node's texture with gui.set_texture.
Parameters
texture:string | Hash— The texture name.
Returns
Node
Node.get_flipbook(): Hash
Returns the node's flipbook animation, from gui.get_flipbook.
Returns
Hash
Node.play_flipbook(animation: string | Hash, complete_function?: (self: unknown, node: Opaque<'node'>) => void, play_properties?: gui.PlayProperties): Node
Plays a flipbook animation on the node with gui.play_flipbook.
Parameters
animation:string | Hash— The animation id.complete_function?:(self: unknown, node: Opaque<'node'>) => void— Called once the animation completes.play_properties?:gui.PlayProperties— The offset and playback rate. Defaults to an empty table.
Returns
Node
Node.cancel_flipbook(): Node
Cancels the node's flipbook animation with gui.cancel_flipbook.
Returns
Node
Node.get_material(): Hash
Returns the node's material, from gui.get_material.
Returns
Hash
Node.set_material(material: string | Hash): Node
Sets the node's material with gui.set_material.
Parameters
material:string | Hash— The material name.
Returns
Node
Node.reset_material(): Node
Resets the node's material to the scene's with gui.reset_material.
Returns
Node
Node.get_font(): Hash
Returns the font of a text node, from gui.get_font.
Returns
Hash
Node.set_font(font: string | Hash): Node
Sets the font of a text node with gui.set_font.
Parameters
font:string | Hash— The font name.
Returns
Node
Node.get_layer(): Hash
Returns the node's layer, from gui.get_layer.
Returns
Hash
Node.set_layer(layer: string | Hash): Node
Sets the node's layer with gui.set_layer.
Parameters
layer:string | Hash— The layer name.
Returns
Node
Node.get_clipping_mode(): gui.ClippingMode
Node.set_clipping_mode(clipping_mode: gui.ClippingMode): Node
Sets the node's clipping mode with gui.set_clipping_mode.
Parameters
clipping_mode:gui.ClippingMode— The clipping mode.
Returns
Node
Node.get_clipping_visible(): boolean
Returns whether the node's clipping is visible, from gui.get_clipping_visible.
Returns
boolean
Node.set_clipping_visible(visible: boolean): Node
Sets whether the node's clipping is visible with gui.set_clipping_visible.
Parameters
visible:boolean— Whether the clipping is visible.
Returns
Node
Node.get_clipping_inverted(): boolean
Returns whether the node's clipping is inverted, from gui.get_clipping_inverted.
Returns
boolean
Node.set_clipping_inverted(inverted: boolean): Node
Sets whether the node's clipping is inverted with gui.set_clipping_inverted.
Parameters
inverted:boolean— Whether the clipping is inverted.
Returns
Node
Node.get_xanchor(): Exclude<gui.Anchor, typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_TOP>
Returns the node's horizontal anchor, from gui.get_xanchor.
Returns
Exclude<gui.Anchor, typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_TOP>
Node.set_xanchor(anchor: Exclude<gui.Anchor, typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_TOP>): Node
Sets the node's horizontal anchor with gui.set_xanchor.
Parameters
anchor:Exclude<gui.Anchor, typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_TOP>— The horizontal anchor.
Returns
Node
Node.get_yanchor(): Exclude<gui.Anchor, typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT>
Returns the node's vertical anchor, from gui.get_yanchor.
Returns
Exclude<gui.Anchor, typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT>
Node.set_yanchor(anchor: Exclude<gui.Anchor, typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT>): Node
Sets the node's vertical anchor with gui.set_yanchor.
Parameters
anchor:Exclude<gui.Anchor, typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT>— The vertical anchor.
Returns
Node
Node.get_pivot(): gui.Pivot
Node.set_pivot(pivot: gui.Pivot): Node
Node.get_slice9(): Vector4
Returns the slice-9 margins of a box node, from gui.get_slice9.
Returns
Vector4
Node.set_slice9(values: Vector4): Node
Sets the slice-9 margins of a box node with gui.set_slice9.
Parameters
values:Vector4— The left, top, right and bottom margins.
Returns
Node
Node.get_perimeter_vertices(): number
Returns the perimeter vertex count of a pie node, from gui.get_perimeter_vertices.
Returns
number
Node.set_perimeter_vertices(vertices: number): Node
Sets the perimeter vertex count of a pie node with gui.set_perimeter_vertices.
Parameters
vertices:number— The vertex count.
Returns
Node
Node.get_fill_angle(): number
Returns the fill angle of a pie node in degrees, from gui.get_fill_angle.
Returns
number
Node.set_fill_angle(angle: number): Node
Sets the fill angle of a pie node with gui.set_fill_angle.
Parameters
angle:number— The angle in degrees.
Returns
Node
Node.get_inner_radius(): number
Returns the inner radius of a pie node, from gui.get_inner_radius.
Returns
number
Node.set_inner_radius(radius: number): Node
Sets the inner radius of a pie node with gui.set_inner_radius.
Parameters
radius:number— The inner radius.
Returns
Node
Node.get_outer_bounds(): gui.PieBounds
Node.set_outer_bounds(bounds_mode: gui.PieBounds): Node
Sets the outer bounds mode of a pie node with gui.set_outer_bounds.
Parameters
bounds_mode:gui.PieBounds— The outer bounds mode.
Returns
Node
Node.get_leading(): number
Returns the line spacing of a text node, from gui.get_leading.
Returns
number
Node.set_leading(leading: number): Node
Sets the line spacing of a text node with gui.set_leading.
Parameters
leading:number— The line spacing.
Returns
Node
Node.get_tracking(): number
Returns the letter spacing of a text node, from gui.get_tracking.
Returns
number
Node.set_tracking(tracking: number): Node
Sets the letter spacing of a text node with gui.set_tracking.
Parameters
tracking:number— The letter spacing.
Returns
Node
Node.in_bound(x: number, y: number): boolean
Returns whether a screen point is inside the node, from gui.pick_node.
Parameters
x:number— The screen x coordinate.y:number— The screen y coordinate.
Returns
boolean
Node.is_enabled(): boolean
Returns whether the node itself is enabled, from gui.is_enabled.
Returns
boolean
Node.set_enabled(enabled: boolean): Node
Enables or disables the node with gui.set_enabled.
Parameters
enabled:boolean— Whether the node is enabled.
Returns
Node
Node.get_visible(): boolean
Returns whether the node is visible, from gui.get_visible.
Returns
boolean
Node.set_visible(visible: boolean): Node
Sets whether the node is visible with gui.set_visible.
Parameters
visible:boolean— Whether the node is visible.
Returns
Node
Node.get_adjust_mode(): gui.Adjust
Node.set_adjust_mode(adjust_mode: gui.Adjust): Node
Sets the node's adjust mode with gui.set_adjust_mode.
Parameters
adjust_mode:gui.Adjust— The adjust mode.
Returns
Node
Node.get_size_mode(): gui.SizeMode
Node.set_size_mode(size_mode: gui.SizeMode): Node
Sets the node's size mode with gui.set_size_mode.
Parameters
size_mode:gui.SizeMode— The size mode.
Returns
Node
Node.move_above(reference: Node | Opaque<'node'> | undefined): Node
Moves the node above another in the draw order with gui.move_above.
Parameters
reference:Node | Opaque<'node'> | undefined— The node to move above, wrapped or not, orundefinedto move this node to the top.
Returns
Node
Node.move_below(reference: Node | Opaque<'node'> | undefined): Node
Moves the node below another in the draw order with gui.move_below.
Parameters
reference:Node | Opaque<'node'> | undefined— The node to move below, wrapped or not, orundefinedto move this node to the bottom.
Returns
Node
Node.get_parent(): Opaque<'node'> | undefined
Returns the node's parent, from gui.get_parent, or undefined for a root node.
Returns
Opaque<'node'> | undefined
Node.set_parent(parent: Node | Opaque<'node'> | undefined, keep_scene_transform?: boolean): Node
Sets the node's parent with gui.set_parent.
Parameters
parent:Node | Opaque<'node'> | undefined— The new parent, wrapped or not, orundefinedto make the node a root.keep_scene_transform?:boolean— Whether to keep the node's scene transform. Defaults tofalse.
Returns
Node
Node.add_child(node: Node | Opaque<'node'>, keep_scene_transform?: boolean): Node
Makes a node a child of this node with gui.set_parent.
Parameters
node:Node | Opaque<'node'>— The new child, wrapped or not.keep_scene_transform?:boolean— Whether to keep the child's scene transform. Defaults tofalse.
Returns
Node
Node.clone(): Opaque<'node'>
Clones the node with gui.clone and returns the clone.
Returns
Opaque<'node'>
Node.clone_tree(): NodeTree
Clones the node and its children with gui.clone_tree and returns the clones by id.
Returns
NodeTree
Node.get_tree(): NodeTree
Returns the node and its children by id, from gui.get_tree.
Returns
NodeTree
Node.get_position(): Vector3
Returns the node's position, from gui.get_position.
Returns
Vector3
Node.set_position(position?: Vector3 | Vector4): Node
Sets the node's position with gui.set_position.
Parameters
position?:Vector3 | Vector4— The position. Defaults to the origin.
Returns
Node
Node.add_position(value: number | Vector3): Node
Adds to the node's position.
Parameters
value:number | Vector3— The offset, or a number added to each of x, y and z.
Returns
Node
Node.get_position_x(): number
Returns the x component of the node's position.
Returns
number
Node.get_position_y(): number
Returns the y component of the node's position.
Returns
number
Node.get_position_z(): number
Returns the z component of the node's position.
Returns
number
Node.set_position_x(x: number): Node
Sets the x component of the node's position.
Parameters
x:number— The x component.
Returns
Node
Node.set_position_y(y: number): Node
Sets the y component of the node's position.
Parameters
y:number— The y component.
Returns
Node
Node.set_position_z(z: number): Node
Sets the z component of the node's position.
Parameters
z:number— The z component.
Returns
Node
Node.add_position_x(x: number): Node
Adds to the x component of the node's position.
Parameters
x:number— The amount to add.
Returns
Node
Node.add_position_y(y: number): Node
Adds to the y component of the node's position.
Parameters
y:number— The amount to add.
Returns
Node
Node.add_position_z(z: number): Node
Adds to the z component of the node's position.
Parameters
z:number— The amount to add.
Returns
Node
Node.get_rotation(): Quaternion
Returns the node's rotation as a quaternion, from gui.get_rotation.
Returns
Quaternion
Node.set_rotation(rotation: Quaternion | Vector4 | Vector3): Node
Sets the node's rotation with gui.set_rotation.
Parameters
rotation:Quaternion | Vector4 | Vector3— The rotation.
Returns
Node
Node.add_rotation(value: number | Vector3): Node
- Deprecated — Raises on every call:
gui.get_rotationreturns a quaternion, which has no+. Useadd_euler.
Adds to the node's rotation.
Parameters
value:number | Vector3— The offset, or a number added to each of x, y and z.
Returns
Node
Node.get_rotation_x(): number
Returns the x component of the node's rotation quaternion, not an angle.
Returns
number
Node.get_rotation_y(): number
Returns the y component of the node's rotation quaternion, not an angle.
Returns
number
Node.get_rotation_z(): number
Returns the z component of the node's rotation quaternion, not an angle.
Returns
number
Node.set_rotation_x(x: number): Node
Sets the x component of the node's rotation quaternion, not an angle.
Parameters
x:number— The x component.
Returns
Node
Node.set_rotation_y(y: number): Node
Sets the y component of the node's rotation quaternion, not an angle.
Parameters
y:number— The y component.
Returns
Node
Node.set_rotation_z(z: number): Node
Sets the z component of the node's rotation quaternion, not an angle.
Parameters
z:number— The z component.
Returns
Node
Node.add_rotation_x(x: number): Node
Adds to the x component of the node's rotation quaternion, not an angle.
Parameters
x:number— The amount to add.
Returns
Node
Node.add_rotation_y(y: number): Node
Adds to the y component of the node's rotation quaternion, not an angle.
Parameters
y:number— The amount to add.
Returns
Node
Node.add_rotation_z(z: number): Node
Adds to the z component of the node's rotation quaternion, not an angle.
Parameters
z:number— The amount to add.
Returns
Node
Node.get_euler(): Vector3
Returns the node's rotation as euler angles in degrees, from gui.get_euler.
Returns
Vector3
Node.set_euler(euler: Vector3 | Vector4): Node
Sets the node's rotation as euler angles in degrees with gui.set_euler.
Parameters
euler:Vector3 | Vector4— The euler angles.
Returns
Node
Node.add_euler(value: number | Vector3): Node
Adds to the node's euler angles.
Parameters
value:number | Vector3— The angles in degrees, or a number added to each of x, y and z.
Returns
Node
Node.get_euler_x(): number
Returns the node's euler angle around x, in degrees.
Returns
number
Node.get_euler_y(): number
Returns the node's euler angle around y, in degrees.
Returns
number
Node.get_euler_z(): number
Returns the node's euler angle around z, in degrees.
Returns
number
Node.set_euler_x(x: number): Node
Sets the node's euler angle around x.
Parameters
x:number— The angle in degrees.
Returns
Node
Node.set_euler_y(y: number): Node
Sets the node's euler angle around y.
Parameters
y:number— The angle in degrees.
Returns
Node
Node.set_euler_z(z: number): Node
Sets the node's euler angle around z.
Parameters
z:number— The angle in degrees.
Returns
Node
Node.add_euler_x(x: number): Node
Adds to the node's euler angle around x.
Parameters
x:number— The angle in degrees.
Returns
Node
Node.add_euler_y(y: number): Node
Adds to the node's euler angle around y.
Parameters
y:number— The angle in degrees.
Returns
Node
Node.add_euler_z(z: number): Node
Adds to the node's euler angle around z.
Parameters
z:number— The angle in degrees.
Returns
Node
Node.get_scale(): Vector3
Returns the node's scale, from gui.get_scale.
Returns
Vector3
Node.set_scale(scale: number | Vector3 | Vector4): Node
Sets the node's scale with gui.set_scale.
Parameters
scale:number | Vector3 | Vector4— The scale, or a number used for each of x, y and z.
Returns
Node
Node.add_scale(value: number | Vector3): Node
Adds to the node's scale.
Parameters
value:number | Vector3— The offset, or a number added to each of x, y and z.
Returns
Node
Node.get_scale_x(): number
Returns the x component of the node's scale.
Returns
number
Node.get_scale_y(): number
Returns the y component of the node's scale.
Returns
number
Node.get_scale_z(): number
Returns the z component of the node's scale.
Returns
number
Node.set_scale_x(x: number): Node
Sets the x component of the node's scale.
Parameters
x:number— The x component.
Returns
Node
Node.set_scale_y(y: number): Node
Sets the y component of the node's scale.
Parameters
y:number— The y component.
Returns
Node
Node.set_scale_z(z: number): Node
Sets the z component of the node's scale.
Parameters
z:number— The z component.
Returns
Node
Node.add_scale_x(x: number): Node
Adds to the x component of the node's scale.
Parameters
x:number— The amount to add.
Returns
Node
Node.add_scale_y(y: number): Node
Adds to the y component of the node's scale.
Parameters
y:number— The amount to add.
Returns
Node
Node.add_scale_z(z: number): Node
Adds to the z component of the node's scale.
Parameters
z:number— The amount to add.
Returns
Node
Node.get_color(): Vector4
Returns the node's color, from gui.get_color.
Returns
Vector4
Node.set_color<S extends string>(color: Vector3 | Vector4 | HexColor | HexColorLiteral<S>): Node
Sets the node's color with gui.set_color.
Parameters
color:Vector3 | Vector4 | HexColor | HexColorLiteral<S>— The color, a#rrggbbor#rrggbbaahex literal in either case, or a checkedHexColor. A string without an alpha pair is opaque.
Returns
Node
Node.get_outline(): Vector4
Returns the outline color of a text node, from gui.get_outline.
Returns
Vector4
Node.set_outline(color: Vector3 | Vector4): Node
Sets the outline color of a text node with gui.set_outline.
Parameters
color:Vector3 | Vector4— The outline color.
Returns
Node
Node.get_shadow(): Vector4
Returns the shadow color of a text node, from gui.get_shadow.
Returns
Vector4
Node.set_shadow(color: Vector3 | Vector4): Node
Sets the shadow color of a text node with gui.set_shadow.
Parameters
color:Vector3 | Vector4— The shadow color.
Returns
Node
Node.get_size(): Vector3
Returns the node's size, from gui.get_size.
Returns
Vector3
Node.set_size(size: Vector3 | Vector4): Node
Sets the node's size with gui.set_size.
Parameters
size:Vector3 | Vector4— The size.
Returns
Node
Node.add_size(value: number | Vector3): Node
Adds to the node's size.
Parameters
value:number | Vector3— The offset, or a number added to each of x, y and z.
Returns
Node
Node.get_size_x(): number
Returns the node's width.
Returns
number
Node.get_size_y(): number
Returns the node's height.
Returns
number
Node.get_size_z(): number
Returns the z component of the node's size.
Returns
number
Node.set_size_x(x: number): Node
Sets the node's width.
Parameters
x:number— The width.
Returns
Node
Node.set_size_y(y: number): Node
Sets the node's height.
Parameters
y:number— The height.
Returns
Node
Node.set_size_z(z: number): Node
Sets the z component of the node's size.
Parameters
z:number— The z component.
Returns
Node
Node.add_size_x(x: number): Node
Adds to the node's width.
Parameters
x:number— The amount to add.
Returns
Node
Node.add_size_y(y: number): Node
Adds to the node's height.
Parameters
y:number— The amount to add.
Returns
Node
Node.add_size_z(z: number): Node
Adds to the z component of the node's size.
Parameters
z:number— The amount to add.
Returns
Node
Node.get_text_metrics(apply_scale?: boolean): resource.TextMetrics
Measures a text node's text in its font with resource.get_text_metrics.
Parameters
apply_scale?:boolean— Whether to multiply the width and height by the node's own x and y scale.
Returns
Node.get_total_scale(): Vector3
Returns the node's scale multiplied by the scale of each of its ancestors.
Returns
Vector3
Node.get_screen_position(): Vector3
Returns the node's screen position, from gui.get_screen_position.
Returns
Vector3
Node.set_screen_position(screen_position: Vector3 | Vector4): Node
Sets the node's screen position with gui.set_screen_position.
Parameters
screen_position:Vector3 | Vector4— The screen position.
Returns
Node
Node.screen_to_local(screen_position: Vector3 | Vector4, ignore_scale?: boolean): Vector3
Converts a screen position to the node's local space with gui.screen_to_local.
Parameters
screen_position:Vector3 | Vector4— The screen position.ignore_scale?:boolean— Whether to divide the result byget_total_scale.
Returns
Vector3
Node.get_flipbook_cursor(): number
Returns the node's flipbook cursor, from gui.get_flipbook_cursor.
Returns
number
Node.set_flipbook_cursor(cursor: number): Node
Sets the node's flipbook cursor with gui.set_flipbook_cursor.
Parameters
cursor:number— The cursor, from0to1.
Returns
Node
Node.get_flipbook_playback_rate(): number
Returns the node's flipbook playback rate, from gui.get_flipbook_playback_rate.
Returns
number
Node.set_flipbook_playback_rate(playback_rate: number): Node
Sets the node's flipbook playback rate with gui.set_flipbook_playback_rate.
Parameters
playback_rate:number— The playback rate.
Returns
Node
Node.play_particlefx(emitter_state_function?: (self: unknown, node: Opaque<'node'> | undefined, emitter: Hash, state: particlefx.EmitterState) => void): Node
Plays the particle fx of a particle fx node with gui.play_particlefx.
Parameters
emitter_state_function?:(self: unknown, node: Opaque<'node'> | undefined, emitter: Hash, state: particlefx.EmitterState) => void— Called when an emitter changes state.
Returns
Node
Node.stop_particlefx(options?: particlefx.StopOptions): Node
Stops the particle fx of a particle fx node with gui.stop_particlefx.
Parameters
options?:particlefx.StopOptions—clearremoves the live particles at once.
Returns
Node
Node.get_particlefx(): Hash
Returns the particle fx of a particle fx node, from gui.get_particlefx.
Returns
Hash
Node.set_particlefx(particlefx: Hash | string): Node
Sets the particle fx of a particle fx node with gui.set_particlefx.
Parameters
particlefx:Hash | string— The particle fx resource name.
Returns
Node
Node.get_inherit_alpha(): boolean
Returns whether the node inherits its parent's alpha, from gui.get_inherit_alpha.
Returns
boolean
Node.set_inherit_alpha(inherit_alpha: boolean): Node
Sets whether the node inherits its parent's alpha with gui.set_inherit_alpha.
Parameters
inherit_alpha:boolean— Whether to inherit the parent's alpha.
Returns
Node
Node.get_alpha(): number
Returns the node's alpha, from gui.get_alpha.
Returns
number
Node.set_alpha(alpha: number): Node
Sets the node's alpha with gui.set_alpha.
Parameters
alpha:number— The alpha, from0to1.
Returns
Node
Node.node: Opaque<'node'>
The wrapped node, passed first to every gui.* call.