Quark #

Modules #

Quark v1.4.0 Documentation

Contents

quark/view #

Enum: ViewType #

ViewType #

Enumeration of all runtime view types in the UI/world tree. Used for RTTI-style checks and optimized branching.

  • View
  • Entity
  • Sprite
  • Spine
  • Label
  • Box
  • Flex
  • Flow
  • Free
  • Image
  • Video
  • Input
  • Textarea
  • Scroll
  • Text
  • Button
  • Morph
  • World
  • Root
  • Enum_Counts

Interface: DOM #

DOM #

Lightweight DOM-like interface for runtime view attachment and ownership. A DOM can be appended into the view tree, moved, and destroyed from its owner.

dom.ref #

Reference name for this node (for lookup / debugging).

readonly ref: string

dom.metaView #

The "meta" view (mount point) associated with this DOM node.

readonly metaView: View

dom.owner #

The owner ViewController that manages this DOM node.

readonly owner: ViewController

dom.appendTo(parent) #

Append this node as a child of the given parent.

appendTo(parent: View): View

Parameters:

  • parent — Target parent view.

Returns: The same view for chaining.

dom.afterTo(prev) #

Insert this node after an existing sibling.

afterTo(prev: View): View

Parameters:

  • prev — The sibling after which this node will be inserted.

Returns: The same view for chaining.

dom.destroy(owner) #

Destroy this node from its logical owner (e.g. a ViewController).

destroy(owner: ViewController): void

Parameters:

  • owner — The controller / owner that manages this DOM node.

ChildDOM #

Internal JSX child node handle (may be null for holes/conditional children).

type ChildDOM = DOM | null

Class: View #

View #

Base class for all visual nodes. A View participates in:

  • The scene tree (parent/child, prev/next sibling, etc.).
  • Layout (size, alignment, margins, etc.).
  • Style (color, border, background, etc.).
  • Input and interaction events (mouse, touch, keys, gestures).
  • Rendering and visibility. View is also an event emitter (Notification<UIEvent>) and implements a DOM-like API.

Extends: Notification<UIEvent> Implements: DOM

view.childDoms #

Internal JSX child DOM nodes (virtual children for VDOM/JSX diffing).

readonly childDoms: ChildDOM[]

view.owner #

The owner ViewController that manages this view.

readonly owner: ViewController

view.onClick #

view.onMultiClick #

view.onBack #

view.onKeyDown #

view.onKeyPress #

view.onKeyUp #

view.onKeyEnter #

view.onTouchStart #

view.onTouchMove #

view.onTouchEnd #

view.onTouchCancel #

view.onMouseLeave #

view.onMouseEnter #

view.onMouseMove #

view.onMouseDown #

view.onMouseUp #

view.onMouseWheel #

view.onFocus #

view.onBlur #

view.onUIStateChange #

view.onActionKeyframe #

view.onActionLoop #

view.onGesture #

view.onPanGesture #

view.onSwipeGesture #

view.onPinchGesture #

view.onRotateGesture #

view.onThreeFingerGesture #

view.onFourFingerGesture #

view.cssclass #

Computed CSS class set for this view.

readonly cssclass: CStyleSheetsClass

view.parent #

Parent view in the scene graph (or null if root).

readonly parent: View | null

view.prev #

Previous sibling view (or null).

readonly prev: View | null

view.next #

Next sibling view (or null).

readonly next: View | null

view.first #

First child view (or null).

readonly first: View | null

view.last #

Last child view (or null).

readonly last: View | null

view.window #

Associated Window / rendering context.

readonly window: Window

view.morphView #

The closest ancestor MorphView (a transformable node), or null. This is useful for walking up to a transform root.

readonly morphView: MorphView | null

view.level #

Depth in the attached view tree. The root level is 1 and descendants increase from there; 0 means that the view is detached. Visibility does not change this value.

readonly level: number

view.layoutWeight #

Layout weight (used by layout containers like Flex/Flow).

readonly layoutWeight: Vec2

view.layoutAlign #

Layout alignment rules for this view inside its parent.

readonly layoutAlign: types.Align

view.isClip #

Whether this view clips its children to its bounds.

readonly isClip: boolean

view.viewType #

View runtime type (for optimized branching and RTTI).

readonly viewType: ViewType

view.isTextInput #

Whether this view is a text input (Input or Textarea).

readonly isTextInput: boolean

view.position #

Final resolved position in layout coordinates.
⚠️ Runtime-synced (render-thread updated):
This value is updated from the rendering thread.
If accessed during active rendering, x and y may come from slightly
different frame moments.
For most use cases, this value is sufficiently accurate,
but precision-critical code should not assume atomic consistency.

readonly position: Vec2
  • @safe rt — updated by the render thread; may not always be atomically consistent.

view.layoutOffset #

Layout offset from parent content origin.

readonly layoutOffset: Vec2
  • @safe rt — updated by the render thread; may not always be atomically consistent.

view.layoutSize #

Final resolved layout size. For Box-like views: border + padding + content + margin.

readonly layoutSize: Vec2
  • @safe rt — updated by the render thread; may not always be atomically consistent.

view.clientSize #

Client (inner) size in local coordinates. For Box: offset, border + padding + content (no margin).

