lyb-pixi-js 1.12.38 → 1.12.40

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.
Files changed (129) hide show
  1. package/package.json +1 -1
  2. package/Components/Base/LibPixiArc.d.ts +0 -16
  3. package/Components/Base/LibPixiArc.js +0 -14
  4. package/Components/Base/LibPixiBitText.d.ts +0 -20
  5. package/Components/Base/LibPixiBitText.js +0 -26
  6. package/Components/Base/LibPixiCircular.d.ts +0 -7
  7. package/Components/Base/LibPixiCircular.js +0 -12
  8. package/Components/Base/LibPixiContainer.d.ts +0 -22
  9. package/Components/Base/LibPixiContainer.js +0 -51
  10. package/Components/Base/LibPixiHtmlText.d.ts +0 -31
  11. package/Components/Base/LibPixiHtmlText.js +0 -30
  12. package/Components/Base/LibPixiOval.d.ts +0 -5
  13. package/Components/Base/LibPixiOval.js +0 -10
  14. package/Components/Base/LibPixiParticleMove.d.ts +0 -101
  15. package/Components/Base/LibPixiParticleMove.js +0 -136
  16. package/Components/Base/LibPixiPolygon.d.ts +0 -7
  17. package/Components/Base/LibPixiPolygon.js +0 -15
  18. package/Components/Base/LibPixiRectBgColor.d.ts +0 -41
  19. package/Components/Base/LibPixiRectBgColor.js +0 -95
  20. package/Components/Base/LibPixiRectangle.d.ts +0 -7
  21. package/Components/Base/LibPixiRectangle.js +0 -15
  22. package/Components/Base/LibPixiRound.d.ts +0 -5
  23. package/Components/Base/LibPixiRound.js +0 -9
  24. package/Components/Base/LibPixiRoundedRect.d.ts +0 -5
  25. package/Components/Base/LibPixiRoundedRect.js +0 -10
  26. package/Components/Base/LibPixiSpine.d.ts +0 -58
  27. package/Components/Base/LibPixiSpine.js +0 -128
  28. package/Components/Base/LibPixiText.d.ts +0 -37
  29. package/Components/Base/LibPixiText.js +0 -35
  30. package/Components/Custom/LibPixiAreaClick.d.ts +0 -6
  31. package/Components/Custom/LibPixiAreaClick.js +0 -16
  32. package/Components/Custom/LibPixiArrangeLinearV2.d.ts +0 -25
  33. package/Components/Custom/LibPixiArrangeLinearV2.js +0 -80
  34. package/Components/Custom/LibPixiButtonHover.d.ts +0 -40
  35. package/Components/Custom/LibPixiButtonHover.js +0 -53
  36. package/Components/Custom/LibPixiCapsule.d.ts +0 -5
  37. package/Components/Custom/LibPixiCapsule.js +0 -10
  38. package/Components/Custom/LibPixiCloseBtn.d.ts +0 -14
  39. package/Components/Custom/LibPixiCloseBtn.js +0 -36
  40. package/Components/Custom/LibPixiDragLocate.d.ts +0 -36
  41. package/Components/Custom/LibPixiDragLocate.js +0 -230
  42. package/Components/Custom/LibPixiDrawer.d.ts +0 -16
  43. package/Components/Custom/LibPixiDrawer.js +0 -59
  44. package/Components/Custom/LibPixiGridLayoutV2.d.ts +0 -27
  45. package/Components/Custom/LibPixiGridLayoutV2.js +0 -37
  46. package/Components/Custom/LibPixiHeadingParagraphLayout.d.ts +0 -18
  47. package/Components/Custom/LibPixiHeadingParagraphLayout.js +0 -27
  48. package/Components/Custom/LibPixiInput.d.ts +0 -77
  49. package/Components/Custom/LibPixiInput.js +0 -198
  50. package/Components/Custom/LibPixiLabelValue.d.ts +0 -30
  51. package/Components/Custom/LibPixiLabelValue.js +0 -26
  52. package/Components/Custom/LibPixiPerforMon.d.ts +0 -47
  53. package/Components/Custom/LibPixiPerforMon.js +0 -166
  54. package/Components/Custom/LibPixiProgress.d.ts +0 -33
  55. package/Components/Custom/LibPixiProgress.js +0 -47
  56. package/Components/Custom/LibPixiPuzzleBg.d.ts +0 -7
  57. package/Components/Custom/LibPixiPuzzleBg.js +0 -46
  58. package/Components/Custom/LibPixiScrollContainerX.d.ts +0 -71
  59. package/Components/Custom/LibPixiScrollContainerX.js +0 -198
  60. package/Components/Custom/LibPixiScrollContainerY.d.ts +0 -109
  61. package/Components/Custom/LibPixiScrollContainerY.js +0 -340
  62. package/Components/Custom/LibPixiScrollNum.d.ts +0 -67
  63. package/Components/Custom/LibPixiScrollNum.js +0 -184
  64. package/Components/Custom/LibPixiSlide.d.ts +0 -94
  65. package/Components/Custom/LibPixiSlide.js +0 -285
  66. package/Components/Custom/LibPixiSlider.d.ts +0 -82
  67. package/Components/Custom/LibPixiSlider.js +0 -165
  68. package/Components/Custom/LibPixiTable.d.ts +0 -64
  69. package/Components/Custom/LibPixiTable.js +0 -76
  70. package/Components/Custom/LibPixiTextGroupWrap.d.ts +0 -20
  71. package/Components/Custom/LibPixiTextGroupWrap.js +0 -50
  72. package/Components/Custom/LibPixiTriangle.d.ts +0 -5
  73. package/Components/Custom/LibPixiTriangle.js +0 -12
  74. package/Components/Custom/LibPixiTurntable.d.ts +0 -6
  75. package/Components/Custom/LibPixiTurntable.js +0 -14
  76. package/Utils/LibContainerCenter.d.ts +0 -3
  77. package/Utils/LibContainerCenter.js +0 -10
  78. package/Utils/LibControlledDelayedCall.d.ts +0 -5
  79. package/Utils/LibControlledDelayedCall.js +0 -20
  80. package/Utils/LibPixiArrangeLinear.d.ts +0 -16
  81. package/Utils/LibPixiArrangeLinear.js +0 -62
  82. package/Utils/LibPixiAudio.d.ts +0 -53
  83. package/Utils/LibPixiAudio.js +0 -168
  84. package/Utils/LibPixiCreateNineGrid.d.ts +0 -15
  85. package/Utils/LibPixiCreateNineGrid.js +0 -19
  86. package/Utils/LibPixiDialogManager/index.d.ts +0 -25
  87. package/Utils/LibPixiDialogManager/index.js +0 -43
  88. package/Utils/LibPixiDialogManager/ui/LibPixiBaseContainer.d.ts +0 -11
  89. package/Utils/LibPixiDialogManager/ui/LibPixiBaseContainer.js +0 -31
  90. package/Utils/LibPixiDialogManager/ui/LibPixiDialog.d.ts +0 -40
  91. package/Utils/LibPixiDialogManager/ui/LibPixiDialog.js +0 -138
  92. package/Utils/LibPixiDigitalIncreasingAnimation.d.ts +0 -18
  93. package/Utils/LibPixiDigitalIncreasingAnimation.js +0 -26
  94. package/Utils/LibPixiDownScaleAnimation.d.ts +0 -7
  95. package/Utils/LibPixiDownScaleAnimation.js +0 -33
  96. package/Utils/LibPixiEmitContainerEvent.d.ts +0 -7
  97. package/Utils/LibPixiEmitContainerEvent.js +0 -13
  98. package/Utils/LibPixiEvent.d.ts +0 -19
  99. package/Utils/LibPixiEvent.js +0 -68
  100. package/Utils/LibPixiFilter.d.ts +0 -9
  101. package/Utils/LibPixiFilter.js +0 -34
  102. package/Utils/LibPixiGlobalUpdater.d.ts +0 -15
  103. package/Utils/LibPixiGlobalUpdater.js +0 -21
  104. package/Utils/LibPixiGridLayout.d.ts +0 -10
  105. package/Utils/LibPixiGridLayout.js +0 -27
  106. package/Utils/LibPixiHVCenter.d.ts +0 -7
  107. package/Utils/LibPixiHVCenter.js +0 -14
  108. package/Utils/LibPixiHVGap.d.ts +0 -8
  109. package/Utils/LibPixiHVGap.js +0 -26
  110. package/Utils/LibPixiIntervalTrigger.d.ts +0 -7
  111. package/Utils/LibPixiIntervalTrigger.js +0 -35
  112. package/Utils/LibPixiOutsideClick.d.ts +0 -8
  113. package/Utils/LibPixiOutsideClick.js +0 -22
  114. package/Utils/LibPixiOverflowHidden.d.ts +0 -6
  115. package/Utils/LibPixiOverflowHidden.js +0 -14
  116. package/Utils/LibPixiPolygonDrawTool.d.ts +0 -44
  117. package/Utils/LibPixiPolygonDrawTool.js +0 -114
  118. package/Utils/LibPixiPromiseTickerTimeout.d.ts +0 -6
  119. package/Utils/LibPixiPromiseTickerTimeout.js +0 -22
  120. package/Utils/LibPixiScaleContainer.d.ts +0 -8
  121. package/Utils/LibPixiScaleContainer.js +0 -14
  122. package/Utils/LibPixiShadow.d.ts +0 -17
  123. package/Utils/LibPixiShadow.js +0 -18
  124. package/Utils/LibPixiSlideInput.d.ts +0 -55
  125. package/Utils/LibPixiSlideInput.js +0 -61
  126. package/Utils/LibPixiTicker.d.ts +0 -14
  127. package/Utils/LibPixiTicker.js +0 -49
  128. package/Utils/LibPixiTickerTimeout.d.ts +0 -6
  129. package/Utils/LibPixiTickerTimeout.js +0 -22
