lyb-pixi-js 1.9.4 → 1.9.6
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/Components/Base/LibPixiSpine.js +2 -2
- package/Components/Custom/LibPixiSlide.d.ts +92 -0
- package/Components/Custom/LibPixiSlide.js +281 -0
- package/libPixiJs.d.ts +41 -114
- package/libPixiJs.js +41 -114
- package/lyb-pixi.js +360 -225
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ export class LibPixiSpine extends Spine {
|
|
|
20
20
|
this._followDots = [];
|
|
21
21
|
/** 是否已开始 */
|
|
22
22
|
this._isStart = false;
|
|
23
|
-
this.
|
|
23
|
+
this.alpha = visible ? 1 : 0;
|
|
24
24
|
this.autoUpdate = false;
|
|
25
25
|
//如果存在挂点
|
|
26
26
|
if (followPointList === null || followPointList === void 0 ? void 0 : followPointList.length) {
|
|
@@ -50,7 +50,7 @@ export class LibPixiSpine extends Spine {
|
|
|
50
50
|
},
|
|
51
51
|
};
|
|
52
52
|
setTimeout(() => {
|
|
53
|
-
this.
|
|
53
|
+
this.alpha = 1;
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
56
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Container } from "pixi.js";
|
|
2
|
+
import { LibPixiContainer } from "../Base/LibPixiContainer";
|
|
3
|
+
export interface LibPixiSlideParams {
|
|
4
|
+
/** 舞台 */
|
|
5
|
+
stage: Container;
|
|
6
|
+
/** 当前方向 */
|
|
7
|
+
direction: "x" | "y";
|
|
8
|
+
/** 滚动区域宽度 */
|
|
9
|
+
width: number;
|
|
10
|
+
/** 滚动区域高度 */
|
|
11
|
+
height: number;
|
|
12
|
+
/** 一页宽度 */
|
|
13
|
+
pageWidth?: number;
|
|
14
|
+
/** 一页高度 */
|
|
15
|
+
pageHeight?: number;
|
|
16
|
+
/** 滚动的容器 */
|
|
17
|
+
content: Container;
|
|
18
|
+
/** 元素列表 */
|
|
19
|
+
itemList: Container[];
|
|
20
|
+
/** 是否启用循环 */
|
|
21
|
+
loop?: boolean;
|
|
22
|
+
/** 景深定制回调,第二参数函数参数景深衰减值,可视区三个元素时,建议0.5,五个元素时,建议0.2 */
|
|
23
|
+
depthCallback?: (container: Container, getValue: (depthAtten: number) => number) => void;
|
|
24
|
+
/** 松手回调 */
|
|
25
|
+
slideCallback?: (index: number) => void;
|
|
26
|
+
/** 滚动回调 */
|
|
27
|
+
scrollCallback?: (x: number, index: number) => void;
|
|
28
|
+
}
|
|
29
|
+
/** @description 滑动页
|
|
30
|
+
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollNum-数字滑动
|
|
31
|
+
*/
|
|
32
|
+
export declare class LibPixiSlide extends LibPixiContainer {
|
|
33
|
+
/** 滑动加速度触发翻页 */
|
|
34
|
+
private _SPEED_THRESHOLD;
|
|
35
|
+
/** 滑动比例翻页 */
|
|
36
|
+
private _SCROLL_THRESHOLD;
|
|
37
|
+
/** 当前方向 */
|
|
38
|
+
private _direction;
|
|
39
|
+
/** 元素列表 */
|
|
40
|
+
private _itemList;
|
|
41
|
+
/** 一页宽度 */
|
|
42
|
+
private _pageWidth;
|
|
43
|
+
/** 一页高度 */
|
|
44
|
+
private _pageHeight;
|
|
45
|
+
/** 是否循环 */
|
|
46
|
+
private _loop;
|
|
47
|
+
/** 两侧预留格数,如可视区有三个,则两侧预留为1 */
|
|
48
|
+
private _freeGridNum;
|
|
49
|
+
/** 当前幻灯片索引 */
|
|
50
|
+
private _currentIndex;
|
|
51
|
+
/** 记录拖动开始时的X坐标 */
|
|
52
|
+
private _startX;
|
|
53
|
+
/** 记录拖动开始时的Y坐标 */
|
|
54
|
+
private _startY;
|
|
55
|
+
/** 偏移量 */
|
|
56
|
+
private _offsetX;
|
|
57
|
+
/** 偏移量 */
|
|
58
|
+
private _offsetY;
|
|
59
|
+
/** 最大索引 */
|
|
60
|
+
private _pageNum;
|
|
61
|
+
/** 记录开始时间 */
|
|
62
|
+
private _startTime;
|
|
63
|
+
/** 是否正在拖动 */
|
|
64
|
+
private _isDragging;
|
|
65
|
+
/** 滑动内容 */
|
|
66
|
+
private _slideArea;
|
|
67
|
+
/** 景深定制回调 */
|
|
68
|
+
private _depthCallback?;
|
|
69
|
+
/** 滑动回调 */
|
|
70
|
+
private _slideCallback?;
|
|
71
|
+
/** 滚动回调 */
|
|
72
|
+
private _scrollCallback?;
|
|
73
|
+
constructor(params: LibPixiSlideParams);
|
|
74
|
+
/** @description 更新坐标 */
|
|
75
|
+
updatePosition(v: number, index: number): void;
|
|
76
|
+
/** @description 上一页 */
|
|
77
|
+
prev(): void;
|
|
78
|
+
/** @description 下一页 */
|
|
79
|
+
next(): void;
|
|
80
|
+
/** @description 滑动到指定索引 */
|
|
81
|
+
slideTo(index: number): void;
|
|
82
|
+
/** @description 设置滚动景深 */
|
|
83
|
+
private _setDepth;
|
|
84
|
+
/** @description 开始拖动 */
|
|
85
|
+
private _onDragStart;
|
|
86
|
+
/** @description 拖动中 */
|
|
87
|
+
private _onDragMove;
|
|
88
|
+
/** @description 滚动触发 */
|
|
89
|
+
private _onScroll;
|
|
90
|
+
/** @description 结束拖动 */
|
|
91
|
+
private _onDragEnd;
|
|
92
|
+
}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { Graphics } from "pixi.js";
|
|
2
|
+
import gsap from "gsap";
|
|
3
|
+
import { LibPixiContainer } from "../Base/LibPixiContainer";
|
|
4
|
+
import { libPixiEvent } from "../../Utils/LibPixiEvent";
|
|
5
|
+
/** @description 滑动页
|
|
6
|
+
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollNum-数字滑动
|
|
7
|
+
*/
|
|
8
|
+
export class LibPixiSlide extends LibPixiContainer {
|
|
9
|
+
constructor(params) {
|
|
10
|
+
const { stage, width, height, content, depthCallback, slideCallback, scrollCallback, pageWidth = 0, pageHeight = 0, itemList, loop = false, direction, } = params;
|
|
11
|
+
super(width, height);
|
|
12
|
+
/** 滑动加速度触发翻页 */
|
|
13
|
+
this._SPEED_THRESHOLD = 0.35;
|
|
14
|
+
/** 滑动比例翻页 */
|
|
15
|
+
this._SCROLL_THRESHOLD = 0.5;
|
|
16
|
+
/** 一页宽度 */
|
|
17
|
+
this._pageWidth = 0;
|
|
18
|
+
/** 一页高度 */
|
|
19
|
+
this._pageHeight = 0;
|
|
20
|
+
/** 是否循环 */
|
|
21
|
+
this._loop = false;
|
|
22
|
+
/** 两侧预留格数,如可视区有三个,则两侧预留为1 */
|
|
23
|
+
this._freeGridNum = 0;
|
|
24
|
+
/** 当前幻灯片索引 */
|
|
25
|
+
this._currentIndex = 0;
|
|
26
|
+
/** 记录拖动开始时的X坐标 */
|
|
27
|
+
this._startX = 0;
|
|
28
|
+
/** 记录拖动开始时的Y坐标 */
|
|
29
|
+
this._startY = 0;
|
|
30
|
+
/** 偏移量 */
|
|
31
|
+
this._offsetX = 0;
|
|
32
|
+
/** 偏移量 */
|
|
33
|
+
this._offsetY = 0;
|
|
34
|
+
/** 最大索引 */
|
|
35
|
+
this._pageNum = 0;
|
|
36
|
+
/** 记录开始时间 */
|
|
37
|
+
this._startTime = new Date().getTime();
|
|
38
|
+
/** 是否正在拖动 */
|
|
39
|
+
this._isDragging = false;
|
|
40
|
+
const mask = new Graphics();
|
|
41
|
+
mask.beginFill(0xffffff);
|
|
42
|
+
mask.drawRect(0, 0, this.width, this.height);
|
|
43
|
+
mask.endFill();
|
|
44
|
+
this.addChild(mask);
|
|
45
|
+
this.mask = mask;
|
|
46
|
+
this._direction = direction;
|
|
47
|
+
this._pageWidth = pageWidth;
|
|
48
|
+
this._pageHeight = pageHeight;
|
|
49
|
+
this._slideArea = content;
|
|
50
|
+
this._itemList = itemList;
|
|
51
|
+
this._loop = loop;
|
|
52
|
+
this._depthCallback = depthCallback;
|
|
53
|
+
this._slideCallback = slideCallback;
|
|
54
|
+
this._scrollCallback = scrollCallback;
|
|
55
|
+
this._pageNum = itemList.length;
|
|
56
|
+
this.addChild(this._slideArea);
|
|
57
|
+
if (this._direction === "x") {
|
|
58
|
+
this._freeGridNum = Math.floor(width / this._pageWidth / 2);
|
|
59
|
+
this._slideArea.x = this._pageWidth * this._freeGridNum;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
this._freeGridNum = Math.floor(height / pageHeight / 2);
|
|
63
|
+
this._slideArea.y = this._pageHeight * this._freeGridNum;
|
|
64
|
+
}
|
|
65
|
+
this.eventMode = "static";
|
|
66
|
+
this.cursor = "pointer";
|
|
67
|
+
this._setDepth();
|
|
68
|
+
libPixiEvent(this, "pointerdown", this._onDragStart.bind(this));
|
|
69
|
+
libPixiEvent(stage, "pointermove", this._onDragMove.bind(this));
|
|
70
|
+
window.addEventListener("pointerup", this._onDragEnd.bind(this));
|
|
71
|
+
}
|
|
72
|
+
/** @description 更新坐标 */
|
|
73
|
+
updatePosition(v, index) {
|
|
74
|
+
this._currentIndex = index;
|
|
75
|
+
this._setDepth();
|
|
76
|
+
if (this._direction === "x") {
|
|
77
|
+
this._slideArea.x = v;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
this._slideArea.y = v;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** @description 上一页 */
|
|
84
|
+
prev() {
|
|
85
|
+
this.slideTo(this._currentIndex - 1);
|
|
86
|
+
}
|
|
87
|
+
/** @description 下一页 */
|
|
88
|
+
next() {
|
|
89
|
+
this.slideTo(this._currentIndex + 1);
|
|
90
|
+
}
|
|
91
|
+
/** @description 滑动到指定索引 */
|
|
92
|
+
slideTo(index) {
|
|
93
|
+
var _a;
|
|
94
|
+
this._currentIndex = index;
|
|
95
|
+
//首尾限制
|
|
96
|
+
if (this._currentIndex < 0) {
|
|
97
|
+
if (this._loop) {
|
|
98
|
+
this._currentIndex = this._pageNum - 1;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
this._currentIndex = 0;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else if (this._currentIndex >= this._pageNum) {
|
|
105
|
+
this._currentIndex = this._pageNum;
|
|
106
|
+
if (this._loop) {
|
|
107
|
+
this._currentIndex = 0;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
this._currentIndex--;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (this._direction === "x") {
|
|
114
|
+
gsap.to(this._slideArea, {
|
|
115
|
+
x: -this._currentIndex * this._pageWidth +
|
|
116
|
+
this._pageWidth * this._freeGridNum,
|
|
117
|
+
duration: 0.25,
|
|
118
|
+
onUpdate: () => {
|
|
119
|
+
this._onScroll();
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
gsap.to(this._slideArea, {
|
|
125
|
+
y: -this._currentIndex * this._pageHeight +
|
|
126
|
+
this._pageHeight * this._freeGridNum,
|
|
127
|
+
duration: 0.25,
|
|
128
|
+
onUpdate: () => {
|
|
129
|
+
this._onScroll();
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
// 触发滑动结束回调
|
|
134
|
+
(_a = this._slideCallback) === null || _a === void 0 ? void 0 : _a.call(this, this._currentIndex);
|
|
135
|
+
}
|
|
136
|
+
/** @description 设置滚动景深 */
|
|
137
|
+
_setDepth() {
|
|
138
|
+
if (!this._depthCallback)
|
|
139
|
+
return;
|
|
140
|
+
let t = 0;
|
|
141
|
+
let currentIndex = 0;
|
|
142
|
+
if (this._direction === "x") {
|
|
143
|
+
const x = this._slideArea.x;
|
|
144
|
+
const startX = this._freeGridNum * this._pageWidth;
|
|
145
|
+
//设置起始位置,获取当前绝对坐标
|
|
146
|
+
const absX = Math.abs(x - startX);
|
|
147
|
+
// 根据滑动宽度计算出当前位置对应的索引
|
|
148
|
+
currentIndex = Math.floor(absX / this._pageWidth);
|
|
149
|
+
// 计算当前索引在一页中的比例,越靠近当前索引的x坐标,值越小,范围0-1
|
|
150
|
+
t = (absX % this._pageWidth) / this._pageWidth;
|
|
151
|
+
//如果在起点的时候还在向左滑,则取反,避免distance显示效果计算错误
|
|
152
|
+
if (x - startX > 0) {
|
|
153
|
+
t = -t;
|
|
154
|
+
currentIndex = -currentIndex;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
const y = this._slideArea.y;
|
|
159
|
+
const startY = this._freeGridNum * this._pageHeight;
|
|
160
|
+
//设置起始位置,获取当前绝对坐标
|
|
161
|
+
const absY = Math.abs(y - startY);
|
|
162
|
+
// 根据滑动宽度计算出当前位置对应的索引
|
|
163
|
+
currentIndex = Math.floor(absY / this._pageHeight);
|
|
164
|
+
// 计算当前索引在一页中的比例,越靠近当前索引的x坐标,值越小,范围0-1
|
|
165
|
+
t = (absY % this._pageHeight) / this._pageHeight;
|
|
166
|
+
//如果在起点的时候还在向左滑,则取反,避免distance显示效果计算错误
|
|
167
|
+
if (y - startY > 0) {
|
|
168
|
+
t = -t;
|
|
169
|
+
currentIndex = -currentIndex;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
this._itemList.forEach((item, i) => {
|
|
173
|
+
var _a;
|
|
174
|
+
// 计算当前项与目标索引之间的索引距离
|
|
175
|
+
const distance = Math.abs(i - currentIndex - t);
|
|
176
|
+
(_a = this._depthCallback) === null || _a === void 0 ? void 0 : _a.call(this, item, (depthAtten) => {
|
|
177
|
+
return Math.max(0, 1 - distance * depthAtten);
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/** @description 开始拖动 */
|
|
182
|
+
_onDragStart(event) {
|
|
183
|
+
this._isDragging = true;
|
|
184
|
+
gsap.killTweensOf(this._slideArea);
|
|
185
|
+
this._startTime = new Date().getTime();
|
|
186
|
+
if (this._direction === "x") {
|
|
187
|
+
this._startX = event.global.x;
|
|
188
|
+
this._offsetX = this._slideArea.x;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
this._startY = event.global.y;
|
|
192
|
+
this._offsetY = this._slideArea.y;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/** @description 拖动中 */
|
|
196
|
+
_onDragMove(event) {
|
|
197
|
+
if (!this._isDragging)
|
|
198
|
+
return;
|
|
199
|
+
if (this._direction === "x") {
|
|
200
|
+
const moveX = event.pageX - this._startX;
|
|
201
|
+
this._slideArea.x = this._offsetX + moveX;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
const moveY = event.pageY - this._startY;
|
|
205
|
+
this._slideArea.y = this._offsetY + moveY;
|
|
206
|
+
}
|
|
207
|
+
this._onScroll();
|
|
208
|
+
}
|
|
209
|
+
/** @description 滚动触发 */
|
|
210
|
+
_onScroll() {
|
|
211
|
+
var _a, _b;
|
|
212
|
+
this._setDepth();
|
|
213
|
+
if (this._direction === "x") {
|
|
214
|
+
(_a = this._scrollCallback) === null || _a === void 0 ? void 0 : _a.call(this, this._slideArea.x, this._currentIndex);
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
(_b = this._scrollCallback) === null || _b === void 0 ? void 0 : _b.call(this, this._slideArea.y, this._currentIndex);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/** @description 结束拖动 */
|
|
221
|
+
_onDragEnd(event) {
|
|
222
|
+
if (this._direction === "x") {
|
|
223
|
+
if (!this._isDragging)
|
|
224
|
+
return;
|
|
225
|
+
this._isDragging = false;
|
|
226
|
+
//滑动耗时
|
|
227
|
+
const slideTime = new Date().getTime() - this._startTime;
|
|
228
|
+
//滑动距离
|
|
229
|
+
const slide = this._startX - event.pageX;
|
|
230
|
+
//滑动速度
|
|
231
|
+
const slideSpeed = Math.abs(slide) / slideTime;
|
|
232
|
+
//要滑动的页数
|
|
233
|
+
const pageChange = Math.round(slide / this._pageWidth);
|
|
234
|
+
//如果滑动超过阈值,则翻页
|
|
235
|
+
if (Math.abs(slide) > this._pageWidth * this._SCROLL_THRESHOLD) {
|
|
236
|
+
this._currentIndex += pageChange;
|
|
237
|
+
}
|
|
238
|
+
//如果滑动速度大于阈值,则翻页
|
|
239
|
+
else if (slideSpeed > this._SPEED_THRESHOLD) {
|
|
240
|
+
let addIndex = slide / this._pageWidth;
|
|
241
|
+
if (addIndex > 0) {
|
|
242
|
+
addIndex = Math.ceil(addIndex);
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
addIndex = Math.floor(addIndex);
|
|
246
|
+
}
|
|
247
|
+
this._currentIndex += addIndex;
|
|
248
|
+
}
|
|
249
|
+
this.slideTo(this._currentIndex);
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
if (!this._isDragging)
|
|
253
|
+
return;
|
|
254
|
+
this._isDragging = false;
|
|
255
|
+
//滑动耗时
|
|
256
|
+
const slideTime = new Date().getTime() - this._startTime;
|
|
257
|
+
//滑动距离
|
|
258
|
+
const slide = this._startY - event.pageY;
|
|
259
|
+
//滑动速度
|
|
260
|
+
const slideSpeed = Math.abs(slide) / slideTime;
|
|
261
|
+
//要滑动的页数
|
|
262
|
+
const pageChange = Math.round(slide / this._pageHeight);
|
|
263
|
+
//如果滑动超过阈值,则翻页
|
|
264
|
+
if (Math.abs(slide) > this._pageHeight * this._SCROLL_THRESHOLD) {
|
|
265
|
+
this._currentIndex += pageChange;
|
|
266
|
+
}
|
|
267
|
+
//如果滑动速度大于阈值,则翻页
|
|
268
|
+
else if (slideSpeed > this._SPEED_THRESHOLD) {
|
|
269
|
+
let addIndex = slide / this._pageHeight;
|
|
270
|
+
if (addIndex > 0) {
|
|
271
|
+
addIndex = Math.ceil(addIndex);
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
addIndex = Math.floor(addIndex);
|
|
275
|
+
}
|
|
276
|
+
this._currentIndex += addIndex;
|
|
277
|
+
}
|
|
278
|
+
this.slideTo(this._currentIndex);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
package/libPixiJs.d.ts
CHANGED
|
@@ -23,193 +23,120 @@ import { LibPixiHtmlText } from "./Components/Base/LibPixiHtmlText";
|
|
|
23
23
|
import { LibPixiRectangle } from "./Components/Base/LibPixiRectangle";
|
|
24
24
|
import { LibPixiPolygon } from "./Components/Base/LibPixiPolygon";
|
|
25
25
|
import { LibPixiCircular } from "./Components/Base/LibPixiCircular";
|
|
26
|
+
import { LibPixiSlide } from "./Components/Custom/LibPixiSlide";
|
|
26
27
|
/** @description 组件 */
|
|
27
28
|
export declare const Components: {
|
|
28
29
|
Base: {
|
|
29
|
-
/** @description 自定义位图文本
|
|
30
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiBitText-位图
|
|
31
|
-
*/
|
|
30
|
+
/** @description 自定义位图文本 */
|
|
32
31
|
LibPixiBitText: typeof LibPixiBitText;
|
|
33
|
-
/** @description 自定义容器大小及背景色
|
|
34
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiContainer-容器
|
|
35
|
-
*/
|
|
32
|
+
/** @description 自定义容器大小及背景色 */
|
|
36
33
|
LibPixiContainer: typeof LibPixiContainer;
|
|
37
|
-
/** @description 利用贝塞尔曲线实现粒子移动
|
|
38
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiParticleMove-粒子容器
|
|
39
|
-
*/
|
|
34
|
+
/** @description 利用贝塞尔曲线实现粒子移动 */
|
|
40
35
|
LibPixiParticleMove: typeof LibPixiParticleMove;
|
|
41
|
-
/** @description 自定义矩形背景色
|
|
42
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiRectBgColor-矩形
|
|
43
|
-
*/
|
|
36
|
+
/** @description 自定义矩形背景色 */
|
|
44
37
|
LibPixiRectBgColor: typeof LibPixiRectBgColor;
|
|
45
|
-
/** @description 矩形类,可用于一些场景的局部点击,传颜色是为了方便定位,最终可能需要将颜色隐藏掉
|
|
46
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiRectangle-矩形
|
|
47
|
-
*/
|
|
38
|
+
/** @description 矩形类,可用于一些场景的局部点击,传颜色是为了方便定位,最终可能需要将颜色隐藏掉 */
|
|
48
39
|
LibPixiRectangle: typeof LibPixiRectangle;
|
|
49
|
-
/** @description 圆形
|
|
50
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiCircular-圆形
|
|
51
|
-
*/
|
|
40
|
+
/** @description 圆形 */
|
|
52
41
|
LibPixiCircular: typeof LibPixiCircular;
|
|
53
|
-
/** @description 多边形类
|
|
54
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPolygon-多边形
|
|
55
|
-
*/
|
|
42
|
+
/** @description 多边形类 */
|
|
56
43
|
LibPixiPolygon: typeof LibPixiPolygon;
|
|
57
|
-
/** @description 自定义 Spine 动画
|
|
58
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiSpine-动画
|
|
59
|
-
*/
|
|
44
|
+
/** @description 自定义 Spine 动画 */
|
|
60
45
|
LibPixiSpine: typeof LibPixiSpine;
|
|
61
|
-
/** @description 自定义文本类
|
|
62
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiText-文本
|
|
63
|
-
*/
|
|
46
|
+
/** @description 自定义文本类 */
|
|
64
47
|
LibPixiText: typeof LibPixiText;
|
|
65
|
-
/** @description 自定义富文本类
|
|
66
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiHtmlText-自定义富文本类
|
|
67
|
-
*/
|
|
48
|
+
/** @description 自定义富文本类 */
|
|
68
49
|
LibPixiHtmlText: typeof LibPixiHtmlText;
|
|
69
50
|
};
|
|
70
51
|
Custom: {
|
|
71
|
-
/** @description 悬浮切换材质
|
|
72
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiButtonHover-按钮悬浮
|
|
73
|
-
*/
|
|
52
|
+
/** @description 悬浮切换材质 */
|
|
74
53
|
LibPixiButtonHover: typeof LibPixiButtonHover;
|
|
75
|
-
/** @description 右上角关闭按钮,支持悬浮旋转动画
|
|
76
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiCloseBtn-关闭按钮
|
|
77
|
-
*/
|
|
54
|
+
/** @description 右上角关闭按钮,支持悬浮旋转动画 */
|
|
78
55
|
LibPixiCloseBtn: typeof LibPixiCloseBtn;
|
|
79
|
-
/** @description 底部弹出抽屉
|
|
80
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDrawer-抽屉
|
|
81
|
-
*/
|
|
56
|
+
/** @description 底部弹出抽屉 */
|
|
82
57
|
LibPixiDrawer: typeof LibPixiDrawer;
|
|
83
|
-
/** @description 监视帧率、Draw Call、Max Draw Call
|
|
84
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPerforMon-性能监视器
|
|
85
|
-
*/
|
|
58
|
+
/** @description 监视帧率、Draw Call、Max Draw Call */
|
|
86
59
|
LibPixiPerforMon: typeof LibPixiPerforMon;
|
|
87
|
-
/** @description 通过裁剪的方式显示进度条
|
|
88
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiProgress-进度条
|
|
89
|
-
*/
|
|
60
|
+
/** @description 通过裁剪的方式显示进度条 */
|
|
90
61
|
LibPixiProgress: typeof LibPixiProgress;
|
|
91
|
-
/** @description 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹
|
|
92
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollContainerX-X轴滚动容器
|
|
93
|
-
*/
|
|
62
|
+
/** @description 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹 */
|
|
94
63
|
LibPixiScrollContainerX: typeof LibPixiScrollContainerX;
|
|
95
|
-
/** @description 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹
|
|
96
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollContainerY-Y轴滚动容器
|
|
97
|
-
*/
|
|
64
|
+
/** @description 支持鼠标滚轮滚动、鼠标拖动、手指滑动,支持惯性滚动及回弹 */
|
|
98
65
|
LibPixiScrollContainerY: typeof LibPixiScrollContainerY;
|
|
99
|
-
/** @description 通过鼠标或手指拖动数字列选择数字
|
|
100
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScrollNum-数字滑动
|
|
101
|
-
*/
|
|
66
|
+
/** @description 通过鼠标或手指拖动数字列选择数字 */
|
|
102
67
|
LibPixiScrollNum: typeof LibPixiScrollNum;
|
|
103
|
-
/** @description 类似轮播图,但是不会自动轮播
|
|
104
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiSlider-横向滑动图
|
|
105
|
-
*/
|
|
68
|
+
/** @description 类似轮播图,但是不会自动轮播 */
|
|
106
69
|
LibPixiSlider: typeof LibPixiSlider;
|
|
107
|
-
/** @description
|
|
108
|
-
|
|
109
|
-
|
|
70
|
+
/** @description 滑动页 */
|
|
71
|
+
LibPixiSlide: typeof LibPixiSlide;
|
|
72
|
+
/** @description 最小、最大按钮和增减按钮功能及置灰逻辑 */
|
|
110
73
|
LibPixiSubAddMinMax: typeof LibPixiSubAddMinMax;
|
|
111
|
-
/** @description 绘制表格并填充数字
|
|
112
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiTable-数字表格
|
|
113
|
-
*/
|
|
74
|
+
/** @description 绘制表格并填充数字 */
|
|
114
75
|
LibPixiTable: typeof LibPixiTable;
|
|
115
76
|
};
|
|
116
77
|
};
|
|
117
78
|
/** @description 方法 */
|
|
118
79
|
export declare const Utils: {
|
|
119
|
-
/** @description 音频播放器
|
|
120
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiAudio-音频播放器
|
|
121
|
-
*/
|
|
80
|
+
/** @description 音频播放器 */
|
|
122
81
|
LibPixiAudio: typeof LibPixiAudio;
|
|
123
|
-
/** @description 九宫格图
|
|
124
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiCreateNineGrid-九宫格图
|
|
125
|
-
*/
|
|
82
|
+
/** @description 九宫格图 */
|
|
126
83
|
libPixiCreateNineGrid: (params: import("./Utils/LibPixiCreateNineGrid").LibPixiCreateNineGridParams) => import("pixi.js").NineSlicePlane;
|
|
127
84
|
/** @description 事件注册
|
|
128
85
|
* @param v 事件容器
|
|
129
86
|
* @param eventName 事件名称
|
|
130
87
|
* @param callback 回调函数
|
|
131
|
-
* @param once 是否只执行一次
|
|
132
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiEvent-事件注册
|
|
133
|
-
*/
|
|
88
|
+
* @param once 是否只执行一次 */
|
|
134
89
|
libPixiEvent: (v: import("pixi.js").Container, eventName: keyof import("pixi.js").DisplayObjectEvents, callback: (event: import("pixi.js").FederatedPointerEvent) => void, params?: import("./Utils/LibPixiEvent").LibPixiEventParams) => () => void;
|
|
135
90
|
/** @description 滤镜
|
|
136
91
|
* @param filterName 滤镜名称
|
|
137
|
-
* @param v 滤镜值
|
|
138
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiFilter-滤镜
|
|
139
|
-
*/
|
|
92
|
+
* @param v 滤镜值 */
|
|
140
93
|
libPixiFilter: (filterName: import("./Utils/LibPixiFilter").LibPixiSetFilterFilterName, v?: number) => import("pixi.js").ColorMatrixFilter | import("pixi.js").BlurFilter;
|
|
141
94
|
/** @description 间隔触发
|
|
142
95
|
* @param callback 回调函数
|
|
143
|
-
* @param interval 间隔毫秒,或随机范围
|
|
144
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiIntervalTrigger-间隔触发
|
|
145
|
-
*/
|
|
96
|
+
* @param interval 间隔毫秒,或随机范围 */
|
|
146
97
|
libPixiIntervalTrigger: (callback: () => void, interval: number | [number, number]) => () => void;
|
|
147
98
|
/** @description 点击容器外或入口按钮时隐藏
|
|
148
99
|
* @param container 容器
|
|
149
100
|
* @param btn 按钮
|
|
150
|
-
* @param onClose 关闭回调
|
|
151
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiOutsideClick-失焦隐藏
|
|
152
|
-
*/
|
|
101
|
+
* @param onClose 关闭回调 */
|
|
153
102
|
libPixiOutsideClick: (container: import("pixi.js").Container, btn: import("pixi.js").Container, onClose: () => void) => () => void;
|
|
154
103
|
/** @description 为容器创建并应用一个矩形遮罩,用于隐藏溢出的内容,函数会返回遮罩,可控制是否显示遮罩
|
|
155
|
-
* @param container 需要设置遮罩裁剪的容器
|
|
156
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiOverflowHidden-溢出裁剪
|
|
157
|
-
*/
|
|
104
|
+
* @param container 需要设置遮罩裁剪的容器 */
|
|
158
105
|
libPixiOverflowHidden: (container: import("pixi.js").Container) => import("pixi.js").Graphics;
|
|
159
106
|
/** @description 基于 Ticker 和 Promise 的定时器
|
|
160
107
|
* @param delay 延迟时间
|
|
161
|
-
* @param callback 延迟后执行的函数
|
|
162
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPromiseTickerTimeout-TickerPromise定时器
|
|
163
|
-
*/
|
|
108
|
+
* @param callback 延迟后执行的函数 */
|
|
164
109
|
libPixiPromiseTickerTimeout: (delay?: number, callback?: () => void) => Promise<void>;
|
|
165
110
|
/** @description 元素超过指定宽度就缩放
|
|
166
111
|
* @param scaleContainer 需要缩放的元素
|
|
167
112
|
* @param maxWidth 最大宽度
|
|
168
|
-
* @param maxHeight 最大高度
|
|
169
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiScaleContainer-超出缩放
|
|
170
|
-
*/
|
|
113
|
+
* @param maxHeight 最大高度 */
|
|
171
114
|
libPixiScaleContainer: (scaleContainer: import("pixi.js").Container | import("pixi.js").Sprite | import("pixi.js").Text, maxWidth: number, maxHeight?: number) => void;
|
|
172
115
|
/** @description 阴影
|
|
173
116
|
* @param container 需要添加阴影的元素
|
|
174
|
-
* @param config 配置项
|
|
175
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiShadow-阴影
|
|
176
|
-
*/
|
|
117
|
+
* @param config 配置项 */
|
|
177
118
|
libPixiShadow: (container: import("pixi.js").Container, config?: import("./Utils/LibPixiShadow").LibPixiShadowShadowConfig) => void;
|
|
178
119
|
/** @description 基于 Ticker 的定时器
|
|
179
120
|
* @param callback 延迟后执行的函数
|
|
180
|
-
* @param delay 延迟时间
|
|
181
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiTickerTimeout-Ticker定时器
|
|
182
|
-
*/
|
|
121
|
+
* @param delay 延迟时间 */
|
|
183
122
|
libPixiTickerTimeout: (callback: () => void, delay?: number) => () => void;
|
|
184
|
-
/** @description 滑动选择器核心代码
|
|
185
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiSlideInput-滑动选择值
|
|
186
|
-
*/
|
|
123
|
+
/** @description 滑动选择器核心代码 */
|
|
187
124
|
LibPixiSlideInput: typeof LibPixiSlideInput;
|
|
188
|
-
/** @description 事件总线更新实例汇总
|
|
189
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibGlobalUpdater-事件实例汇总
|
|
190
|
-
*/
|
|
125
|
+
/** @description 事件总线更新实例汇总 */
|
|
191
126
|
LibPixiGlobalUpdater: typeof LibPixiGlobalUpdater;
|
|
192
|
-
/** @description 多边形绘制工具,绘制时浏览器窗口需要全屏显示,空格键控制开始和结束,开始后鼠标进行点击绘制,退格删除点,空格结束绘制,绘制结果在控制台打印,不满意可再次按空格清空并重新绘制
|
|
193
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPolygonDrawTool-多边形绘制
|
|
194
|
-
*/
|
|
127
|
+
/** @description 多边形绘制工具,绘制时浏览器窗口需要全屏显示,空格键控制开始和结束,开始后鼠标进行点击绘制,退格删除点,空格结束绘制,绘制结果在控制台打印,不满意可再次按空格清空并重新绘制 */
|
|
195
128
|
LibPixiPolygonDrawTool: typeof LibPixiPolygonDrawTool;
|
|
196
129
|
/** @description 数值递增动画
|
|
197
130
|
* @param params 动画参数
|
|
198
|
-
* @returns 设置为目标值并停止动画
|
|
199
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDigitalIncreasingAnimation-递增动画
|
|
200
|
-
*/
|
|
131
|
+
* @returns 设置为目标值并停止动画 */
|
|
201
132
|
LibPixiDigitalIncreasingAnimation: (params: import("./Utils/LibPixiDigitalIncreasingAnimation").LibPixiDigitalIncreasingAnimationParams) => () => void;
|
|
202
133
|
/** @description 按下放大
|
|
203
|
-
* @param container 要放大的容器
|
|
204
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDownScaleAnimation-按下放大
|
|
205
|
-
*/
|
|
134
|
+
* @param container 要放大的容器 */
|
|
206
135
|
LibPixiDownScaleAnimation: (container: import("pixi.js").Container) => void;
|
|
207
136
|
/**
|
|
208
137
|
* @description 将元素按照指定的列数和间隔排列成网格布局。
|
|
209
138
|
* @param items 要排列的元素数组
|
|
210
139
|
* @param gap 每个元素之间的间隔
|
|
211
|
-
* @param cols 网格的列数,默认为元素数量
|
|
212
|
-
* @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiGridLayout-网格布局
|
|
213
|
-
*/
|
|
140
|
+
* @param cols 网格的列数,默认为元素数量 */
|
|
214
141
|
LibPixiGridLayout: (items: import("pixi.js").Container[], gap: number, cols?: number) => void;
|
|
215
142
|
};
|