readonly clientSize: Vec2
  • @safe rt — updated by the render thread; may not always be atomically consistent.

view.clientRegion #

Client region (used for precise hit testing).

readonly clientRegion: types.Region
  • @safe rt — updated by the render thread; may not always be atomically consistent.

view.metaView #

Meta view for controller mounting. In many cases this is the same View, but controller systems may wrap.

readonly metaView: View

view.visibleArea #

Whether this view is currently in the visible area.

readonly visibleArea: boolean

view.ref #

Reference in owner view controller

readonly ref: string

view.key #

Unique key for this view in the DOMCollection.

readonly key: string | number

view.data #

Arbitrary data field attached to this view.

data: any

view.style #

Style sheet block attached to this view.

style: StyleSheets

view.action #

Running animation or tween controller.

action: Action | null

view.class #

Assigned class names. Setting this updates cssclass internally.

class: string[]

view.color #

Local color tint applied to this view. The final rendered color is a combination of this color and parent color (depending on cascade_color).

color: types.Color

view.cascadeColor #

Color inheritance mode from the parent view. Determines how this view's color combines with its parent's final color. final_color = parent.final_color ⨉ self.color // depending on cascade_color Default: CascadeColor::Both

cascadeColor: types.CascadeColor

view.cursor #

Mouse cursor style when hovering this view.

cursor: types.CursorStyle

view.zIndex #

Z index in global view tree.

zIndex: Uint

view.opacity #

Visual opacity. 0.0 ~ 1.0. Often mirrors color.a / 255.0.

opacity: Float

view.visible #

Whether the view is visible for rendering & hit testing.

visible: boolean

view.cascadeVisible #

Effective visibility in the attached view tree. This is true only when this view and every ancestor are visible.

readonly cascadeVisible: boolean

view.receive #

Whether the view is currently interactive / receiving events.

receive: boolean

view.aa #

Enable anti-aliasing for drawing (if supported), default true.

aa: boolean

view.isFocus #

Whether the view currently has keyboard focus.

isFocus: boolean

view.focus() #

Request focus for this view (if focusable).

focus(): boolean

Returns: true if focus was granted.

view.blur() #

Drop focus from this view if it currently has focus.

blur(): boolean

view.show() #

Convenience: set visible = true.

show(): void

view.hide() #

Convenience: set visible = false.

hide(): void

view.isChild(child) #

Returns true if the given view is contained in this view's subtree.

isChild(child: View): boolean

Parameters:

  • child — The view to test.

view.before(view) #

Insert this view before another sibling in the same parent.

before(view: View): void

Parameters:

  • view — Sibling to insert before.

view.after(view) #

Insert this view after another sibling in the same parent.

after(view: View): void

Parameters:

  • view — Sibling to insert after.

view.prepend(view) #

Insert a view as the first child.

prepend(view: View): void

Parameters:

  • view — Child to prepend.

view.append(view) #

Append a view as the last child.

append(view: View): void

Parameters:

  • view — Child to append.

view.remove() #

Remove this view from its parent.

remove(): void

view.removeAllChild() #

Remove all children from this view.

removeAllChild(): void

view.overlapTest(point) #

Hit test in world or parent space.

overlapTest(point: Vec2): boolean

Parameters:

  • point — World-space or compatible test point.

Returns: true if the point overlaps this view's hit region.

view.hashCode() #

Returns a hash code / unique runtime identifier.

hashCode(): Int

view.appendTo(parent) #

DOM: append this view to a parent view.

appendTo(parent: View): this

Parameters:

  • parent — Parent to append into.

Returns: this view.

view.afterTo(prev) #

DOM: insert this view after a sibling.

afterTo(prev: View): this

Parameters:

  • prev — Sibling to insert after.

Returns: this view.

view.destroy(owner) #

Destroy this view in the context of its owning controller.

destroy(owner: ViewController): void

Parameters:

  • owner — The ViewController managing this view.

view.transition(to,from?) #

Run a visual transition (animation) from an initial keyframe to a target keyframe.

transition(to: KeyframeIn, from: any, from?: KeyframeIn): TransitionResult

Parameters:

  • to — Target keyframe(s)
  • from — Optional starting keyframe(s)

view.asTextOptions() #

Cast helper: return this view as a TextOptions if it is one, otherwise null.

asTextOptions(): TextOptions | null

view.asScrollView() #

Cast helper: return this view as a ScrollView if it is one, otherwise null.

asScrollView(): ScrollView | null

view.asButton() #

Cast helper: return this view as a Button if it is one, otherwise null.

asButton(): Button | null

view.asMorphView() #

Cast helper: return this view as a MorphView if it is one, otherwise null.

asMorphView(): MorphView | null

view.asEntity() #

Cast helper: return this view as an Entity if it is one, otherwise null.

asEntity(): Entity | null

view.hasClass(name) #

Check if this view has a given CSS class name.

hasClass(name: string): boolean

view.addClass(name) #

Add a CSS class name to this view.

addClass(name: string): void

view.removeClass(name) #

Add a CSS class name to this view.

removeClass(name: string): void

view.constructor(win) #

Create a new View instance bound to a given Window.

constructor(win: Window)

