lyb-pixi-js 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,7 +32,7 @@ export declare class LibPixiSpine extends Spine {
32
32
  private _isStart;
33
33
  /** spine更新函数 */
34
34
  private _loopFn;
35
- constructor(texture: any, params?: LibPixiSpineParams);
35
+ constructor(spineNameOrTexture: string | any, params?: LibPixiSpineParams);
36
36
  /** @description 设置动画
37
37
  * @param animationName 动画名称
38
38
  * @param loop 是否循环播放
@@ -13,16 +13,23 @@ var __extends = (this && this.__extends) || (function () {
13
13
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
14
  };
15
15
  })();
16
- import { Ticker } from "pixi.js";
16
+ import { Assets, Ticker } from "pixi.js";
17
17
  import { Spine } from "@pixi-spine/runtime-3.8";
18
18
  import gsap from "gsap";
19
19
  /** @description 自定义 Spine 动画 */
20
20
  var LibPixiSpine = /** @class */ (function (_super) {
21
21
  __extends(LibPixiSpine, _super);
22
- function LibPixiSpine(texture, params) {
22
+ function LibPixiSpine(spineNameOrTexture, params) {
23
23
  var _this = this;
24
24
  var _a = params || {}, followPointList = _a.followPointList, _b = _a.visible, visible = _b === void 0 ? false : _b;
25
- _this = _super.call(this, texture.spineData) || this;
25
+ var spineData;
26
+ if (typeof spineNameOrTexture === "string") {
27
+ spineData = Assets.get(spineNameOrTexture).spineData;
28
+ }
29
+ else {
30
+ spineData = spineNameOrTexture.spineData;
31
+ }
32
+ _this = _super.call(this, spineData) || this;
26
33
  /** 挂点 */
27
34
  _this._followDots = [];
28
35
  /** 是否已开始 */
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "lyb-pixi-js",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "自用Pixi.JS方法库",
5
5
  "license": "ISC",
6
6
  "type": "module",
7
7
  "types": "./dist/index.d.ts",
8
8
  "main": "./dist/index.js",
9
9
  "scripts": {
10
- "build": "tsc & vite build"
10
+ "build": "vite build & tsc"
11
11
  },
12
12
  "exports": {
13
13
  "./*": "./dist/*"
@@ -45,4 +45,4 @@
45
45
  "pixi.js": "^7.4.2",
46
46
  "vite": "^4.5.5"
47
47
  }
48
- }
48
+ }