Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pixi/spritesheet

Package Overview
Dependencies
Maintainers
2
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/spritesheet - npm Package Compare versions

Comparing version 7.1.2 to 7.2.0-beta

56

lib/Spritesheet.d.ts
import { BaseTexture, Texture, utils } from '@pixi/core';
import type { IPointData } from '@pixi/core';
/** Represents the JSON data for a spritesheet atlas. */
import type { IPointData, ITextureBorders } from '@pixi/core';
/**
* Represents the JSON data for a spritesheet atlas.
* @memberof PIXI
*/
export interface ISpritesheetFrameData {

@@ -22,4 +25,8 @@ frame: {

anchor?: IPointData;
borders?: ITextureBorders;
}
/** Atlas format. */
/**
* Atlas format.
* @memberof PIXI
*/
export interface ISpritesheetData {

@@ -57,5 +64,46 @@ frames: utils.Dict<ISpritesheetFrameData>;

*
* Here's an example of a sprite sheet JSON data file:
* ```json
* {
* "frames": {
* "enemy1.png":
* {
* "frame": {"x":103,"y":1,"w":32,"h":32},
* "spriteSourceSize": {"x":0,"y":0,"w":32,"h":32},
* "sourceSize": {"w":32,"h":32},
* "anchor": {"x":16,"y":16}
* },
* "enemy2.png":
* {
* "frame": {"x":103,"y":35,"w":32,"h":32},
* "spriteSourceSize": {"x":0,"y":0,"w":32,"h":32},
* "sourceSize": {"w":32,"h":32},
* "anchor": {"x":16,"y":16}
* },
* "button.png":
* {
* "frame": {"x":1,"y":1,"w":100,"h":100},
* "spriteSourceSize": {"x":0,"y":0,"w":100,"h":100},
* "sourceSize": {"w":100,"h":100},
* "anchor": {"x":0,"y":0},
* "borders": {"left":35,"top":35,"right":35,"bottom":35}
* }
* },
*
* "animations": {
* "enemy": ["enemy1.png","enemy2.png"]
* },
*
* "meta": {
* "image": "sheet.png",
* "format": "RGBA8888",
* "size": {"w":136,"h":102},
* "scale": "1"
* }
* }
* ```
* Sprite sheets can be packed using tools like {@link https://codeandweb.com/texturepacker|TexturePacker},
* {@link https://renderhjs.net/shoebox/|Shoebox} or {@link https://github.com/krzysztof-o/spritesheet.js|Spritesheet.js}.
* Default anchor points (see {@link PIXI.Texture#defaultAnchor}) and grouping of animation sprites are currently only
* Default anchor points (see {@link PIXI.Texture#defaultAnchor}), default 9-slice borders
* (see {@link PIXI.Texture#defaultBorders}) and grouping of animation sprites are currently only
* supported by TexturePacker.

@@ -62,0 +110,0 @@ * @memberof PIXI

2

lib/Spritesheet.js

@@ -66,3 +66,3 @@ 'use strict';

}
this.textures[i] = new core.Texture(this.baseTexture, frame, orig, trim, data.rotated ? 2 : 0, data.anchor);
this.textures[i] = new core.Texture(this.baseTexture, frame, orig, trim, data.rotated ? 2 : 0, data.anchor, data.borders);
core.Texture.addToCache(this.textures[i], i);

@@ -69,0 +69,0 @@ }

import { Spritesheet } from './Spritesheet';
import type { AssetExtension } from '@pixi/assets';
import type { ISpritesheetData } from './Spritesheet';
interface SpriteSheetJson extends ISpritesheetData {
export interface SpriteSheetJson extends ISpritesheetData {
meta: {

@@ -14,4 +14,4 @@ image: string;

* @memberof PIXI
* @type {PIXI.AssetExtension}
*/
export declare const spritesheetAsset: AssetExtension<Spritesheet | SpriteSheetJson, any>;
export {};
{
"name": "@pixi/spritesheet",
"version": "7.1.2",
"version": "7.2.0-beta",
"main": "lib/index.js",

@@ -41,4 +41,3 @@ "module": "lib/index.mjs",

"@pixi/core"
],
"gitHead": "27e65c73bb36a06fd00d6da5bf460bbee9f6c984"
]
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc