lyb-pixi-js 1.6.1 → 1.7.0

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.
@@ -1,8 +1,7 @@
1
1
  import { Container } from "pixi.js";
2
- import { type EmitterConfigV3 } from "@pixi/particle-emitter";
3
2
  export interface LibPixiParticleMoveParams {
4
3
  /** 粒子JSON资源 */
5
- json: EmitterConfigV3;
4
+ container: Container;
6
5
  /** 运动时长 */
7
6
  duration: number;
8
7
  /** 粒子开始位置 */
@@ -26,6 +25,66 @@ export interface LibPixiParticleMoveParams {
26
25
  showControl?: boolean;
27
26
  /** 是否循环,调试使用 */
28
27
  loop?: boolean;
28
+ /** 是否启用粒子容器 */
29
+ enableParticleContainer?: boolean;
30
+ /** 粒子配置 */
31
+ particleConfig: {
32
+ /** 随机时长 */
33
+ lifetime: {
34
+ /** 最小时长 */
35
+ min: number;
36
+ /** 最大时长 */
37
+ max: number;
38
+ };
39
+ /** 混合模式 */
40
+ blendMode?: string;
41
+ /** 频率,秒/个 */
42
+ frequency?: number;
43
+ /** 透明度变化 */
44
+ alpha?: {
45
+ /** 开始透明度 */
46
+ start: number;
47
+ /** 结束透明度 */
48
+ end: number;
49
+ };
50
+ /** 颜色变化 */
51
+ color?: {
52
+ /** 开始颜色 */
53
+ start: string;
54
+ /** 结束颜色 */
55
+ end: string;
56
+ };
57
+ /** 随机缩放变化 */
58
+ scale?: {
59
+ /** 最小 */
60
+ start: number;
61
+ /** 最大 */
62
+ end: number;
63
+ };
64
+ /** 随机偏移角度变化 */
65
+ rotation?: {
66
+ /** 最小角度 */
67
+ min: number;
68
+ /** 最大角度 */
69
+ max: number;
70
+ };
71
+ /** 随机自身旋转角度变化 */
72
+ rotate?: {
73
+ /** 最小角度 */
74
+ min: number;
75
+ /** 最大角度 */
76
+ max: number;
77
+ };
78
+ /** 移动速度,像素 */
79
+ speed?: {
80
+ /** 开始速度,不能为0,可无限接近0 */
81
+ start: number;
82
+ /** 结束速度,开始速度会衰减到结束速度 */
83
+ end: number;
84
+ };
85
+ };
86
+ /** 头部粒子到达终点后触发,可在此设置隐藏动画,隐藏动画结束后调用 destroy 参数进行销毁 */
87
+ onDestroy?: (destroy: () => void) => void;
29
88
  }
30
89
  /** @description 利用贝塞尔曲线实现粒子移动
31
90
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiParticleMove-粒子容器
@@ -33,7 +92,10 @@ export interface LibPixiParticleMoveParams {
33
92
  export declare class LibPixiParticleMove extends Container {
34
93
  private _particleContainer;
35
94
  constructor(params: LibPixiParticleMoveParams);
95
+ /** @description 创建贝塞尔曲线路径点组 */
36
96
  private _createBezierPoints;
97
+ /** @description 计算贝塞尔曲线单个路径衔接点 */
37
98
  private _multiPointBezier;
99
+ /** @description 计算组合数 */
38
100
  private _binomial;
39
101
  }
@@ -1,5 +1,5 @@
1
1
  import { Container, ParticleContainer, Ticker } from "pixi.js";
2
- import { Emitter } from "@pixi/particle-emitter";
2
+ import { Emitter, upgradeConfig } from "@pixi/particle-emitter";
3
3
  import gsap from "gsap";
4
4
  import { LibPixiText } from "./LibPixiText";
