@galacean/effects-specification 2.2.0 → 2.3.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/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_2'];
43
+ export declare const LATEST_VERSION = JSONSceneVersion['3_3'];
@@ -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';
@@ -35,8 +36,24 @@ export declare enum EndBehavior {
35
36
  */
36
37
  freeze = 4
37
38
  }
38
- export declare enum ParentItemEndBehavior {
39
- destroyChildren = 6
39
+ /**
40
+ * 元素被遮挡/反向遮挡,需要时传入
41
+ */
42
+ export interface ObscuredOptions {
43
+ mode: ObscuredMode;
44
+ /**
45
+ * 指向作为蒙版的组件
46
+ */
47
+ ref: DataPath;
48
+ }
49
+ /**
50
+ * 元素的蒙版行为
51
+ */
52
+ export interface MaskOptions {
53
+ /**
54
+ * 是否作为蒙版
55
+ */
56
+ mask?: boolean;
40
57
  }
41
58
  export interface BaseItem {
42
59
  /**
@@ -75,7 +92,7 @@ export interface BaseItem {
75
92
  * 元素结束行为
76
93
  * @default destroy
77
94
  */
78
- endBehavior: EndBehavior | ParentItemEndBehavior;
95
+ endBehavior: EndBehavior;
79
96
  /**
80
97
  * 元素播放延时(单位秒)
81
98
  * @default 0
@@ -1,4 +1,4 @@
1
- import { END_BEHAVIOR_DESTROY, END_BEHAVIOR_DESTROY_CHILDREN, END_BEHAVIOR_FORWARD, END_BEHAVIOR_FREEZE, END_BEHAVIOR_RESTART, } from '../constants';
1
+ import { END_BEHAVIOR_DESTROY, END_BEHAVIOR_FORWARD, END_BEHAVIOR_FREEZE, END_BEHAVIOR_RESTART, } from '../constants';
2
2
  /**
3
3
  * 结束行为
4
4
  */
@@ -21,7 +21,3 @@ export var EndBehavior;
21
21
  */
22
22
  EndBehavior[EndBehavior["freeze"] = 4] = "freeze";
23
23
  })(EndBehavior || (EndBehavior = {}));
24
- export var ParentItemEndBehavior;
25
- (function (ParentItemEndBehavior) {
26
- ParentItemEndBehavior[ParentItemEndBehavior["destroyChildren"] = 6] = "destroyChildren";
27
- })(ParentItemEndBehavior || (ParentItemEndBehavior = {}));
@@ -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
- import type { ItemType, RendererOptions, TextureSheetAnimation, BlendingMode, SplitParameter } from '../type';
1
+ import type { ItemType, RendererOptions, TextureSheetAnimation, BlendingMode, SplitParameter, ObscuredMode } 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
  */
@@ -413,4 +417,8 @@ export interface ParticleTrail {
413
417
  * 拖尾+图层绑定同一个父节点时使用
414
418
  */
415
419
  parentAffectsPosition?: boolean;
420
+ /**
421
+ * 拖尾蒙版属性,传入表示需要被遮挡/反向遮挡
422
+ */
423
+ mask?: ObscuredMode;
416
424
  }
@@ -1,4 +1,4 @@
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
4
  import type { vec2 } from '../number-expression';
@@ -42,4 +42,8 @@ export interface RichTextComponentData extends Omit<TextComponentData, 'options'
42
42
  * 富文本元素基础属性
43
43
  */
44
44
  options: RichTextContentOptions;
