Utility nodes handle time, audio, animation playback, and logical grouping. Unlike the 2D nodes, utility nodes are non-spatial — they do not extendDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/sanchedev/fraxel/llms.txt
Use this file to discover all available pages before exploring further.
Node2D and have no world position. They extend the base Node class directly, which means they inherit id, zIndex, deltaIncrease, lifecycle events (started, updated, destroyed), and tree methods (addChild, destroy, etc.) but have no position or globalPosition.
Nodes
Group — <group>
Group — <group>
Class: Slowing a subset of nodes:
Group · Enum: PrimaryNode.Group · JSX tag: <group>Group is a lightweight logical container. It organises child nodes in the hierarchy without contributing any spatial offset. Unlike <transform>, it does not translate its children — use it purely for tree structure, batch-destruction, shared deltaIncrease, or script attachment.<List> uses Transform internally as an anchor for keyed reconciliation when rendering arrays of nodes.Props
Node identifier for
child() path lookups.Z-order. Higher values render on top of siblings.
Speed multiplier for this node and all descendants. Defaults to
1.Child nodes to nest inside this group.
Events
| Event | useEvent name | Callback | Description |
|---|---|---|---|
started | 'started' | () => void | Fires once when the group and all its children have started. |
updated | 'updated' | (delta: number) => void | Fires every frame. |
destroyed | 'destroyed' | () => void | Fires when the group (and all children) are destroyed. |
Notes
Grouphas no visual representation and no position property.- For nodes that need a shared world position, use
<transform>instead.
Timer — <timer>
Timer — <timer>
Class: Starting a timer on demand:
Timer · Enum: PrimaryNode.Timer · JSX tag: <timer>Timer counts up from 0 to duration (in seconds) and fires a timeout event when it completes. Each frame the internal counter advances by delta (the elapsed time in seconds since the last frame), so timers are framerate-independent. The timeChanged event fires every frame while the timer is running, providing the current elapsed value.See the Nodes guide for usage patterns.Props
Total duration in seconds. When the elapsed time reaches this value,
timeout fires and the timer stops. Accepts a SignalGetter<number> for reactive duration.When
true, the timer starts immediately when the node is created. Defaults to false.Node identifier for
child() path lookups.Speed multiplier.
2 makes the timer count at double speed. Defaults to 1.Events
| Event | useEvent name | Callback | Description |
|---|---|---|---|
timeout | 'timeout' | () => void | Fires once when elapsed >= duration. The timer stops automatically. |
timeChanged | 'timeChanged' | (elapsed: number) => void | Fires every frame while the timer is playing. elapsed is the current time in seconds. |
Methods
| Method | Signature | Description |
|---|---|---|
play | (from?: number) => void | Starts or resumes the timer. Optional from sets the starting time in seconds (clamped to [0, duration]). |
pause | () => void | Pauses the timer without resetting elapsed time. |
stop | () => void | Stops the timer and resets elapsed time to 0. |
Instance properties
| Property | Type | Description |
|---|---|---|
duration | number | Current duration in seconds. Mutable. |
AudioPlayer — <audio-player>
AudioPlayer — <audio-player>
Class: One-shot sound with
AudioPlayer · Enum: PrimaryNode.AudioPlayer · JSX tag: <audio-player>AudioPlayer plays audio buffers loaded with loadSound(). Internally it manages a Web Audio API AudioBufferSourceNode and a GainNode for volume control. The AudioContext is created lazily on first use (required by browser autoplay policies).For full audio documentation see the Audio guide.persistUntilEnd:Props
The symbol returned by
loadSound(). The sound buffer must be loaded before playback is attempted.When
true, the sound loops indefinitely until stop() is called. Defaults to false.Playback volume
0–1. 0 = silent, 1 = full volume. Defaults to 1.Playback speed multiplier.
1 = normal speed, 2 = double speed, 0.5 = half speed. Defaults to 1.When
true, calling destroy() on the node while audio is playing defers actual destruction until playback ends. Useful for one-shot sounds on components that self-destruct. Defaults to false.Events
| Event | useEvent name | Callback | Description |
|---|---|---|---|
ended | 'ended' | () => void | Fires when non-looping playback reaches the end of the buffer. |
error | 'error' | (err: Error) => void | Fires if playback fails (e.g. AudioContext unavailable, buffer missing). |
Methods
| Method | Signature | Description |
|---|---|---|
play | (offset?: number) => void | Starts playback. Optional offset sets the start time in seconds. Resumes from the pause position if called after pause(). |
pause | () => void | Pauses playback, preserving the current position for resumption via play(). |
stop | () => void | Stops playback and resets position to 0. |
Instance properties (getters/setters)
| Property | Type | Description |
|---|---|---|
isPlaying | boolean | true if audio is currently playing (read-only). |
volume | number | Get/set the playback volume. Updates the GainNode immediately if playing. |
playbackRate | number | Get/set the playback rate. Updates the AudioBufferSourceNode immediately if playing. |
AnimationPlayer — <animation-player>
AnimationPlayer — <animation-player>
Class: One-shot animation with
AnimationPlayer · Enum: PrimaryNode.AnimationPlayer · JSX tag: <animation-player>AnimationPlayer drives frame-based animations. It maintains a map of named Animation objects, each containing a list of keyframe functions and an FPS value. The player advances through keyframes each frame based on delta * fps, making animations framerate-independent.The animations prop is a function called at node start — not at construction time. This deferred evaluation allows keyframes to reference sibling Sprite nodes that may not yet exist when the scene JSX is first evaluated.The currentAnim prop accepts both a static string and a reactive SignalGetter<string>, enabling declarative animation switching via signals.For full animation documentation see the Animation guide.destroyOnEnd:Props
A function returning a record of animation definitions. Called when the node starts (deferred), not at construction time. This allows referencing sibling
Sprite nodes that may not exist yet at JSX evaluation time.The name of the animation to play. Accepts a static string or a
SignalGetter<string> for reactive animation switching. When the signal value changes, the player automatically transitions to the new animation.When
true, the node is automatically destroyed after the current (non-looping) animation ends and animationEnded has fired. Defaults to false.Events
| Event | useEvent name | Callback | Description |
|---|---|---|---|
animationEnded | 'animationEnded' | (animName: string) => void | Fires when a non-looping animation finishes. animName is the name of the completed animation. |
animationChanged | 'animationChanged' | (newAnim: string, oldAnim: string | null) => void | Fires when play() switches to a different animation. |
animationIndexChanged | 'animationIndexChanged' | (index: number) => void | Fires each time the frame index advances. |
animationStopped | 'animationStopped' | (animName: string) => void | Fires when stop() is called on the current animation. |
Methods
| Method | Signature | Description |
|---|---|---|
play | (animName: string, index?: number) => void | Starts the named animation, optionally from a specific frame index. |
stop | () => void | Stops the current animation and resets the frame index to 0. |
setNext | (animName: string | null) => void | Queues an animation to play after the current one ends. Pass null to clear the queue. |
add | (animName: string, animation: Animation) => this | Adds a single animation by name. Returns this for chaining. |
define | (animations: Record<string, Animation>) => this | Adds multiple animations at once. Returns this for chaining. |
Instance properties
| Property | Type | Description |
|---|---|---|
currentAnim | string | null | The name of the currently playing animation (read-only). null if stopped. |
index | number | The current integer frame index (read-only). |
Animation type
JSX Components
These are not nodes but JSX components exported fromfraxel/jsx. They orchestrate how scenes, games, and lists are composed.
<Game>
<Game>
The root component. Renders the game canvas and bootstraps the engine. Must wrap all other Fraxel content.
Props
Canvas width in pixels.
Canvas height in pixels.
The
name of the <Scene> to load on startup.Development-only options for visualising colliders, ray-casts, and clickable areas. See
TestOptions in game-config.ts.Global theme applied to all
<text> nodes. Overrides TextStyle.DEFAULT.Options forwarded to the input system (e.g. custom pointer event handling).
<Scene>
<Scene>
Declares a named scene. Each
<Scene> maps a string name to a component function. Scenes are rendered inside <Game> and can be switched at runtime. The component prop supports both direct component references and dynamic imports for code splitting.Props
Unique name for this scene. Referenced by
defaultScene on <Game> and by the scene-switching API.The scene root component function, or a dynamic import that resolves to one. Called when the scene becomes active. Use a dynamic import (
() => import('./scene.js')) for lazy loading.<List>
<List>
Renders a reactive array of nodes with keyed reconciliation. When the signal changes,
<List> adds, removes, and reorders child nodes efficiently — only mutating what has changed.<List> uses a hidden <transform> node internally as an anchor for reconciliation.Props
A reactive array signal.
<List> subscribes to this signal and reconciles the rendered output whenever the array changes.Render function called for each item in the array. Receives the item value, its index, and the full array. Must return a single JSX node.
Key extractor for stable reconciliation. When provided,
<List> uses the key to match old and new items, avoiding unnecessary node recreation. Strongly recommended for mutable arrays.Optional node to render when the array is empty.
<Fragment>
<Fragment>
Logically groups multiple JSX nodes without adding a wrapper node to the scene tree. Identical in behaviour to React/JSX fragments.Shorthand syntax (if your JSX config supports it):
Props
<Fragment> accepts no props. It is a pure logical grouping mechanism and adds no node to the scene tree.