5
5
  /** @description 利用贝塞尔曲线实现粒子移动
@@ -8,11 +8,32 @@ import { LibPixiText } from "./LibPixiText";
8
8
  export class LibPixiParticleMove extends Container {
9
9
  constructor(params) {
10
10
  super();
11
- const { start, control, end, json, duration, ease = "power1.out", showControl = false, loop = false, } = params;
12
- this._particleContainer = new ParticleContainer();
11
+ const { start, control, end, container, duration, ease = "power1.out", showControl = false, loop = false, enableParticleContainer = false, particleConfig, onDestroy, } = params;
12
+ const config = upgradeConfig({
13
+ lifetime: particleConfig.lifetime,
14
+ blendMode: particleConfig.blendMode,
15
+ frequency: particleConfig.frequency || 0.01,
16
+ maxParticles: 1 / (particleConfig.frequency || 0.01),
17
+ alpha: particleConfig.alpha,
18
+ scale: particleConfig.scale,
19
+ color: particleConfig.color,
20
+ startRotation: particleConfig.rotation,
21
+ rotationSpeed: particleConfig.rotate,
22
+ speed: particleConfig.speed,
23
+ pos: {
24
+ x: 0,
25
+ y: 0,
26
+ },
27
+ }, [container]);
28
+ if (enableParticleContainer) {
29
+ this._particleContainer = new ParticleContainer();
30
+ }
31
+ else {
32
+ this._particleContainer = new Container();
33
+ }
13
34
  this.addChild(this._particleContainer);
14
35
  // 初始化粒子发射器
15
- const flyParticle = new Emitter(this._particleContainer, json);
36
+ const flyParticle = new Emitter(this._particleContainer, config);
16
37
  // 创建贝塞尔曲线的路径
17
38
  const path = this._createBezierPoints([start, ...control, end], 100, showControl);
18
39
  // 用来控制路径动画的对象
@@ -21,6 +42,7 @@ export class LibPixiParticleMove extends Container {
21
42
  duration,
22
43
  pathThrough: path.length - 1,
23
44
  repeat: loop ? -1 : 0,
45
+ repeatDelay: loop ? 1 : 0,
24
46
  ease,
25
47
  onStart: () => {
26
48
  flyParticle.emit = true;
@@ -31,23 +53,33 @@ export class LibPixiParticleMove extends Container {
31
53
  flyParticle.updateOwnerPos(p.x, p.y);
32
54
  },
33
55
  onComplete: () => {
34
- gsap.to(this, {
35
- alpha: 0,
36
- duration: 0.5,
37
- onComplete: () => {
56
+ if (onDestroy) {
57
+ onDestroy(() => {
38
58
  flyParticle.emit = false;
39
59
  ticker.destroy();
40
- this.removeFromParent();
41
- },
42
- });
60
+ this.destroy({ children: true });
61
+ });
62
+ }
63
+ else {
64
+ gsap.to(this, {
65
+ alpha: 0,
66
+ duration: 1,
67
+ onComplete: () => {
68
+ flyParticle.emit = false;
69
+ ticker.destroy();
70
+ this.destroy({ children: true });
71
+ },
72
+ });
73
+ }
43
74
  },
44
75
  });
45
76
  const ticker = new Ticker();
46
77
  ticker.add(() => {
47
- flyParticle.update(1 / 75);
78
+ flyParticle.update(ticker.deltaMS / 1000);
48
79
  });
49
80
  ticker.start();
50
81
  }
82
+ /** @description 创建贝塞尔曲线路径点组 */
51
83
  _createBezierPoints(anchorPoints, pointsAmount, showControl) {
52
84
  const points = [];
53
85
  // 渲染控制点
@@ -56,7 +88,10 @@ export class LibPixiParticleMove extends Container {
56
88
  //创建一个小圆点
57
89
  const text = new LibPixiText({
58
90
  text: index + 1,
59
- fontSize: 16,
91
+ fontSize: 20,
92
+ stroke: true,
93
+ strokeColor: "#000",
94
+ strokeThickness: 1,
60
95
  });
61
96
  text.position.set(item.x, item.y);
62
97
  this.addChild(text);
@@ -69,6 +104,7 @@ export class LibPixiParticleMove extends Container {
69
104
  }
70
105
  return points;
71
106
  }
107
+ /** @description 计算贝塞尔曲线单个路径衔接点 */
72
108
  _multiPointBezier(points, t) {
73
109
  const len = points.length;
74
110
  let x = 0, y = 0;
@@ -88,6 +124,7 @@ export class LibPixiParticleMove extends Container {
88
124
  }
89
125
  return { x, y };
90
126
  }
127
+ /** @description 计算组合数 */
91
128
  _binomial(n, k) {
92
129
  if (k === 0 || k === n)
93
130
  return 1;
@@ -1,15 +1,11 @@
1
1
  import { Graphics } from "pixi.js";
2
2
  export interface LibPixiRectBgColorParams {
3
3
  /** 宽度 */
4
- width?: number;
4
+ width: number;
5
5
  /** 高度 */
6
- height?: number;
6
+ height: number;
7
7
  /** 背景颜色 */
8
8
  bgColor?: string | number;
9
- /** x轴偏移 */
10
- x?: number;
11
- /** y轴偏移 */
12
- y?: number;
13
9
  /** 透明度 */
14
10
  alpha?: number;
15
11
  /** 圆角半径 */
@@ -18,9 +18,7 @@ export class LibPixiRectBgColor extends Graphics {
18
18
  this.borderColor = "black";
19
19
  /** 背景色 */
20
20
  this.bgAlpha = 1;
21
- const { x = 0, y = 0, width = 0, height = 0, bgColor = "#fff", alpha = 1, radius = 0, borderWidth = 0, borderColor = "black", enableTint = true, } = options;
22
- this.x = x;
23
- this.y = y;
21
+ const { width, height, bgColor = "#fff", alpha = 1, radius = 0, borderWidth = 0, borderColor = "black", enableTint = true, } = options;
24
22
  this.bgAlpha = alpha;
25
23
  this.radius = radius;
26
24
  this.enableTint = enableTint;
@@ -64,10 +64,4 @@ export declare class LibPixiScrollNum extends LibPixiContainer {
64
64
  private _onDragMove;
65
65
  /** @description 结束拖动 */
66
66
  private _onDragEnd;
67
- /** @description 线性插值
68
- * @param a1 当 t = 0 时,返回 a1
69
- * @param a2 当 t = 1 时,返回 a2
70
- * @param t 插值比例,取值范围 0~1
71
- */
72
- private lerp;
73
67
  }
@@ -1,6 +1,7 @@
1
1
  import { Graphics } from "pixi.js";
2
2
  import gsap from "gsap";
3
3
  import { LibPixiContainer } from "../Base/LibPixiContainer";
4
+ import { LibJsLerp } from "lyb-js/Math/LibJsLerp";
4
5
  /** @description 通过鼠标或手指拖动数字列选择数字
5
6
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollNum-数字滑动
6
7
  */
@@ -111,20 +112,20 @@ export class LibPixiScrollNum extends LibPixiContainer {
111
112
  const nextIdx = idx + 1;
112
113
  const nextIdx2 = idx + 2;
113
114
  const curItem = containerList[idx];
114
- curItem.alpha = this.lerp(0.5, 1, 1 - t);
115
- curItem.scale.y = this.lerp(0.85, 1, 1 - t);
115
+ curItem.alpha = LibJsLerp(0.5, 1, 1 - t);
116
+ curItem.scale.y = LibJsLerp(0.85, 1, 1 - t);
116
117
  if (nextIdx < containerList.length) {
117
118
  const nextItem = containerList[nextIdx];
118
- nextItem.alpha = this.lerp(0.5, 1, t);
119
- nextItem.scale.y = this.lerp(0.85, 1, t);
119
+ nextItem.alpha = LibJsLerp(0.5, 1, t);
120
+ nextItem.scale.y = LibJsLerp(0.85, 1, t);
120
121
  }
121
122
  if (nextIdx2 < containerList.length) {
122
123
  const nextItem = containerList[nextIdx2];
123
- nextItem.alpha = this.lerp(0.1, 0.5, t);
124
+ nextItem.alpha = LibJsLerp(0.1, 0.5, t);
124
125
  }
125
126
  if (prevIdx >= 0) {
126
127
  const prevItem = containerList[prevIdx];
127
- prevItem.alpha = this.lerp(0.1, 0.5, 1 - t);
128
+ prevItem.alpha = LibJsLerp(0.1, 0.5, 1 - t);
128
129
  }
129
130
  }
130
131
  /** @description 开始拖动 */
@@ -180,12 +181,4 @@ export class LibPixiScrollNum extends LibPixiContainer {
180
181
  // 执行滑动到目标页码
181
182
  this.slideTo(this._currentIndex);
182
183
  }
183
- /** @description 线性插值
184
- * @param a1 当 t = 0 时,返回 a1
185
- * @param a2 当 t = 1 时,返回 a2
186
- * @param t 插值比例,取值范围 0~1
187
- */
188
- lerp(a1, a2, t) {
189
- return a1 * (1 - t) + a2 * t;
190
- }
191
184
  }
@@ -74,6 +74,5 @@ export declare class LibPixiSlider extends LibPixiContainer {
74
74
  * @param startY 内部将y - startY进行计算
75
75
  */
76
76
  private _setDepth;
77
- lerp(a1: number, a2: number, t: number): number;
78
77
  }
79
78
  export {};
@@ -2,6 +2,7 @@ import { Container } from "pixi.js";
2
2
  import gsap from "gsap";
3
3
  import { libPixiOverflowHidden } from "../../Utils/LibPixiOverflowHidden";
4
4
  import { LibPixiContainer } from "../Base/LibPixiContainer";
5
+ import { LibJsLerp } from 'lyb-js/Math/LibJsLerp';
5
6
  /** @description 类似轮播图,但是不会自动轮播
6
7
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiSlider-横向滑动图
7
8
  */
@@ -150,20 +151,17 @@ export class LibPixiSlider extends LibPixiContainer {
150
151
  const prevIdx = idx - 1;
151
152
  const nextIdx = idx + 1;
152
153
  const curItem = this._slideList[idx];
153
- curItem.alpha = this.lerp(this._depthAlpha, 1, 1 - t);
154
- curItem.scale.set(this.lerp(this._depthScale, 1, 1 - t));
154
+ curItem.alpha = LibJsLerp(this._depthAlpha, 1, 1 - t);
155
+ curItem.scale.set(LibJsLerp(this._depthScale, 1, 1 - t));
155
156
  if (nextIdx < this._slideList.length) {
156
157
  const nextItem = this._slideList[nextIdx];
157
- nextItem.alpha = this.lerp(this._depthAlpha, 1, t);
158
- nextItem.scale.set(this.lerp(this._depthScale, 1, t));
158
+ nextItem.alpha = LibJsLerp(this._depthAlpha, 1, t);
159
+ nextItem.scale.set(LibJsLerp(this._depthScale, 1, t));
159
160
  }
160
161
  if (prevIdx >= 0) {
161
162
  const prevItem = this._slideList[prevIdx];
162
- prevItem.alpha = this.lerp(this._depthAlpha, 1, 1 - t);
163
- prevItem.scale.set(this.lerp(this._depthScale, 1, 1 - t));
163
+ prevItem.alpha = LibJsLerp(this._depthAlpha, 1, 1 - t);
164
+ prevItem.scale.set(LibJsLerp(this._depthScale, 1, 1 - t));
164
165
  }
165
166
  }
166
- lerp(a1, a2, t) {
167
- return a1 * (1 - t) + a2 * t;
168
- }
169
167
  }
package/README.md CHANGED
@@ -114,6 +114,8 @@ app.stage.addChild(box);
114
114
 
115
115
  \- [LibPixiTable-数字表格](#LibPixiTable-数字表格)
116
116
 
117
+ \- [LibPixiParticleMove-粒子移动特效](#LibPixiParticleMove-粒子移动特效)
118
+
117
119
  ### 方法
118
120
 
119
121
  \- [LibPixiAudio-音频播放器](#LibPixiAudio-音频播放器)
@@ -153,12 +155,39 @@ app.stage.addChild(box);
153
155
  > 自定义文本类
154
156
 
155
157
  ```ts
156
- const text = new LibPixiJs.Base.LibPixiText({
157
- text: "Hello World!",
158
- fontSize: 50,
159
- fontColor: "red",
160
- });
158
+ const text = new LibPixiJs.Base.LibPixiText(LibPixiTextParams);
161
159
  this.addChild(text);
160
+
161
+ interface LibPixiTextParams {
162
+ /** 文本内容 */
163
+ text: string | number;
164
+ /** 字体大小 */
165
+ fontSize?: number;
166
+ /** 字体颜色 */
167
+ fontColor?: any;
168
+ /** 是否描边 */
169
+ stroke?: boolean;
170
+ /** 描边颜色 */
171
+ strokeColor?: string | number;
172
+ /** 描边宽度 */
173
+ strokeThickness?: number;
174
+ /** 字体样式 */
175
+ fontFamily?: string;
176
+ /** 字体粗细 */
177
+ fontWeight?: TextStyleFontWeight;
178
+ /** 是否换行 */
179
+ wordWrap?: boolean;
180
+ /** 换行宽度 */
181
+ wordWrapWidth?: number;
182
+ /** 行高 */
183
+ lineHeight?: number;
184
+ /** 对齐方式 */
185
+ align?: TextStyleAlign;
186
+ /** 缩进,单位为字数 */
187
+ indent?: number;
188
+ /** 阴影-颜色 角度 模糊度 阴影距离 */
189
+ shadow?: [string, number, number, number];
190
+ }
162
191
  ```
163
192
 
164
193
  ### LibPixiBitText-位图
@@ -166,6 +195,11 @@ this.addChild(text);
166
195
  > 自定义位图文本
167
196
 
168
197
  ```ts
198
+ /**
199
+ * @param fontName 字体名称
200
+ * @param defaultFontSize 默认字体大小
201
+ */
202
+
169
203
  //所有文字使用同一个字体大小
170
204
  const font = new LibPixiBitText("FontName", 16);
171
205
  const fontText = font.createText("10");
@@ -184,6 +218,12 @@ this.addChild(fontText2);
184
218
  > 自定义容器大小及背景色
185
219
 
186
220
  ```ts
221
+ /**
222
+ * @param width 容器宽度
223
+ * @param height 容器高度
224
+ * @param bgColor 背景色
225
+ * @param overHidden 是否溢出裁剪
226
+ */
187
227
  const box = new LibPixiJs.Base.LibPixiContainer(100, 100, "#fff", true);
188
228
  this.addChild(box);
189
229
  ```
@@ -193,12 +233,27 @@ this.addChild(box);
193
233
  > 自定义矩形背景色
194
234
 
195
235
  ```ts
196
- const rect = new LibPixiRectBgColor({
197
- width: 100,
198
- height: 100,
199
- bgColor: "red",
200
- });
236
+ const rect = new LibPixiRectBgColor(LibPixiRectBgColorParams);
201
237
  this.addChild(rect);
238
+
239
+ interface LibPixiRectBgColorParams {
240
+ /** 宽度 */
241
+ width: number;
242
+ /** 高度 */
243
+ height: number;
244
+ /** 背景颜色 */
245
+ bgColor?: string | number;
246
+ /** 透明度 */
247
+ alpha?: number;
248
+ /** 圆角半径 */
249
+ radius?: number | number[];
250
+ /** 边框宽度 */
251
+ borderWidth?: number;
252
+ /** 边框颜色 */
253
+ borderColor?: string;
254
+ /** 是否启用变色功能 */
255
+ enableTint?: boolean;
256
+ }
202
257
  ```
203
258
 
204
259
  ### LibPixiSpine-动画
@@ -233,6 +288,31 @@ this.bgSpine = new LibPixiSpine("spine_buyfree", {
233
288
  },
234
289
  ],
235
290
  });
291
+
292
+ interface OnUpdateParams {
293
+ x: number;
294
+ y: number;
295
+ rotate: number;
296
+ scaleX: number;
297
+ scaleY: number;
298
+ }
299
+ interface LibPixiSpineParams {
300
+ /** 默认是否可见 */
301
+ visible?: boolean;
302
+ /** 挂点列表 */
303
+ followPointList?: {
304
+ /** 挂点名称 */
305
+ boneName: string;
306
+ /** 跟随的精灵或容器 */
307
+ follow: Container;
308
+ /** 是否启用角度 */
309
+ angleFollow?: boolean;
310
+ /** 是否启用缩放 */
311
+ scaleFollow?: boolean;
312
+ /** 更新回调,不传则接受内置挂点更新 */
313
+ onUpdate?: (config: OnUpdateParams) => void;
314
+ }[];
315
+ }
236
316
  ```
237
317
 
238
318
  ### LibPixiParticleMove-粒子容器
@@ -240,19 +320,139 @@ this.bgSpine = new LibPixiSpine("spine_buyfree", {
240
320
  > 利用贝塞尔曲线实现粒子移动
241
321
 
242
322
  ```ts
243
- const libPixiParticleMove = new LibPixiJs.Base.LibPixiParticleMove({
244
- start: { x: 300, y: 600 },
245
- control: [
246
- { x: 600, y: 500 },
247
- { x: 500, y: 100 },
248
- ],
249
- end: { x: 0, y: 0 },
250
- json: PIXI.Assets.get("fly.json"),
251
- duration: 1,
252
- showControl: true,
253
- ease: "power1.in",
254
- loop: true,
255
- });
323
+ const libParticleMove = new LibPixiJs.Components.Base.LibPixiParticleMove({
324
+ start: { x: 0, y: window.innerHeight },
325
+ control: [
326
+ { x: 1000, y: 750 },
327
+ { x: 500, y: 250 },
328
+ ],
329
+ end: { x: 0, y: 0 },
330
+ container: PIXI.Assets.get("fly.png"),
331
+ duration: 1,
332
+ showControl: true,
333
+ ease: "power1.in",
334
+ particleConfig: {
335
+ frequency: 0.001,
336
+ blendMode: "add",
337
+ lifetime: {
338
+ min: 0.01,
339
+ max: 1,
340
+ },
341
+ alpha: {
342
+ start: 1,
343
+ end: 0,
344
+ },
345
+ color: {
346
+ start: "#fff96c",
347
+ end: "#ff837f",
348
+ },
349
+ scale: {
350
+ start: 2,
351
+ end: 3,
352
+ },
353
+ rotation: {
354
+ min: 0,
355
+ max: 360,
356
+ },
357
+ rotate: {
358
+ min: 0,
359
+ max: 360,
360
+ },
361
+ speed: {
362
+ start: 0,
363
+ end: 0,
364
+ },
365
+ },
366
+
367
+ onDestroy: (destroy) => {
368
+ gsap.to(libParticleMove, {
369
+ alpha: 0,
370
+ onComplete: () => {
371
+ destroy()
372
+ }
373
+ })
374
+ }
375
+ });
376
+ app.stage.addChild(libParticleMove);
377
+
378
+ export interface LibPixiParticleMoveParams {
379
+ /** 粒子JSON资源 */
380
+ container: Container;
381
+ /** 运动时长 */
382
+ duration: number;
383
+ /** 粒子开始位置 */
384
+ start: { x: number; y: number };
385
+ /** 粒子控制点 */
386
+ control: { x: number; y: number }[];
387
+ /** 粒子结束点 */
388
+ end: { x: number; y: number };
389
+ /** 运动曲线 */
390
+ ease?: gsap.EaseString;
391
+ /** 是否显示控制点,调试使用 */
392
+ showControl?: boolean;
393
+ /** 是否循环,调试使用 */
394
+ loop?: boolean;
395
+ /** 是否启用粒子容器 */
396
+ enableParticleContainer?: boolean;
397
+ /** 粒子配置 */
398
+ particleConfig: {
399
+ /** 随机时长 */
400
+ lifetime: {
401
+ /** 最小时长 */
402
+ min: number;
403
+ /** 最大时长 */
404
+ max: number;
405
+ };
406
+ /** 混合模式 */
407
+ blendMode?: string;
408
+ /** 频率,秒/个 */
409
+ frequency?: number;
410
+ /** 透明度变化 */
411
+ alpha?: {
412
+ /** 开始透明度 */
413
+ start: number;
414
+ /** 结束透明度 */
415
+ end: number;
416
+ };
417
+ /** 颜色变化 */
418
+ color?: {
419
+ /** 开始颜色 */
420
+ start: string;
421
+ /** 结束颜色 */
422
+ end: string;
423
+ };
424
+ /** 随机缩放变化 */
425
+ scale?: {
426
+ /** 最小 */
427
+ start: number;
428
+ /** 最大 */
429
+ end: number;
430
+ };
431
+ /** 随机偏移角度变化 */
432
+ rotation?: {
433
+ /** 最小角度 */
434
+ min: number;
435
+ /** 最大角度 */
436
+ max: number;
437
+ };
438
+ /** 随机自身旋转角度变化 */
439
+ rotate?: {
440
+ /** 最小角度 */
441
+ min: number;
442
+ /** 最大角度 */
443
+ max: number;
444
+ };
445
+ /** 移动速度,像素 */
446
+ speed?: {
447
+ /** 开始速度,不能为0,可无限接近0 */
448
+ start: number;
449
+ /** 结束速度,开始速度会衰减到结束速度 */
450
+ end: number;
451
+ };
452
+ };
453
+ /** 头部粒子到达终点后触发,可在此设置隐藏动画,隐藏动画结束后调用 destroy 参数进行销毁 */
454
+ onDestroy?: (destroy: () => void) => void;
455
+ }
256
456
  ```
257
457
 
258
458
  ## Custom-定制
@@ -12,5 +12,6 @@ export interface LibPixiEventParams {
12
12
  * @param eventName 事件名称
13
13
  * @param callback 回调函数
14
14
  * @returns 停止监听
15
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiEvent-事件注册
15
16
  */
16
17
  export declare const libPixiEvent: (v: Container, eventName: keyof DisplayObjectEvents, callback: (event: FederatedPointerEvent) => void, params?: LibPixiEventParams) => () => void;
@@ -18,6 +18,7 @@ const debounceImmediate = (func, wait) => {
18
18
  * @param eventName 事件名称
19
19
  * @param callback 回调函数
20
20
  * @returns 停止监听
21
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiEvent-事件注册
21
22
  */
22
23
  export const libPixiEvent = (v, eventName, callback, params = {}) => {
23
24
  const { once = false, debounce = false, debounceTime = 1000 } = params;