Files
Foundry-VTT-Docker/resources/app/node_modules/@pixi/spritesheet/lib/Spritesheet.mjs.map

1 line
19 KiB
Plaintext
Raw Normal View History

2025-01-04 00:34:03 +01:00
{"version":3,"file":"Spritesheet.mjs","sources":["../src/Spritesheet.ts"],"sourcesContent":["import { BaseTexture, Rectangle, Texture, utils } from '@pixi/core';\n\nimport type { ImageResource, IPointData, ITextureBorders } from '@pixi/core';\n\n/**\n * Represents the JSON data for a spritesheet atlas.\n * @memberof PIXI\n */\nexport interface ISpritesheetFrameData\n{\n frame: {\n h: number;\n w: number;\n x: number;\n y: number;\n };\n trimmed?: boolean;\n rotated?: boolean;\n sourceSize?: {\n h: number;\n w: number;\n };\n spriteSourceSize?: {\n h?: number;\n w?: number;\n x: number;\n y: number;\n };\n anchor?: IPointData;\n borders?: ITextureBorders;\n}\n\n/**\n * Atlas format.\n * @memberof PIXI\n */\nexport interface ISpritesheetData\n{\n animations?: utils.Dict<string[]>;\n frames: utils.Dict<ISpritesheetFrameData>;\n meta: {\n app?: string;\n format?: string;\n frameTags?: {\n from: number;\n name: string;\n to: number;\n direction: string;\n }[];\n image?: string;\n layers?: {\n blendMode: string;\n name: string;\n opacity: number;\n }[];\n scale: string | number;\n size?: {\n h: number;\n w: number;\n };\n slices?: {\n color: string;\n name: string;\n keys: {\n frame: number,\n bounds: {\n x: number;\n y: number;\n w: number;\n h: number;\n };\n }[];\n }[];\n // eslint-disable-next-line camelcase\n related_multi_packs?: string[];\n version?: string;\n };\n}\n\n/**\n * Options for loading a spritesheet from an atlas.\n * @memberof PIXI\n */\ninterface SpritesheetOptions<S extends ISpritesheetData = ISpritesheetData>\n{\n /** Reference to Texture */\n texture: BaseTexture | Texture;\n /** JSON data for the atlas. */\n data: S;\n /** The filename to consider when determining the resolution of the spritesheet. */\n resolutionFilename?: string;\n /**\n * Prefix to add to texture names when adding to global TextureCache,\n * using this option can be helpful if you have multiple texture atlases\n * that share texture names and you need to disambiguate them.\n */\n cachePrefix?: string;\n}\n\n/**\n * Utility class for maintaining reference to a collection\n * of Textures on a single Spritesheet.\n *\n * To access a sprite sheet from your code you may pass its JSON data file to Pixi's loader:\n *\n * ```js\n * import { Assets } from 'pixi.js';\n *\n * const sheet = await Assets.load('images/spritesheet.json');\n * ```\n *\n * Alternately, you may circumvent the loader by instantiating the Spritesheet directly:\n *\n * ```js\n * import { Spritesheet } from 'pixi.js';\n *\n * const sheet = new Spritesheet(texture, spritesheetData);\n * await sheet.parse();\n * console.log('Spritesheet ready to use!');\n * ```\n *\n * With the `sheet.textures` you can create Sprite objects, and `sheet.animations` can be used to create an AnimatedSprite.\n *\n * Here's an example of a sprite sheet JSON data file:\n * ```json\n * {\n * \"frames\": {\n * \"enemy1.png\":\n * {\n * \"frame\": {\"x\":103,\"y\":1,\"w\":32,\"h\":32},\n * \"spriteSourceSize\": {\"x\":0,\"y\":0,\"w\":32,\"h\":32},\n * \"sourceSize\": {\"w\":32,\"h\":32},\n * \"anchor\": {\"x\":16,\"y\":16}\n * },\n * \"enemy2.png\":\n * {\n * \"frame\": {\"x\":103,\"y\":35,\"w\":32,\"h\":32},\n * \"spriteSourceSize\": {\"x\":0,\"y\":0,\"w\":32,\"h\":32},\n * \"sourceSize\": {\"w\":32,\"h\":32},\n * \"anchor\": {\"x\":16,\"y\":16}\n * },\n * \"button.png\":\n * {\n * \"frame\": {\"x\":1,\"y\":1,\"w\