Parameters:

  • win — Rendering / event window context.

view.isViewController #

Marker used by JSX/runtime to detect controllers.

readonly isViewController: boolean

Class: Br #

Br #

Line Break is a special invisible view that forces a line break in text layout.

Extends: View

Class: Box #

Box #

Box is a rectangular layout container. It introduces margin, padding, border, background, radius, and shadow styling, plus "weight" and computed content size.

Extends: View

box.clip #

Clip children to this box's bounds.

clip: boolean

box.layout #

Layout type for child positioning and sizing. Default: LayoutType::Normal

layout: types.LayoutType

box.align #

Alignment of this box inside its parent.

align: types.Align

box.boxSizing #

Box sizing model for width/height calculations.

boxSizing: types.BoxSizing

box.width #

Declared width (can be absolute, auto, percent, etc.).

width: types.BoxSize

box.height #

Declared height.

height: types.BoxSize

box.minWidth #

Minimum width constraint.

minWidth: types.BoxSize

box.minHeight #

Minimum height constraint.

minHeight: types.BoxSize

box.maxWidth #

Maximum width constraint.

maxWidth: types.BoxSize

box.maxHeight #

Maximum height constraint.

maxHeight: types.BoxSize

box.margin #

Margin (top,right,bottom,left).

margin: number[]

box.marginTop #

Margin top.

marginTop: number

box.marginRight #

Margin right.

marginRight: number

box.marginBottom #

Margin bottom.

marginBottom: number

box.marginLeft #

Margin left.

marginLeft: number

box.padding #

Padding (top,right,bottom,left).

padding: number[]

box.paddingTop #

Padding top.

paddingTop: number

box.paddingRight #

Padding right.

paddingRight: number

box.paddingBottom #

Padding bottom.

paddingBottom: number

box.paddingLeft #

Padding left.

paddingLeft: number

box.borderRadius #

Corner radii (tl,tr,br,bl).

borderRadius: number[]

box.borderTopLeftRadius #

Corner radius top-left.

borderTopLeftRadius: number

box.borderTopRightRadius #

Corner radius top-right.

borderTopRightRadius: number

box.borderBottomRightRadius #

Corner radius bottom-right.

borderBottomRightRadius: number

box.borderBottomLeftRadius #

Corner radius bottom-left.

borderBottomLeftRadius: number

box.border #

Border descriptors for each edge.

border: types.Border[]

box.borderTop #

Border descriptor for the top edge.

borderTop: types.Border

box.borderRight #

Border descriptor for the right edge.

borderRight: types.Border

box.borderBottom #

Border descriptor for the bottom edge.

borderBottom: types.Border

box.borderLeft #

Border descriptor for the left edge.

borderLeft: types.Border

box.borderWidth #

Border widths per edge (top,right,bottom,left).

borderWidth: number[]

box.borderTopWidth #

Border width top.

borderTopWidth: number

box.borderRightWidth #

Border width right.

borderRightWidth: number

box.borderBottomWidth #

Border width bottom.

borderBottomWidth: number

box.borderLeftWidth #

Border width left.

borderLeftWidth: number

box.borderColor #

Border colors per edge (top,right,bottom,left).

borderColor: types.Color[]

box.borderTopColor #

Border color top.

borderTopColor: types.Color

box.borderRightColor #

Border color right.

borderRightColor: types.Color

box.borderBottomColor #

Border color bottom.

borderBottomColor: types.Color

box.borderLeftColor #

Border color left.

borderLeftColor: types.Color

box.backgroundColor #

Solid background color.

backgroundColor: types.Color

box.background #

Advanced background or filter effect.

background: types.BoxFilter | null

box.boxShadow #

Drop shadow definition.

boxShadow: types.BoxShadow | null

box.weight #

Layout weight (e.g. Flex ratio). Often interpreted by parent layout containers.

weight: Vec2

box.contentSize #

Final inner content size (width,height), not including this view's padding.

readonly contentSize: Vec2

Class: Flex #

Flex #

Flex is a box-level container that arranges children in a single line (row or column) with alignment rules similar to flexbox concepts.

Extends: Box

flex.direction #

Main axis direction (row, column, etc.).

direction: types.Direction

flex.itemsAlign #

Alignment of items along the main axis.

itemsAlign: types.ItemsAlign

flex.crossAlign #

Alignment of items along the cross axis.

crossAlign: types.CrossAlign

Class: Flow #

Flow #

Flow is a flex-like container that supports wrapping, similar to a multi-line flexbox layout.

Extends: Flex

flow.wrap #

Whether and how children wrap to the next line/column.

wrap: types.Wrap

flow.wrapAlign #

Alignment of wrapped lines relative to the container.

wrapAlign: types.WrapAlign

Class: Free #

Free #

Free is a box-style view without additional layout rules. Useful for absolute/overlay-style positioning inside custom layouts.

Extends: Box

Class: Image #

Image #

Image is a drawable rectangular view that displays a texture or bitmap.

Extends: Box

image.onLoad #

image.onError #

image.src #

Image source URL or resource identifier.

src: string

Interface: MorphView #

MorphView #

MorphView is a transform-capable view interface. Anything that implements MorphView can be translated, scaled, skewed, rotated, and exposes a transform matrix.

