@galacean/effects-specification 2.0.0-alpha.16 → 2.0.0-alpha.18

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.
@@ -70,10 +70,7 @@ export declare enum CompositionEndBehavior {
70
70
  */
71
71
  freeze = 4
72
72
  }
73
- /**
74
- * 合成信息
75
- */
76
- export interface Composition {
73
+ interface CompositionBase {
77
74
  /**
78
75
  * 合成ID
79
76
  */
@@ -99,10 +96,6 @@ export interface Composition {
99
96
  * 合成相机信息
100
97
  */
101
98
  camera: CameraOptions;
102
- /**
103
- * 元素信息
104
- */
105
- items: Item[];
106
99
  /**
107
100
  * 合成视窗预览大小
108
101
  * 如果没有提供,默认为 player 的 container 大小
@@ -115,48 +108,22 @@ export interface Composition {
115
108
  fallbackImage?: string;
116
109
  }
117
110
  /**
118
- * 合成数据
111
+ * 合成信息
119
112
  */
120
- export interface CompositionData {
121
- /**
122
- * 合成ID
123
- */
124
- id: string;
125
- /**
126
- * 合成名称
127
- */
128
- name: string;
129
- /**
130
- * 合成持续时间
131
- */
132
- duration: number;
133
- /**
134
- * 合成开始播放的时间,单位妙
135
- * @default 0
136
- */
137
- startTime?: number;
138
- /**
139
- * 合成结束行为
140
- */
141
- endBehavior: CompositionEndBehavior;
113
+ export interface Composition extends CompositionBase {
142
114
  /**
143
- * 合成相机信息
115
+ * 元素信息
144
116
  */
145
- camera: CameraOptions;
117
+ items: Item[];
118
+ }
119
+ /**
120
+ * 合成数据
121
+ */
122
+ export interface CompositionData extends CompositionBase {
146
123
  /**
147
124
  * 元素信息
148
125
  */
149
126
  items: DataPath[];
150
- /**
151
- * 合成视窗预览大小
152
- * 如果没有提供,默认为 player 的 container 大小
153
- * @default [0,0]
154
- */
155
- previewSize?: [width: number, height: number];
156
- /**
157
- * 降级图
158
- */
159
- fallbackImage?: string;
160
127
  /**
161
128
  * 时间轴资产(TimelineAssetData)
162
129
  */
@@ -176,3 +143,4 @@ export interface SceneBindingData {
176
143
  */
177
144
  value: DataPath;
178
145
  }
146
+ export {};
package/es/image.d.ts CHANGED
@@ -75,8 +75,8 @@ export interface Image {
75
75
  */
76
76
  url: string;
77
77
  /**
78
- * webp 地址
79
- * 如果运行时支持 webp,则尽量使用 webp
78
+ * WebP 地址
79
+ * 如果运行时支持 WebP,则优先使用 WebP
80
80
  */
81
81
  webp?: string;
82
82
  /**
@@ -91,8 +91,8 @@ export interface Image {
91
91
  */
92
92
  mipmap?: boolean;
93
93
  /**
94
- * 图片Y轴的方向,如果Y轴向上(与OpenGL相同)则为 1
95
- * 如果Y轴向下(与OpenGL相反)则为 -1 ,图片再绘制数据模板的时候需要翻转绘制
94
+ * 图片 Y 轴的方向,如果 Y 轴向上(与 OpenGL 相同)则为 1
95
+ * 如果 Y 轴向下(与 OpenGL 相反)则为 -1,图片再绘制数据模板的时候需要翻转绘制
96
96
  * @default 1
97
97
  */
98
98
  oriY?: 1 | -1;
@@ -50,15 +50,15 @@ export interface CameraContent {
50
50
  }
51
51
  export interface CameraPositionOverLifetime {
52
52
  /**
53
- * x轴位置变化信息
53
+ * x 轴位置变化信息
54
54
  */
55
55
  linearX?: FixedNumberExpression;
56
56
  /**
57
- * y轴位置变化信息
57
+ * y 轴位置变化信息
58
58
  */
59
59
  linearY?: FixedNumberExpression;
60
60
  /**
61
- * z轴位置变化信息
61
+ * z 轴位置变化信息
62
62
  */
63
63
  linearZ?: FixedNumberExpression;
64
64
  /**
@@ -7,7 +7,7 @@ import type { PositionOverLifetime } from '../type';
7
7
  */
8
8
  export interface CompositionItem extends BaseItem {
9
9
  /**
10
- * 元素类型[指定为composition]
10
+ * 元素类型(指定为 composition
11
11
  */
12
12
  type: ItemType.composition;
13
13
  /**
@@ -25,7 +25,7 @@ export interface CompositionContent {
25
25
  */
26
26
  options: {
27
27
  /**
28
- * 引用的合成id
28
+ * 引用的合成 ID
29
29
  */
30
30
  refId: string;
31
31
  /**
@@ -7,7 +7,7 @@ import type { ComponentData } from '../components';
7
7
  */
8
8
  export interface InteractItem extends BaseItem {
9
9
  /**
10
- * 元素类型[指定为interact]
10
+ * 元素类型(指定为 interact
11
11
  */
12
12
  type: ItemType.interact;
13
13
  /**
@@ -6,7 +6,7 @@ import type { BaseItem } from './base-item';
6
6
  */
7
7
  export interface NullItem extends BaseItem {
8
8
  /**
9
- * 元素类型[指定为null]
9
+ * 元素类型(指定为 null
10
10
  */
11
11
  type: ItemType.null;
12
12
  /**
@@ -21,7 +21,7 @@ export declare enum ParticleInteractionBehavior {
21
21
  */
22
22
  export interface ParticleItem extends BaseItem {
23
23
  /**
24
- * 元素类型[指定为particle]
24
+ * 元素类型(指定为 particle
25
25
  */
26
26
  type: ItemType.particle;
27
27
  /**
@@ -57,7 +57,7 @@ export interface ParticleEmission {
57
57
  */
58
58
  cycles?: number;
59
59
  /**
60
- * 爆发时间间隔,单位秒
60
+ * 爆发时间间隔(单位:秒)
61
61
  * @default 0
62
62
  */
63
63
  interval?: number;
@@ -71,15 +71,15 @@ export interface ParticleEmission {
71
71
  */
72
72
  index: number;
73
73
  /**
74
- * x方向偏移值
74
+ * x 方向偏移值
75
75
  */
76
76
  x: number;
77
77
  /**
78
- * y方向偏移值
78
+ * y 方向偏移值
79
79
  */
80
80
  y: number;
81
81
  /**
82
- * z方向偏移值
82
+ * z 方向偏移值
83
83
  */
84
84
  z: number;
85
85
  }[];
@@ -90,15 +90,15 @@ export interface ParticlePositionOverLifetime {
90
90
  */
91
91
  asMovement?: boolean;
92
92
  /**
93
- * x轴位置变化信息
93
+ * x 轴位置变化信息
94
94
  */
95
95
  linearX?: NumberExpression;
96
96
  /**
97
- * y轴位置变化信息
97
+ * y 轴位置变化信息
98
98
  */
99
99
  linearY?: NumberExpression;
100
100
  /**
101
- * z轴位置变化信息
101
+ * z 轴位置变化信息
102
102
  */
103
103
  linearZ?: NumberExpression;
104
104
  /**
@@ -106,15 +106,15 @@ export interface ParticlePositionOverLifetime {
106
106
  */
107
107
  asRotation?: boolean;
108
108
  /**
109
- * x轴环绕角度变化信息
109
+ * x 轴环绕角度变化信息
110
110
  */
111
111
  orbitalX?: NumberExpression;
112
112
  /**
113
- * y轴环绕角度变化信息
113
+ * y 轴环绕角度变化信息
114
114
  */
115
115
  orbitalY?: NumberExpression;
116
116
  /**
117
- * z轴环绕角度变化信息
117
+ * z 轴环绕角度变化信息
118
118
  */
119
119
  orbitalZ?: NumberExpression;
120
120
  /**
@@ -137,7 +137,7 @@ export interface ParticlePositionOverLifetime {
137
137
  */
138
138
  forceCurve?: FunctionExpression;
139
139
  /**
140
- * 增加一个初速度,匀速直线运动,direction为运动方向
140
+ * 增加一个初速度,匀速直线运动,direction 为运动方向
141
141
  * @default 0
142
142
  */
143
143
  startSpeed?: NumberExpression;
@@ -146,7 +146,7 @@ export interface ParticlePositionOverLifetime {
146
146
  */
147
147
  speedOverLifetime?: FixedNumberExpression;
148
148
  /**
149
- * 增加一个重力,gravity为重力方向,gravityModifier为重力大小
149
+ * 增加一个重力,gravity 为重力方向,gravityModifier 为重力大小
150
150
  * @default 0
151
151
  */
152
152
  gravity?: vec3;
@@ -165,15 +165,15 @@ export interface ParticleRotationOverLifetime {
165
165
  */
166
166
  asRotation?: boolean;
167
167
  /**
168
- * x轴旋转函数
168
+ * x 轴旋转函数
169
169
  */
170
170
  x?: NumberExpression;
171
171
  /**
172
- * y轴旋转函数
172
+ * y 轴旋转函数
173
173
  */
174
174
  y?: NumberExpression;
175
175
  /**
176
- * z轴旋转函数(不分轴时,变化z)
176
+ * z 轴旋转函数(不分轴时,变化 z)
177
177
  */
178
178
  z?: NumberExpression;
179
179
  }
@@ -187,11 +187,11 @@ export interface ParticleSizeOverLifetime {
187
187
  */
188
188
  size?: NumberExpression;
189
189
  /**
190
- * x轴大小变化信息(分轴模式)
190
+ * x 轴大小变化信息(分轴模式)
191
191
  */
192
192
  x?: NumberExpression;
193
193
  /**
194
- * y轴大小变化信息(分轴模式)
194
+ * y 轴大小变化信息(分轴模式)
195
195
  */
196
196
  y?: NumberExpression;
197
197
  }
@@ -5,7 +5,7 @@ import type { BaseItem, ItemEndBehavior } from './base-item';
5
5
  */
6
6
  export interface PluginItem extends BaseItem {
7
7
  /**
8
- * 元素类型[指定为plugin]
8
+ * 元素类型(指定为 plugin
9
9
  */
10
10
  type: ItemType.plugin;
11
11
  /**
@@ -53,7 +53,7 @@ export interface PluginSpineOption {
53
53
  */
54
54
  activeSkin: string;
55
55
  /**
56
- * 当前使用的动画列表,1.5之前为 string
56
+ * 当前使用的动画列表,1.5 之前为 string
57
57
  */
58
58
  activeAnimation: string[] | string;
59
59
  /**
@@ -7,7 +7,7 @@ import type { ComponentData } from '../components';
7
7
  */
8
8
  export interface SpriteItem extends BaseItem {
9
9
  /**
10
- * 元素类型[指定为sprite]
10
+ * 元素类型(指定为 sprite
11
11
  */
12
12
  type: ItemType.sprite;
13
13
  /**
@@ -8,7 +8,7 @@ import type { ComponentData } from '../components';
8
8
  */
9
9
  export interface TextItem extends BaseItem {
10
10
  /**
11
- * 元素类型[指定为text]
11
+ * 元素类型(指定为 text
12
12
  */
13
13
  type: ItemType.text;
14
14
  /**
package/es/item.d.ts CHANGED
@@ -9,8 +9,6 @@ import type { CameraItem } from './item/camera-item';
9
9
  import type { CompositionItem } from './item/composition-item';
10
10
  import type { TextItem } from './item/text-item';
11
11
  /**
12
- * Item Interface,
13
- * 1.0版本
14
- * 基类,无对应元素
12
+ * Item 基类,无对应元素
15
13
  */
16
14
  export type Item = SpriteItem | ParticleItem | NullItem | PluginItem | InteractItem | CameraItem | TextItem | ModelMeshItem<'json'> | ModelSkyboxItem<'json'> | ModelTreeItem<'json'> | ModelLightItem | ModelCameraItem | SpineItem | CompositionItem | ModelMeshItem<'studio'> | ModelSkyboxItem<'studio'> | ModelTreeItem<'studio'>;
@@ -50,7 +50,7 @@ export declare enum ValueType {
50
50
  */
51
51
  SHAPE_SPLITS = 11,
52
52
  /**
53
- *直线路径
53
+ * 直线路径
54
54
  */
55
55
  LINEAR_PATH = 12,
56
56
  /**
@@ -52,7 +52,7 @@ export var ValueType;
52
52
  */
53
53
  ValueType[ValueType["SHAPE_SPLITS"] = 11] = "SHAPE_SPLITS";
54
54
  /**
55
- *直线路径
55
+ * 直线路径
56
56
  */
57
57
  ValueType[ValueType["LINEAR_PATH"] = 12] = "LINEAR_PATH";
58
58
  /**
package/es/scene.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import type { Composition } from './composition';
1
+ import type { Composition, CompositionData } from './composition';
2
2
  import type { SpineResource } from './item/spine-item';
3
3
  import type { PlayerVersion, Shape } from './type';
4
4
  import type { TemplateImage, Image, CompressedImage, TextureDefine } from './image';
5
5
  import type { FontBase, FontDefine } from './text';
6
6
  import type { BinaryFile } from './binary';
7
- import type { ComponentData, GeometryData, MaterialData, ShaderData } from './components';
7
+ import type { ComponentData, EffectsObjectData, GeometryData, MaterialData, ShaderData } from './components';
8
8
  import type { VFXItemData } from './vfx-item-data';
9
9
  import type { AnimationClipData } from './animation-clip-data';
10
10
  /**
@@ -119,25 +119,25 @@ export interface JSONScene {
119
119
  type: string;
120
120
  /*************************************** 用于加载 json 后复原合成 **************************************/
121
121
  /**
122
- * 选中合成ID
122
+ * 选中合成 ID
123
123
  * 如果没有设置,选择合成中的第一个
124
124
  */
125
125
  compositionId?: string;
126
126
  /**
127
127
  * 渲染所需合成列表
128
128
  */
129
- compositions: Composition[];
129
+ compositions: CompositionData[];
130
130
  /******************************** 以下皆为可复用信息,加载在对应 Manager 中 *******************************/
131
131
  /**
132
132
  * 贴图信息
133
133
  */
134
134
  images: (TemplateImage | Image | CompressedImage)[];
135
135
  /**
136
- * 根据合成ID,每个合成用到的 image 的数组索引
136
+ * 根据合成 ID,每个合成用到的 image 的数组索引
137
137
  */
138
138
  imgUsage?: Record<string, number[]>;
139
139
  /**
140
- * 根据合成id,每个合成用到的 bin 的数组索引
140
+ * 根据合成 ID,每个合成用到的 bin 的数组索引
141
141
  */
142
142
  binUsage?: Record<string, number[]>;
143
143
  /**
@@ -156,17 +156,14 @@ export interface JSONScene {
156
156
  fonts?: FontBase[] | FontDefine[];
157
157
  /**
158
158
  * spine 资源
159
- * @version 1.5
160
159
  */
161
160
  spines?: SpineResource[];
162
161
  /**
163
162
  * 二进制文件地址
164
- * @version 1.3
165
163
  */
166
164
  bins?: BinaryFile[];
167
165
  /**
168
166
  * textures 配置
169
- * 从 v1.3 开始,images 数组会对应创建 textures 数组
170
167
  */
171
168
  textures?: TextureDefine[];
172
169
  /**
@@ -193,4 +190,8 @@ export interface JSONScene {
193
190
  * 动画数据
194
191
  */
195
192
  animations: AnimationClipData[];
193
+ /**
194
+ * 分类外的资产数据
195
+ */
196
+ miscs: EffectsObjectData[];
196
197
  }
package/es/text.d.ts CHANGED
@@ -50,52 +50,6 @@ export interface FontBase {
50
50
  */
51
51
  letterSpace?: number;
52
52
  }
53
- export interface Text {
54
- x: number;
55
- y: number;
56
- /**
57
- * 变量名
58
- */
59
- n?: string;
60
- /**
61
- * content,
62
- * 文字内容,如果包含 $var$ 样式,内容将被替换
63
- */
64
- t: string;
65
- /**
66
- * width, if not provide use canvas.measureText() to get width
67
- * 文字最大宽度,如果不设置,由系统进行计算
68
- */
69
- w?: number;
70
- /**
71
- * font, index to fonts array
72
- * 字体,指向字体数组
73
- * @default 0
74
- */
75
- f?: number;
76
- /**
77
- * textAlignment
78
- * 字体排列
79
- * @default 0
80
- */
81
- a?: TextAlignment;
82
- /**
83
- * index to color array
84
- * 字体颜色,指向数组
85
- */
86
- c?: number;
87
- /**
88
- * 当文字超过最大宽度时,文字的表现行为
89
- * 仅当设置文字最大宽度后生效
90
- * @default 0
91
- */
92
- of?: TextOverflow;
93
- /**
94
- * 当文字overflow为ellipsis时的替换符号
95
- * @default ".."
96
- */
97
- et?: string;
98
- }
99
53
  export declare enum TextOverflow {
100
54
  /**
101
55
  * display 模式下,会显示所有文本,存在文本超过边界框的情况。
@@ -127,7 +81,7 @@ export declare enum TextBaseline {
127
81
  export declare enum TextAlignment {
128
82
  /**
129
83
  * text alignment starts from(x,y) to right direction
130
- * 从(x,y)开始第一个字符,向右边延伸
84
+ * 从 (x,y) 开始第一个字符,向右边延伸
131
85
  */
132
86
  left = 0,
133
87
  /**
@@ -137,7 +91,7 @@ export declare enum TextAlignment {
137
91
  middle = 1,
138
92
  /**
139
93
  * text alignment ends with(x,y) from left direction
140
- * 从(x,y)结束最后一个字符,向左边延伸
94
+ * 从 (x,y) 结束最后一个字符,向左边延伸
141
95
  */
142
96
  right = 2
143
97
  }
package/es/text.js CHANGED
@@ -32,7 +32,7 @@ export var TextAlignment;
32
32
  (function (TextAlignment) {
33
33
  /**
34
34
  * text alignment starts from(x,y) to right direction
35
- * 从(x,y)开始第一个字符,向右边延伸
35
+ * 从 (x,y) 开始第一个字符,向右边延伸
36
36
  */
37
37
  TextAlignment[TextAlignment["left"] = 0] = "left";
38
38
  /**
@@ -42,7 +42,7 @@ export var TextAlignment;
42
42
  TextAlignment[TextAlignment["middle"] = 1] = "middle";
43
43
  /**
44
44
  * text alignment ends with(x,y) from left direction
45
- * 从(x,y)结束最后一个字符,向左边延伸
45
+ * 从 (x,y) 结束最后一个字符,向左边延伸
46
46
  */
47
47
  TextAlignment[TextAlignment["right"] = 2] = "right";
48
48
  })(TextAlignment || (TextAlignment = {}));
@@ -3,7 +3,7 @@ export interface TimelineClipData {
3
3
  start?: number;
4
4
  duration?: number;
5
5
  /**
6
- * 可播放资产(PlayableAssetData)
7
- */
6
+ * 可播放资产(PlayableAssetData)
7
+ */
8
8
  asset: DataPath;
9
9
  }
package/es/type.d.ts CHANGED
@@ -4,11 +4,11 @@ import type { FixedVec3Expression, vec2, vec3, GradientColor, ShapePoints, Shape
4
4
  */
5
5
  export interface PlayerVersion {
6
6
  /**
7
- * Web端版本号
7
+ * Web 端版本号
8
8
  */
9
9
  web: string;
10
10
  /**
11
- * Native端版本号
11
+ * Native 端版本号
12
12
  */
13
13
  native: string;
14
14
  }
@@ -72,15 +72,15 @@ export interface SizeOverLifetime {
72
72
  */
73
73
  size?: FixedNumberExpression;
74
74
  /**
75
- * x轴大小变化信息(分轴模式)
75
+ * x 轴大小变化信息(分轴模式)
76
76
  */
77
77
  x?: FixedNumberExpression;
78
78
  /**
79
- * y轴大小变化信息(分轴模式)
79
+ * y 轴大小变化信息(分轴模式)
80
80
  */
81
81
  y?: FixedNumberExpression;
82
82
  /**
83
- * z轴大小变化信息(分轴模式)
83
+ * z 轴大小变化信息(分轴模式)
84
84
  */
85
85
  z?: FixedNumberExpression;
86
86
  }
@@ -118,15 +118,15 @@ export interface PositionOverLifetime {
118
118
  */
119
119
  asMovement?: boolean;
120
120
  /**
121
- * x轴位置变化信息
121
+ * x 轴位置变化信息
122
122
  */
123
123
  linearX?: FixedNumberExpression;
124
124
  /**
125
- * y轴位置变化信息
125
+ * y 轴位置变化信息
126
126
  */
127
127
  linearY?: FixedNumberExpression;
128
128
  /**
129
- * z轴位置变化信息
129
+ * z 轴位置变化信息
130
130
  */
131
131
  linearZ?: FixedNumberExpression;
132
132
  /**
@@ -134,15 +134,15 @@ export interface PositionOverLifetime {
134
134
  */
135
135
  asRotation?: boolean;
136
136
  /**
137
- * x轴环绕角度变化信息
137
+ * x 轴环绕角度变化信息
138
138
  */
139
139
  orbitalX?: FixedNumberExpression;
140
140
  /**
141
- * y轴环绕角度变化信息
141
+ * y 轴环绕角度变化信息
142
142
  */
143
143
  orbitalY?: FixedNumberExpression;
144
144
  /**
145
- * z轴环绕角度变化信息
145
+ * z 轴环绕角度变化信息
146
146
  */
147
147
  orbitalZ?: FixedNumberExpression;
148
148
  /**
@@ -3,9 +3,9 @@ import type { ItemEndBehavior, ParentItemEndBehavior, BaseContent, TransformData
3
3
  import type { ItemType, RenderLevel } from './type';
4
4
  export interface VFXItemData extends EffectsObjectData {
5
5
  /**
6
- * 元素 id
7
- * 非预合成的元素 id 为 int 类型的数字字符串
8
- * 预合成元素 id 为 `'{ref元素id}+{合成内id}'` 字符串
6
+ * 元素 ID
7
+ * 非预合成的元素 ID 为 int 类型的数字字符串
8
+ * 预合成元素 ID 为 `'{ref 元素 ID}+{合成内 ID}'` 字符串
9
9
  */
10
10
  id: string;
11
11
  /**
@@ -17,14 +17,13 @@ export interface VFXItemData extends EffectsObjectData {
17
17
  */
18
18
  duration: number;
19
19
  /**
20
- * 元素类型,string 类型
20
+ * 元素类型,String 类型
21
21
  * Galacean Effects 内部元素使用 int 数字字符串
22
22
  * plugin 模块实现者自由实现命名
23
- * 2022.12更新: spine: "spine", 陀螺仪: "5"
24
23
  */
25
24
  type: ItemType;
26
25
  /**
27
- * 父节点ID
26
+ * 父节点 ID
28
27
  * 如果父节点无法找到,播放将直接报错
29
28
  */
30
29
  parentId?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-specification",
3
- "version": "2.0.0-alpha.16",
3
+ "version": "2.0.0-alpha.18",
4
4
  "description": "Galacean Effects JSON Specification",
5
5
  "module": "./es/index.js",
6
6
  "main": "./es/index.js",