@galacean/effects-specification 2.2.0-alpha.3 → 2.2.0-alpha.5

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/es/assets.d.ts CHANGED
@@ -68,12 +68,6 @@ export interface Image extends AssetBase {
68
68
  * @default false
69
69
  */
70
70
  mipmap?: boolean;
71
- /**
72
- * 图片 Y 轴的方向,如果 Y 轴向上(与 OpenGL 相同)则为 1
73
- * 如果 Y 轴向下(与 OpenGL 相反)则为 -1,图片再绘制数据模板的时候需要翻转绘制
74
- * @default 1
75
- */
76
- oriY?: 1 | -1;
77
71
  }
78
72
  /**
79
73
  * 模板贴图属性
package/es/index.d.ts CHANGED
@@ -40,4 +40,4 @@ export * from './material-data';
40
40
  export * from './geometry-data';
41
41
  export * from './shader-data';
42
42
  export * from './effects-package-data';
43
- export declare const LATEST_VERSION = JSONSceneVersion['3_1'];
43
+ export declare const LATEST_VERSION = JSONSceneVersion['3_2'];
@@ -1,7 +1,8 @@
1
1
  import type { BinaryEnv } from '../binary';
2
+ import type { DataPath } from '../components';
2
3
  import type { Vector2Data, Vector3Data } from '../math';
3
4
  import type { vec3, vec4 } from '../number-expression';
4
- import type { ItemType, RenderLevel } from '../type';
5
+ import type { ItemType, ObscuredMode, RenderLevel } from '../type';
5
6
  import type { CameraContent } from './camera-item';
6
7
  import type { CompositionContent } from './composition-item';
7
8
  import type { EffectContent } from './effect-item';
@@ -38,6 +39,25 @@ export declare enum EndBehavior {
38
39
  export declare enum ParentItemEndBehavior {
39
40
  destroyChildren = 6
40
41
  }
42
+ /**
43
+ * 元素被遮挡/反向遮挡,需要时传入
44
+ */
45
+ export interface ObscuredOptions {
46
+ mode: ObscuredMode;
47
+ /**
48
+ * 指向作为蒙版的组件
49
+ */
50
+ ref: DataPath;
51
+ }
52
+ /**
53
+ * 元素的蒙版行为
54
+ */
55
+ export interface MaskOptions {
56
+ /**
57
+ * 是否作为蒙版
58
+ */
59
+ mask?: boolean;
60
+ }
41
61
  export interface BaseItem {
42
62
  /**
43
63
  * 元素 id
@@ -1,6 +1,6 @@
1
1
  import type { ComponentData, DataPath } from '../components';
2
2
  import type { ItemType, PositionOverLifetime, RotationOverLifetime, SizeOverLifetime } from '../type';
3
- import type { BaseItem, EndBehavior } from './base-item';
3
+ import type { BaseItem, EndBehavior, ObscuredOptions } from './base-item';
4
4
  /**
5
5
  * 特效元素
6
6
  */
@@ -38,4 +38,8 @@ export interface EffectComponentData extends ComponentData {
38
38
  _priority: number;
39
39
  materials: DataPath[];
40
40
  geometry: DataPath;
41
+ /**
42
+ * 特效元素蒙版属性,传入表示需要被遮挡/反向遮挡
43
+ */
44
+ mask?: ObscuredOptions;
41
45
  }
@@ -1,6 +1,6 @@
1
1
  import type { ItemType, RendererOptions, TextureSheetAnimation, BlendingMode, SplitParameter } from '../type';
2
2
  import type { FixedNumberExpression, NumberExpression, GradientColor, vec3, FixedVec3Expression, ColorExpression, FunctionExpression } from '../number-expression';
3
- import type { BaseItem, EndBehavior } from './base-item';
3
+ import type { BaseItem, EndBehavior, ObscuredOptions } from './base-item';
4
4
  import type { ParticleShape } from './particle-shape';
5
5
  import type { ComponentData, DataPath } from '../components';
6
6
  /**
@@ -277,6 +277,10 @@ export interface ParticleContent {
277
277
  * 粒子元素材质渲染属性
278
278
  */
279
279
  renderer: RendererOptions;
280
+ /**
281
+ * 粒子元素蒙版属性,传入表示需要被遮挡/反向遮挡
282
+ */
283
+ mask?: ObscuredOptions;
280
284
  /**
281
285
  * 粒子元素发射器形状属性
282
286
  */
@@ -1,12 +1,13 @@
1
- import type { BaseItem, EndBehavior } from './base-item';
1
+ import type { BaseItem, EndBehavior, MaskOptions } from './base-item';
2
2
  import type { ItemType } from '../type';
3
3
  import type { BaseTextContentOptions, TextComponentData, TextContent } from './text-item';
4
+ import type { vec2 } from '../number-expression';
4
5
  /**
5
6
  * 富文本元素
6
7
  */
7
8
  export interface RichTextItem extends BaseItem {
8
9
  /**
9
- * 元素类型(指定为 text
10
+ * 元素类型(指定为 richtext
10
11
  */
11
12
  type: ItemType.richtext;
12
13
  /**
@@ -16,13 +17,22 @@ export interface RichTextItem extends BaseItem {
16
17
  endBehavior: EndBehavior;
17
18
  }
18
19
  /**
19
- * 文本元素渲染属性
20
+ * 富文本元素参数
21
+ */
22
+ export interface RichTextContentOptions extends BaseTextContentOptions {
23
+ /**
24
+ * 富文本元素大小
25
+ */
26
+ size?: vec2;
27
+ }
28
+ /**
29
+ * 富文本元素渲染属性
20
30
  */
21
31
  export interface RichTextContent extends Omit<TextContent, 'options'> {
22
32
  /**
23
- * 文本元素基础属性
33
+ * 富文本元素基础属性
24
34
  */
25
- options: BaseTextContentOptions;
35
+ options: RichTextContentOptions;
26
36
  }
27
37
  /**
28
38
  * 富文本元素渲染属性
@@ -31,5 +41,9 @@ export interface RichTextComponentData extends Omit<TextComponentData, 'options'
31
41
  /**
32
42
  * 富文本元素基础属性
33
43
  */
34
- options: BaseTextContentOptions;
44
+ options: RichTextContentOptions;
45
+ /**
46
+ * 富文本元素蒙版属性,传入表示需要作为蒙版/被遮挡/反向遮挡
47
+ */
48
+ mask?: MaskOptions;
35
49
  }
@@ -1,8 +1,8 @@
1
1
  import type { BinaryPointer } from '../binary';
2
2
  import type { ComponentData, DataPath } from '../components';
3
3
  import type { DataType } from '../data-type';
4
- import type { SizeOverLifetime, RotationOverLifetime, PositionOverLifetime, ColorOverLifetime, RendererOptions, ItemType, MaskMode, RenderMode } from '../type';
5
- import type { BaseItem, EndBehavior } from './base-item';
4
+ import type { SizeOverLifetime, RotationOverLifetime, PositionOverLifetime, ColorOverLifetime, RendererOptions, ItemType, RenderMode } from '../type';
5
+ import type { BaseItem, EndBehavior, ObscuredOptions } from './base-item';
6
6
  /**
7
7
  * 插件元素
8
8
  */
@@ -121,6 +121,9 @@ export interface SpineComponent extends ComponentData {
121
121
  };
122
122
  renderer?: {
123
123
  renderMode: RenderMode;
124
- maskMode: MaskMode;
125
124
  };
125
+ /**
126
+ * Spine 元素蒙版属性,传入表示需要被遮挡/反向遮挡
127
+ */
128
+ mask?: ObscuredOptions;
126
129
  }