Extends: View

morphview.translate #

Translation in local space.

translate: Vec2

morphview.scale #

Scale factors along X and Y axes.

scale: Vec2

morphview.skew #

Skew factors for X and Y axes.

skew: Vec2

morphview.origin #

Anchor point(s) used for transformation origin.

origin: types.BoxOrigin[]

morphview.originX #

X-axis anchor (e.g., left, center, right).

originX: types.BoxOrigin

morphview.originY #

Y-axis anchor (e.g., top, center, bottom).

originY: types.BoxOrigin

morphview.x #

Local X position.

x: number

morphview.y #

Local Y position.

y: number

morphview.scaleX #

X scale factor.

scaleX: number

morphview.scaleY #

Y scale factor.

scaleY: number

morphview.skewX #

X-axis skew in degrees.

skewX: number

morphview.skewY #

Y-axis skew in degrees.

skewY: number

morphview.rotateZ #

Z-axis rotation in degrees.

rotateZ: number

morphview.originValue #

Resolved origin offset values as [x, y].

readonly originValue: number[]

morphview.matrix #

Combined transformation matrix (local-to-world).

readonly matrix: types.Mat

Class: Morph #

Morph #

Morph is a Box that supports geometric transform (translate, scale, skew, rotation, and origin). It is typically used as a transform root / group.

Extends: Box Implements: MorphView

Class: Entity #

Entity #

Entity is the base class for all drawable / interactive 2D world objects. An Entity:

  • Participates in rendering and hit testing.
  • Has world-space transform (via MorphView).
  • Maintains geometric bounds (polygon / circle / etc.).
  • Can exist inside a World.

Extends: View Implements: MorphView

entity.bounds #

Geometric bounds for collision / hit testing. Examples: circle radius, polygon points, etc.

bounds: types.Bounds

entity.asAgent() #

Cast helper: return this view as an Agent if it is one, otherwise null.

asAgent(): Agent | null

entity.participate #

Whether this entity participates in the world as a detectable/collidable object. If false, other agents will ignore this entity (no collision, no detection), but this entity may still actively collide or detect others if it is an Agent. Default: true

participate: boolean

Class: Agent #

Agent #

Agent is a moving Entity with basic navigation / AI behavior. An Agent:

  • Can move toward a target position.
  • Can follow a waypoint path.
  • Can follow another Agent with distance constraints.
  • Emits movement- and AI-related events.

Extends: Entity

agent.onReachWaypoint #

Fired when the agent reaches the next waypoint.

agent.onAgentMovement #

Fired when the agent arrives at its final destination.

agent.onDiscoveryAgent #

Fired when an agent is discovered (enters range) or lost (leaves range).

agent.onAgentHeadingChange #

Fired when the agent's heading direction changes.

agent.active #

Whether the agent is currently active (moving or processing behavior). Default: true

active: boolean

agent.moving #

Whether the agent is currently moving toward a target or along waypoints or following another agent.

readonly moving: boolean

agent.floatingStation #

Indicates if the agent’s standing position is floating (soft). When enabled, the agent does not defend its current spot after arrival and can be displaced by nearby agents—useful for group formations or crowding around large targets. Default: false

floatingStation: boolean

agent.waypoints #

Waypoints path for the agent to navigate.

waypoints: Path | null

agent.target #

Direct movement destination in world coordinates.

readonly target: Vec2

agent.velocitySteer #

Current avoidance velocity steering vector in world coordinates.

readonly velocitySteer: Vec2

agent.velocity #

Current real velocity vector in world coordinates.

readonly velocity: Vec2

agent.heading #

Behavior heading direction (normalized). The agent's intended movement direction based on path/follow logic. Not necessarily equal to velocity direction and does not jitter.

readonly heading: Vec2

agent.velocityMax #

Maximum allowed movement speed.

velocityMax: Float

agent.currentWaypoint #

Index of the current waypoint along the path.

readonly currentWaypoint: Uint

agent.discoveryDistances #

Discovery radii for proximity checks. Each element is a threshold band for detection.

discoveryDistances: Float[]

agent.safetyBuffer #

Safety buffer distance for local avoidance. Higher = keep more distance from obstacles/agents.

safetyBuffer: Float

agent.avoidanceFactor #

Avoidance strength multiplier during collision resolution. Default is 1.0f, range [0.0, 10.0].

avoidanceFactor: Float

agent.avoidanceVelocityFactor #

Maximum avoidance velocity applied when steering away from obstacles. Default is 0.8f, range [0.0, 3.0], recommended range [0.0, 1.0].

avoidanceVelocityFactor: Float

agent.followMinDistance #

Distance min range maintained while following a target agent.

followMinDistance: Float

agent.followMaxDistance #

Distance max range maintained while following a target agent.

followMaxDistance: Float

agent.followTarget #

The agent currently being followed. If null, no follow behavior is active.

followTarget: Agent | null

agent.moveTo(target,immediately?) #

Move toward a specific position.

moveTo(target: Vec2, immediately: any, immediately?: boolean): void

Parameters:

  • target — Destination position (world coords).
  • immediately — If true, teleport or snap immediately.

