# pixi-spine-loader

> pixi-spine-loader pixi-spine spine-loader

Latest version **0.1.0** (published 2022-08-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install pixi-spine-loader
pnpm add pixi-spine-loader
yarn add pixi-spine-loader
bun add pixi-spine-loader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2022-08-18 |
| First published | 2022-08-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 13.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | fierzhang |
| Maintainers | zhangxiang_zx |

## Links

- npm: https://www.npmjs.com/package/pixi-spine-loader
- npm.io page: https://npm.io/package/pixi-spine-loader

## Dependencies (3)

- [pixi.js](https://npm.io/package/pixi.js.md) ^6.4.2
- [pixi-spine](https://npm.io/package/pixi-spine.md) ^3.0.13
- [resource-loader](https://npm.io/package/resource-loader.md) 3.0.1

## Recent versions

- 0.1.0 (latest) — 2022-08-18

## README

# `pixi-spine-loader`

> 基于 pixi.js pixi-spine 改造的 spine 本地数据解析工具

## Why

受限于 pixi 的设计，在加载 Spine 资源数据时，需要传入一个 json 文件路径，pixi loader 会发起 http 请求去下载 json 文件，以及同名的 atlas 和 png 文件，并借助第三方库 `resouce-loader` 去解析数据，转换成 Spine 支持的数据格式。

但它没有向外提供 API，以让我们传入本地 json、atlas、png 数据给 resource-loader 解析。如果想实现 spine 的换装功能，允许自己组合 spine 的数据，允许获取与 json 不同名的皮肤图片，就必须有一个允许解析本地 Spine 数据的 API，把本地重组的 spine 数据和非同名皮肤图片 整合到一起，并转换成 Spine 支持的数据格式。

## Usage

```
import { pixi-spine-loader } from "@tencent/pixi-spine-loader";
import { Spine } from "pixi-spine";

const spineData = await pixi-spine-loader({
	json: { 骨骼json数据... },
	atlas: "123",
	png: { 骨骼皮肤资源... },
});
const spine = new Spine(spineData);
```

参数：

| 字段名 | 类型   | 是否必填 | 默认值 | 说明                                                                                                                                    |
| ------ | ------ | -------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------- |
| json   | object | 是       | {}     | 默认是设计导出的 json 数据，也可以是结合自定义换肤数据后重组的 json 数据                                                                |
| atlas  | string | 否       | ""     | 设计导出的 atlas 文件的文本字符串，换行通过 `\n` 连接 ；                                                                                |
| png    | object | 否       | {}     | key 是图片名字，对应 atlas 中图片名字，value 是图片地址，图片链接文件后缀不必和 key 同名。如： { "skeleton.png": "https://a.com/c.png"} |

---
_Source: https://npm.io/package/pixi-spine-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
