Spriter animation playback engine for pixi.js.
npm install pixi-spriterpixi-spriter library provides a simple set of classes to (hopefully) make it easy to add animations exported from Spriter Pro in your pixi.js projects!
pixi-spriter provides a Loader Plugin for the pixi.js resource-loader.
.scml files.
.scon files.
TagUtils module. There aren't any convenience functions added to the display components so that if your project doesn't use the feature then the code won't be in your final bundle (assuming your bundler kaes use of tree-shaking).
TagChecker class provides some convenience methods and can be reused for querying different Animator instances.
Animator and are interpolated like the other timeline objects (bones, and sprites). They can be retrieved (when available) through the Spriter.getPoint() method.
Animator. Presently only point collisions are supported. Checking for collisions is done either calling checkCollisions, or through the conveience method on the Spriter class - which calls checkCollisions internall anyway.
checkCollisions directly, the point supplied must be in the same co-ordinate space as the Animator being queried.
Spriter method, the point suplpied needs to be in world (global) space; the method will handle the coordinate translation internally.
Spriter class allows for checking whether an event was triggered on the latest call to update(). isTriggered will only return true for the first frame when the Event is active - even when playing animaitons at lower speeds. Spriter also has an event: onEventTriggered which will signal whenever an event is triggered.
js
const anim = new Spriter();
// Listen for events triggering.
anim.onEventTriggered.add((event) => {
console.log("Event triggered! Name:", event)
});
...
anim.update(deltaTime);
// Or check in an update loop.
if (anim.isTriggered("eventName")) {
console.log("Event triggered just now: eventName");
}
``