@@ -1,53 +0,0 @@
1
- import "@pixi/sound";
2
- export declare class LibPixiAudio {
3
- /** 是否启用音效 */
4
- effectEnabled: boolean;
5
- /** 是否启用音乐 */
6
- musicEnabled: boolean;
7
- /** 音乐是否处于暂停状态 */
8
- private _isMusicPaused;
9
- /** 是否已切换后台 */
10
- private _isBackground;
11
- /** 当前音乐播放器 */
12
- private _musicPlayer?;
13
- /** 当前正在播放的音效列表 */
14
- private _playingList;
15
- constructor();
16
- /** @description 播放音效
17
- * @param key 音效资源Key,内部会使用Assets.get(key)获取音频资源
18
- * @param end 倒数几秒位置播放,单位秒
19
- */
20
- playEffect(key: string, end?: number): Promise<void>;
21
- /** @description 播放音乐
22
- * @param key 音效资源Key,内部会使用Assets.get(key)获取音频资源
23
- */
24
- playMusic(key: string): Promise<void>;
25
- /** @description 暂停音乐 */
26
- pauseMusic(): void;
27
- /** @description 继续播放音乐 */
28
- resumeMusic(): void;
29
- /** @description 停止播放指定音效
30
- * @param key 音效资源Key,内部会使用Assets.get(key)获取音频资源进行停止
31
- */
32
- stopEffect(key: string): void;
33
- /** @description 设置启用音效
34
- * @param enabled 启用状态,false为禁用
35
- */
36
- setEffectEnabled(enabled: boolean): void;
37
- /** @description 设置启用音乐
38
- * @param enabled 启用状态,false为禁用
39
- */
40
- setMusicEnabled(enabled: boolean): void;
41
- /** @description 设置音效和音乐播放状态
42
- * @param status 播放状态,false为暂停
43
- */
44
- private _setPlayStatus;
45
- /** @description 设置静音音乐
46
- * @param disabled 静音状态,true为静音
47
- */
48
- private _setMusicMute;
49
- /** @description 设置静音音效
50
- * @param disabled 静音状态,true为静音
51
- */
52
- private _setEffectMute;
53
- }
@@ -1,168 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { Assets } from "pixi.js";
11
- import { Howl } from "howler";
12
- import "@pixi/sound";
13
- import gsap from "gsap";
14
- export class LibPixiAudio {
15
- constructor() {
16
- /** 是否启用音效 */
17
- this.effectEnabled = true;
18
- /** 是否启用音乐 */
19
- this.musicEnabled = true;
20
- /** 音乐是否处于暂停状态 */
21
- this._isMusicPaused = false;
22
- /** 是否已切换后台 */
23
- this._isBackground = false;
24
- /** 当前正在播放的音效列表 */
25
- this._playingList = [];
26
- /** @description 设置音效和音乐播放状态
27
- * @param status 播放状态,false为暂停
28
- */
29
- this._setPlayStatus = (status) => {
30
- var _a, _b;
31
- if (status) {
32
- !this._isMusicPaused && ((_a = this._musicPlayer) === null || _a === void 0 ? void 0 : _a.play());
33
- }
34
- else {
35
- (_b = this._musicPlayer) === null || _b === void 0 ? void 0 : _b.pause();
36
- }
37
- this._playingList.forEach((item) => {
38
- if (status) {
39
- item.audio.play();
40
- }
41
- else {
42
- item.audio.pause();
43
- }
44
- });
45
- };
46
- document.addEventListener("visibilitychange", () => {
47
- this._isBackground = document.hidden;
48
- this._setPlayStatus(!document.hidden);
49
- });
50
- }
51
- /** @description 播放音效
52
- * @param key 音效资源Key,内部会使用Assets.get(key)获取音频资源
53
- * @param end 倒数几秒位置播放,单位秒
54
- */
55
- playEffect(key, end) {
56
- return new Promise((resolve) => {
57
- const id = Math.random();
58
- const url = Assets.get(key).url;
59
- const sound = new Howl({
60
- src: url,
61
- mute: this._isBackground || !this.effectEnabled,
62
- });
63
- sound.play();
64
- sound.on("end", () => {
65
- this._playingList = this._playingList.filter((item) => item.id !== id);
66
- resolve();
67
- });
68
- //倒数几秒位置播放
69
- if (end) {
70
- const duration = sound.duration();
71
- const start = duration - end;
72
- sound.seek(start);
73
- }
74
- this._playingList.push({
75
- id,
76
- audio: sound,
77
- url,
78
- });
79
- });
80
- }
81
- /** @description 播放音乐
82
- * @param key 音效资源Key,内部会使用Assets.get(key)获取音频资源
83
- */
84
- playMusic(key) {
85
- return __awaiter(this, void 0, void 0, function* () {
86
- const url = Assets.get(key).url;
87
- //如果有音乐正在播放,则停止
88
- if (this._musicPlayer) {
89
- gsap.killTweensOf(this._musicPlayer);
90
- yield gsap.to(this._musicPlayer, {
91
- volume: 0,
92
- duration: 1,
93
- ease: "linear",
94
- });
95
- this._musicPlayer.stop();
96
- }
97
- this._musicPlayer = new Howl({
98
- src: url,
99
- loop: true,
100
- volume: 0,
101
- mute: this._isBackground || !this.musicEnabled,
102
- });
103
- this._musicPlayer.play();
104
- this._isMusicPaused = false;
105
- gsap.killTweensOf(this._musicPlayer);
106
- gsap.to(this._musicPlayer, {
107
- volume: 1,
108
- duration: 1,
109
- ease: "linear",
110
- });
111
- });
112
- }
113
- /** @description 暂停音乐 */
114
- pauseMusic() {
115
- var _a;
116
- this._isMusicPaused = true;
117
- (_a = this._musicPlayer) === null || _a === void 0 ? void 0 : _a.pause();
118
- }
119
- /** @description 继续播放音乐 */
120
- resumeMusic() {
121
- var _a, _b;
122
- this._isMusicPaused = false;
123
- if ((_a = this._musicPlayer) === null || _a === void 0 ? void 0 : _a.playing())
124
- return;
125
- (_b = this._musicPlayer) === null || _b === void 0 ? void 0 : _b.play();
126
- }
127
- /** @description 停止播放指定音效
128
- * @param key 音效资源Key,内部会使用Assets.get(key)获取音频资源进行停止
129
- */
130
- stopEffect(key) {
131
- const url = Assets.get(key).url;
132
- this._playingList.forEach((item) => {
133
- if (item.url === url) {
134
- item.audio.stop();
135
- }
136
- });
137
- this._playingList = this._playingList.filter((item) => item.url !== url);
138
- }
139
- /** @description 设置启用音效
140
- * @param enabled 启用状态,false为禁用
141
- */
142
- setEffectEnabled(enabled) {
143
- this.effectEnabled = enabled;
144
- this._setEffectMute(!enabled);
145
- }
146
- /** @description 设置启用音乐
147
- * @param enabled 启用状态,false为禁用
148
- */
149
- setMusicEnabled(enabled) {
150
- this.musicEnabled = enabled;
151
- this._setMusicMute(!enabled);
152
- }
153
- /** @description 设置静音音乐
154
- * @param disabled 静音状态,true为静音
155
- */
156
- _setMusicMute(disabled) {
157
- var _a;
158
- (_a = this._musicPlayer) === null || _a === void 0 ? void 0 : _a.mute(disabled || !this.musicEnabled);
159
- }
160
- /** @description 设置静音音效
161
- * @param disabled 静音状态,true为静音
162
- */
163
- _setEffectMute(disabled) {
164
- this._playingList.forEach((item) => {
165
- item.audio.mute(disabled || !this.effectEnabled);
166
- });
167
- }
168
- }
@@ -1,15 +0,0 @@
1
- import { NineSlicePlane, type Texture } from "pixi.js";
2
- export interface LibPixiCreateNineGridParams {
3
- /** 九宫格图片 */
4
- texture: Texture;
5
- /** 四个角的宽度 */
6
- dotWidth: number | [number, number, number, number];
7
- /** 宽度 */
8
- width: number;
9
- /** 高度 */
10
- height: number;
11
- }
12
- /** @description 九宫格图
13
- * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiCreateNineGrid-九宫格图
14
- */
15
- export declare const libPixiCreateNineGrid: (params: LibPixiCreateNineGridParams) => NineSlicePlane;
@@ -1,19 +0,0 @@
1
- import { NineSlicePlane } from "pixi.js";
2
- /** @description 九宫格图
3
- * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiCreateNineGrid-九宫格图
4
- */
5
- export const libPixiCreateNineGrid = (params) => {
6
- const { texture, dotWidth, width, height } = params;
7
- let slice_width = [];
8
- // 四个角的宽度
9
- if (Array.isArray(dotWidth)) {
10
- slice_width = dotWidth;
11
- }
12
- else {
13
- slice_width = [dotWidth, dotWidth, dotWidth, dotWidth];
14
- }
15
- const nineSlicePlane = new NineSlicePlane(texture, slice_width[0], slice_width[1], slice_width[2], slice_width[3]);
16
- nineSlicePlane.width = width;
17
- nineSlicePlane.height = height;
18
- return nineSlicePlane;
19
- };
@@ -1,25 +0,0 @@
1
- import type { Container } from "pixi.js";
2
- import type { LibPixiBaseContainer } from "./ui/LibPixiBaseContainer";
3
- export { LibPixiBaseContainer } from "./ui/LibPixiBaseContainer";
4
- export { LibPixiDialog } from "./ui/LibPixiDialog";
5
- interface IViewCtor {
6
- new (...args: any[]): LibPixiBaseContainer;
7
- }
8
- /** @description 弹窗管理器 */
9
- export declare class LibPixiDialogManager {
10
- /** 视图表 */
11
- private views;
12
- /** open时显示的元素的父容器 */
13
- private _openContainer;
14
- constructor(parent: Container);
15
- /**
16
- * 打开界面
17
- * @param View 实例类型或构造方法
18
- * @param args 实例参数
19
- */
20
- open<T extends IViewCtor>(View: T, id: string, ...args: ConstructorParameters<T>): InstanceType<T>;
21
- /** @description 关闭页面,会调用页面的 onBeforeUnmount 事件,里面会做关闭动画,动画结束后会自动销毁
22
- * @param id 页面名称
23
- */
24
- close(id: string): Promise<void>;
25
- }
@@ -1,43 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- export { LibPixiBaseContainer } from "./ui/LibPixiBaseContainer";
11
- export { LibPixiDialog } from "./ui/LibPixiDialog";
12
- /** @description 弹窗管理器 */
13
- export class LibPixiDialogManager {
14
- constructor(parent) {
15
- /** 视图表 */
16
- this.views = {};
17
- this._openContainer = parent;
18
- }
19
- /**
20
- * 打开界面
21
- * @param View 实例类型或构造方法
22
- * @param args 实例参数
23
- */
24
- open(View, id, ...args) {
25
- const view = new View(...args);
26
- this._openContainer.addChild(view);
27
- this.views[id] = view;
28
- return view;
29
- }
30
- /** @description 关闭页面,会调用页面的 onBeforeUnmount 事件,里面会做关闭动画,动画结束后会自动销毁
31
- * @param id 页面名称
32
- */
33
- close(id) {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- var _a;
36
- const view = this.views[id];
37
- if (view) {
38
- yield ((_a = view.destroy) === null || _a === void 0 ? void 0 : _a.call(view));
39
- delete this.views[id];
40
- }
41
- });
42
- }
43
- }
@@ -1,11 +0,0 @@
1
- import { Container } from "pixi.js";
2
- /** @description */
3
- export declare class LibPixiBaseContainer extends Container {
4
- /** 销毁之前 */
5
- protected _onBeforeDestroy?: () => void | Promise<void>;
6
- /** 已销毁 */
7
- protected _onDestroyed?: () => void;
8
- constructor();
9
- /** @description 销毁 */
10
- destroy(): Promise<void>;
11
- }
@@ -1,31 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { Container } from "pixi.js";
11
- /** @description */
12
- export class LibPixiBaseContainer extends Container {
13
- constructor() {
14
- super();
15
- }
16
- /** @description 销毁 */
17
- destroy() {
18
- const _super = Object.create(null, {
19
- destroy: { get: () => super.destroy }
20
- });
21
- return __awaiter(this, void 0, void 0, function* () {
22
- var _a;
23
- yield ((_a = this._onBeforeDestroy) === null || _a === void 0 ? void 0 : _a.call(this));
24
- requestAnimationFrame(() => {
25
- var _a;
26
- _super.destroy.call(this, { children: true });
27
- (_a = this._onDestroyed) === null || _a === void 0 ? void 0 : _a.call(this);
28
- });
29
- });
30
- }
31
- }
@@ -1,40 +0,0 @@
1
- import { Container } from "pixi.js";
2
- import { LibPixiBaseContainer } from "./LibPixiBaseContainer";
3
- interface Params {
4
- /** 是否需要显示黑色背景 */
5
- needBg?: boolean;
6
- /** 点击蒙版回调 */
7
- onClickMask?: () => void;
8
- /** 竖版缩放大小 */
9
- vScale?: number;
10
- }
11
- /** @description 弹窗组件 */
12
- export declare class LibPixiDialog extends LibPixiBaseContainer {
13
- /** 黑色背景透明度 */
14
- static bgAlpha: number;
15
- /** 动画时长 */
16
- static durationIn: number;
17
- static durationOut: number;
18
- /** 是否支持横竖版 */
19
- static adaptation: "hv" | "h" | "v";
20
- /** 蒙版UI */
21
- private _maskUI;
22
- /** 内容容器 */
23
- private _dialogContainer;
24
- /** 竖版缩放大小 */
25
- private _vScale;
26
- /** 上一次是否为横版 */
27
- private _lastIsH?;
28
- /** 停止监听窗口 */
29
- private _offResize?;
30
- constructor(params?: Params);
31
- /** @description 设置弹窗内容 */
32
- setDialogContent(content: Container): void;
33
- /** @description 设置弹窗容器锚点 */
34
- updatePivot(): void;
35
- /** @description 关闭 */
36
- close(): Promise<void>;
37
- /** @description 重绘弹窗 */
38
- private _redraw;
39
- }
40
- export {};
@@ -1,138 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { Container } from "pixi.js";
11
- import gsap from "gsap";
12
- import { LibJsResizeWatcher } from "lyb-js/Base/LibJsResizeWatcher.js";
13
- import { LibPixiRectangle } from "../../../Components/Base/LibPixiRectangle";
14
- import { libPixiEvent } from "../../LibPixiEvent";
15
- import { LibPixiBaseContainer } from "./LibPixiBaseContainer";
16
- /** @description 弹窗组件 */
17
- export class LibPixiDialog extends LibPixiBaseContainer {
18
- constructor(params) {
19
- super();
20
- /** 竖版缩放大小 */
21
- this._vScale = 1;
22
- const { onClickMask, vScale = 1, needBg = true } = params || {};
23
- this._vScale = vScale;
24
- //蒙版
25
- this._maskUI = new LibPixiRectangle(2700, 1080, "#000");
26
- this.addChild(this._maskUI);
27
- this._maskUI.alpha = 0;
28
- this._maskUI.eventMode = "static";
29
- this._maskUI.visible = needBg;
30
- if (onClickMask) {
31
- libPixiEvent(this._maskUI, "pointertap", () => {
32
- var _a;
33
- onClickMask === null || onClickMask === void 0 ? void 0 : onClickMask();
34
- (_a = this._offResize) === null || _a === void 0 ? void 0 : _a.call(this);
35
- }, {
36
- once: true,
37
- });
38
- }
39
- //弹窗内容容器
40
- this._dialogContainer = new Container();
41
- this.addChild(this._dialogContainer);
42
- this._dialogContainer.eventMode = "static";
43
- const resize = new LibJsResizeWatcher(LibPixiDialog.adaptation);
44
- this._offResize = resize.on(this._redraw.bind(this), false);
45
- }
46
- /** @description 设置弹窗内容 */
47
- setDialogContent(content) {
48
- this._dialogContainer.addChild(content);
49
- this._dialogContainer.alpha = 0;
50
- requestAnimationFrame(() => {
51
- this.updatePivot();
52
- if (LibPixiDialog.adaptation === "h") {
53
- this._redraw(1920, 1080);
54
- }
55
- else if (LibPixiDialog.adaptation === "v") {
56
- this._redraw(1080, 1920);
57
- }
58
- else {
59
- this._redraw(window.innerWidth, window.innerHeight);
60
- }
61
- gsap.to(this._maskUI, {
62
- duration: LibPixiDialog.durationIn,
63
- alpha: LibPixiDialog.bgAlpha,
64
- });
65
- gsap.to(this._dialogContainer, {
66
- duration: LibPixiDialog.durationIn,
67
- alpha: 1,
68
- });
69
- });
70
- }
71
- /** @description 设置弹窗容器锚点 */
72
- updatePivot() {
73
- const dialogW = this._dialogContainer.width / 2;
74
- const dialogH = this._dialogContainer.height / 2;
75
- this._dialogContainer.pivot.set(dialogW, dialogH);
76
- }
77
- /** @description 关闭 */
78
- close() {
79
- return __awaiter(this, void 0, void 0, function* () {
80
- var _a;
81
- this._maskUI.eventMode = "none";
82
- (_a = this._offResize) === null || _a === void 0 ? void 0 : _a.call(this);
83
- gsap.to(this._dialogContainer.scale, {
84
- duration: LibPixiDialog.durationOut,
85
- ease: "back.in",
86
- x: 0,
87
- y: 0,
88
- });
89
- gsap.to(this._dialogContainer, {
90
- duration: LibPixiDialog.durationOut,
91
- delay: LibPixiDialog.durationOut / 2,
92
- alpha: 0,
93
- });
94
- yield gsap.to(this._maskUI, {
95
- duration: LibPixiDialog.durationOut,
96
- delay: LibPixiDialog.durationOut / 2,
97
- alpha: 0,
98
- });
99
- });
100
- }
101
- /** @description 重绘弹窗 */
102
- _redraw(w, h) {
103
- if (this._lastIsH === w > h)
104
- return;
105
- this._lastIsH = w > h;
106
- let scale = 0;
107
- const halfW = 1920 / 2;
108
- const halfH = 1080 / 2;
109
- if (w > h) {
110
- this._maskUI.width = 2700;
111
- this._maskUI.height = 1080;
112
- this._maskUI.x = -(2700 - 1920) / 2;
113
- this._dialogContainer.position.set(halfW, halfH);
114
- scale = 1;
115
- }
116
- else {
117
- this._maskUI.width = 1080;
118
- this._maskUI.height = 2700;
119
- this._maskUI.x = 0;
120
- this._dialogContainer.position.set(halfH, halfW);
121
- scale = this._vScale;
122
- }
123
- this._dialogContainer.scale.set(0);
124
- gsap.to(this._dialogContainer.scale, {
125
- duration: LibPixiDialog.durationIn,
126
- ease: "back.out",
127
- x: scale,
128
- y: scale,
129
- });
130
- }
131
- }
132
- /** 黑色背景透明度 */
133
- LibPixiDialog.bgAlpha = 0.5;
134
- /** 动画时长 */
135
- LibPixiDialog.durationIn = 0.5;
136
- LibPixiDialog.durationOut = 0.5;
137
- /** 是否支持横竖版 */
138
- LibPixiDialog.adaptation = "hv";
@@ -1,18 +0,0 @@
1
- export interface LibPixiDigitalIncreasingAnimationParams {
2
- /** 目标值 */
3
- value: number;
4
- /** 开始值 */
5
- startValue?: number;
6
- /** 动画时长 */
7
- duration?: number;
8
- /** 值改变时触发 */
9
- onChange: (value: string) => void;
10
- /** 动画完成后触发 */
11
- onComplete?: () => void;
12
- }
13
- /** @description 数值递增动画
14
- * @param params 动画参数
15
- * @returns 设置为目标值并停止动画
16
- * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDigitalIncreasingAnimation-递增动画
17
- */
18
- export declare const LibPixiDigitalIncreasingAnimation: (params: LibPixiDigitalIncreasingAnimationParams) => () => void;
@@ -1,26 +0,0 @@
1
- import { libJsNumComma } from "lyb-js/Formatter/LibJsNumComma.js";
2
- import gsap from "gsap";
3
- /** @description 数值递增动画
4
- * @param params 动画参数
5
- * @returns 设置为目标值并停止动画
6
- * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDigitalIncreasingAnimation-递增动画
7
- */
8
- export const LibPixiDigitalIncreasingAnimation = (params) => {
9
- const { value, onChange, onComplete, startValue = 0, duration = 4 } = params;
10
- // 动画递增的目标值
11
- const animatedValue = { value: startValue };
12
- // 使用 GSAP 创建递增动画
13
- gsap.killTweensOf(animatedValue);
14
- const amountAnimation = gsap.to(animatedValue, {
15
- value,
16
- duration,
17
- ease: "linear",
18
- onUpdate: () => {
19
- onChange(libJsNumComma(animatedValue.value, 2));
20
- },
21
- onComplete: onComplete,
22
- });
23
- return () => {
24
- amountAnimation.progress(1);
25
- };
26
- };
@@ -1,7 +0,0 @@
1
- import { Container } from "pixi.js";
2
- /** @description 按下放大
3
- * @param container 要放大的容器
4
- * @param type 缩放类型
5
- * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDownScaleAnimation-按下放大
6
- */
7
- export declare const LibPixiDownScaleAnimation: (container: Container, type?: "small" | "big") => void;
@@ -1,33 +0,0 @@
1
- import { libPixiEvent } from "./LibPixiEvent";
2
- import gsap from "gsap";
3
- /** @description 按下放大
4
- * @param container 要放大的容器
5
- * @param type 缩放类型
6
- * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDownScaleAnimation-按下放大
7
- */
8
- export const LibPixiDownScaleAnimation = (container, type = "big") => {
9
- libPixiEvent(container, "pointerdown", () => {
10
- gsap.to(container, {
11
- duration: 0.1,
12
- pixi: {
13
- scale: type === "big" ? 1.1 : 0.9,
14
- },
15
- });
16
- });
17
- libPixiEvent(container, "pointerup", () => {
18
- gsap.to(container, {
19
- duration: 0.1,
20
- pixi: {
21
- scale: 1,
22
- },
23
- });
24
- });
25
- libPixiEvent(container, "pointerleave", () => {
26
- gsap.to(container, {
27
- duration: 0.1,
28
- pixi: {
29
- scale: 1,
30
- },
31
- });
32
- });
33
- };
@@ -1,7 +0,0 @@
1
- import { Container } from "pixi.js";
2
- /** @description 触发后代监听
3
- * @param container 容器
4
- * @param event 事件名称
5
- * @param payload 事件携带数据
6
- */
7
- export declare const LibPixiEmitContainerEvent: (container: Container, event: string, payload?: any) => void;
@@ -1,13 +0,0 @@
1
- /** @description 触发后代监听
2
- * @param container 容器
3
- * @param event 事件名称
4
- * @param payload 事件携带数据
5
- */
6
- export const LibPixiEmitContainerEvent = (container, event, payload) => {
7
- container.children.forEach((child) => {
8
- child.emit(event, payload);
9
- if ("children" in child) {
10
- LibPixiEmitContainerEvent(child, event, payload);
11
- }
12
- });
13
- };