lyb-pixi-js 1.0.7 → 1.0.9

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.
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  >
7
7
  > 在通过`import`引入使用时,鼠标悬浮在每一个方法上都有较为完整的`Jsdoc`提示
8
8
  >
9
- > 示例仅展示方法的部分参数使用,更多传参和调用,需要查看方法源码
9
+ > 示例仅展示方法的部分参数使用,更多传参和调用,可在编辑器右键方法转到类型定义查看方法的`.d.ts `文件
10
10
 
11
11
  ## 起步
12
12
 
@@ -1,5 +1,7 @@
1
1
  import { BitmapText } from "pixi.js";
2
- /** @description 自定义位图文本 */
2
+ /** @description 自定义位图文本
3
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiBitText-位图
4
+ */
3
5
  export declare class LibPixiBitText {
4
6
  /** 字体名称 */
5
7
  private _fontName;
@@ -1 +1,26 @@
1
- "use strict";import{BitmapText as i}from"pixi.js";export class LibPixiBitText{constructor(t,e){this._fontName=t,this._defaultFontSize=e}createText(t,e){return new i(t.toString(),{fontName:this._fontName,fontSize:this._defaultFontSize||e})}}
1
+ import { BitmapText } from "pixi.js";
2
+ /** @description 自定义位图文本
3
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiBitText-位图
4
+ */
5
+ export class LibPixiBitText {
6
+ /**
7
+ * @param fontName 字体名称
8
+ * @param defaultFontSize 默认字体大小
9
+ */
10
+ constructor(fontName, defaultFontSize) {
11
+ this._fontName = fontName;
12
+ this._defaultFontSize = defaultFontSize;
13
+ }
14
+ /** @description 创建位图文本
15
+ * @param text 文本内容
16
+ * @param fontSize 字体大小,不填则使用默认大小
17
+ * @returns 位图实例
18
+ */
19
+ createText(text, fontSize) {
20
+ const bitMapText = new BitmapText(text.toString(), {
21
+ fontName: this._fontName,
22
+ fontSize: this._defaultFontSize || fontSize,
23
+ });
24
+ return bitMapText;
25
+ }
26
+ }
@@ -9,7 +9,9 @@ interface LibPixiContainerParams {
9
9
  /** 背景色 */
10
10
  bgColor?: string;
11
11
  }
12
- /** @description 自定义容器大小及背景色 */
12
+ /** @description 自定义容器大小及背景色
13
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiContainer-容器
14
+ */
13
15
  export declare class LibPixiContainer extends Container {
14
16
  /** 填充容器 */
15
17
  private _fill?;
@@ -1 +1,48 @@
1
- "use strict";import{Container as o,Graphics as r,Sprite as f}from"pixi.js";import{LibPixiRectBgColor as d}from"../LibPixiRectBgColor";export class LibPixiContainer extends o{constructor(t){super();const{width:i,height:s,overHidden:e,bgColor:h}=t;if(e){const l=new r;l.beginFill(16777215),l.drawRect(0,0,i,s),l.endFill(),this.addChild(l),this.mask=l}h?(this._bgColorFill=new d({width:i,height:s,bgColor:h}),this.addChild(this._bgColorFill)):(this._fill=new f,this._fill.width=i,this._fill.height=s,this.addChild(this._fill))}setSize(t,i){this._fill&&(this._fill.width=t,this._fill.height=i),this._bgColorFill&&this._bgColorFill.renderBg(t,i)}}
1
+ import { Container, Graphics, Sprite } from "pixi.js";
2
+ import { LibPixiRectBgColor } from "../LibPixiRectBgColor";
3
+ /** @description 自定义容器大小及背景色
4
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiContainer-容器
5
+ */
6
+ export class LibPixiContainer extends Container {
7
+ /**
8
+ * @param width 容器宽度
9
+ * @param height 容器高度
10
+ * @param bgColor 背景色
11
+ */
12
+ constructor(params) {
13
+ super();
14
+ const { width, height, overHidden, bgColor } = params;
15
+ if (overHidden) {
16
+ const mask = new Graphics();
17
+ mask.beginFill(0xffffff); // 创建一个白色矩形
18
+ mask.drawRect(0, 0, width, height);
19
+ mask.endFill();
20
+ this.addChild(mask);
21
+ this.mask = mask;
22
+ }
23
+ if (bgColor) {
24
+ this._bgColorFill = new LibPixiRectBgColor({
25
+ width,
26
+ height,
27
+ bgColor,
28
+ });
29
+ this.addChild(this._bgColorFill);
30
+ }
31
+ else {
32
+ this._fill = new Sprite();
33
+ this._fill.width = width;
34
+ this._fill.height = height;
35
+ this.addChild(this._fill);
36
+ }
37
+ }
38
+ /** @description 设置容器大小 */
39
+ setSize(width, height) {
40
+ if (this._fill) {
41
+ this._fill.width = width;
42
+ this._fill.height = height;
43
+ }
44
+ if (this._bgColorFill) {
45
+ this._bgColorFill.renderBg(width, height);
46
+ }
47
+ }
48
+ }
@@ -27,7 +27,9 @@ export interface LibPixiParticleMoveParams {
27
27
  /** 是否循环,调试使用 */
28
28
  loop?: boolean;
29
29
  }
30
- /** @description 利用贝塞尔曲线实现粒子移动 */
30
+ /** @description 利用贝塞尔曲线实现粒子移动
31
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiParticleMove-粒子容器
32
+ */
31
33
  export declare class LibPixiParticleMove extends Container {
32
34
  private _particleContainer;
33
35
  constructor(params: LibPixiParticleMoveParams);
@@ -1 +1,100 @@
1
- "use strict";import{Container as x,ParticleContainer as C,Ticker as P}from"pixi.js";import{Emitter as w}from"@pixi/particle-emitter";import u from"gsap";import{LibPixiText as _}from"../LibPixiText";export class LibPixiParticleMove extends x{constructor(n){super();const{start:i,control:o,end:e,json:r,duration:s,ease:t="power1.out",showControl:c=!1,loop:h=!1}=n;this._particleContainer=new C,this.addChild(this._particleContainer);const a=new w(this._particleContainer,r),l=this._createBezierPoints([i,...o,e],100,c),f={pathThrough:0};u.to(f,{duration:s,pathThrough:l.length-1,repeat:h?-1:0,ease:t,onStart:()=>{a.emit=!0},onUpdate:()=>{const d=Math.floor(f.pathThrough),m=l[d];a.updateOwnerPos(m.x,m.y)},onComplete:()=>{u.to(this,{alpha:0,duration:.5,onComplete:()=>{a.emit=!1,p.destroy(),this.removeFromParent()}})}});const p=new P;p.add(()=>{a.update(1/75)}),p.start()}_createBezierPoints(n,i,o){const e=[];o&&n.forEach((r,s)=>{const t=new _({text:s+1,fontSize:16});t.position.set(r.x,r.y),this.addChild(t)});for(let r=0;r<i;r++){const s=this._multiPointBezier(n,r/i);e.push(s)}return e}_multiPointBezier(n,i){const o=n.length;let e=0,r=0;const s=[];for(let t=0;t<o;t++)s[t]=this._binomial(o-1,t);for(let t=0;t<o;t++){const c=n[t],h=s[t],a=Math.pow(i,t),l=Math.pow(1-i,o-1-t);e+=c.x*l*a*h,r+=c.y*l*a*h}return{x:e,y:r}}_binomial(n,i){if(i===0||i===n)return 1;let o=1;for(let e=1;e<=i;e++)o=o*(n-e+1)/e;return o}}
1
+ import { Container, ParticleContainer, Ticker } from "pixi.js";
2
+ import { Emitter } from "@pixi/particle-emitter";
3
+ import gsap from "gsap";
4
+ import { LibPixiText } from "../LibPixiText";
5
+ /** @description 利用贝塞尔曲线实现粒子移动
6
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiParticleMove-粒子容器
7
+ */
8
+ export class LibPixiParticleMove extends Container {
9
+ constructor(params) {
10
+ super();
11
+ const { start, control, end, json, duration, ease = "power1.out", showControl = false, loop = false, } = params;
12
+ this._particleContainer = new ParticleContainer();
13
+ this.addChild(this._particleContainer);
14
+ // 初始化粒子发射器
15
+ const flyParticle = new Emitter(this._particleContainer, json);
16
+ // 创建贝塞尔曲线的路径
17
+ const path = this._createBezierPoints([start, ...control, end], 100, showControl);
18
+ // 用来控制路径动画的对象
19
+ const flyObj = { pathThrough: 0 };
20
+ gsap.to(flyObj, {
21
+ duration,
22
+ pathThrough: path.length - 1,
23
+ repeat: loop ? -1 : 0,
24
+ ease,
25
+ onStart: () => {
26
+ flyParticle.emit = true;
27
+ },
28
+ onUpdate: () => {
29
+ const i = Math.floor(flyObj.pathThrough);
30
+ const p = path[i];
31
+ flyParticle.updateOwnerPos(p.x, p.y);
32
+ },
33
+ onComplete: () => {
34
+ gsap.to(this, {
35
+ alpha: 0,
36
+ duration: 0.5,
37
+ onComplete: () => {
38
+ flyParticle.emit = false;
39
+ ticker.destroy();
40
+ this.removeFromParent();
41
+ },
42
+ });
43
+ },
44
+ });
45
+ const ticker = new Ticker();
46
+ ticker.add(() => {
47
+ flyParticle.update(1 / 75);
48
+ });
49
+ ticker.start();
50
+ }
51
+ _createBezierPoints(anchorPoints, pointsAmount, showControl) {
52
+ const points = [];
53
+ // 渲染控制点
54
+ if (showControl) {
55
+ anchorPoints.forEach((item, index) => {
56
+ //创建一个小圆点
57
+ const text = new LibPixiText({
58
+ text: index + 1,
59
+ fontSize: 16,
60
+ });
61
+ text.position.set(item.x, item.y);
62
+ this.addChild(text);
63
+ });
64
+ }
65
+ // 计算并存储贝塞尔曲线上的点
66
+ for (let i = 0; i < pointsAmount; i++) {
67
+ const point = this._multiPointBezier(anchorPoints, i / pointsAmount);
68
+ points.push(point);
69
+ }
70
+ return points;
71
+ }
72
+ _multiPointBezier(points, t) {
73
+ const len = points.length;
74
+ let x = 0, y = 0;
75
+ // 预计算组合数
76
+ const binomials = [];
77
+ for (let i = 0; i < len; i++) {
78
+ binomials[i] = this._binomial(len - 1, i);
79
+ }
80
+ // 计算贝塞尔曲线上的点
81
+ for (let i = 0; i < len; i++) {
82
+ const point = points[i];
83
+ const binom = binomials[i];
84
+ const factorT = Math.pow(t, i);
85
+ const factor1MinusT = Math.pow(1 - t, len - 1 - i);
86
+ x += point.x * factor1MinusT * factorT * binom;
87
+ y += point.y * factor1MinusT * factorT * binom;
88
+ }
89
+ return { x, y };
90
+ }
91
+ _binomial(n, k) {
92
+ if (k === 0 || k === n)
93
+ return 1;
94
+ let res = 1;
95
+ for (let i = 1; i <= k; i++) {
96
+ res = (res * (n - i + 1)) / i;
97
+ }
98
+ return res;
99
+ }
100
+ }
@@ -13,7 +13,9 @@ export interface LibPixiRectBgColorParams {
13
13
  /** 是否启用变色功能 */
14
14
  enableTint?: boolean;
15
15
  }
16
- /** @description 自定义矩形背景色 */
16
+ /** @description 自定义矩形背景色
17
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiRectBgColor-矩形
18
+ */
17
19
  export declare class LibPixiRectBgColor extends Graphics {
18
20
  /** 启用着色 */
19
21
  private enableTint;
@@ -1 +1,37 @@
1
- "use strict";import{Graphics as l}from"pixi.js";import n from"gsap";export class LibPixiRectBgColor extends l{constructor(t){super(),this.enableTint=!0,this.bgColor="#fff";const{x:i=0,y:e=0,width:s=0,height:r=0,bgColor:o="#fff",enableTint:h=!0}=t;this.x=i,this.y=e,this.enableTint=h,this.bgColor=o,this.renderBg(s,r)}updateColor(t){n.to(this,{tint:t,duration:.25})}renderBg(t,i){this.clear(),this.enableTint?(this.beginFill("#fff"),this.tint=this.bgColor):this.beginFill(this.bgColor),this.drawRect(0,0,t,i),this.endFill()}}
1
+ import { Graphics } from "pixi.js";
2
+ import gsap from "gsap";
3
+ /** @description 自定义矩形背景色
4
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiRectBgColor-矩形
5
+ */
6
+ export class LibPixiRectBgColor extends Graphics {
7
+ constructor(options) {
8
+ super();
9
+ /** 启用着色 */
10
+ this.enableTint = true;
11
+ /** 背景颜色 */
12
+ this.bgColor = "#fff";
13
+ const { x = 0, y = 0, width = 0, height = 0, bgColor = "#fff", enableTint = true, } = options;
14
+ this.x = x;
15
+ this.y = y;
16
+ this.enableTint = enableTint;
17
+ this.bgColor = bgColor;
18
+ this.renderBg(width, height);
19
+ }
20
+ /** @description 重新绘制并添加颜色 */
21
+ updateColor(tint) {
22
+ gsap.to(this, { tint, duration: 0.25 });
23
+ }
24
+ /** @description 更新宽度 */
25
+ renderBg(width, height) {
26
+ this.clear();
27
+ if (this.enableTint) {
28
+ this.beginFill("#fff");
29
+ this.tint = this.bgColor;
30
+ }
31
+ else {
32
+ this.beginFill(this.bgColor);
33
+ }
34
+ this.drawRect(0, 0, width, height);
35
+ this.endFill();
36
+ }
37
+ }
@@ -24,7 +24,9 @@ export interface LibPixiSpineParams {
24
24
  onUpdate?: (config: OnUpdateParams) => void;
25
25
  }[];
26
26
  }
27
- /** @description 自定义 Spine 动画 */
27
+ /** @description 自定义 Spine 动画
28
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiSpine-动画
29
+ */
28
30
  export declare class LibPixiSpine extends Spine {
29
31
  /** 挂点 */
30
32
  private _followDots;
@@ -1 +1,132 @@
1
- "use strict";import{Assets as a,Ticker as n}from"pixi.js";import{Spine as r}from"@pixi-spine/runtime-3.8";import f from"gsap";export class LibPixiSpine extends r{constructor(o,e){const{followPointList:t,visible:l=!1}=e||{};let i;typeof o=="string"?i=a.get(o).spineData:i=o.spineData,super(i),this._followDots=[],this._isStart=!1,this.visible=l,this.autoUpdate=!1,t?.length&&t?.forEach(s=>{s.follow.alpha=0,this._followDots.push({point:this.skeleton.findBone(s.boneName),follow:s.follow,onUpdate:s.onUpdate,angleFollow:s.angleFollow||!1,scaleFollow:s.scaleFollow||!0})}),this._loopFn=this._loop.bind(this),n.system.add(this._loopFn)}setAnimation(o="Animation",e=!1,t=!0){return new Promise(l=>{this.visible=!0,this.state.setAnimation(0,o,e).listener={complete:()=>{t?requestAnimationFrame(()=>{l()}):l()}}})}addAnimation(o="Animation",e=!1,t=0){return new Promise(l=>{this.state.addAnimation(0,o,e,t).listener={complete:()=>{requestAnimationFrame(()=>{l()})}}})}setSkin(o){this.skeleton.setSkinByName(o)}destroyAll(){n.system.remove(this._loopFn),this.destroy(),this.removeFromParent()}_loop(){this.update(n.system.deltaMS/1e3),this._updateFollowPoint()}_updateFollowPoint(){this._followDots.length!==0&&(this._followDots.forEach(o=>{const{worldX:e,worldY:t}=o.point,l=o.point.getWorldRotationX()*(Math.PI/180),i=o.point.getWorldScaleX(),s=o.point.getWorldScaleY();o.onUpdate?o.onUpdate({x:e,y:t,rotate:l,scaleX:i,scaleY:s}):(o.angleFollow&&(o.follow.rotation=l),o.scaleFollow&&o.follow.scale.set(i,s),o.follow.position.set(e+1920/2-o.follow.width/2,t+1080/2-o.follow.height/2))}),this._isStart||(this._isStart=!0,this._followDots.forEach(o=>{f.to(o.follow,{alpha:1,duration:.25,delay:.15})})))}}
1
+ import { Assets, Ticker } from "pixi.js";
2
+ import { Spine } from "@pixi-spine/runtime-3.8";
3
+ import gsap from "gsap";
4
+ /** @description 自定义 Spine 动画
5
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiSpine-动画
6
+ */
7
+ export class LibPixiSpine extends Spine {
8
+ constructor(spineNameOrTexture, params) {
9
+ const { followPointList, visible = false } = params || {};
10
+ let spineData;
11
+ if (typeof spineNameOrTexture === "string") {
12
+ spineData = Assets.get(spineNameOrTexture).spineData;
13
+ }
14
+ else {
15
+ spineData = spineNameOrTexture.spineData;
16
+ }
17
+ super(spineData);
18
+ /** 挂点 */
19
+ this._followDots = [];
20
+ /** 是否已开始 */
21
+ this._isStart = false;
22
+ this.visible = visible;
23
+ this.autoUpdate = false;
24
+ //如果存在挂点
25
+ if (followPointList === null || followPointList === void 0 ? void 0 : followPointList.length) {
26
+ followPointList === null || followPointList === void 0 ? void 0 : followPointList.forEach((item) => {
27
+ item.follow.alpha = 0;
28
+ this._followDots.push({
29
+ point: this.skeleton.findBone(item.boneName),
30
+ follow: item.follow,
31
+ onUpdate: item.onUpdate,
32
+ angleFollow: item.angleFollow || false,
33
+ scaleFollow: item.scaleFollow || true,
34
+ });
35
+ });
36
+ }
37
+ this._loopFn = this._loop.bind(this);
38
+ Ticker.system.add(this._loopFn);
39
+ }
40
+ /** @description 设置动画
41
+ * @param animationName 动画名称
42
+ * @param loop 是否循环播放
43
+ * @param delay 是否延迟播放
44
+ */
45
+ setAnimation(animationName = "Animation", loop = false, delay = true) {
46
+ return new Promise((resolve) => {
47
+ this.visible = true;
48
+ this.state.setAnimation(0, animationName, loop).listener = {
49
+ complete: () => {
50
+ if (delay) {
51
+ requestAnimationFrame(() => {
52
+ resolve();
53
+ });
54
+ }
55
+ else {
56
+ resolve();
57
+ }
58
+ },
59
+ };
60
+ });
61
+ }
62
+ /** @description 添加动画
63
+ * @param animationName 动画名称
64
+ * @param loop 是否循环播放
65
+ * @param delay 延迟播放时间
66
+ */
67
+ addAnimation(animationName = "Animation", loop = false, delay = 0) {
68
+ return new Promise((resolve) => {
69
+ this.state.addAnimation(0, animationName, loop, delay).listener = {
70
+ complete: () => {
71
+ requestAnimationFrame(() => {
72
+ resolve();
73
+ });
74
+ },
75
+ };
76
+ });
77
+ }
78
+ /** @description 改变骨骼数据 */
79
+ setSkin(skinName) {
80
+ this.skeleton.setSkinByName(skinName);
81
+ }
82
+ /** @description 销毁动画及挂点 */
83
+ destroyAll() {
84
+ Ticker.system.remove(this._loopFn);
85
+ this.destroy();
86
+ this.removeFromParent();
87
+ }
88
+ /** @description 更新渲染 */
89
+ _loop() {
90
+ this.update(Ticker.system.deltaMS / 1000);
91
+ this._updateFollowPoint();
92
+ }
93
+ /** @description 更新挂点 */
94
+ _updateFollowPoint() {
95
+ if (this._followDots.length === 0)
96
+ return;
97
+ this._followDots.forEach((item) => {
98
+ const { worldX: x, worldY: y } = item.point;
99
+ const rotate = item.point.getWorldRotationX() * (Math.PI / 180);
100
+ const scaleX = item.point.getWorldScaleX();
101
+ const scaleY = item.point.getWorldScaleY();
102
+ if (item.onUpdate) {
103
+ item.onUpdate({
104
+ x,
105
+ y,
106
+ rotate,
107
+ scaleX,
108
+ scaleY,
109
+ });
110
+ }
111
+ else {
112
+ if (item.angleFollow) {
113
+ item.follow.rotation = rotate;
114
+ }
115
+ if (item.scaleFollow) {
116
+ item.follow.scale.set(scaleX, scaleY);
117
+ }
118
+ item.follow.position.set(x + 1920 / 2 - item.follow.width / 2, y + 1080 / 2 - item.follow.height / 2);
119
+ }
120
+ });
121
+ if (!this._isStart) {
122
+ this._isStart = true;
123
+ this._followDots.forEach((item) => {
124
+ gsap.to(item.follow, {
125
+ alpha: 1,
126
+ duration: 0.25,
127
+ delay: 0.15,
128
+ });
129
+ });
130
+ }
131
+ }
132
+ }
@@ -29,7 +29,9 @@ export interface LibPixiTextParams {
29
29
  /** 阴影-颜色 角度 模糊度 阴影距离 */
30
30
  shadow?: [string, number, number, number];
31
31
  }
32
- /** @description 自定义文本类 */
32
+ /** @description 自定义文本类
33
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiText-文本
34
+ */
33
35
  export declare class LibPixiText extends Text {
34
36
  constructor(options: LibPixiTextParams);
35
37
  }
@@ -1 +1,32 @@
1
- "use strict";import{Text as k,TextStyle as S}from"pixi.js";export class LibPixiText extends k{constructor(n){const{text:s,fontSize:e=36,fontColor:a=16777215,stroke:r,strokeColor:l,strokeThickness:d,fontFamily:f="MicrosoftYaHei",fontWeight:h="normal",wordWrap:i=!1,wordWrapWidth:p=100,lineHeight:c=1.25,align:w="left",indent:x=0,shadow:t}=n,o=new S({fontSize:e,wordWrap:i,wordWrapWidth:p,fontWeight:h,lineHeight:c*e,breakWords:i,fill:a,align:w,fontFamily:f,stroke:r?l:"transparent",strokeThickness:r?d:0,lineJoin:"round"});t&&(o.dropShadow=!0,o.dropShadowColor=t[0],o.dropShadowAngle=t[1]*(Math.PI/180),o.dropShadowBlur=t[2],o.dropShadowDistance=t[3]),super(s,o),this.position.x=x*e}}
1
+ import { Text, TextStyle } from "pixi.js";
2
+ /** @description 自定义文本类
3
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiText-文本
4
+ */
5
+ export class LibPixiText extends Text {
6
+ constructor(options) {
7
+ const { text, fontSize = 36, fontColor = 0xffffff, stroke, strokeColor, strokeThickness, fontFamily = "MicrosoftYaHei", fontWeight = "normal", wordWrap = false, wordWrapWidth = 100, lineHeight = 1.25, align = "left", indent = 0, shadow, } = options;
8
+ const style = new TextStyle({
9
+ fontSize,
10
+ wordWrap,
11
+ wordWrapWidth,
12
+ fontWeight,
13
+ lineHeight: lineHeight * fontSize,
14
+ breakWords: wordWrap,
15
+ fill: fontColor,
16
+ align,
17
+ fontFamily: fontFamily,
18
+ stroke: stroke ? strokeColor : "transparent",
19
+ strokeThickness: stroke ? strokeThickness : 0,
20
+ lineJoin: "round",
21
+ });
22
+ if (shadow) {
23
+ style.dropShadow = true;
24
+ style.dropShadowColor = shadow[0];
25
+ style.dropShadowAngle = shadow[1] * (Math.PI / 180);
26
+ style.dropShadowBlur = shadow[2];
27
+ style.dropShadowDistance = shadow[3];
28
+ }
29
+ super(text, style);
30
+ this.position.x = indent * fontSize;
31
+ }
32
+ }
package/dist/index.js CHANGED
@@ -1 +1,2 @@
1
- "use strict";import*as i from"./libPixiJs";export{i as LibPixiJs};
1
+ import * as LibPixiJs_1 from "./libPixiJs";
2
+ export { LibPixiJs_1 as LibPixiJs };
@@ -6,16 +6,28 @@ import { LibPixiSpine } from "./Base/LibPixiSpine";
6
6
  import { LibPixiText } from "./Base/LibPixiText";
7
7
  /** @description 基础方法 */
8
8
  export declare const Base: {
9
- /** @description 自定义位图文本 */
9
+ /** @description 自定义位图文本
10
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiBitText-位图
11
+ */
10
12
  LibPixiBitText: typeof LibPixiBitText;
11
- /** @description 自定义容器大小及背景色 */
13
+ /** @description 自定义容器大小及背景色
14
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiContainer-容器
15
+ */
12
16
  LibPixiContainer: typeof LibPixiContainer;
13
- /** @description 粒子移动 */
17
+ /** @description 利用贝塞尔曲线实现粒子移动
18
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiParticleMove-粒子容器
19
+ */
14
20
  LibPixiParticleMove: typeof LibPixiParticleMove;
15
- /** @description 自定义矩形背景色 */
21
+ /** @description 自定义矩形背景色
22
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiRectBgColor-矩形
23
+ */
16
24
  LibPixiRectBgColor: typeof LibPixiRectBgColor;
17
- /** @description 自定义 Spine 动画 */
25
+ /** @description 自定义 Spine 动画
26
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiSpine-动画
27
+ */
18
28
  LibPixiSpine: typeof LibPixiSpine;
19
- /** @description 自定义普通文本类 */
29
+ /** @description 自定义文本类
30
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiText-文本
31
+ */
20
32
  LibPixiText: typeof LibPixiText;
21
33
  };
package/dist/libPixiJs.js CHANGED
@@ -1 +1,33 @@
1
- "use strict";import{LibPixiBitText as i}from"./Base/LibPixiBitText";import{LibPixiContainer as o}from"./Base/LibPixiContainer";import{LibPixiParticleMove as r}from"./Base/LibPixiParticleMove";import{LibPixiRectBgColor as t}from"./Base/LibPixiRectBgColor";import{LibPixiSpine as m}from"./Base/LibPixiSpine";import{LibPixiText as e}from"./Base/LibPixiText";export const Base={LibPixiBitText:i,LibPixiContainer:o,LibPixiParticleMove:r,LibPixiRectBgColor:t,LibPixiSpine:m,LibPixiText:e};
1
+ import { LibPixiBitText } from "./Base/LibPixiBitText";
2
+ import { LibPixiContainer } from "./Base/LibPixiContainer";
3
+ import { LibPixiParticleMove } from "./Base/LibPixiParticleMove";
4
+ import { LibPixiRectBgColor } from "./Base/LibPixiRectBgColor";
5
+ import { LibPixiSpine } from "./Base/LibPixiSpine";
6
+ import { LibPixiText } from "./Base/LibPixiText";
7
+ /** @description 基础方法 */
8
+ export const Base = {
9
+ /** @description 自定义位图文本
10
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiBitText-位图
11
+ */
12
+ LibPixiBitText,
13
+ /** @description 自定义容器大小及背景色
14
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiContainer-容器
15
+ */
16
+ LibPixiContainer,
17
+ /** @description 利用贝塞尔曲线实现粒子移动
18
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiParticleMove-粒子容器
19
+ */
20
+ LibPixiParticleMove,
21
+ /** @description 自定义矩形背景色
22
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiRectBgColor-矩形
23
+ */
24
+ LibPixiRectBgColor,
25
+ /** @description 自定义 Spine 动画
26
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiSpine-动画
27
+ */
28
+ LibPixiSpine,
29
+ /** @description 自定义文本类
30
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiText-文本
31
+ */
32
+ LibPixiText,
33
+ };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "lyb-pixi-js",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
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": "vite build & tsc & esbuild dist/**/*.js --minify --outdir=dist --allow-overwrite"
10
+ "build": "vite build & tsc"
11
11
  },
12
12
  "exports": {
13
13
  "./*": "./dist/*"
@@ -34,7 +34,6 @@
34
34
  ],
35
35
  "devDependencies": {
36
36
  "@types/node": "^22.10.5",
37
- "esbuild": "^0.24.2",
38
37
  "typescript": "^5.7.3"
39
38
  },
40
39
  "dependencies": {
@@ -46,4 +45,4 @@
46
45
  "pixi.js": "^7.4.2",
47
46
  "vite": "^4.5.5"
48
47
  }
49
- }
48
+ }