agent.setWaypoints(waypoints,immediately?) #

Assign a list of waypoints for navigation.

setWaypoints(waypoints: Path, immediately: any, immediately?: boolean): void

Parameters:

  • waypoints — Path object representing the navigation route.
  • immediately — If true, begin from the nearest waypoint now.

agent.returnToWaypoints(immediately?) #

Rejoin the assigned waypoint path from the closest segment.

returnToWaypoints(immediately: any, immediately?: boolean): void

Parameters:

  • immediately — If true, snap directly to that segment.

agent.stop() #

clear current movement (waypoints or follow target). and set target to current position.

stop(): void

Class: Sprite #

Sprite #

Sprite is a renderable Agent that draws from a sprite sheet / atlas. Features:

  • Frame-based animation (rows/cols).
  • Playback control (play / stop).
  • Directional facing.

Extends: Agent

sprite.onLoad #

sprite.onError #

sprite.src #

Sprite source (image / atlas).

src: string

sprite.width #

Rendered width of the sprite (px / world units).

width: Float

sprite.height #

Rendered height of the sprite.

height: Float

sprite.frame #

Current frame index.

frame: Uint16

sprite.frames #

Total frame count in the animation grid.

frames: Uint16

sprite.set #

The current set of the sprite animation, default 0.

set: Uint16

sprite.sets #

The number of sets in the sprite animation, default 1.

sets: Uint16

sprite.spacing #

Spacing between frames in the sprite sheet (px).

spacing: Uint8

sprite.frequency #

Animation playback frequency (frames per second).

frequency: Uint8

sprite.direction #

Facing or motion direction.

direction: types.Direction

sprite.playing #

Whether the sprite is currently playing an animation.

playing: boolean

sprite.play() #

Begin playback of the active animation.

play(): void

sprite.stop() #

Stop playback and hold the current frame.

stop(): void

Class: Spine #

Spine #

Spine is an animated skeletal Agent driven by Spine runtime data. Features:

  • Multiple animation tracks.
  • Mixing, events, callbacks.
  • Runtime skin changes.

Extends: Agent

spine.onSpineStart #

spine.onSpineInterrupt #

spine.onSpineEnd #

spine.onSpineDispose #

spine.onSpineComplete #

spine.onSpineEvent #

spine.skel #

Spine skeleton data (bones, slots, attachments).

skel: types.SkeletonData | null

spine.skin #

Current active skin name.

skin: string

spine.speed #

Global playback speed scale.

speed: Float

spine.defaultMix #

Default crossfade/mix duration between animations.

defaultMix: Float

spine.animation #

Get/Set current animation name for track 0 (the base track).

animation: string

spine.setToSetupPose() #

Reset full skeleton pose to setup state.

setToSetupPose(): void

spine.setBonesToSetupPose() #

Reset bones to setup pose.

setBonesToSetupPose(): void

spine.setSlotsToSetupPose() #

Reset slots (attachments/visuals) to setup pose.

setSlotsToSetupPose(): void

spine.getAnimationDuration(name) #

Get the duration of a specific animation by name.

getAnimationDuration(name: string): Float

spine.setAttachment(slotName,attachmentName) #

Attach a specific attachment into a slot.

setAttachment(slotName: string, attachmentName: string): void

Parameters:

  • slotName — Target slot.
  • attachmentName — Attachment to bind.

spine.setMix(fromName,toName,duration) #

Define mix duration when transitioning from one animation to another.

setMix(fromName: string, toName: string, duration: Float): void

Parameters:

  • fromName — Source animation.
  • toName — Target animation.
  • duration — Crossfade time.

spine.setAnimation(trackIndex,name,loop?) #

Set an animation on a given track.

setAnimation(trackIndex: Uint, name: string, loop: any, loop?: boolean): void

Parameters:

  • trackIndex — Track number.
  • name — Animation name.
  • loop — Whether to loop.

spine.addAnimation(trackIndex,name,loop?,delay?) #

Queue another animation after the current one.

addAnimation(trackIndex: Uint, name: string, loop: any, delay: any, loop?: boolean, delay?: Float): void

Parameters:

  • trackIndex — Track number.
  • name — Animation name.
  • loop — Whether to loop.
  • delay — Delay before it starts.

spine.setEmptyAnimation(trackIndex,mixDuration) #

Set an "empty" animation (used to smoothly fade out pose).

setEmptyAnimation(trackIndex: Uint, mixDuration: Float): void

Parameters:

  • trackIndex — Track number.
  • mixDuration — Fade duration.

spine.setEmptyAnimations(mixDuration) #

Apply "empty" animation to all tracks with default mix. Used to smoothly clear pose.

setEmptyAnimations(mixDuration: Float): void

Parameters:

  • mixDuration — Fade duration.

spine.addEmptyAnimation(trackIndex,mixDuration,delay?) #

Queue an empty animation after current.

addEmptyAnimation(trackIndex: Uint, mixDuration: Float, delay: any, delay?: Float): void

Parameters:

  • trackIndex — Track number.
  • mixDuration — Fade duration.
  • delay — Delay before it starts.

spine.clearTracks() #

Clear all animation tracks.

clearTracks(): void

spine.clearTrack(trackIndex?) #

