
AuraJS exposes several deterministic helper namespaces for animation-heavy gameplay.
Non-blank generated projects also ship a higher-level 2D authoring layer in
src/starter-utils/:
animation-2d.js for named sprite states and current-frame resolutionanimation-packaging-2d.js for atlas/clip/state packaging over the sprite
animation laneatlas-assets-2d.js for explicit image-path plus animation-manifest
ownership over the packaging lanetween-2d.js for sequence/parallel/delay/yoyo/repeat style motion compositioncombat-feedback-2d.js for floating text, hit sparks, hit flashes, and hover/lift feedbacktilemap-world-2d.js for one-map load/query/move ownership over aura.tilemaptilemap-nav-2d.js for mutable grid navigation with topology and occupancy invalidationstreamed-world-2d.js for explicit region ownership, focus-driven load/unload, and routed point/AABB/ray queries over multiple tilemap-world regionsThat local path stays copied into the scaffold so authored game code can be
inspected and edited without waiting on package installation. When you need the
shared package-backed helper lane directly, use
@auraindustry/aurajs/helpers/2d.
Use these when you want a faster scaffolded 2D game-authoring path. Use raw
aura.anim2d, aura.animation, and aura.tween directly when you need
custom low-level ownership.
For authored sprite atlases, the packaging helper keeps the boundary explicit:
animation-2d.js runtime lane
instead of inventing a second playback systematlas-assets-2d.js is the truthful paved road when the image path and the
clip/state manifest should stay separate but packaged together in authored
JSassets/pilot-ui-sheet.pnggenerated://... remains a proof-only or runtime-authored image source, not
the packaged asset guarantee for a shipped projectExample:
import {
createAtlasAssetManifest2D,
createAnimationPackageFromAtlasAsset2D,
createPackagedSpriteAnimator2D,
createSpriteAnimationRuntime2D,
} from '@auraindustry/aurajs/helpers/2d'
const runtime = createSpriteAnimationRuntime2D(aura)
const atlasAsset = createAtlasAssetManifest2D({
name: 'pilot-ui',
image: 'assets/pilot-ui-sheet.png',
manifest: {
frameWidth: 48,
frameHeight: 48,
columns: 4,
defaultFrameDuration: 0.18,
clips: {
idle: [0, 1],
alert: [2, 3],
},
states: {
idle: { clip: 'idle', frameDuration: 0.24 },
alert: { clip: 'alert', frameDuration: 0.12 },
},
defaultState: 'idle',
},
})
const animationPackage = createAnimationPackageFromAtlasAsset2D(atlasAsset)
const animator = createPackagedSpriteAnimator2D(runtime, animationPackage)
For larger 2D worlds, keep the boundary honest:
streamed-world-2d.js is a JS-first logical region helper, not a full persistence or off-screen simulation framework2D clip/state-machine helper:
registerClip(name, frames, options?)createMachine(initialState?)defineState(machineId, stateName, clipName, options?)play(machineId, stateName)update(dt)getState(machineId)onComplete(machineId, callback, order?)Use cases:
Timeline and atlas-driven animation surface:
create(options)play(timelineId)pause(timelineId)resume(timelineId)seek(timelineId, time)transition(timelineId, options)crossfade(fromId, toId, options)onComplete(timelineId, callback, order?)onEvent(timelineId, callback, order?)setLoop(timelineId, loop)setSpeed(timelineId, speed)getState(timelineId)update(dt)Atlas/spritesheet helpers:
registerAtlas(name, atlasSpec)resolveAtlasFrame(name, frame)createAtlasClip(options)stepAtlasClip(clipId, dt)getAtlasClipState(clipId)Use cases:
Deterministic scalar tween helper:
create(options)pause(tweenId)resume(tweenId)cancel(tweenId)onUpdate(tweenId, callback, order?)onComplete(tweenId, callback, order?)update(dt)getState(tweenId)Use cases:
In scaffolded 2D projects, src/starter-utils/tween-2d.js is the default
wrapper for authored move/fade/scale/pulse/punch flows.
Lightweight particle/VFX helper:
emit(options)burst(options)update(dt)draw()stop(emitterId)kill(emitterId)setLayer(emitterId, layer)setBlend(emitterId, mode)setGravity(emitterId, gravity)getState(emitterId)Use cases:
Retained 3D particle-emitter helper:
create(options)destroy(emitterId)emit(emitterId, count?)burst(emitterId, count)burst(options) for one-shot emitterspause(emitterId)resume(emitterId)stop(emitterId)update(dt)draw()setPosition(emitterId, x, y, z)setEmitRate(emitterId, rate)getState(emitterId)Truthful ownership:
create(...) returns a retained emitter that persists until destroy(...)burst(options) is the one-shot path; it auto-destroys after its particles
empty instead of pretending to be a retained ambient emitterpause(...) freezes simulation/emission, stop(...) halts future emission
while leaving live particles alone, and resume(...) clears both paused and
stopped stategetState(...) reports retained runtime truth such as paused, stopped,
emitting, particles, and autoDestroyWhenEmptyCurrent authoring aliases:
velocity: { x, y, z } can stand in for direction + speedacceleration: { x, y, z } can stand in for gravityCurrent rendering truth:
draw() submits camera-facing billboard particles through the Draw3D
billboard/material laneShared JS-first 3D emitter/runtime helper:
create(options)destroy(emitterId)emit(emitterId, count?)burst(emitterId, count) or burst({ ... , count }) for a one-shot emitterpause(emitterId)resume(emitterId)stop(emitterId)update(dt)draw()getState(emitterId)Truthful runtime notes:
pause(...) freezes that emitter's simulation and emission state until
resumedresume(...) clears paused/stopped state and resumes normal emit-rate-driven
behaviorstop(...) halts future emission while allowing existing particles to age
out naturallyburst({ ... , count }) emitters auto-destroy when emptydestroy(...) returns cleanup confirmation including destroyed and
particlesCleareddraw() currently submits camera-facing billboards through
aura.draw3d.billboard(...)Tilemap import/render/query/mutation surface:
import(source, options?)create(model, options?)unload(mapId)getInfo(mapId)drawLayer(mapId, layerRef, options?)draw(mapId, options?)setTile(mapId, layerRef, x, y, gid)setRegion(mapId, layerRef, region, gid)removeRegion(mapId, layerRef, region)replaceRegion(mapId, layerRef, region, fromGid, toGid)setTileCollision(mapId, layerRef, x, y, collision)setLayerFlags(mapId, layerRef, flags)setLayerVisibility(mapId, layerRef, visible)setLayerCollision(mapId, layerRef, collision)queryPoint(mapId, point, options?)queryAABB(mapId, bounds, options?)queryRay(mapId, ray, options?)queryRaycast(mapId, ray, options?)queryObjects(mapId, options?)queryObjectsAtPoint(mapId, point, options?)queryObjectsInAABB(mapId, bounds, options?)setTileAnimation(mapId, layerRef, gid, animationSpec)updateAnimations(mapId, dt)getAnimationState(mapId)setOrientation(mapId, orientation)tileToScreen(mapId, x, y)screenToTile(mapId, x, y)Use cases: