parcel-transformer-spritesheet

1.0.1 • Public • Published

Parcel Transformer for Spritesheets

() This transformer handles spritesheets as generated by tools like Texture Packer, for use with PixiJS.

It handles both single and multi-pack (linked) spritesheets.

Getting Started

Install it with your favorite package manager: yarn add -D parcel-transformer-spritesheet or npm i -D parcel-transformer-spritesheet.

Then include it in your .parcelrc. In this example, the spritesheets and images are in the images/ directory.

{
  "extends": ["@parcel/config-default"],
  "transformers": {
    "images/*.json": ["parcel-transformer-spritesheet"]
  },
  "packagers": {
    "*.json": "@parcel/packager-raw-url"
  }
}

In your game or app, you can then include spritesheets like so:

const interfaceImages = new URL("../images/interface.json", import.meta.url);
await PIXI.Assets.load({
  alias: ["interface"],
  src: interfaceImages.pathname,
});

Package Sidebar

Install

npm i parcel-transformer-spritesheet

Weekly Downloads

10

Version

1.0.1

License

MIT

Unpacked Size

3.72 kB

Total Files

4

Last publish

Collaborators

  • himmelattack