Clear a specific animation track.

clearTrack(trackIndex: any, trackIndex?: Uint): void

Parameters:

  • trackIndex — Track number to clear. If omitted, may clear default.

Class: World #

World #

World is a transformable container (Morph) that simulates a 2D world for Entity and Agent objects. World responsibilities:

  • Run per-frame / sub-step updates.
  • Drive agent movement, avoidance and discovery logic.
  • Act as the spatial root / coordinate space for gameplay logic. Pausing World (playing = false) freezes simulation but keeps visuals.

Extends: Morph

world.playing #

Whether the world is actively simulating. If false, agents remain visible but do not update or move.

playing: boolean

world.subSteps #

Number of physics / navigation sub-steps per frame. Higher values improve stability at high speeds. Typical range: 1–5.

subSteps: Uint

world.timeScale #

Global time scaling factor. 1.0 = realtime, <1.0 = slow motion, >1.0 = fast-forward.

timeScale: Float

world.predictionTime #

Prediction horizon (in seconds) used for avoidance. Agents steer based on projected future positions in this time window.

predictionTime: Float

world.discoveryThresholdBuffer #

Buffer distance added to discovery thresholds to prevent flicker. Helps avoid repeated enter/leave spam when agents hover near edge.

discoveryThresholdBuffer: Float

world.waypointRadius #

Radius (in world units) around waypoints that counts as "reached".
When an agent comes within this distance of a waypoint, it will proceed to the next one. Default: 0.0f

waypointRadius: Float

Class: Root #

Root #

Root is a top-level Morph typically used as the root of a scene or UI tree. It often serves as the mount point for a Window or ViewController.

Extends: Morph

Interface: TextOptions #

TextOptions #

TextOptions describes common text styling and measurement APIs shared by text-capable views (Text, Label, Input, etc.).

textoptions.fontStyle #

Font style bitmask / ID (implementation-defined).

readonly fontStyle: number

textoptions.textAlign #

Horizontal text alignment.

textAlign: types.TextAlign

textoptions.fontWeight #

Font weight.

fontWeight: types.FontWeight

textoptions.fontSlant #

Font slant / italic style.

fontSlant: types.FontSlant

textoptions.textDecoration #

Text decoration (underline, strike, etc.).

textDecoration: types.TextDecoration

textoptions.textOverflow #

Overflow handling (clip, ellipsis, etc.).

textOverflow: types.TextOverflow

textoptions.whiteSpace #

Whitespace handling.

whiteSpace: types.WhiteSpace

textoptions.wordBreak #

Word-break rule.

wordBreak: types.WordBreak

textoptions.fontSize #

Font size.

fontSize: types.FontSize

textoptions.textBackgroundColor #

Background color for text glyphs.

textBackgroundColor: types.TextColor

textoptions.textStroke #

Stroke/outline style for text.

textStroke: types.TextStroke

textoptions.textColor #

Primary text color.

textColor: types.TextColor

textoptions.lineHeight #

Line height.

lineHeight: types.FontSize

textoptions.textShadow #

Shadow styling for text.

textShadow: types.TextShadow

textoptions.fontFamily #

Font family / fallback list.

fontFamily: types.FontFamily

textoptions.computeLayoutSize(text,limit?) #

Measure the rendered layout size of a text string, using this object's current font / style settings.

computeLayoutSize(text: string, limit: any, limit?: Vec2): Vec2

Parameters:

  • text — Text to measure.
  • limit — Optional size limit for wrapping/truncation.

Returns: Size in px/world units (w,h).

Class: Text #

Text #

Text is a non-editable text view with rich styling support. It can measure, wrap, truncate, etc.

Extends: Box Implements: TextOptions

text.value #

Actual displayed string content.

value: string

text.computeLayoutSize(text,limit?) #

Measure size for the given text using current style.

computeLayoutSize(text: string, limit?: Vec2): Vec2

Class: Button #

Button #

Button is an interactive Text view that can be navigated, focused, and "clicked". It can also expose directional navigation helpers for gamepad/keyboard UIs.

Extends: Text

button.nextButton(dir) #

Query the next logical button in a given direction. Useful for D-pad / keyboard navigation grids.

nextButton(dir: types.Direction): Button | null

Parameters:

  • dir — Direction to search.

Returns: The neighbor Button or null.

Class: Label #

Label #

