@galacean/effects-specification 2.7.2 → 2.8.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.
@@ -1,5 +1,6 @@
1
- import type { EffectsObjectData } from './effects-object-data';
2
- import type { ColorCurveValue, Vector3CurveValue, BezierValue, BezierCurvePath, BezierCurveQuat } from './number-expression';
1
+ import type { EffectsObjectData } from '../effects-object-data';
2
+ import type { ColorCurveValue, Vector3CurveValue, BezierValue, BezierCurvePath, BezierCurveQuat } from '../number-expression';
3
+ import type { AnimationEventInfoData } from './animation-event';
3
4
  export interface AnimationClipData extends EffectsObjectData {
4
5
  duration?: number;
5
6
  positionCurves?: PositionCurveData[];
@@ -8,6 +9,7 @@ export interface AnimationClipData extends EffectsObjectData {
8
9
  scaleCurves?: ScaleCurveData[];
9
10
  floatCurves?: AnimationCurveFloatData[];
10
11
  colorCurves?: AnimationCurveColorData[];
12
+ events?: AnimationEventInfoData[];
11
13
  }
12
14
  export interface PositionCurveData {
13
15
  path: string;
@@ -0,0 +1,5 @@
1
+ export interface AnimationEventInfoData {
2
+ name: string;
3
+ startTime: number;
4
+ duration?: number;
5
+ }
@@ -0,0 +1,4 @@
1
+ // export interface AnimationEventData {
2
+ // typeName?: string,
3
+ // }
4
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './animation-clip-data';
2
+ export * from './animation-event';
@@ -0,0 +1,2 @@
1
+ export * from './animation-clip-data';
2
+ export * from './animation-event';
@@ -1,6 +1,6 @@
1
1
  export declare const BuiltinObjectGUID: {
2
2
  WhiteTexture: string;
3
- TransparentTexture: string;
3
+ EmptyTexture: string;
4
4
  PBRShader: string;
5
5
  UnlitShader: string;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  export const BuiltinObjectGUID = {
2
2
  WhiteTexture: 'whitetexture00000000000000000000',
3
- TransparentTexture: 'transparenttexture00000000000000000000',
3
+ EmptyTexture: 'emptyTexture00000000000000000000',
4
4
  PBRShader: 'pbr00000000000000000000000000000',
5
5
  UnlitShader: 'unlit000000000000000000000000000',
6
6
  };
@@ -0,0 +1,7 @@
1
+ import type { ComponentData } from './component-data';
2
+ import type { ColorData } from '../math/color-data';
3
+ import type { DataType } from 'src/data-type';
4
+ export interface FrameComponentData extends ComponentData {
5
+ dataType: DataType.FrameComponent;
6
+ color?: ColorData;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,6 @@
1
1
  export * from './component-data';
2
2
  export * from './post-process-volume-data';
3
3
  export * from './ffd-data';
4
+ export * from './frame-component-data';
5
+ export * from './maskable-graphic-data';
6
+ export * from './orientation-component-data';
@@ -1,3 +1,6 @@
1
1
  export * from './component-data';
2
2
  export * from './post-process-volume-data';
3
3
  export * from './ffd-data';
4
+ export * from './frame-component-data';
5
+ export * from './maskable-graphic-data';
6
+ export * from './orientation-component-data';
@@ -0,0 +1,7 @@
1
+ import type { ComponentData } from './component-data';
2
+ import type { RendererOptions } from '../type';
3
+ import type { MaskOptions } from '../item/base-item';
4
+ export interface MaskableGraphicData extends ComponentData {
5
+ renderer: RendererOptions;
6
+ mask?: MaskOptions;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { ComponentData } from './component-data';
2
+ import type { PluginGyroscopeTarget } from '../type';
3
+ export interface OrientationComponentData extends ComponentData {
4
+ options: {
5
+ targets?: PluginGyroscopeTarget[];
6
+ };
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -78,6 +78,7 @@ interface CompositionBase {
78
78
  }
79
79
  /**
80
80
  * 合成信息
81
+ * @deprecated
81
82
  */
82
83
  export interface Composition extends CompositionBase {
83
84
  /**
@@ -93,6 +94,10 @@ export interface CompositionData extends CompositionBase {
93
94
  * @description 组件数据
94
95
  */
95
96
  components: DataPath[];
97
+ /**
98
+ * 合成的子节点列表
99
+ */
100
+ children?: DataPath[];
96
101
  }
97
102
  /**
98
103
  * 合成组件数据
package/es/data-type.d.ts CHANGED
@@ -51,6 +51,7 @@ export declare enum DataType {
51
51
  AnimationGraphAsset = "AnimationGraphAsset",
52
52
  CompositionComponent = "CompositionComponent",
53
53
  FFDComponent = "FFDComponent",
54
+ FrameComponent = "FrameComponent",
54
55
  Animator = "Animator",
55
56
  TimelineClip = "TimelineClip"
56
57
  }
package/es/data-type.js CHANGED
@@ -55,6 +55,7 @@ export var DataType;
55
55
  DataType["AnimationGraphAsset"] = "AnimationGraphAsset";
56
56
  DataType["CompositionComponent"] = "CompositionComponent";
57
57
  DataType["FFDComponent"] = "FFDComponent";
58
+ DataType["FrameComponent"] = "FrameComponent";
58
59
  DataType["Animator"] = "Animator";
59
60
  // Non-EffectObject
60
61
  DataType["TimelineClip"] = "TimelineClip";
package/es/index.d.ts CHANGED
@@ -24,7 +24,7 @@ export * from './item/video-item';
24
24
  export * from './item/audio-item';
25
25
  export * from './item/model';
26
26
  export * from './vfx-item-data';
27
- export * from './animation-clip-data';
27
+ export * from './animation';
28
28
  export * from './binary';
29
29
  export * from './text';
30
30
  export * from './components';
@@ -41,4 +41,4 @@ export * from './material-data';
41
41
  export * from './geometry-data';
42
42
  export * from './shader-data';
43
43
  export * from './effects-package-data';
44
- export declare const LATEST_VERSION = JSONSceneVersion['3_6'];
44
+ export declare const LATEST_VERSION = JSONSceneVersion['3_7'];
package/es/index.js CHANGED
@@ -24,7 +24,7 @@ export * from './item/video-item';
24
24
  export * from './item/audio-item';
25
25
  export * from './item/model';
26
26
  export * from './vfx-item-data';
27
- export * from './animation-clip-data';
27
+ export * from './animation';
28
28
  export * from './binary';
29
29
  export * from './text';
30
30
  export * from './components';
@@ -2,6 +2,7 @@ import type { BaseItem, EndBehavior } from './base-item';
2
2
  import type { ItemType, RotationOverLifetime } from '../type';
3
3
  import type { FixedNumberExpression, FixedVec3Expression } from '../number-expression';
4
4
  import type { CameraClipMode } from '../composition';
5
+ import type { ComponentData } from '../components/component-data';
5
6
  export interface CameraItem extends BaseItem {
6
7
  /**
7
8
  * 元素类型[指定为model]
@@ -67,3 +68,5 @@ export interface CameraPositionOverLifetime {
67
68
  */
68
69
  path?: FixedVec3Expression;
69
70
  }
71
+ export interface CameraControllerData extends ComponentData, CameraContent {
72
+ }
@@ -95,3 +95,5 @@ export interface AnimationComponentData extends ComponentData {
95
95
  */
96
96
  animationClips: DataPath[];
97
97
  }
98
+ export interface ModelTreeComponentData<T extends BinaryEnv> extends ComponentData, ModelTreeContent<T> {
99
+ }
@@ -1,4 +1,4 @@
1
- import type { ItemType, RendererOptions, TextureSheetAnimation, BlendingMode, SplitParameter, ObscuredMode } from '../type';
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
3
  import type { BaseItem, EndBehavior, MaskOptions } from './base-item';
4
4
  import type { ParticleShape } from './particle-shape';
@@ -229,6 +229,10 @@ export interface ParticleTextureSheetAnimation extends TextureSheetAnimation {
229
229
  animationDuration: NumberExpression;
230
230
  }
231
231
  export interface ParticleOptions {
232
+ /**
233
+ * 发射循环开关
234
+ */
235
+ looping?: boolean;
232
236
  /**
233
237
  * 最大粒子数
234
238
  */
@@ -417,8 +421,4 @@ export interface ParticleTrail {
417
421
  * 拖尾+图层绑定同一个父节点时使用
418
422
  */
419
423
  parentAffectsPosition?: boolean;
420
- /**
421
- * 拖尾蒙版属性,传入表示需要被遮挡/反向遮挡
422
- */
423
- mask?: ObscuredMode;
424
424
  }
@@ -1,7 +1,6 @@
1
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';
5
4
  import type { TextSizeMode } from '../text';
6
5
  /**
7
6
  * 富文本元素
@@ -21,10 +20,6 @@ export interface RichTextItem extends BaseItem {
21
20
  * 富文本元素参数
22
21
  */
23
22
  export interface RichTextContentOptions extends BaseTextContentOptions {
24
- /**
25
- * 富文本元素大小
26
- */
27
- size?: vec2;
28
23
  /**
29
24
  * 文本框宽度,用来排版和控制文本溢出行为
30
25
  */
@@ -1,7 +1,7 @@
1
1
  import type { BaseItem, EndBehavior, MaskOptions } 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
- import type { ComponentData } from '../components';
4
+ import type { ComponentData, DataPath } from '../components';
5
5
  /**
6
6
  * 图层元素
7
7
  */
@@ -79,4 +79,8 @@ export interface SpriteContent {
79
79
  * 图层组件属性
80
80
  */
81
81
  export interface SpriteComponentData extends ComponentData, SpriteContent {
82
+ /**
83
+ * 自定义几何体数据
84
+ */
85
+ geometry?: DataPath;
82
86
  }
@@ -1,7 +1,7 @@
1
1
  import type { BaseItem, EndBehavior, MaskOptions } 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
- import type { FontStyle, TextAlignment, TextBaseline, TextOverflow, TextWeight, TextVerticalAlign } from '../text';
4
+ import type { FontStyle, TextAlignment, TextBaseline, TextOverflow, TextWeight, TextVerticalAlign, TextSizeMode } from '../text';
5
5
  import type { ComponentData } from '../components';
6
6
  /**
7
7
  * 文本元素
@@ -29,15 +29,10 @@ export interface TextContentOptions extends BaseTextContentOptions {
29
29
  */
30
30
  textHeight?: number;
31
31
  /**
32
- * 自适应宽高开关(和文本固定宽度冲突)
33
- * @default false
32
+ * 文本自动调整尺寸模式
33
+ * @default TextSizeMode.fixed
34
34
  */
35
- autoWidth?: boolean;
36
- /**
37
- * 自适应宽高开关(和文本固定高度冲突)
38
- * @default false
39
- */
40
- autoHeight?: boolean;
35
+ autoResize?: TextSizeMode;
41
36
  }
42
37
  export interface BaseTextContentOptions {
43
38
  /**
@@ -27,11 +27,13 @@ export declare enum ValueType {
27
27
  */
28
28
  LINE = 5,
29
29
  /**
30
- * 曲线
30
+ * 曲线(Hermite 曲线)
31
+ * @deprecated 使用 BEZIER_CURVE 替代,此类型仅用于旧数据迁移兼容
31
32
  */
32
33
  CURVE = 6,
33
34
  /**
34
35
  * 贝塞尔路径
36
+ * @deprecated 使用 BEZIER_CURVE_PATH 替代,此类型仅用于旧数据迁移兼容
35
37
  */
36
38
  BEZIER_PATH = 7,
37
39
  /**
@@ -129,6 +131,10 @@ export type mat4 = [
129
131
  export type FunctionExpression = LineValue | CurveValue | BezierValue;
130
132
  export type FixedNumberExpression = ConstantNumber | LineValue | CurveValue | BezierValue;
131
133
  export type NumberExpression = FixedNumberExpression | RandomValue;
134
+ /**
135
+ * 固定 vec3 表达式
136
+ * @deprecated BezierPath 和 LinearPath 仅用于旧数据迁移兼容,推荐使用 BezierCurvePath
137
+ */
132
138
  export type FixedVec3Expression = ConstantVec3 | BezierPath | LinearPath | BezierCurvePath;
133
139
  export type FixedQuatExpression = BezierCurveQuat;
134
140
  /**
@@ -151,11 +157,13 @@ export type RandomValue = [type: ValueType.RANDOM, value: [min: number, max: num
151
157
  export type LineValue = [type: ValueType.LINE, value: [time: number, value: number][]];
152
158
  export type CurveEasingPoint = [time: number, value: number, tanIn: number, tanOut: number];
153
159
  /**
154
- * 曲线段数值
160
+ * 曲线段数值(Hermite 曲线)
161
+ * @deprecated 使用 BezierValue 替代,此类型仅用于旧数据迁移兼容
155
162
  */
156
163
  export type CurveValue = [type: ValueType.CURVE, value: CurveEasingPoint[]];
157
164
  /**
158
165
  * 贝塞尔路径数值
166
+ * @deprecated 使用 BezierCurvePath 替代,此类型仅用于旧数据迁移兼容
159
167
  */
160
168
  export type BezierPath = [type: ValueType.BEZIER_PATH, value: BezierPathValue];
161
169
  export type BezierPathValue = [
@@ -28,11 +28,13 @@ export var ValueType;
28
28
  */
29
29
  ValueType[ValueType["LINE"] = 5] = "LINE";
30
30
  /**
31
- * 曲线
31
+ * 曲线(Hermite 曲线)
32
+ * @deprecated 使用 BEZIER_CURVE 替代,此类型仅用于旧数据迁移兼容
32
33
  */
33
34
  ValueType[ValueType["CURVE"] = 6] = "CURVE";
34
35
  /**
35
36
  * 贝塞尔路径
37
+ * @deprecated 使用 BEZIER_CURVE_PATH 替代,此类型仅用于旧数据迁移兼容
36
38
  */
37
39
  ValueType[ValueType["BEZIER_PATH"] = 7] = "BEZIER_PATH";
38
40
  /**
package/es/scene.d.ts CHANGED
@@ -6,13 +6,13 @@ import type { FontBase, FontDefine } from './text';
6
6
  import type { BinaryFile } from './binary';
7
7
  import type { ComponentData } from './components';
8
8
  import type { VFXItemData } from './vfx-item-data';
9
- import type { AnimationClipData } from './animation-clip-data';
10
9
  import type { AssetBase, ImageSource, VideoInfo } from './assets';
11
10
  import type { RenderSettings } from './render-settings';
12
11
  import type { EffectsObjectData } from './effects-object-data';
13
12
  import type { MaterialData } from './material-data';
14
13
  import type { GeometryData } from './geometry-data';
15
14
  import type { ShaderData } from './shader-data';
15
+ import type { AnimationClipData } from './animation';
16
16
  /**
17
17
  * JSON 版本
18
18
  */
@@ -35,12 +35,13 @@ export declare enum JSONSceneVersion {
35
35
  '3_4' = "3.4",// 动画状态机
36
36
  '3_5' = "3.5",// 网格形状变化动画、矢量图形填充/描边渐变色
37
37
  '3_6' = "3.6",// 支持 KTX2 纹理、H265 视频格式、文本增强
38
- 'LATEST' = "3.6"
38
+ '3_7' = "3.7",// 文本 autoSize、元素子节点
39
+ 'LATEST' = "3.7"
39
40
  }
40
41
  /**
41
42
  * runtime 2.0 之前的场景信息
42
43
  * 素材信息存放于统一数据结构中
43
- * @deprecated
44
+ * @deprecated 使用 JSONScene 代替
44
45
  */
45
46
  export interface JSONSceneLegacy {
46
47
  /************** 文件版本不是 Player 版本,应用于文件变更后在 editor/player 中加载时的分类处理 **************/
package/es/scene.js CHANGED
@@ -21,5 +21,6 @@ export var JSONSceneVersion;
21
21
  JSONSceneVersion["3_4"] = "3.4";
22
22
  JSONSceneVersion["3_5"] = "3.5";
23
23
  JSONSceneVersion["3_6"] = "3.6";
24
- JSONSceneVersion["LATEST"] = "3.6";
24
+ JSONSceneVersion["3_7"] = "3.7";
25
+ JSONSceneVersion["LATEST"] = "3.7";
25
26
  })(JSONSceneVersion || (JSONSceneVersion = {}));
package/es/type.d.ts CHANGED
@@ -448,6 +448,7 @@ export interface RendererOptions {
448
448
  texture?: DataPath;
449
449
  /**
450
450
  * 蒙版形状,索引到 scene 的 shapes 中
451
+ * @deprecated runtime 2.0 后迁移到 SpriteComponentData.geometry
451
452
  */
452
453
  shape?: number | ShapeGeometry;
453
454
  /**
@@ -23,6 +23,15 @@ export interface VFXItemData extends EffectsObjectData {
23
23
  * plugin 模块实现者自由实现命名
24
24
  */
25
25
  type: ItemType;
26
+ /**
27
+ * 元素结束行为
28
+ * @default destroy
29
+ */
30
+ endBehavior: EndBehavior;
31
+ /**
32
+ * 元素的组件数据
33
+ */
34
+ components: DataPath[];
26
35
  /**
27
36
  * 父节点 ID
28
37
  * 如果父节点无法找到,播放将直接报错
@@ -35,40 +44,39 @@ export interface VFXItemData extends EffectsObjectData {
35
44
  */
36
45
  visible?: boolean;
37
46
  /**
38
- * 元素结束行为
39
- * @default destroy
47
+ * 元素渲染等级
40
48
  */
41
- endBehavior: EndBehavior;
49
+ renderLevel?: RenderLevel;
50
+ /**
51
+ * 元素的基础位置
52
+ */
53
+ transform?: TransformData;
54
+ /**
55
+ * 元素的子节点列表
56
+ */
57
+ children?: DataPath[];
42
58
  /**
43
59
  * 元素播放延时(单位秒)
44
60
  * @default 0
61
+ * @deprecated
45
62
  */
46
63
  delay?: number;
47
64
  /**
48
65
  * 元素渲染信息属性
66
+ * @deprecated
49
67
  */
50
68
  content: BaseContent;
51
- /**
52
- * 元素渲染等级
53
- */
54
- renderLevel?: RenderLevel;
55
69
  /**
56
70
  * 元素的插件模块名,如果不指定,则和 type 相同
57
71
  * 从数组的 plugins 中获取 name
58
72
  * 例如:pn:1, plugins:["model@1.0",'spine@1.0']
59
73
  * pn 实际为 spine
74
+ * @deprecated
60
75
  */
61
76
  pn?: number;
62
77
  /**
63
78
  * 元素的插件模块名, 优先级高于 pn
79
+ * @deprecated
64
80
  */
65
81
  pluginName?: string;
66
- /**
67
- * 元素的基础位置
68
- */
69
- transform?: TransformData;
70
- /**
71
- * 元素的组件数据
72
- */
73
- components: DataPath[];
74
82
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-specification",
3
- "version": "2.7.2",
3
+ "version": "2.8.0",
4
4
  "description": "Galacean Effects JSON Specification",
5
5
  "module": "./es/index.js",
6
6
  "main": "./es/index.js",
@@ -15,6 +15,17 @@
15
15
  "types": "./es/index.d.ts"
16
16
  }
17
17
  },
18
+ "scripts": {
19
+ "prebuild": "pnpm clean",
20
+ "build": "pnpm build:lib",
21
+ "build:lib": "tsc -b tsconfig.build.json",
22
+ "lint": "eslint src --ext .ts,.mjs",
23
+ "lint:fix": "eslint src --fix --quiet --ext .ts,.mjs",
24
+ "check:ts": "tsc -b tsconfig.check.json",
25
+ "clean": "rimraf es/**",
26
+ "prepare": "husky install",
27
+ "prepublishOnly": "npm run build"
28
+ },
18
29
  "browserslist": [
19
30
  "iOS 9"
20
31
  ],
@@ -32,19 +43,14 @@
32
43
  "rimraf": "^3.0.2",
33
44
  "typescript": "^5.3.3"
34
45
  },
46
+ "engines": {
47
+ "node": "18",
48
+ "pnpm": "8"
49
+ },
35
50
  "author": "Ant Group CO., Ltd.",
36
51
  "license": "MIT",
37
52
  "publishConfig": {
38
53
  "access": "public",
39
54
  "registry": "https://registry.npmjs.org"
40
- },
41
- "scripts": {
42
- "prebuild": "pnpm clean",
43
- "build": "pnpm build:lib",
44
- "build:lib": "tsc -b tsconfig.build.json",
45
- "lint": "eslint src --ext .ts,.mjs",
46
- "lint:fix": "eslint src --fix --quiet --ext .ts,.mjs",
47
- "check:ts": "tsc -b tsconfig.check.json",
48
- "clean": "rimraf es/**"
49
55
  }
50
- }
56
+ }