lyb-pixi-js 1.12.1 → 1.12.2

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.
@@ -6,6 +6,8 @@ export interface LibPixiTextParams {
6
6
  fontSize?: number;
7
7
  /** 字体颜色 */
8
8
  fontColor?: any;
9
+ /** 渐变方向 */
10
+ gradientDirection?: "v" | "h";
9
11
  /** 描边颜色 */
10
12
  stroke?: string | number;
11
13
  /** 描边宽度 */
@@ -1,10 +1,10 @@
1
- import { Text, TextStyle, } from "pixi.js";
1
+ import { Text, TEXT_GRADIENT, TextStyle, } from "pixi.js";
2
2
  /** @description 自定义文本类
3
3
  * @link 使用方法:https://www.npmjs.com/package/lyb-pixi-js#LibPixiText-文本
4
4
  */
5
5
  export class LibPixiText extends Text {
6
6
  constructor(options) {
7
- const { text, fontSize = 36, fontColor = 0xffffff, stroke, strokeThickness, fontFamily = "Arial", fontWeight = "normal", wordWrapWidth, lineHeight = 1, align = "left", indent = 0, shadow, } = options;
7
+ const { text, fontSize = 36, fontColor = 0xffffff, stroke, strokeThickness, fontFamily = "Arial", fontWeight = "normal", wordWrapWidth, lineHeight = 1, align = "left", indent = 0, shadow, gradientDirection, } = options;
8
8
  const style = new TextStyle({
9
9
  fontSize,
10
10
  wordWrap: !!wordWrapWidth,
@@ -18,6 +18,9 @@ export class LibPixiText extends Text {
18
18
  stroke: stroke ? stroke : "transparent",
19
19
  strokeThickness: strokeThickness ? strokeThickness : 0,
20
20
  lineJoin: "round",
21
+ fillGradientType: gradientDirection === "h"
22
+ ? TEXT_GRADIENT.LINEAR_HORIZONTAL
23
+ : TEXT_GRADIENT.LINEAR_VERTICAL,
21
24
  });
22
25
  if (shadow) {
23
26
  style.dropShadow = true;
package/lyb-pixi.js CHANGED
@@ -31841,7 +31841,8 @@ void main(void)\r
31841
31841
  lineHeight = 1,
31842
31842
  align = "left",
31843
31843
  indent = 0,
31844
- shadow
31844
+ shadow,
31845
+ gradientDirection
31845
31846
  } = options;
31846
31847
  const style = new TextStyle({
31847
31848
  fontSize,
@@ -31855,7 +31856,8 @@ void main(void)\r
31855
31856
  fontFamily: LibPixiText.fontFamily || fontFamily,
31856
31857
  stroke: stroke ? stroke : "transparent",
31857
31858
  strokeThickness: strokeThickness ? strokeThickness : 0,
31858
- lineJoin: "round"
31859
+ lineJoin: "round",
31860
+ fillGradientType: gradientDirection === "h" ? TEXT_GRADIENT.LINEAR_HORIZONTAL : TEXT_GRADIENT.LINEAR_VERTICAL
31859
31861
  });
31860
31862
  if (shadow) {
31861
31863
  style.dropShadow = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lyb-pixi-js",
3
- "version": "1.12.1",
3
+ "version": "1.12.2",
4
4
  "description": "自用Pixi.JS方法库",
5
5
  "license": "ISC",
6
6
  "exports": {