Label is a lightweight text-bearing View. It behaves similarly to Text, but does not inherit Box layout (so it's cheaper and may integrate differently with layout).

Extends: View Implements: TextOptions

label.value #

Text content for display.

value: string

label.align #

Alignment of this label inside its parent Box.

align: types.Align

label.computeLayoutSize(text,limit?) #

Measure size for the given text using current style.

computeLayoutSize(text: string, limit?: Vec2): Vec2

Class: InputSink #

InputSink #

InputSink is a shadow input view. It does not own, store, or render any text content. Its sole responsibility is to act as a sink for text input semantics coming from the system keyboard or IME (Input Method Editor), and forward them to higher-level logic (e.g. editors like ACE). InputSink participates in focus management and IME positioning, but delegates all document, cursor, and rendering logic to external systems.

Extends: View

inputsink.onInputDelete #

Fired when text is deleted.

This event represents a semantic delete operation, not a key press. The deletion count is provided via InputEvent.inputDelete.

inputsink.onInputInsert #

Fired when text is inserted.

This event represents committed text input, including:

  • direct keyboard input
  • IME commit results

The inserted text is provided via InputEvent.input.

inputsink.onInputMarked #

Fired when text is in a marked (composing) state.

This typically corresponds to IME composition updates, where the text is provisional and not yet committed. The composing text is provided via InputEvent.input.

inputsink.onInputUnmark #

Fired when marked (composing) text is finalized.

This indicates the end of an IME composition session. The finalized text (if any) is provided via InputEvent.input, and is typically followed by an insertion event.

inputsink.onInputControl #

Fired on non-textual input control actions.

This includes keys such as:

  • Enter / Return
  • Escape
  • Arrow keys
  • Other control or navigation commands

The control key is provided via InputEvent.inputControl.

inputsink.spotRect #

The rectangle representing the current input caret position. This is used by the system IME to position candidate or composition windows. InputSink itself does not render a caret; the value is provided by the owning editor or logic layer.

spotRect: types.Rect

inputsink.canDelete #

Indicates whether the current context allows deletion. Used by the system to enable or disable delete operations.

canDelete: boolean

inputsink.canBackspace #

Indicates whether backspace is allowed in the current context. This may differ from canDelete depending on editor semantics.

canBackspace: boolean

inputsink.readonly #

Indicates whether the input target is read-only. When true, text insertion and deletion may be suppressed, but control events can still be delivered.

readonly: boolean

inputsink.keyboardType #

Hint for the preferred virtual keyboard type. This value is forwarded to the platform input system and does not affect input semantics within InputSink itself.

keyboardType: types.KeyboardType

inputsink.returnType #

Hint for the preferred return/enter key behavior. This value is used by virtual keyboards to adjust the appearance or label of the return key (e.g. Done, Search, Go).

returnType: types.KeyboardReturnType

inputsink.cancelMarkedText() #

Cancel any ongoing marked (composing) text state. This aborts the current IME composition session without committing text.

cancelMarkedText(): void

inputsink.isMarkedText #

Whether there is currently marked (composing) text.

readonly isMarkedText: boolean

inputsink.cursorIndex #

Current cursor position (index in text).

readonly cursorIndex: number

inputsink.markedText #

Current text length (may differ from value.length due to encoding).

readonly markedText: string

inputsink.markedTextLength #

Current marked (composing) text length.

readonly markedTextLength: number

Class: Input #

Input #

Input is a single-line editable text box. Features:

  • Cursor, max length, secure entry.
  • Software keyboard hints (type, return key).
  • Inline styling consistent with TextOptions.

Extends: Box Implements: TextOptions

input.onChange #

input.onInputDelete #

input.onInputInsert #

input.onInputMarked #

input.onInputUnmark #

input.onInputControl #

input.security #

If true, mask input (password-style).

security: boolean

input.readonly #

Whether the field is read-only.

readonly: boolean

input.keyboardType #

Keyboard type hint for virtual keyboards.

keyboardType: types.KeyboardType

input.returnType #

Return/enter key style hint.

returnType: types.KeyboardReturnType

input.placeholderColor #

Placeholder text color.

placeholderColor: types.Color

input.cursorColor #

Caret (cursor) color.

cursorColor: types.Color

input.maxLength #

Maximum allowed text length.

maxLength: number

input.value #

Current text value.

value: string

input.placeholder #

Placeholder text when empty.

placeholder: string

input.textLength #

Current text length (may differ from value.length due to encoding).

readonly textLength: number

input.cursorIndex #

Current cursor position (index in text).

readonly cursorIndex: number

input.cursorLine #

Current cursor line number (for multi-line IME).

readonly cursorLine: number

input.isMarkedText #

Whether there is currently marked (composing) text.

readonly isMarkedText: boolean

input.markedText #

Current marked (composing) text.

readonly markedText: string

input.markedTextIndex #

Current marked (composing) text start index.

readonly markedTextIndex: number

input.markedTextLength #

Current marked (composing) text length.

readonly markedTextLength: number

input.computeLayoutSize(text,limit?) #

Measure size for the given text using current style.

computeLayoutSize(text: string, limit?: Vec2): Vec2

input.cancelMarkedText() #

Cancel any ongoing marked (composing) text state. This aborts the current IME composition session without committing text.

cancelMarkedText(): void

Interface: ScrollView #

ScrollView #

ScrollView describes scrollable behavior and parameters. It's implemented by Scroll and Textarea.

Extends: Box

scrollview.scrollbar #

Whether scrollbars are shown.

scrollbar: boolean

scrollview.bounce #

Whether content can bounce (rubber-band).

bounce: boolean

scrollview.bounceLock #

If true, bouncing locks when edge is reached to reduce jitter / overscroll chaining.

bounceLock: boolean

scrollview.momentum #

Whether inertial/momentum scrolling is enabled.

momentum: boolean

scrollview.lockDirection #

If true, lock scroll to the first detected direction.

lockDirection: boolean

scrollview.scrollLeft #

Current scroll X offset.

scrollLeft: number

scrollview.scrollTop #

Current scroll Y offset.

scrollTop: number

scrollview.scroll #

Current scroll offset as Vec2.

scroll: Vec2

scrollview.resistance #

Scroll resistance factor.

resistance: number

scrollview.bounceResistance #

Overscroll drag resistance multiplier.

bounceResistance: number

scrollview.bounceStiffness #

Overscroll spring stiffness multiplier.

bounceStiffness: number

scrollview.bounceDamping #

Overscroll spring damping multiplier.

bounceDamping: number

scrollview.momentumVelocity #

Maximum release velocity multiplier.

momentumVelocity: number

scrollview.catchPositionX #

Sticky "catch" position X (e.g. snap zones).

catchPositionX: number

scrollview.catchPositionY #

Sticky "catch" position Y.

catchPositionY: number

scrollview.scrollbarColor #

Scrollbar color.

scrollbarColor: types.Color

scrollview.scrollbarWidth #

Scrollbar thickness.

scrollbarWidth: number

scrollview.scrollbarMargin #

Scrollbar margin from the edge.

scrollbarMargin: number

scrollview.scrollDuration #

Scroll animation duration for programmatic scrolls (ms).

scrollDuration: number

scrollview.defaultCurve #

Default easing curve for programmatic scrolls.

defaultCurve: types.Curve

scrollview.scrollbarH #

Whether horizontal scrollbar is active.

readonly scrollbarH: boolean

scrollview.scrollbarV #

Whether vertical scrollbar is active.

readonly scrollbarV: boolean

scrollview.scrollSize #

Total scrollable content size.

readonly scrollSize: Vec2

scrollview.scrollTo(val,duration?,curve?) #

Smooth-scroll to a given offset.

scrollTo(val: Vec2, duration: any, curve: any, duration?: number, curve?: types.Curve): void

Parameters:

  • val — Target scroll offset.
  • duration — Optional animation duration.
  • curve — Optional easing curve.

scrollview.terminate() #

Abort any running scroll animation / momentum.

terminate(): void

scrollview.beginDrag(pos) #

Begin a drag interaction. Should be called when pointer/touch press starts. The position must be in the same coordinate space for all subsequent drag() calls. This will:

  • Stop any ongoing momentum/animation
  • Start tracking movement
  • Prepare velocity calculation
    beginDrag(pos: Vec2): void

scrollview.drag(pos) #

Continue dragging. Should be called on every pointer/touch move after beginDrag(). The position must be absolute and continuous (not delta). Scroll offset will be updated based on the movement distance between this position and the previous one.

drag(pos: Vec2): void

scrollview.endDrag() #

End the drag interaction. Should be called when pointer/touch is released. This will:

  • Compute drag velocity
  • Start momentum scrolling if enabled
  • Apply snap/catch logic if configured
    endDrag(): void

scrollview.wheel(delta) #

Apply wheel/trackpad scrolling. Delta is a scroll distance in pixels: delta.y > 0 → scroll down delta.y < 0 → scroll up Typically called from:

  • Mouse wheel
  • Trackpad scroll
  • Keyboard-triggered scroll simulation This does not start a drag session and can be used independently.
    wheel(delta: Vec2): void

Class: Textarea #

Textarea #

Textarea is a multi-line text input field with its own scrollable viewport. It merges text editing and ScrollView behaviors.

Extends: Input Implements: ScrollView

textarea.onScroll #

Class: Scroll #

Scroll #

Scroll is a generic scrollable container. It can host arbitrary child content and provides ScrollView APIs.

Extends: Box Implements: ScrollView

scroll.onScroll #

Class: Video #

Video #

Video is a playable media view that extends Image and implements Player. It exposes playback control (play/pause/stop/seek), audio track switching, mute/volume control, and metadata such as duration.

Extends: Image Implements: Player

video.onStop #

video.onBuffering #

testOverlapFromConvexQuadrilateral(quadrilateral,point) #

test overlap point in convex quadrilateral

testOverlapFromConvexQuadrilateral(quadrilateral: Vec2[], point: Vec2): boolean

Interface: MinimumTranslationVector #

MinimumTranslationVector #

Represents the minimum translation vector required to separate two overlapping convex shapes.

minimumtranslationvector.axis #

The axis along which the minimum translation should occur.

axis: Vec2

minimumtranslationvector.overlap #

The magnitude of the overlap along the axis.

overlap: Float

MTV #

alias MinimumTranslationVector

type MTV = MinimumTranslationVector

testPolygonVsPolygon(poly1,poly2,outMTV?,requestSeparationMTV?) #

Test overlap from convex polygons with SAT and GJK algorithm and get minimum translation vector.

testPolygonVsPolygon(poly1: Vec2[], poly2: Vec2[], outMTV?: Partial<MTV>, requestSeparationMTV?: boolean): boolean

Parameters:

  • poly1 — The vertices of the first convex polygon.
  • poly2 — The vertices of the second convex polygon.
  • outMTV? — Optional output parameter to receive the minimum translation vector to separate the polygons.
  • requestSeparationMTV? — Optional flag to compute the minimum translation vector even when the polygons are separated.

Returns: Returns true if the polygons overlap, false otherwise.