Every game object in tiny-engine is a node. Nodes form a tree — the scene graph — where parent nodes position and own their children. The engine walks this tree every frame to callDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/sanchedev/tiny-engine/llms.txt
Use this file to discover all available pages before exploring further.
update and draw on each node in zIndex order. When a parent is destroyed every descendant is destroyed with it, making ownership and cleanup predictable.
Built-in Nodes
tiny-engine ships a set of built-in node types. Each type maps directly to a JSX intrinsic element you can use in your component markup.| Node | JSX Tag | Description |
|---|---|---|
Transform | <transform> | Positioning container — translates its children to a world position |
Sprite | <sprite> | Renders a texture with optional visual filters (brightness, grayscale, modulate…) |
AnimationPlayer | <animation-player> | Plays frame-based sprite-sheet animations; supports reactive currentAnim |
Collider | <collider> | Detects overlaps with other colliders using shapes and group filters |
RayCast | <ray-cast> | Projects a ray in a direction and reports which colliders it intersects |
Clickable | <clickable> | Detects pointer click, enter, and exit events over a rectangular hit area |
Timer | <timer> | Counts elapsed time and fires a timeout event after a configurable duration |
Rectangle | <rectangle> | Renders a filled or stroked rectangle directly onto the canvas |
The PrimaryNode Enum
PrimaryNode is an enum whose values are the string identifiers for every built-in node type. Import it whenever you need a type-safe way to refer to a node kind — most commonly when calling useRefNode or useChild.
Node Lifecycle Events
Each node emits the following events at key points in its lifetime. Subscribe with.on(callback).
| Event | Fires when… |
|---|---|
started | The node’s start() lifecycle has completed (first frame it is active) |
updated | Each frame during the node’s update cycle; receives delta in seconds |
drawed | Each frame after the node has drawn; receives delta in seconds |
destroyed | The node and all its children have been torn down |
Nesting Nodes
Nodes are nested by placing them as JSX children. The parent<transform> positions every child relative to itself.
zIndex property so draw order is deterministic regardless of declaration order.
The ref Prop and useRefNode
Pass a NodeReference created by useRefNode to any intrinsic element’s ref prop. Once the node mounts, ref.node is populated with the fully initialised node instance, typed to the exact PrimaryNode variant you specified.
sprite.node:
Node API Reference
Transform
Position, z-index, delta scaling, and child management
Sprite
Texture rendering, display size, and visual filters
Collider
Collision shapes, groups, and overlap events