45
+ /**
46
+ * 富文本元素蒙版属性,传入表示需要作为蒙版/被遮挡/反向遮挡
47
+ */
48
+ mask?: MaskOptions;
45
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';
@@ -143,6 +143,10 @@ export interface TextContent {
143
143
  * 文本元素材质渲染属性
144
144
  */
145
145
  renderer: RendererOptions;
146
+ /**
147
+ * 文本元素蒙版属性,传入表示需要作为蒙版/被遮挡/反向遮挡
148
+ */
149
+ mask?: MaskOptions | ObscuredOptions;
146
150
  /**
147
151
  * 文本元素大小变化属性
148
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
@@ -31,7 +31,8 @@ export declare enum JSONSceneVersion {
31
31
  '3_0' = "3.0",// EC 改造、移除滤镜元素
32
32
  '3_1' = "3.1",// 音视频
33
33
  '3_2' = "3.2",// 矢量动画、透明视频、增加富文本属性
34
- 'LATEST' = "3.2"
34
+ '3_3' = "3.3",// 指向型蒙版、图片蒙版
35
+ 'LATEST' = "3.3"
35
36
  }
36
37
  /**
37
38
  * runtime 2.0 之前的场景信息
package/es/scene.js CHANGED
@@ -17,5 +17,6 @@ export var JSONSceneVersion;
17
17
  JSONSceneVersion["3_0"] = "3.0";
18
18
  JSONSceneVersion["3_1"] = "3.1";
19
19
  JSONSceneVersion["3_2"] = "3.2";
20
- JSONSceneVersion["LATEST"] = "3.2";
20
+ JSONSceneVersion["3_3"] = "3.3";
21
+ JSONSceneVersion["LATEST"] = "3.3";
21
22
  })(JSONSceneVersion || (JSONSceneVersion = {}));
@@ -1,4 +1,5 @@
1
1
  import type { ComponentData } from '../components/component-data';
2
+ import type { MaskOptions, ObscuredOptions } from '../item/base-item';
2
3
  import type { ShapeFillParam } from './shape-fill-param';
3
4
  import type { ShapePrimitiveType } from './shape-primitive-type';
4
5
  import type { ShapeStrokeParam } from './shape-stroke-param';
@@ -18,4 +19,8 @@ export interface ShapeComponentData extends ComponentData {
18
19
  * 填充属性
19
20
  */
20
21
  fill?: ShapeFillParam;
22
+ /**
23
+ * 蒙版属性,传入表示需要作为蒙版/被遮挡/反向遮挡
24
+ */
25
+ mask?: MaskOptions | ObscuredOptions;
21
26
  }
package/es/type.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { DataPath } from './components';
2
+ import type { ObscuredOptions, MaskOptions } from './item/base-item';
2
3
  import type { FixedVec3Expression, vec2, vec3, GradientColor, ShapePoints, ShapeSplits, FixedNumberExpression } from './number-expression';
3
4
  /**
4
5
  * 播放器版本
@@ -294,17 +295,12 @@ export declare enum SideMode {
294
295
  BACK = 1029
295
296
  }
296
297
  /**
297
- * 蒙版模式
298
+ * 元素是否被蒙版遮挡/反向遮挡
298
299
  */
299
- export declare enum MaskMode {
300
+ export declare enum ObscuredMode {
300
301
  /**
301
- * 无蒙版
302
- */
303
- NONE = 0,
304
- /**
305
- * 蒙版
302
+ *
306
303
  */
307
- MASK = 1,
308
304
  /**
309
305
  * 被遮挡
310
306
  */
@@ -446,11 +442,6 @@ export interface RendererOptions {
446
442
  * 贴图,索引到 scene 中的 images 数组
447
443
  */
448
444
  texture?: DataPath;
449
- /**
450
- * 蒙版模式
451
- * @default none
452
- */
453
- maskMode?: MaskMode;
454
445
  /**
455
446
  * 蒙版形状,索引到 scene 的 shapes 中
456
447
  */
@@ -463,6 +454,10 @@ export interface RendererOptions {
463
454
  * 锚点
464
455
  */
465
456
  anchor?: vec2;
457
+ /**
458
+ * 蒙版属性
459
+ */
460
+ mask?: MaskOptions | ObscuredOptions;
466
461
  }
467
462
  /**
468
463
  * 元素类型
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",
3
+ "version": "2.3.0",
4
4
  "description": "Galacean Effects JSON Specification",
5
5
  "module": "./es/index.js",
6
6
  "main": "./es/index.js",