Documentation 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.
Sprite is the primary rendering node. It draws a texture loaded with loadTexture() at the node’s position, optionally sliced from a sprite sheet via margin and sourceSize, and scaled up with displaySize. A full set of visual filters — brightness, contrast, saturation, hue rotation, grayscale, invert, opacity, and RGBA modulation — can all be driven reactively from signals.
Sprite extends Node2D, so it also accepts position, id, zIndex, deltaIncrease, script, ref, and children.
Usage
Props
Texture
The symbol returned by
loadTexture(). The texture must be loaded before the scene starts. Setting this to null clears the sprite. Reactive when a SignalGetter is passed.Pixel offset into the source image where the slice begins. Use this to pick a specific frame from a packed sprite sheet.
Width and height of the region to read from the texture. Defaults to the full texture size when omitted.
Width and height to draw on screen. Defaults to
sourceSize. Useful for pixel-art upscaling without keeping a large source image.Mirror the sprite horizontally. Defaults to
false.Mirror the sprite vertically. Defaults to
false.Filters
All filter props accept a static value or a reactiveSignalGetter<number>. See Filters guide for worked examples.
Adjusts brightness.
0 = black, 1 = unchanged, 2 = fully white. Default: 1.Converts to grayscale.
0 = full color, 1 = fully desaturated. Default: 0.Multiplies every pixel by an RGBA tint
[r, g, b, a] where each channel is 0–1. Applied via multiply composite operation after the main draw. Default: [1, 1, 1, 1] (no tint).Adjusts contrast.
0 = flat grey, 1 = unchanged, 2 = double contrast. Default: 1.Adjusts color saturation.
0 = desaturated, 1 = unchanged, 2 = double saturation. Default: 1.Rotates the hue wheel in degrees.
0 = unchanged, 180 = complementary colors, 360 = full rotation. Default: 0.Inverts all colors.
0 = normal, 1 = fully inverted. Default: 0.Overall transparency.
0 = invisible, 1 = fully opaque. Default: 1.Events
Sprite inherits all base node events. Subscribe with useEvent.
| Event name | Callback signature | Description |
|---|---|---|
started | () => void | Fires once after the texture is loaded. |
updated | (delta: number) => void | Fires every frame during the update cycle. |
drawed | (delta: number) => void | Fires every frame during the draw cycle. |
destroyed | () => void | Fires once when the node is removed. |
Example — reactive brightness on hover
CombineClickable + a signal to create a hover-brighten button effect.
Example — sprite sheet frame
Slice a single 16×16 frame from a horizontal strip at column 2 (zero-indexed).The texture must be registered with
loadTexture() before the scene mounts. Passing an unregistered symbol will render nothing without throwing at construction time.Related
AnimationPlayer— frame-based animation driven by the sprite’smarginTransform— position the sprite in world space- Filters guide — detailed examples for every filter prop
useSignal— create reactive values to drive filter props