npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

aispritejs

v0.5.9

Published

Input-driven, renderer-agnostic 2D sprite animation runtime — a tiny, Rive-like visual state machine driven by Number / Boolean / Trigger inputs. JSON transition graph, deterministic update(dt), zero runtime dependencies. Browser / Node / Bun / Deno / Web

Readme

aispritejs

Input-driven, renderer-agnostic 2D sprite animation runtime. A JSON graph maps Number/Boolean/Trigger inputs to visual states and frames; adapters bind the chosen frame to a renderer.

Status: 0.5.9 - stable family-aligned surface. Core, PixiJS adapter, atlas parser, and JSON Schema subpath are shipped.

Install

pnpm add aispritejs
pnpm add pixi.js # only when using aispritejs/pixi
import { createSpriteAnimator } from "aispritejs";

Quick Start - Core

const anim = createSpriteAnimator({
  inputs: {
    speed: { type: "number", default: 0 },
    jump: { type: "trigger" },
  },
  initial: "idle",
  states: {
    idle: { animation: "idle" },
    run: { animation: "run", speed: 1 },
    jump: { animation: "jump", loop: false, onEnd: "idle" },
  },
  transitions: [
    { from: "idle", to: "run", when: [{ input: "speed", op: "GreaterThan", value: 0 }] },
    { from: "*", to: "jump", when: [{ input: "jump", op: "Trigger" }] },
  ],
  animations: {
    idle: ["idle_0"],
    run: ["run_0", "run_1"],
    jump: ["jump_0", "jump_1"],
  },
});

anim.setInput("speed", 1);
anim.fireTrigger("jump");
anim.update(16.7);
console.log(anim.activeState, anim.activeFrameKey);

PixiJS Adapter

import { createPixiSpriteAnimator } from "aispritejs/pixi";

const view = createPixiSpriteAnimator(sprite, graph, spritesheet);
view.update(deltaMs);
view.dispose(); // disposes core animator; does not destroy the Pixi sprite

pixi.js is an optional peer dependency and is imported type-only by the adapter. The root package never imports Pixi, DOM, or canvas APIs.

Atlas and Schema

  • parseAtlas(atlas, control?) converts a PixiJS-v8 style atlas plus control block into a SpriteGraph.
  • loadAtlas(atlas, control?) parses and creates a SpriteAnimator.
  • aispritejs/schema exports schemas/aispritejs-graph.schema.json for editor/CI validation.
  • Parser validation is structural (InvalidAtlasError); compiler validation is semantic (InvalidGraphError).

Core API

  • createSpriteAnimator(graph) returns a SpriteAnimator.
  • setInput(name, value) accepts Number/Boolean inputs.
  • fireTrigger(name) consumes Trigger inputs on transition.
  • update(deltaMs) advances time, transitions, frame index, and onEnd.
  • reset() returns to the initial state.
  • dispose() is idempotent; mutators throw SpriteAnimatorDisposedError afterward.
  • onStateChange(handler, options?) and onComplete(handler, options?) support once and signal.

Sharp Edges

  • Non-looping states with onEnd transition during the same update() tick that completes the clip.
  • AnimatedSprite is accepted by the Pixi adapter because it extends Sprite, but playback is stopped on bind so it cannot fight the adapter.
  • Every reachable frame key must exist in the texture map/spritesheet; missing keys throw MissingTextureError.
  • duration, defaultFrameDuration, and state speed must be finite numbers greater than zero.

AI Context

License

MIT