lyb-pixi-js 1.8.11 → 1.9.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.
package/README.md CHANGED
@@ -156,6 +156,12 @@ app.stage.addChild(box);
156
156
 
157
157
  \- [LibPixiPolygonDrawTool-多边形绘制](#LibPixiPolygonDrawTool-多边形绘制)
158
158
 
159
+ \- [LibPixiDigitalIncreasingAnimation-递增动画](#LibPixiDigitalIncreasingAnimation-递增动画)
160
+
161
+ \- [LibPixiDownScaleAnimation-按下放大](#LibPixiDownScaleAnimation-按下放大)
162
+
163
+ \- [LibPixiGridLayout-网格布局](#LibPixiGridLayout-网格布局)
164
+
159
165
  ## Base-基础
160
166
 
161
167
  ### LibPixiText-文本
@@ -1124,3 +1130,37 @@ $bus.on("play", () => {
1124
1130
  ```ts
1125
1131
  new LibPixiPolygonDrawTool(app);
1126
1132
  ```
1133
+
1134
+ ### LibPixiDigitalIncreasingAnimation-递增动画
1135
+
1136
+ > 数值递增动画
1137
+
1138
+ ```ts
1139
+ const amountAnimation = _digitalIncreasingAnimation({
1140
+ startValue: 0,
1141
+ value: 100,
1142
+ duration: 1,
1143
+ onChange: (v) => {
1144
+ this._winAmountText.text = v;
1145
+ },
1146
+ onComplete: () => {
1147
+ },
1148
+ });
1149
+ ```
1150
+
1151
+ ### LibPixiDownScaleAnimation-按下放大
1152
+
1153
+ > 鼠标按下放大
1154
+
1155
+ ```ts
1156
+ LibPixiDownScaleAnimation(sprite);
1157
+ ```
1158
+
1159
+ ### LibPixiGridLayout-网格布局
1160
+
1161
+ > 将元素按照指定的列数和间隔排列成网格布局
1162
+
1163
+ ```ts
1164
+ LibPixiGridLayout(cardList, 20, 3); //间隔20,一行三个
1165
+ ```
1166
+
@@ -0,0 +1,18 @@
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;
@@ -0,0 +1,25 @@
1
+ import { libJsNumComma } from "lyb-js/Formatter/LibJsNumComma.js";
2
+ /** @description 数值递增动画
3
+ * @param params 动画参数
4
+ * @returns 设置为目标值并停止动画
5
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDigitalIncreasingAnimation-递增动画
6
+ */
7
+ export const LibPixiDigitalIncreasingAnimation = (params) => {
8
+ const { value, onChange, onComplete, startValue = 0, duration = 4 } = params;
9
+ // 动画递增的目标值
10
+ const animatedValue = { value: startValue };
11
+ // 使用 GSAP 创建递增动画
12
+ gsap.killTweensOf(animatedValue);
13
+ const amountAnimation = gsap.to(animatedValue, {
14
+ value,
15
+ duration,
16
+ ease: "linear",
17
+ onUpdate: () => {
18
+ onChange(libJsNumComma(animatedValue.value, 2));
19
+ },
20
+ onComplete: onComplete,
21
+ });
22
+ return () => {
23
+ amountAnimation.progress(1);
24
+ };
25
+ };
@@ -0,0 +1,6 @@
1
+ import { Container } from "pixi.js";
2
+ /** @description 按下放大
3
+ * @param container 要放大的容器
4
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDownScaleAnimation-按下放大
5
+ */
6
+ export declare const LibPixiDownScaleAnimation: (container: Container) => void;
@@ -0,0 +1,31 @@
1
+ import { libPixiEvent } from "./LibPixiEvent";
2
+ /** @description 按下放大
3
+ * @param container 要放大的容器
4
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDownScaleAnimation-按下放大
5
+ */
6
+ export const LibPixiDownScaleAnimation = (container) => {
7
+ libPixiEvent(container, "pointerdown", () => {
8
+ gsap.to(container, {
9
+ duration: 0.1,
10
+ pixi: {
11
+ scale: 1.1,
12
+ },
13
+ });
14
+ });
15
+ libPixiEvent(container, "pointerup", () => {
16
+ gsap.to(container, {
17
+ duration: 0.1,
18
+ pixi: {
19
+ scale: 1,
20
+ },
21
+ });
22
+ });
23
+ libPixiEvent(container, "pointerleave", () => {
24
+ gsap.to(container, {
25
+ duration: 0.1,
26
+ pixi: {
27
+ scale: 1,
28
+ },
29
+ });
30
+ });
31
+ };
@@ -0,0 +1,9 @@
1
+ import { Container } from "pixi.js";
2
+ /**
3
+ * @description 将元素按照指定的列数和间隔排列成网格布局。
4
+ * @param items 要排列的元素数组
5
+ * @param gap 每个元素之间的间隔
6
+ * @param cols 网格的列数,默认为元素数量
7
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiGridLayout-网格布局
8
+ */
9
+ export declare const LibPixiGridLayout: (items: Container[], gap: number, cols?: number) => void;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @description 将元素按照指定的列数和间隔排列成网格布局。
3
+ * @param items 要排列的元素数组
4
+ * @param gap 每个元素之间的间隔
5
+ * @param cols 网格的列数,默认为元素数量
6
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiGridLayout-网格布局
7
+ */
8
+ export const LibPixiGridLayout = (items, gap, cols = items.length) => {
9
+ let lastX = 0;
10
+ items.forEach((item, index) => {
11
+ const itemWidth = item.width || 0;
12
+ const itemHeight = item.height || 0;
13
+ const colIndex = index % cols;
14
+ const rowIndex = Math.floor(index / cols);
15
+ item.x = colIndex === 0 ? 0 : lastX + gap;
16
+ item.y = rowIndex * (itemHeight + gap);
17
+ lastX = item.x + itemWidth;
18
+ if (colIndex === cols - 1) {
19
+ lastX = 0;
20
+ }
21
+ });
22
+ };
package/libPixiJs.d.ts CHANGED
@@ -193,4 +193,23 @@ export declare const Utils: {
193
193
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPolygonDrawTool-多边形绘制
194
194
  */
195
195
  LibPixiPolygonDrawTool: typeof LibPixiPolygonDrawTool;
196
+ /** @description 数值递增动画
197
+ * @param params 动画参数
198
+ * @returns 设置为目标值并停止动画
199
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDigitalIncreasingAnimation-递增动画
200
+ */
201
+ LibPixiDigitalIncreasingAnimation: (params: import("./Utils/LibPixiDigitalIncreasingAnimation").LibPixiDigitalIncreasingAnimationParams) => () => void;
202
+ /** @description 按下放大
203
+ * @param container 要放大的容器
204
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDownScaleAnimation-按下放大
205
+ */
206
+ LibPixiDownScaleAnimation: (container: import("pixi.js").Container) => void;
207
+ /**
208
+ * @description 将元素按照指定的列数和间隔排列成网格布局。
209
+ * @param items 要排列的元素数组
210
+ * @param gap 每个元素之间的间隔
211
+ * @param cols 网格的列数,默认为元素数量
212
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiGridLayout-网格布局
213
+ */
214
+ LibPixiGridLayout: (items: import("pixi.js").Container[], gap: number, cols?: number) => void;
196
215
  };
package/libPixiJs.js CHANGED
@@ -33,6 +33,9 @@ import { LibPixiHtmlText } from "./Components/Base/LibPixiHtmlText";
33
33
  import { LibPixiRectangle } from "./Components/Base/LibPixiRectangle";
34
34
  import { LibPixiPolygon } from "./Components/Base/LibPixiPolygon";
35
35
  import { LibPixiCircular } from "./Components/Base/LibPixiCircular";
36
+ import { LibPixiDigitalIncreasingAnimation } from "./Utils/LibPixiDigitalIncreasingAnimation";
37
+ import { LibPixiDownScaleAnimation } from "./Utils/LibPixiDownScaleAnimation";
38
+ import { LibPixiGridLayout } from "./Utils/LibPixiGridLayout";
36
39
  /** @description 组件 */
37
40
  export const Components = {
38
41
  Base: {
@@ -203,4 +206,23 @@ export const Utils = {
203
206
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPolygonDrawTool-多边形绘制
204
207
  */
205
208
  LibPixiPolygonDrawTool,
209
+ /** @description 数值递增动画
210
+ * @param params 动画参数
211
+ * @returns 设置为目标值并停止动画
212
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDigitalIncreasingAnimation-递增动画
213
+ */
214
+ LibPixiDigitalIncreasingAnimation,
215
+ /** @description 按下放大
216
+ * @param container 要放大的容器
217
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDownScaleAnimation-按下放大
218
+ */
219
+ LibPixiDownScaleAnimation,
220
+ /**
221
+ * @description 将元素按照指定的列数和间隔排列成网格布局。
222
+ * @param items 要排列的元素数组
223
+ * @param gap 每个元素之间的间隔
224
+ * @param cols 网格的列数,默认为元素数量
225
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiGridLayout-网格布局
226
+ */
227
+ LibPixiGridLayout,
206
228
  };
package/lyb-pixi.js CHANGED
@@ -1315,7 +1315,7 @@
1315
1315
  var ys = arrObjKeys(obj, inspect2);
1316
1316
  var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
1317
1317
  var protoTag = obj instanceof Object ? "" : "null prototype";
1318
- var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
1318
+ var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr$1(obj), 8, -1) : protoTag ? "Object" : "";
1319
1319
  var constructorTag = isPlainObject || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
1320
1320
  var tag = constructorTag + (stringTag || protoTag ? "[" + $join.call($concat$1.call([], stringTag || [], protoTag || []), ": ") + "] " : "");
1321
1321
  if (ys.length === 0) {
@@ -1337,25 +1337,25 @@
1337
1337
  return $replace$1.call(String(s2), /"/g, """);
1338
1338
  }
1339
1339
  function isArray$3(obj) {
1340
- return toStr(obj) === "[object Array]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1340
+ return toStr$1(obj) === "[object Array]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1341
1341
  }
1342
1342
  function isDate(obj) {
1343
- return toStr(obj) === "[object Date]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1343
+ return toStr$1(obj) === "[object Date]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1344
1344
  }
1345
1345
  function isRegExp$1(obj) {
1346
- return toStr(obj) === "[object RegExp]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1346
+ return toStr$1(obj) === "[object RegExp]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1347
1347
  }
1348
1348
  function isError(obj) {
1349
- return toStr(obj) === "[object Error]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1349
+ return toStr$1(obj) === "[object Error]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1350
1350
  }
1351
1351
  function isString(obj) {
1352
- return toStr(obj) === "[object String]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1352
+ return toStr$1(obj) === "[object String]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1353
1353
  }
1354
1354
  function isNumber(obj) {
1355
- return toStr(obj) === "[object Number]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1355
+ return toStr$1(obj) === "[object Number]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1356
1356
  }
1357
1357
  function isBoolean(obj) {
1358
- return toStr(obj) === "[object Boolean]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1358
+ return toStr$1(obj) === "[object Boolean]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
1359
1359
  }
1360
1360
  function isSymbol(obj) {
1361
1361
  if (hasShammedSymbols) {
@@ -1391,7 +1391,7 @@
1391
1391
  function has$3(obj, key) {
1392
1392
  return hasOwn$1.call(obj, key);
1393
1393
  }
1394
- function toStr(obj) {
1394
+ function toStr$1(obj) {
1395
1395
  return objectToString.call(obj);
1396
1396
  }
1397
1397
  function nameOf(f2) {
@@ -1700,7 +1700,7 @@
1700
1700
  var uri = URIError;
1701
1701
  var abs$1 = Math.abs;
1702
1702
  var floor$1 = Math.floor;
1703
- var max$1 = Math.max;
1703
+ var max$2 = Math.max;
1704
1704
  var min$1 = Math.min;
1705
1705
  var pow$1 = Math.pow;
1706
1706
  var round$2 = Math.round;
@@ -1833,102 +1833,78 @@
1833
1833
  Object_getPrototypeOf = $Object2.getPrototypeOf || null;
1834
1834
  return Object_getPrototypeOf;
1835
1835
  }
1836
- var implementation;
1837
- var hasRequiredImplementation;
1838
- function requireImplementation() {
1839
- if (hasRequiredImplementation)
1840
- return implementation;
1841
- hasRequiredImplementation = 1;
1842
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
1843
- var toStr2 = Object.prototype.toString;
1844
- var max2 = Math.max;
1845
- var funcType = "[object Function]";
1846
- var concatty = function concatty2(a2, b2) {
1847
- var arr = [];
1848
- for (var i2 = 0; i2 < a2.length; i2 += 1) {
1849
- arr[i2] = a2[i2];
1850
- }
1851
- for (var j2 = 0; j2 < b2.length; j2 += 1) {
1852
- arr[j2 + a2.length] = b2[j2];
1853
- }
1854
- return arr;
1855
- };
1856
- var slicy = function slicy2(arrLike, offset) {
1857
- var arr = [];
1858
- for (var i2 = offset || 0, j2 = 0; i2 < arrLike.length; i2 += 1, j2 += 1) {
1859
- arr[j2] = arrLike[i2];
1860
- }
1861
- return arr;
1862
- };
1863
- var joiny = function(arr, joiner) {
1864
- var str = "";
1865
- for (var i2 = 0; i2 < arr.length; i2 += 1) {
1866
- str += arr[i2];
1867
- if (i2 + 1 < arr.length) {
1868
- str += joiner;
1869
- }
1836
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
1837
+ var toStr = Object.prototype.toString;
1838
+ var max$1 = Math.max;
1839
+ var funcType = "[object Function]";
1840
+ var concatty = function concatty2(a2, b2) {
1841
+ var arr = [];
1842
+ for (var i2 = 0; i2 < a2.length; i2 += 1) {
1843
+ arr[i2] = a2[i2];
1844
+ }
1845
+ for (var j2 = 0; j2 < b2.length; j2 += 1) {
1846
+ arr[j2 + a2.length] = b2[j2];
1847
+ }
1848
+ return arr;
1849
+ };
1850
+ var slicy = function slicy2(arrLike, offset) {
1851
+ var arr = [];
1852
+ for (var i2 = offset || 0, j2 = 0; i2 < arrLike.length; i2 += 1, j2 += 1) {
1853
+ arr[j2] = arrLike[i2];
1854
+ }
1855
+ return arr;
1856
+ };
1857
+ var joiny = function(arr, joiner) {
1858
+ var str = "";
1859
+ for (var i2 = 0; i2 < arr.length; i2 += 1) {
1860
+ str += arr[i2];
1861
+ if (i2 + 1 < arr.length) {
1862
+ str += joiner;
1870
1863
  }
1871
- return str;
1872
- };
1873
- implementation = function bind2(that) {
1874
- var target = this;
1875
- if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
1876
- throw new TypeError(ERROR_MESSAGE + target);
1877
- }
1878
- var args = slicy(arguments, 1);
1879
- var bound;
1880
- var binder = function() {
1881
- if (this instanceof bound) {
1882
- var result = target.apply(
1883
- this,
1884
- concatty(args, arguments)
1885
- );
1886
- if (Object(result) === result) {
1887
- return result;
1888
- }
1889
- return this;
1890
- }
1891
- return target.apply(
1892
- that,
1864
+ }
1865
+ return str;
1866
+ };
1867
+ var implementation$1 = function bind2(that) {
1868
+ var target = this;
1869
+ if (typeof target !== "function" || toStr.apply(target) !== funcType) {
1870
+ throw new TypeError(ERROR_MESSAGE + target);
1871
+ }
1872
+ var args = slicy(arguments, 1);
1873
+ var bound;
1874
+ var binder = function() {
1875
+ if (this instanceof bound) {
1876
+ var result = target.apply(
1877
+ this,
1893
1878
  concatty(args, arguments)
1894
1879
  );
1895
- };
1896
- var boundLength = max2(0, target.length - args.length);
1897
- var boundArgs = [];
1898
- for (var i2 = 0; i2 < boundLength; i2++) {
1899
- boundArgs[i2] = "$" + i2;
1900
- }
1901
- bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
1902
- if (target.prototype) {
1903
- var Empty = function Empty2() {
1904
- };
1905
- Empty.prototype = target.prototype;
1906
- bound.prototype = new Empty();
1907
- Empty.prototype = null;
1880
+ if (Object(result) === result) {
1881
+ return result;
1882
+ }
1883
+ return this;
1908
1884
  }
1909
- return bound;
1885
+ return target.apply(
1886
+ that,
1887
+ concatty(args, arguments)
1888
+ );
1910
1889
  };
1911
- return implementation;
1912
- }
1913
- var functionBind;
1914
- var hasRequiredFunctionBind;
1915
- function requireFunctionBind() {
1916
- if (hasRequiredFunctionBind)
1917
- return functionBind;
1918
- hasRequiredFunctionBind = 1;
1919
- var implementation2 = requireImplementation();
1920
- functionBind = Function.prototype.bind || implementation2;
1921
- return functionBind;
1922
- }
1923
- var functionCall;
1924
- var hasRequiredFunctionCall;
1925
- function requireFunctionCall() {
1926
- if (hasRequiredFunctionCall)
1927
- return functionCall;
1928
- hasRequiredFunctionCall = 1;
1929
- functionCall = Function.prototype.call;
1930
- return functionCall;
1931
- }
1890
+ var boundLength = max$1(0, target.length - args.length);
1891
+ var boundArgs = [];
1892
+ for (var i2 = 0; i2 < boundLength; i2++) {
1893
+ boundArgs[i2] = "$" + i2;
1894
+ }
1895
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
1896
+ if (target.prototype) {
1897
+ var Empty = function Empty2() {
1898
+ };
1899
+ Empty.prototype = target.prototype;
1900
+ bound.prototype = new Empty();
1901
+ Empty.prototype = null;
1902
+ }
1903
+ return bound;
1904
+ };
1905
+ var implementation = implementation$1;
1906
+ var functionBind = Function.prototype.bind || implementation;
1907
+ var functionCall = Function.prototype.call;
1932
1908
  var functionApply;
1933
1909
  var hasRequiredFunctionApply;
1934
1910
  function requireFunctionApply() {
@@ -1939,14 +1915,14 @@
1939
1915
  return functionApply;
1940
1916
  }
1941
1917
  var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
1942
- var bind$2 = requireFunctionBind();
1918
+ var bind$2 = functionBind;
1943
1919
  var $apply$1 = requireFunctionApply();
1944
- var $call$2 = requireFunctionCall();
1920
+ var $call$2 = functionCall;
1945
1921
  var $reflectApply = reflectApply;
1946
1922
  var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
1947
- var bind$1 = requireFunctionBind();
1923
+ var bind$1 = functionBind;
1948
1924
  var $TypeError$4 = type;
1949
- var $call$1 = requireFunctionCall();
1925
+ var $call$1 = functionCall;
1950
1926
  var $actualApply = actualApply;
1951
1927
  var callBindApplyHelpers = function callBindBasic2(args) {
1952
1928
  if (args.length < 1 || typeof args[0] !== "function") {
@@ -2015,7 +1991,7 @@
2015
1991
  hasRequiredHasown = 1;
2016
1992
  var call = Function.prototype.call;
2017
1993
  var $hasOwn = Object.prototype.hasOwnProperty;
2018
- var bind2 = requireFunctionBind();
1994
+ var bind2 = functionBind;
2019
1995
  hasown = bind2.call(call, $hasOwn);
2020
1996
  return hasown;
2021
1997
  }
@@ -2030,7 +2006,7 @@
2030
2006
  var $URIError = uri;
2031
2007
  var abs = abs$1;
2032
2008
  var floor = floor$1;
2033
- var max = max$1;
2009
+ var max = max$2;
2034
2010
  var min = min$1;
2035
2011
  var pow = pow$1;
2036
2012
  var round$1 = round$2;
@@ -2064,7 +2040,7 @@
2064
2040
  var $ObjectGPO = requireObject_getPrototypeOf();
2065
2041
  var $ReflectGPO = requireReflect_getPrototypeOf();
2066
2042
  var $apply = requireFunctionApply();
2067
- var $call = requireFunctionCall();
2043
+ var $call = functionCall;
2068
2044
  var needsEval = {};
2069
2045
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
2070
2046
  var INTRINSICS = {
@@ -2234,7 +2210,7 @@
2234
2210
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
2235
2211
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
2236
2212
  };
2237
- var bind = requireFunctionBind();
2213
+ var bind = functionBind;
2238
2214
  var hasOwn = requireHasown();
2239
2215
  var $concat = bind.call($call, Array.prototype.concat);
2240
2216
  var $spliceApply = bind.call($apply, Array.prototype.splice);
@@ -25775,7 +25751,7 @@ void main(void)\r
25775
25751
  return _isFunction(value) || _isString(value);
25776
25752
  }, _isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView || function() {
25777
25753
  }, _isArray = Array.isArray, _strictNumExp = /(?:-?\.?\d|\.)+/gi, _numExp = /[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g, _numWithUnitExp = /[-+=.]*\d+[.e-]*\d*[a-z%]*/g, _complexStringNumExp = /[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi, _relExp = /[+-]=-?[.\d]+/, _delimitedValueExp = /[^,'"\[\]\s]+/gi, _unitExp = /^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i, _globalTimeline, _win$1, _coreInitted, _doc$1, _globals = {}, _installScope = {}, _coreReady, _install = function _install2(scope) {
25778
- return (_installScope = _merge(scope, _globals)) && gsap;
25754
+ return (_installScope = _merge(scope, _globals)) && gsap$1;
25779
25755
  }, _missingPlugin = function _missingPlugin2(property, value) {
25780
25756
  return console.warn("Invalid property", property, "set to", value, "Missing plugin? gsap.registerPlugin()");
25781
25757
  }, _warn = function _warn2(message, suppress) {
@@ -26403,7 +26379,7 @@ void main(void)\r
26403
26379
  name = (name === "css" ? "CSS" : name.charAt(0).toUpperCase() + name.substr(1)) + "Plugin";
26404
26380
  }
26405
26381
  _addGlobal(name, Plugin);
26406
- config.register && config.register(gsap, Plugin, PropTween);
26382
+ config.register && config.register(gsap$1, Plugin, PropTween);
26407
26383
  } else {
26408
26384
  _registerPluginQueue.push(config);
26409
26385
  }
@@ -26580,8 +26556,8 @@ void main(void)\r
26580
26556
  if (!_coreInitted && _windowExists$1()) {
26581
26557
  _win$1 = _coreInitted = window;
26582
26558
  _doc$1 = _win$1.document || {};
26583
- _globals.gsap = gsap;
26584
- (_win$1.gsapVersions || (_win$1.gsapVersions = [])).push(gsap.version);
26559
+ _globals.gsap = gsap$1;
26560
+ (_win$1.gsapVersions || (_win$1.gsapVersions = [])).push(gsap$1.version);
26585
26561
  _install(_installScope || _win$1.GreenSockGlobals || !_win$1.gsap && _win$1 || {});
26586
26562
  _registerPluginQueue.forEach(_createPlugin);
26587
26563
  }
@@ -28447,7 +28423,7 @@ void main(void)\r
28447
28423
  target = toArray(target);
28448
28424
  if (target.length > 1) {
28449
28425
  var setters = target.map(function(t2) {
28450
- return gsap.quickSetter(t2, property, unit);
28426
+ return gsap$1.quickSetter(t2, property, unit);
28451
28427
  }), l2 = setters.length;
28452
28428
  return function(value) {
28453
28429
  var i2 = l2;
@@ -28470,7 +28446,7 @@ void main(void)\r
28470
28446
  },
28471
28447
  quickTo: function quickTo(target, property, vars) {
28472
28448
  var _merge2;
28473
- var tween = gsap.to(target, _merge((_merge2 = {}, _merge2[property] = "+=0.1", _merge2.paused = true, _merge2), vars || {})), func = function func2(value, start, startIsRelative) {
28449
+ var tween = gsap$1.to(target, _merge((_merge2 = {}, _merge2[property] = "+=0.1", _merge2.paused = true, _merge2), vars || {})), func = function func2(value, start, startIsRelative) {
28474
28450
  return tween.resetTo(property, value, start, startIsRelative);
28475
28451
  };
28476
28452
  func.tween = tween;
@@ -28656,7 +28632,7 @@ void main(void)\r
28656
28632
  }
28657
28633
  };
28658
28634
  };
28659
- var gsap = _gsap.registerPlugin({
28635
+ var gsap$1 = _gsap.registerPlugin({
28660
28636
  name: "attr",
28661
28637
  init: function init2(target, vars, tween, index, targets) {
28662
28638
  var p2, pt, v2;
@@ -28685,7 +28661,7 @@ void main(void)\r
28685
28661
  }
28686
28662
  }
28687
28663
  }, _buildModifierPlugin("roundProps", _roundModifier), _buildModifierPlugin("modifiers"), _buildModifierPlugin("snap", snap)) || _gsap;
28688
- Tween.version = Timeline$1.version = gsap.version = "3.12.5";
28664
+ Tween.version = Timeline$1.version = gsap$1.version = "3.12.5";
28689
28665
  _coreReady = 1;
28690
28666
  _windowExists$1() && _wake();
28691
28667
  _easeMap.Power0;
@@ -28813,7 +28789,7 @@ void main(void)\r
28813
28789
  revert: _revertStyle,
28814
28790
  save: _saveStyle
28815
28791
  };
28816
- target._gsap || gsap.core.getCache(target);
28792
+ target._gsap || gsap$1.core.getCache(target);
28817
28793
  properties && properties.split(",").forEach(function(p2) {
28818
28794
  return saver.save(p2);
28819
28795
  });
@@ -28846,7 +28822,7 @@ void main(void)\r
28846
28822
  _transformOriginProp = _transformProp + "Origin";
28847
28823
  _tempDiv.style.cssText = "border-width:0;line-height:0;position:absolute;padding:0";
28848
28824
  _supports3D = !!_checkPropPrefix("perspective");
28849
- _reverting = gsap.core.reverting;
28825
+ _reverting = gsap$1.core.reverting;
28850
28826
  _pluginInitted = 1;
28851
28827
  }
28852
28828
  }, _getBBoxHack = function _getBBoxHack2(swapIfPossible) {
@@ -29720,8 +29696,8 @@ void main(void)\r
29720
29696
  _getMatrix
29721
29697
  }
29722
29698
  };
29723
- gsap.utils.checkPrefix = _checkPropPrefix;
29724
- gsap.core.getStyleSaver = _getStyleSaver;
29699
+ gsap$1.utils.checkPrefix = _checkPropPrefix;
29700
+ gsap$1.core.getStyleSaver = _getStyleSaver;
29725
29701
  (function(positionAndScale, rotation, others, aliases) {
29726
29702
  var all = _forEachName(positionAndScale + "," + rotation + "," + others, function(name) {
29727
29703
  _transformProps[name] = 1;
@@ -29739,8 +29715,8 @@ void main(void)\r
29739
29715
  _forEachName("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective", function(name) {
29740
29716
  _config.units[name] = "px";
29741
29717
  });
29742
- gsap.registerPlugin(CSSPlugin);
29743
- var gsapWithCSS = gsap.registerPlugin(CSSPlugin) || gsap;
29718
+ gsap$1.registerPlugin(CSSPlugin);
29719
+ var gsapWithCSS = gsap$1.registerPlugin(CSSPlugin) || gsap$1;
29744
29720
  gsapWithCSS.core.Tween;
29745
29721
  class LibPixiRectBgColor extends Graphics {
29746
29722
  constructor(options) {
@@ -55056,6 +55032,69 @@ void main(void){
55056
55032
  this.endFill();
55057
55033
  }
55058
55034
  }
55035
+ const libJsNumComma = (num, reserve = 2) => {
55036
+ const str = num.toFixed(reserve).toString();
55037
+ const reg = str.indexOf(".") > -1 ? /(\d)(?=(\d{3})+\.)/g : /(\d)(?=(?:\d{3})+$)/g;
55038
+ return str.replace(reg, "$1,");
55039
+ };
55040
+ const LibPixiDigitalIncreasingAnimation = (params) => {
55041
+ const { value, onChange, onComplete, startValue = 0, duration = 4 } = params;
55042
+ const animatedValue = { value: startValue };
55043
+ gsap.killTweensOf(animatedValue);
55044
+ const amountAnimation = gsap.to(animatedValue, {
55045
+ value,
55046
+ duration,
55047
+ ease: "linear",
55048
+ onUpdate: () => {
55049
+ onChange(libJsNumComma(animatedValue.value, 2));
55050
+ },
55051
+ onComplete
55052
+ });
55053
+ return () => {
55054
+ amountAnimation.progress(1);
55055
+ };
55056
+ };
55057
+ const LibPixiDownScaleAnimation = (container) => {
55058
+ libPixiEvent(container, "pointerdown", () => {
55059
+ gsap.to(container, {
55060
+ duration: 0.1,
55061
+ pixi: {
55062
+ scale: 1.1
55063
+ }
55064
+ });
55065
+ });
55066
+ libPixiEvent(container, "pointerup", () => {
55067
+ gsap.to(container, {
55068
+ duration: 0.1,
55069
+ pixi: {
55070
+ scale: 1
55071
+ }
55072
+ });
55073
+ });
55074
+ libPixiEvent(container, "pointerleave", () => {
55075
+ gsap.to(container, {
55076
+ duration: 0.1,
55077
+ pixi: {
55078
+ scale: 1
55079
+ }
55080
+ });
55081
+ });
55082
+ };
55083
+ const LibPixiGridLayout = (items, gap, cols = items.length) => {
55084
+ let lastX = 0;
55085
+ items.forEach((item, index) => {
55086
+ const itemWidth = item.width || 0;
55087
+ const itemHeight = item.height || 0;
55088
+ const colIndex = index % cols;
55089
+ const rowIndex = Math.floor(index / cols);
55090
+ item.x = colIndex === 0 ? 0 : lastX + gap;
55091
+ item.y = rowIndex * (itemHeight + gap);
55092
+ lastX = item.x + itemWidth;
55093
+ if (colIndex === cols - 1) {
55094
+ lastX = 0;
55095
+ }
55096
+ });
55097
+ };
55059
55098
  const Components = {
55060
55099
  Base: {
55061
55100
  /** @description 自定义位图文本
@@ -55223,7 +55262,26 @@ void main(void){
55223
55262
  /** @description 多边形绘制工具,绘制时浏览器窗口需要全屏显示,空格键控制开始和结束,开始后鼠标进行点击绘制,退格删除点,空格结束绘制,绘制结果在控制台打印,不满意可再次按空格清空并重新绘制
55224
55263
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiPolygonDrawTool-多边形绘制
55225
55264
  */
55226
- LibPixiPolygonDrawTool
55265
+ LibPixiPolygonDrawTool,
55266
+ /** @description 数值递增动画
55267
+ * @param params 动画参数
55268
+ * @returns 设置为目标值并停止动画
55269
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDigitalIncreasingAnimation-递增动画
55270
+ */
55271
+ LibPixiDigitalIncreasingAnimation,
55272
+ /** @description 按下放大
55273
+ * @param container 要放大的容器
55274
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiDownScaleAnimation-按下放大
55275
+ */
55276
+ LibPixiDownScaleAnimation,
55277
+ /**
55278
+ * @description 将元素按照指定的列数和间隔排列成网格布局。
55279
+ * @param items 要排列的元素数组
55280
+ * @param gap 每个元素之间的间隔
55281
+ * @param cols 网格的列数,默认为元素数量
55282
+ * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiGridLayout-网格布局
55283
+ */
55284
+ LibPixiGridLayout
55227
55285
  };
55228
55286
  const LibPixiJs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
55229
55287
  __proto__: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lyb-pixi-js",
3
- "version": "1.8.11",
3
+ "version": "1.9.0",
4
4
  "description": "自用Pixi.JS方法库",
5
5
  "license": "ISC",
6
6
  "exports": {