API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classTileAnimator

@codexo/exojs-tilemap / tilemap / stable

Drives per-tile animations on one or more TileLayers, RPG-Maker style. On construction it scans the given layer(s) once and registers every cell whose tile carries an `animation` (see import('./types').TileDefinition). Each update advances a shared clock and rewrites **only** the registered animated cells, and **only** when a cell crosses a frame boundary - static tiles are never touched. Because a tile rewrite goes through `layer.setTileAt`, only the chunks that actually contain animated cells rebuild their geometry, and only on the (infrequent) frames where a boundary is crossed. The large static body of the map never rebuilds. An unbounded import('./TileLayer').TileLayer (see import('./TileLayer').TileLayer.bounded) is skipped entirely by the initial scan and reports zero animated cells for that layer, rather than sweeping every ever-loaded chunk. Streaming/procedural chunk providers that need animated tiles must drive per-chunk `TileAnimator` instances themselves (scanning only the newly-adopted chunk's tile range) - a whole-layer `TileAnimator` is not currently wired to react to chunk load/unload. Tick it from your update loop, like `TweenSequencer`: ```ts const animator = new TileAnimator(map.layers); scene.systems.add({ update: (t) => animator.update(t.deltaSeconds) }); ``` The animator references - but never owns - the layers and their tilesets; destroy only drops its own cell registry.

2
props
4
methods
0
events
Import
import { TileAnimator } from '@codexo/exojs-tilemap'

Drives per-tile animations on one or more TileLayers, RPG-Maker style.

On construction it scans the given layer(s) once and registers every cell whose tile carries an `animation` (see import('./types').TileDefinition). Each update advances a shared clock and rewrites **only** the registered animated cells, and **only** when a cell crosses a frame boundary - static tiles are never touched. Because a tile rewrite goes through `layer.setTileAt`, only the chunks that actually contain animated cells rebuild their geometry, and only on the (infrequent) frames where a boundary is crossed. The large static body of the map never rebuilds.

An unbounded import('./TileLayer').TileLayer (see import('./TileLayer').TileLayer.bounded) is skipped entirely by the initial scan and reports zero animated cells for that layer, rather than sweeping every ever-loaded chunk. Streaming/procedural chunk providers that need animated tiles must drive per-chunk `TileAnimator` instances themselves (scanning only the newly-adopted chunk's tile range) - a whole-layer `TileAnimator` is not currently wired to react to chunk load/unload.

Tick it from your update loop, like `TweenSequencer`:

```ts const animator = new TileAnimator(map.layers); scene.systems.add({ update: (t) => animator.update(t.deltaSeconds) }); ```

The animator references - but never owns - the layers and their tilesets; destroy only drops its own cell registry.

Constructors1
Methods4
destroy(): void
Drop the cell registry. Does not modify the layers or tilesets.
rescan(): void
Re-scan the layers for animated cells. Call after structural edits that add or remove animated tiles. Resets all currently-tracked cells to frame 0 first so the rescan starts from a clean, deterministic state.
reset(): void
Restore every animated cell to its first frame and reset the clock. Useful before serialising or pausing.
update(deltaSeconds: number): void
Advance all registered animations by deltaSeconds and write the current frame into any cell that crossed a frame boundary. Cells that did not change frame are not touched, so their chunks do not rebuild.
Properties2
animatedCellCount: number
Number of animated cells currently registered across all layers.
elapsedMs: number
Total elapsed animation time in milliseconds since construction/reset.
Source