@@ -1,4 +1,4 @@
1
- import type { BaseItem, EndBehavior } from './base-item';
1
+ import type { BaseItem, EndBehavior, MaskOptions, ObscuredOptions } from './base-item';
2
2
  import type { SizeOverLifetime, RotationOverLifetime, PositionOverLifetime, ColorOverLifetime, ItemType, TextureSheetAnimation, RendererOptions, SplitParameter, InteractBehavior } from '../type';
3
3
  import type { RGBAColorValue } from '../number-expression';
4
4
  import type { ComponentData } from '../components';
@@ -40,6 +40,10 @@ export interface SpriteContent {
40
40
  * 图层元素材质渲染属性
41
41
  */
42
42
  renderer: RendererOptions;
43
+ /**
44
+ * 图层元素蒙版属性,传入表示需要作为蒙版/被遮挡/反向遮挡
45
+ */
46
+ mask?: MaskOptions | ObscuredOptions;
43
47
  /**
44
48
  * 图层元素大小变化属性
45
49
  */
@@ -1,4 +1,4 @@
1
- import type { BaseItem, EndBehavior } from './base-item';
1
+ import type { BaseItem, EndBehavior, MaskOptions, ObscuredOptions } from './base-item';
2
2
  import type { SizeOverLifetime, RotationOverLifetime, PositionOverLifetime, ColorOverLifetime, ItemType, TextureSheetAnimation, RendererOptions, InteractBehavior } from '../type';
3
3
  import type { RGBAColorValue } from '../number-expression';
4
4
  import type { FontStyle, TextAlignment, TextBaseline, TextOverflow, TextWeight } from '../text';
@@ -18,11 +18,6 @@ export interface TextItem extends BaseItem {
18
18
  endBehavior: EndBehavior;
19
19
  }
20
20
  export interface TextContentOptions extends BaseTextContentOptions {
21
- /**
22
- * 文本间隔
23
- * @default 0
24
- */
25
- letterSpace?: number;
26
21
  /**
27
22
  * 文本固定宽度(和自适应宽高冲突)
28
23
  * @default 31
@@ -43,14 +38,13 @@ export interface TextContentOptions extends BaseTextContentOptions {
43
38
  * @default false
44
39
  */
45
40
  autoWidth?: boolean;
46
- /**
47
- * 当文字超过最大宽度时,文字的表现行为
48
- * 仅当设置文字最大宽度后生效
49
- * @default TextOverflow.display
50
- */
51
- textOverflow?: TextOverflow;
52
41
  }
53
42
  export interface BaseTextContentOptions {
43
+ /**
44
+ * 文本间隔
45
+ * @default 0
46
+ */
47
+ letterSpace?: number;
54
48
  /**
55
49
  * 文本内容
56
50
  */
@@ -93,7 +87,7 @@ export interface BaseTextContentOptions {
93
87
  /**
94
88
  * 当文字超过最大宽度时,文字的表现行为
95
89
  * 仅当设置文字最大宽度后生效
96
- * @default TextOverflow.display
90
+ * @default TextOverflow.clip
97
91
  */
98
92
  textOverflow?: TextOverflow;
99
93
  /**
@@ -149,6 +143,10 @@ export interface TextContent {
149
143
  * 文本元素材质渲染属性
150
144
  */
151
145
  renderer: RendererOptions;
146
+ /**
147
+ * 文本元素蒙版属性,传入表示需要作为蒙版/被遮挡/反向遮挡
148
+ */
149
+ mask?: MaskOptions | ObscuredOptions;
152
150
  /**
153
151
  * 文本元素大小变化属性
154
152
  */
@@ -1,7 +1,7 @@
1
1
  import type { ComponentData, DataPath } from '../components';
2
2
  import type { RGBAColorValue } from '../number-expression';
3
3
  import type { SizeOverLifetime, RotationOverLifetime, PositionOverLifetime, ColorOverLifetime, InteractBehavior, RendererOptions, ItemType } from '../type';
4
- import type { BaseItem, EndBehavior } from './base-item';
4
+ import type { BaseItem, EndBehavior, ObscuredOptions } from './base-item';
5
5
  /**
6
6
  * 视频元素
7
7
  */
@@ -59,6 +59,10 @@ export interface VideoComponentData extends ComponentData {
59
59
  * 视频元素材质渲染属性
60
60
  */
61
61
  renderer: RendererOptions;
62
+ /**
63
+ * 视频元素蒙版属性,传入表示需要被遮挡/反向遮挡
64
+ */
65
+ mask?: ObscuredOptions;
62
66
  /**
63
67
  * 视频元素大小变化属性
64
68
  */
package/es/scene.d.ts CHANGED
@@ -30,7 +30,8 @@ export declare enum JSONSceneVersion {
30
30
  '2_4' = "2.4",// 支持贝塞尔曲线
31
31
  '3_0' = "3.0",// EC 改造、移除滤镜元素
32
32
  '3_1' = "3.1",// 音视频
33
- 'LATEST' = "3.1"
33
+ '3_2' = "3.2",// 矢量动画、透明视频、增加富文本属性
34
+ 'LATEST' = "3.2"
34
35
  }
35
36
  /**
36
37
  * runtime 2.0 之前的场景信息
package/es/scene.js CHANGED
@@ -16,5 +16,6 @@ export var JSONSceneVersion;
16
16
  JSONSceneVersion["2_4"] = "2.4";
17
17
  JSONSceneVersion["3_0"] = "3.0";
18
18
  JSONSceneVersion["3_1"] = "3.1";
19
- JSONSceneVersion["LATEST"] = "3.1";
19
+ JSONSceneVersion["3_2"] = "3.2";
20
+ JSONSceneVersion["LATEST"] = "3.2";
20
21
  })(JSONSceneVersion || (JSONSceneVersion = {}));
@@ -1,7 +1,6 @@
1
1
  import type { TransformData } from '../item/base-item';
2
2
  import type { Vector2Data } from '../math';
3
3
  import type { ShapeComponentData } from './shape-component-data';
4
- import type { ShapeFillParam } from './shape-fill-param';
5
4
  import type { ShapePrimitiveType } from './shape-primitive-type';
6
5
  /**
7
6
  * 自定义形状点
@@ -32,10 +31,6 @@ export interface CustomShape {
32
31
  * 是否为闭合图形 - 用于Stroke
33
32
  */
34
33
  close: boolean;
35
- /**
36
- * 填充属性
37
- */
38
- fill?: ShapeFillParam;
39
34
  /**
40
35
  * 空间变换
41
36
  */
@@ -1,6 +1,5 @@
1
1
  import type { TransformData } from '../item/base-item';
2
2
  import type { ShapeComponentData } from './shape-component-data';
3
- import type { ShapeFillParam } from './shape-fill-param';
4
3
  import type { ShapePrimitiveType } from './shape-primitive-type';
5
4
  /**
6
5
  * 椭圆组件参数
@@ -17,10 +16,6 @@ export interface EllipseData extends ShapeComponentData {
17
16
  * y 轴半径
18
17
  */
19
18
  yRadius: number;
20
- /**
21
- * 填充属性
22
- */
23
- fill?: ShapeFillParam;
24
19
  /**
25
20
  * 空间变换
26
21
  */
@@ -1,6 +1,5 @@
1
1
  import type { TransformData } from '../item/base-item';
2
2
  import type { ShapeComponentData } from './shape-component-data';
3
- import type { ShapeFillParam } from './shape-fill-param';
4
3
  /**
5
4
  * 多边形参数
6
5
  */
@@ -17,10 +16,6 @@ export interface PolygonData extends ShapeComponentData {
17
16
  * 角点圆度
18
17
  */
19
18
  roundness: number;
20
- /**
21
- * 填充属性
22
- */
23
- fill?: ShapeFillParam;
24
19
  /**
25
20
  * 空间变换
26
21
  */
@@ -1,6 +1,5 @@
1
1
  import type { TransformData } from '../item/base-item';
2
2
  import type { ShapeComponentData } from './shape-component-data';
3
- import type { ShapeFillParam } from './shape-fill-param';
4
3
  /**
5
4
  * 矩形参数
6
5
  */
@@ -17,10 +16,6 @@ export interface RectangleData extends ShapeComponentData {
17
16
  * 角点元素
18
17
  */
19
18
  roundness: number;
20
- /**
21
- * 填充属性
22
- */
23
- fill?: ShapeFillParam;
24
19
  /**
25
20
  * 空间变换
26
21
  */
@@ -1,4 +1,5 @@
1
1
  import type { ComponentData } from '../components/component-data';
2
+ import type { ShapeFillParam } from './shape-fill-param';
2
3
  import type { ShapePrimitiveType } from './shape-primitive-type';
3
4
  import type { ShapeStrokeParam } from './shape-stroke-param';
4
5
  /**
@@ -13,4 +14,8 @@ export interface ShapeComponentData extends ComponentData {
13
14
  * 描边属性
14
15
  */
15
16
  stroke?: ShapeStrokeParam;
17
+ /**
18
+ * 填充属性
19
+ */
20
+ fill?: ShapeFillParam;
16
21
  }
@@ -1,7 +1,19 @@
1
1
  import type { ColorData } from '../math/color-data';
2
- export declare enum ShapeConnectType {
2
+ export declare enum LineCap {
3
+ /** 默认值。向线条的每个末端添加平直的边缘 */
4
+ Butt = 0,
5
+ /** 向线条的每个末端添加圆形线帽 */
6
+ Round = 1,
7
+ /** 向线条的每个末端添加正方形线帽 */
8
+ Square = 2
3
9
  }
4
- export declare enum ShapePointType {
10
+ export declare enum LineJoin {
11
+ /** 创建圆角 */
12
+ Round = 0,
13
+ /** 创建斜角 */
14
+ Bevel = 1,
15
+ /** 创建尖角 */
16
+ Miter = 2
5
17
  }
6
18
  /**
7
19
  * 矢量描边参数
@@ -16,11 +28,11 @@ export interface ShapeStrokeParam {
16
28
  */
17
29
  color: ColorData;
18
30
  /**
19
- * 连接类型
31
+ * 线段端点的样式
20
32
  */
21
- connectType: ShapeConnectType;
33
+ cap: LineCap;
22
34
  /**
23
- * 点类型
35
+ * 线段连接处的样式
24
36
  */
25
- pointType: ShapePointType;
37
+ join: LineJoin;
26
38
  }
@@ -1,8 +1,18 @@
1
- // 本期无该功能 待补充
2
- export var ShapeConnectType;
3
- (function (ShapeConnectType) {
4
- })(ShapeConnectType || (ShapeConnectType = {}));
5
- // @待补充
6
- export var ShapePointType;
7
- (function (ShapePointType) {
8
- })(ShapePointType || (ShapePointType = {}));
1
+ export var LineCap;
2
+ (function (LineCap) {
3
+ /** 默认值。向线条的每个末端添加平直的边缘 */
4
+ LineCap[LineCap["Butt"] = 0] = "Butt";
5
+ /** 向线条的每个末端添加圆形线帽 */
6
+ LineCap[LineCap["Round"] = 1] = "Round";
7
+ /** 向线条的每个末端添加正方形线帽 */
8
+ LineCap[LineCap["Square"] = 2] = "Square";
9
+ })(LineCap || (LineCap = {}));
10
+ export var LineJoin;
11
+ (function (LineJoin) {
12
+ /** 创建圆角 */
13
+ LineJoin[LineJoin["Round"] = 0] = "Round";
14
+ /** 创建斜角 */
15
+ LineJoin[LineJoin["Bevel"] = 1] = "Bevel";
16
+ /** 创建尖角 */
17
+ LineJoin[LineJoin["Miter"] = 2] = "Miter";
18
+ })(LineJoin || (LineJoin = {}));
@@ -1,6 +1,5 @@
1
1
  import type { TransformData } from '../item/base-item';
2
2
  import type { ShapeComponentData } from './shape-component-data';
3
- import type { ShapeFillParam } from './shape-fill-param';
4
3
  /**
5
4
  * 星形参数
6
5
  */
@@ -25,10 +24,6 @@ export interface StarData extends ShapeComponentData {
25
24
  * 外径点圆度
26
25
  */
27
26
  outerRoundness: number;
28
- /**
29
- * 填充属性
30
- */
31
- fill?: ShapeFillParam;
32
27
  /**
33
28
  * 空间变换
34
29
  */
package/es/text.d.ts CHANGED
@@ -52,7 +52,7 @@ export interface FontBase {
52
52
  }
53
53
  export declare enum TextOverflow {
54
54
  /**
55
- * display 模式下,会显示所有文本,存在文本超过边界框的情况。
55
+ * display 模式下,会显示所有文本,文本大小会根据边界框调整。
56
56
  */
57
57
  display = 0,
58
58
  /**
package/es/text.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export var TextOverflow;
2
2
  (function (TextOverflow) {
3
3
  /**
4
- * display 模式下,会显示所有文本,存在文本超过边界框的情况。
4
+ * display 模式下,会显示所有文本,文本大小会根据边界框调整。
5
5
  */
6
6
  TextOverflow[TextOverflow["display"] = 0] = "display";
7
7
  /**
package/es/type.d.ts CHANGED
@@ -294,17 +294,12 @@ export declare enum SideMode {
294
294
  BACK = 1029
295
295
  }
296
296
  /**
297
- * 蒙版模式
297
+ * 元素是否被蒙版遮挡/反向遮挡
298
298
  */
299
- export declare enum MaskMode {
299
+ export declare enum ObscuredMode {
300
300
  /**
301
- * 无蒙版
302
- */
303
- NONE = 0,
304
- /**
305
- * 蒙版
301
+ *
306
302
  */
307
- MASK = 1,
308
303
  /**
309
304
  * 被遮挡
310
305
  */
@@ -446,11 +441,6 @@ export interface RendererOptions {
446
441
  * 贴图,索引到 scene 中的 images 数组
447
442
  */
448
443
  texture?: DataPath;
449
- /**
450
- * 蒙版模式
451
- * @default none
452
- */
453
- maskMode?: MaskMode;
454
444
  /**
455
445
  * 蒙版形状,索引到 scene 的 shapes 中
456
446
  */
package/es/type.js CHANGED
@@ -69,27 +69,27 @@ export var SideMode;
69
69
  SideMode[SideMode["BACK"] = 1029] = "BACK";
70
70
  })(SideMode || (SideMode = {}));
71
71
  /**
72
- * 蒙版模式
72
+ * 元素是否被蒙版遮挡/反向遮挡
73
73
  */
74
- export var MaskMode;
75
- (function (MaskMode) {
74
+ export var ObscuredMode;
75
+ (function (ObscuredMode) {
76
76
  /**
77
- * 无蒙版
78
- */
79
- MaskMode[MaskMode["NONE"] = 0] = "NONE";
80
- /**
81
- * 蒙版
77
+ *
82
78
  */
83
- MaskMode[MaskMode["MASK"] = 1] = "MASK";
79
+ // NONE = 0,
80
+ // /**
81
+ // * 蒙版
82
+ // */
83
+ // MASK = 1,
84
84
  /**
85
85
  * 被遮挡
86
86
  */
87
- MaskMode[MaskMode["OBSCURED"] = 2] = "OBSCURED";
87
+ ObscuredMode[ObscuredMode["OBSCURED"] = 2] = "OBSCURED";
88
88
  /**
89
89
  * 被反向遮挡
90
90
  */
91
- MaskMode[MaskMode["REVERSE_OBSCURED"] = 3] = "REVERSE_OBSCURED";
92
- })(MaskMode || (MaskMode = {}));
91
+ ObscuredMode[ObscuredMode["REVERSE_OBSCURED"] = 3] = "REVERSE_OBSCURED";
92
+ })(ObscuredMode || (ObscuredMode = {}));
93
93
  /**
94
94
  * 发射器形状
95
95
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-specification",
3
- "version": "2.2.0-alpha.3",
3
+ "version": "2.2.0-alpha.5",
4
4
  "description": "Galacean Effects JSON Specification",
5
5
  "module": "./es/index.js",
6
6
  "main": "./es/index.js",