@vvfx/sdk 0.1.19-alpha.0 → 0.1.19-alpha.10
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/dist/index.cjs +1 -1
- package/dist/index.d.cts +1145 -777
- package/dist/index.d.ts +1145 -777
- package/dist/index.global.js +7 -7
- package/dist/index.js +1 -1
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -1,194 +1,678 @@
|
|
|
1
1
|
import * as _galacean_effects from '@galacean/effects';
|
|
2
|
-
import {
|
|
2
|
+
import { math, spec, Player } from '@galacean/effects';
|
|
3
3
|
export { generateGUID, spec } from '@galacean/effects';
|
|
4
4
|
import { Point } from '@pixi/constants';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @
|
|
8
|
-
* @description 支持扩展属性,允许添加任意额外属性
|
|
7
|
+
* @class 二维线段
|
|
9
8
|
*/
|
|
10
|
-
|
|
9
|
+
declare class Line2 {
|
|
10
|
+
start: Vector2;
|
|
11
|
+
end: Vector2;
|
|
12
|
+
constructor(start?: Vector2, end?: Vector2);
|
|
11
13
|
/**
|
|
12
|
-
*
|
|
14
|
+
* 设置二维线段
|
|
15
|
+
* @param {Vector2} start 线段起点
|
|
16
|
+
* @param {Vector2} end 线段终点
|
|
17
|
+
* @returns {Line2} 二维线段
|
|
13
18
|
*/
|
|
14
|
-
|
|
19
|
+
set(start: Vector2, end: Vector2): this;
|
|
15
20
|
/**
|
|
16
|
-
*
|
|
21
|
+
* 复制二维线段
|
|
22
|
+
* @param {Line2} line 复制对象
|
|
23
|
+
* @returns {Line2} 复制结果
|
|
17
24
|
*/
|
|
18
|
-
|
|
25
|
+
copyFrom(line: Line2): this;
|
|
19
26
|
/**
|
|
20
|
-
*
|
|
27
|
+
* 二维线段求方向
|
|
28
|
+
* @returns {Vector2} 二维线段方向
|
|
21
29
|
*/
|
|
22
|
-
|
|
30
|
+
direction(): Vector2;
|
|
23
31
|
/**
|
|
24
|
-
*
|
|
32
|
+
* 二维线段求中点
|
|
33
|
+
* @param {Vector2} [target=new Vector2()] 目标保存对象
|
|
34
|
+
* @returns {Vector2} 二维线段中点
|
|
25
35
|
*/
|
|
26
|
-
|
|
36
|
+
getCenter(target?: Vector2): Vector2;
|
|
27
37
|
/**
|
|
28
|
-
*
|
|
38
|
+
* 二维线段向量值
|
|
39
|
+
* @param {Vector2} [target=new Vector2()] 目标保存对象
|
|
40
|
+
* @returns {Vector2} 二维线段向量值
|
|
29
41
|
*/
|
|
30
|
-
|
|
42
|
+
delta(target?: Vector2): Vector2;
|
|
31
43
|
/**
|
|
32
|
-
*
|
|
44
|
+
* 二维线段欧式距离平方(应用于计算)
|
|
45
|
+
* @returns {number} 计算结果
|
|
33
46
|
*/
|
|
34
|
-
|
|
47
|
+
distanceSq(): number;
|
|
35
48
|
/**
|
|
36
|
-
*
|
|
49
|
+
* 二维线段欧式距离
|
|
50
|
+
* @returns {number} 计算结果
|
|
37
51
|
*/
|
|
38
|
-
|
|
52
|
+
distance(): number;
|
|
39
53
|
/**
|
|
40
|
-
*
|
|
54
|
+
* 求二维线段比例点
|
|
55
|
+
* @param {number} t 比例值
|
|
56
|
+
* @param {Vector2} target 目标保存对象
|
|
57
|
+
* @returns {Vector2} 比例点结果
|
|
41
58
|
*/
|
|
42
|
-
|
|
59
|
+
at(t: number, target?: Vector2): Vector2;
|
|
43
60
|
/**
|
|
44
|
-
*
|
|
61
|
+
* 求点与线段的最短距离
|
|
62
|
+
* @param {Vector2} point 二维空间点
|
|
63
|
+
* @param {boolean} clampToLine 是否限制于线段内
|
|
64
|
+
* @returns {number} 距离结果
|
|
45
65
|
*/
|
|
46
|
-
|
|
66
|
+
closestPointToPointParameter(point: Vector2, clampToLine: boolean): number;
|
|
47
67
|
/**
|
|
48
|
-
*
|
|
68
|
+
* 求点与线段的最近交点
|
|
69
|
+
* @param {Vector2} point 二维空间点
|
|
70
|
+
* @param {boolean} clampToLine 是否限制于线段内
|
|
71
|
+
* @param {Vector2} target 目标保存对象
|
|
72
|
+
* @returns {Vector2} 最近交点
|
|
49
73
|
*/
|
|
50
|
-
|
|
74
|
+
closestPointToPoint(point: Vector2, clampToLine: boolean, target?: Vector2): Vector2;
|
|
51
75
|
/**
|
|
52
|
-
*
|
|
76
|
+
* 二维线段判等
|
|
77
|
+
* @param {Line2} line 二维线段
|
|
78
|
+
* @returns {boolean} 判等结果
|
|
53
79
|
*/
|
|
54
|
-
|
|
80
|
+
equals(line: Line2): boolean;
|
|
55
81
|
/**
|
|
56
|
-
*
|
|
82
|
+
* 克隆二维线段
|
|
83
|
+
* @returns {Line2} 克隆结果
|
|
57
84
|
*/
|
|
58
|
-
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* @description Sprite SDKItem 选项
|
|
62
|
-
*/
|
|
63
|
-
type SpriteItemOptions = SDKItemOptions & {
|
|
85
|
+
clone(): Line2;
|
|
64
86
|
/**
|
|
65
|
-
*
|
|
87
|
+
* 二维线段求长度
|
|
88
|
+
* @returns {number} 长度
|
|
66
89
|
*/
|
|
67
|
-
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* @description Text SDKItem 选项
|
|
71
|
-
*/
|
|
72
|
-
type TextItemOptions = SDKItemOptions & {
|
|
90
|
+
length(): number;
|
|
73
91
|
/**
|
|
74
|
-
*
|
|
92
|
+
* 二维线段判断相交
|
|
93
|
+
* @param {Line2} other 二维线段
|
|
94
|
+
* @returns {boolean} 相交判断结果
|
|
75
95
|
*/
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
96
|
+
crossWithLine(other: Line2): boolean;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
declare class Vector2 extends math.Vector2 {
|
|
100
|
+
subtract(other: Vector2): this;
|
|
101
|
+
toViewCoordinate(width: number, height: number): this;
|
|
102
|
+
clone(): Vector2;
|
|
103
|
+
distanceTo(other: Vector2): number;
|
|
104
|
+
scaleByCenter(scalar: Vector2, anchor?: Vector2): this;
|
|
105
|
+
round(precision?: number): this;
|
|
82
106
|
/**
|
|
83
|
-
*
|
|
107
|
+
* 点到直线的最短距离
|
|
108
|
+
* @returns {{d: number, t: number}} d表示距离,t表示最近点在直线的比例
|
|
84
109
|
*/
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
*/
|
|
90
|
-
type GroupItemOptions = SDKItemOptions & {
|
|
110
|
+
distanceToLine(line: Line2): {
|
|
111
|
+
d: number;
|
|
112
|
+
t: number;
|
|
113
|
+
};
|
|
91
114
|
/**
|
|
92
|
-
*
|
|
115
|
+
* 二维向量与x轴夹角
|
|
116
|
+
* @returns {number} 弧度值
|
|
93
117
|
*/
|
|
94
|
-
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* @description Generator SDKItem 选项(资源生成器)
|
|
98
|
-
* @description 支持 image 和 video 两种生成器类型
|
|
99
|
-
* @description 使用 GeneratorItemProperty 包含 generatorType
|
|
100
|
-
*/
|
|
101
|
-
type GeneratorItemOptions = SDKItemOptions & {
|
|
118
|
+
angle(): number;
|
|
102
119
|
/**
|
|
103
|
-
*
|
|
120
|
+
* 二维点绕点旋转
|
|
121
|
+
* @param {Vec2} center 旋转中心
|
|
122
|
+
* @param {number} angle 旋转角度
|
|
123
|
+
* @returns {Vec2} 旋转结果
|
|
104
124
|
*/
|
|
105
|
-
|
|
106
|
-
};
|
|
107
|
-
type EffectsItemOptions = SDKItemOptions & {
|
|
108
|
-
property?: Partial<EffectsItemProperty>;
|
|
109
|
-
};
|
|
110
|
-
/**
|
|
111
|
-
* @description SDKItem 类型(独立于 spec.ItemType)
|
|
112
|
-
* @description 包含所有 SDK 层级的元素类型,包括虚拟类型如 generator
|
|
113
|
-
*/
|
|
114
|
-
declare enum SDKItemType {
|
|
115
|
-
SPRITE = "sprite",
|
|
116
|
-
TEXT = "text",
|
|
117
|
-
VIDEO = "video",
|
|
118
|
-
GROUP = "group",
|
|
119
|
-
GENERATOR = "generator",
|
|
120
|
-
EFFECTS = "effects",
|
|
121
|
-
FRAME = "frame"
|
|
125
|
+
rotateAround(center: Vector2, angle: number): this;
|
|
122
126
|
}
|
|
123
127
|
|
|
124
128
|
/**
|
|
125
|
-
* @
|
|
126
|
-
* @description 支持属性扩展,允许添加任意自定义属性
|
|
129
|
+
* @class 二维包围盒
|
|
127
130
|
*/
|
|
128
|
-
declare
|
|
131
|
+
declare class Box2 {
|
|
129
132
|
/**
|
|
130
|
-
* @
|
|
133
|
+
* @member {Vector2[]} corners 二维包围盒角点
|
|
131
134
|
*/
|
|
132
|
-
|
|
135
|
+
corners: Vector2[];
|
|
136
|
+
min: Vector2;
|
|
137
|
+
max: Vector2;
|
|
133
138
|
/**
|
|
134
|
-
*
|
|
139
|
+
* 构造函数,传入值为空时表示空包围盒
|
|
140
|
+
* @param {Vector2} [min=new Vector2(Infinity, Infinity)] 最小点
|
|
141
|
+
* @param {Vector2} [max=new Vector2(-Infinity, -Infinity)] 最大点
|
|
135
142
|
*/
|
|
136
|
-
|
|
143
|
+
constructor(min?: Vector2, max?: Vector2);
|
|
137
144
|
/**
|
|
138
|
-
*
|
|
145
|
+
* 通过最大最小点设置二维包围盒
|
|
146
|
+
* @param {Vector2} min 最小点
|
|
147
|
+
* @param {Vector2} max 最大点
|
|
148
|
+
* @returns {Box2} 二维包围盒
|
|
139
149
|
*/
|
|
140
|
-
|
|
150
|
+
set(min: Vector2, max: Vector2): this;
|
|
141
151
|
/**
|
|
142
|
-
*
|
|
152
|
+
* 通过角点设置二维包围盒
|
|
153
|
+
* @param {Vector2[]} vecArray 二维空间点数组
|
|
154
|
+
* @returns {Box2} 二维包围盒
|
|
143
155
|
*/
|
|
144
|
-
|
|
156
|
+
setFromVec2Array(vecArray: Vector2[]): this;
|
|
145
157
|
/**
|
|
146
|
-
*
|
|
158
|
+
* 通过屏幕坐标点设置二维包围盒 - 点为屏幕坐标点,x正方向为右,y正方向为向上
|
|
159
|
+
* @param vecArray 屏幕坐标点
|
|
147
160
|
*/
|
|
148
|
-
|
|
161
|
+
setFromVec2ArrayWithOutCorners(vecArray: Vector2[]): this;
|
|
149
162
|
/**
|
|
150
|
-
*
|
|
163
|
+
* 通过中心与大小设置二维包围盒
|
|
164
|
+
* @param {Vector2} center 二维中心点
|
|
165
|
+
* @param {Vector2} size 二维大小
|
|
166
|
+
* @returns {Box2} 二维包围盒
|
|
151
167
|
*/
|
|
152
|
-
|
|
168
|
+
setFromCenterAndSize(center: Vector2, size: Vector2): this;
|
|
153
169
|
/**
|
|
154
|
-
*
|
|
170
|
+
* 克隆二维包围盒
|
|
171
|
+
* @returns {Box2} 克隆结果
|
|
155
172
|
*/
|
|
156
|
-
|
|
173
|
+
clone(): Box2;
|
|
157
174
|
/**
|
|
158
|
-
*
|
|
175
|
+
* 复制二维包围盒
|
|
176
|
+
* @param {Box2} box 二维包围盒
|
|
177
|
+
* @returns {Box2} 复制结果
|
|
159
178
|
*/
|
|
160
|
-
|
|
161
|
-
isCoreEditable: boolean;
|
|
179
|
+
copyFrom(box: Box2): this;
|
|
162
180
|
/**
|
|
163
|
-
*
|
|
181
|
+
* 二维包围盒置空
|
|
182
|
+
* @returns {Box2} 置空结果
|
|
164
183
|
*/
|
|
165
|
-
|
|
184
|
+
makeEmpty(): this;
|
|
166
185
|
/**
|
|
167
|
-
*
|
|
168
|
-
* @
|
|
186
|
+
* 二维包围盒判空
|
|
187
|
+
* @returns {boolean} 判空结果
|
|
169
188
|
*/
|
|
170
|
-
|
|
189
|
+
isEmpty(): boolean;
|
|
171
190
|
/**
|
|
172
|
-
*
|
|
191
|
+
* 获取二维包围盒角点
|
|
192
|
+
* @returns {Vector2[]} 二维包围盒角点
|
|
173
193
|
*/
|
|
174
|
-
|
|
175
|
-
constructor(options: SDKItemOptions);
|
|
194
|
+
getCorners(): Vector2[];
|
|
176
195
|
/**
|
|
177
|
-
*
|
|
178
|
-
* @param
|
|
179
|
-
* @
|
|
196
|
+
* 获取二维包围盒中心点
|
|
197
|
+
* @param {Vector2} [target=new Vector2()] 目标点(用以存放二维包围盒中心点)
|
|
198
|
+
* @returns {Vector2} 二维包围盒中心点
|
|
180
199
|
*/
|
|
181
|
-
|
|
200
|
+
getCenter(target?: Vector2): Vector2;
|
|
182
201
|
/**
|
|
183
|
-
*
|
|
184
|
-
* @param
|
|
185
|
-
* @returns
|
|
202
|
+
* 获取二维包围盒大小
|
|
203
|
+
* @param {Vector2} [target=new Vector2()] 目标向量(用以存放二维包围盒大小)
|
|
204
|
+
* @returns {Vector2} 二维包围盒大小
|
|
186
205
|
*/
|
|
187
|
-
|
|
206
|
+
getSize(target?: Vector2): Vector2;
|
|
188
207
|
/**
|
|
189
|
-
*
|
|
190
|
-
* @param
|
|
191
|
-
* @returns
|
|
208
|
+
* 通过二维空间点扩展二维包围盒
|
|
209
|
+
* @param {Vector2} point 二维空间点
|
|
210
|
+
* @returns {Box2} 扩展包围盒
|
|
211
|
+
*/
|
|
212
|
+
expandByPoint(point: Vector2): this;
|
|
213
|
+
/**
|
|
214
|
+
* 通过向量扩展二维包围盒
|
|
215
|
+
* @param {Vector2} vector 二维向量
|
|
216
|
+
* @returns {Box2} 扩展结果
|
|
217
|
+
*/
|
|
218
|
+
expandByVector(vector: Vector2): this;
|
|
219
|
+
/**
|
|
220
|
+
* 通过大小扩展二维包围盒
|
|
221
|
+
* @param {number} scalar 扩展大小
|
|
222
|
+
* @returns {Box2} 扩展结果
|
|
223
|
+
*/
|
|
224
|
+
expandByScalar(scalar: number): this;
|
|
225
|
+
/**
|
|
226
|
+
* 判断二维包围盒是否包含二维空间点
|
|
227
|
+
* @param {Vector2} point 二维空间点
|
|
228
|
+
* @param {boolean} [isOrthogonal=true] 包围盒正交判断(默认为true)
|
|
229
|
+
* @returns {boolean} 点包含判断结果
|
|
230
|
+
*/
|
|
231
|
+
containsPoint(point: Vector2, isOrthogonal?: boolean): boolean;
|
|
232
|
+
/**
|
|
233
|
+
* 判断二维包围盒包含关系(if this contains other)
|
|
234
|
+
* @param {Box2} box 其它包围盒
|
|
235
|
+
* @returns {boolean} 二维包围盒包含判断结果
|
|
236
|
+
*/
|
|
237
|
+
containsBox(box: Box2): boolean;
|
|
238
|
+
/**
|
|
239
|
+
* 获取点以包围盒左上角顶点为原点的相对位置
|
|
240
|
+
* @param {Vector2} point 指定二维空间点
|
|
241
|
+
* @param {Vector2} [target=new Vector2()] 目标空间点
|
|
242
|
+
* @returns {Vector2} 计算结果空间点
|
|
243
|
+
*/
|
|
244
|
+
getParameter(point: Vector2, target?: Vector2): Vector2;
|
|
245
|
+
/**
|
|
246
|
+
* 求点与二维包围盒的最近点
|
|
247
|
+
* @param {Vector2} point 二维空间点
|
|
248
|
+
* @param {Vector2} [target=new Vector2()] 结果点
|
|
249
|
+
* @returns {Vector2} 二维空间点
|
|
250
|
+
*/
|
|
251
|
+
clampPoint(point: Vector2, target?: Vector2): Vector2;
|
|
252
|
+
/**
|
|
253
|
+
* 求点到二维包围盒的距离
|
|
254
|
+
* @param {Vector2} point 二维空间点
|
|
255
|
+
* @returns {number} 距离
|
|
256
|
+
*/
|
|
257
|
+
distanceToPoint(point: Vector2): number;
|
|
258
|
+
/**
|
|
259
|
+
* 二维包围盒求交集
|
|
260
|
+
* @param {Box2} box 二维包围盒
|
|
261
|
+
* @returns {Box2} 求交结果
|
|
262
|
+
*/
|
|
263
|
+
intersect(box: Box2): this;
|
|
264
|
+
/**
|
|
265
|
+
* 二维包围盒求并集
|
|
266
|
+
* @param {Box2} box 二维包围盒
|
|
267
|
+
* @returns {Box2} 求并结果
|
|
268
|
+
*/
|
|
269
|
+
union(target: Box2 | Vector2): this;
|
|
270
|
+
/**
|
|
271
|
+
* 二维包围盒位移
|
|
272
|
+
* @param {Vector2} offset 位移向量
|
|
273
|
+
* @returns {Box2} 位移结果
|
|
274
|
+
*/
|
|
275
|
+
translate(offset: Vector2): this;
|
|
276
|
+
scale(scalar: number | Vector2, anchor?: Vector2): this;
|
|
277
|
+
/**
|
|
278
|
+
* 二维包围盒判等
|
|
279
|
+
* @param {Box2} box 二维包围盒
|
|
280
|
+
* @returns {boolean} 判等结果
|
|
281
|
+
*/
|
|
282
|
+
equals(box: Box2): boolean;
|
|
283
|
+
/**
|
|
284
|
+
* 判断二维包围盒相交关系(if this intersect other)
|
|
285
|
+
* @param {Box2} box 二维包围盒
|
|
286
|
+
* @param {boolean} [isOrthogonal=true] 正交判断(当前包围盒)
|
|
287
|
+
* @returns {boolean} 相交判断结果
|
|
288
|
+
*/
|
|
289
|
+
intersectsBox(box: Box2, isOrthogonal?: boolean): boolean;
|
|
290
|
+
rotate(angle: number, center?: Vector2): this;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
type SizeAdaptDirection = 'x' | 'y';
|
|
294
|
+
|
|
295
|
+
declare const MEDIA_TYPE: {
|
|
296
|
+
readonly APNG: "APNG";
|
|
297
|
+
readonly MP4: "MP4";
|
|
298
|
+
readonly WebM: "WebM";
|
|
299
|
+
readonly Images: "Images";
|
|
300
|
+
readonly WebP: "WebP";
|
|
301
|
+
readonly GIF: "GIF";
|
|
302
|
+
readonly AlphaMaskVideo: "AlphaMaskVideo";
|
|
303
|
+
};
|
|
304
|
+
/**
|
|
305
|
+
* GIF 压缩参数
|
|
306
|
+
* 核心通过参数 flags + palettegen + paletteuse 实现
|
|
307
|
+
* highest: lanczos + max_colors=256 + dither=bayer
|
|
308
|
+
* high: bicubic + max_colors=200 + dither=bayer
|
|
309
|
+
* medium: bilinear + max_colors=64 + dither=bayer
|
|
310
|
+
* low: neighbor + max_colors=32 + dither=none
|
|
311
|
+
*/
|
|
312
|
+
declare const GIF_QUALITY_TO_FFMPEG_ARGS: {
|
|
313
|
+
highest: string;
|
|
314
|
+
high: string;
|
|
315
|
+
medium: string;
|
|
316
|
+
low: string;
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
declare global {
|
|
320
|
+
interface Window {
|
|
321
|
+
/**
|
|
322
|
+
* @description 创建 WebP Core 实例
|
|
323
|
+
*/
|
|
324
|
+
createWebPCore: (config: any) => Promise<Img2WebPCore>;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
type FileBuffer = ArrayBuffer | Uint8Array;
|
|
328
|
+
type MediaType = typeof MEDIA_TYPE[keyof typeof MEDIA_TYPE];
|
|
329
|
+
type FS = {
|
|
330
|
+
writeFile: (path: string, data: Uint8Array | string) => void;
|
|
331
|
+
readFile(path: string, opts: {
|
|
332
|
+
encoding: 'binary';
|
|
333
|
+
flags?: string | undefined;
|
|
334
|
+
}): Uint8Array;
|
|
335
|
+
readFile(path: string, opts: {
|
|
336
|
+
encoding: 'utf8';
|
|
337
|
+
flags?: string | undefined;
|
|
338
|
+
}): string;
|
|
339
|
+
readFile(path: string, opts?: {
|
|
340
|
+
flags?: string | undefined;
|
|
341
|
+
}): Uint8Array;
|
|
342
|
+
unlink: (path: string) => void;
|
|
343
|
+
quit: () => void;
|
|
344
|
+
};
|
|
345
|
+
type Pointer = number;
|
|
346
|
+
type Img2WebPCore = {
|
|
347
|
+
FS: FS;
|
|
348
|
+
run: (...args: string[]) => number;
|
|
349
|
+
cwrap: (ident: string, returnType: string, argTypes: string[]) => ((argc: number, argv: Pointer) => number);
|
|
350
|
+
_malloc: (size: number) => Pointer;
|
|
351
|
+
writeAsciiToMemory: (str: string, buffer: number, dontAddNull?: boolean) => void;
|
|
352
|
+
setValue: (ptr: number, value: any, type: string, noSafe?: boolean) => void;
|
|
353
|
+
};
|
|
354
|
+
type ExportMediaInitOptions = {
|
|
355
|
+
/**
|
|
356
|
+
* 导出类型
|
|
357
|
+
*/
|
|
358
|
+
mediaType: MediaType;
|
|
359
|
+
/**
|
|
360
|
+
* 额外画布,导出透明视频时使用
|
|
361
|
+
*/
|
|
362
|
+
extraCanvas?: HTMLCanvasElement | null;
|
|
363
|
+
/**
|
|
364
|
+
* 是否打印转码过程中的日志,仅在导出 MP4/AlphaMaskVideo 时有效, 默认 false
|
|
365
|
+
* 供开发调试使用
|
|
366
|
+
*/
|
|
367
|
+
loggerInTranscoding?: boolean;
|
|
368
|
+
/**
|
|
369
|
+
* ffmpeg 转码是否开启多线程,默认 false,确保环境支持 SharedArrayBuffer
|
|
370
|
+
*/
|
|
371
|
+
multiThreading?: boolean;
|
|
372
|
+
/**
|
|
373
|
+
* 是否输出 buffer,默认 false
|
|
374
|
+
*/
|
|
375
|
+
isOutputBuffer?: boolean;
|
|
376
|
+
};
|
|
377
|
+
type MP4Config = {
|
|
378
|
+
/**
|
|
379
|
+
* @description MP4 导出时是否需要导出最后一帧 PNG
|
|
380
|
+
*/
|
|
381
|
+
isExportLastFrameJPEG?: boolean;
|
|
382
|
+
};
|
|
383
|
+
type GifConfig = {
|
|
384
|
+
/**
|
|
385
|
+
* @description GIF 导出时的帧率
|
|
386
|
+
*/
|
|
387
|
+
fps?: number;
|
|
388
|
+
/**
|
|
389
|
+
* @description GIF 导出时的缩放比例
|
|
390
|
+
* 默认 '-1:-1', 表示不缩放
|
|
391
|
+
* 例如 '100:-1', 表示宽度 100,高度自动
|
|
392
|
+
* 例如 '-1:100', 表示宽度自动,高度 100
|
|
393
|
+
*/
|
|
394
|
+
scale?: string;
|
|
395
|
+
/**
|
|
396
|
+
* @description GIF 导出时的质量
|
|
397
|
+
* 默认 'highest'
|
|
398
|
+
* 可选 'highest', 'high', 'medium', 'low'
|
|
399
|
+
*/
|
|
400
|
+
quality?: keyof typeof GIF_QUALITY_TO_FFMPEG_ARGS;
|
|
401
|
+
};
|
|
402
|
+
type ApngConfig = {
|
|
403
|
+
/**
|
|
404
|
+
* @description APNG 导出时的帧率
|
|
405
|
+
*/
|
|
406
|
+
fps?: number;
|
|
407
|
+
/**
|
|
408
|
+
* @description APNG 导出时的缩放比例
|
|
409
|
+
* 默认 '-1:-1', 表示不缩放
|
|
410
|
+
* 例如 '100:-1', 表示宽度 100,高度自动
|
|
411
|
+
* 例如 '-1:100', 表示宽度自动,高度 100
|
|
412
|
+
*/
|
|
413
|
+
scale?: string;
|
|
414
|
+
/**
|
|
415
|
+
* @description APNG 导出时的质量
|
|
416
|
+
* 默认 'highest'
|
|
417
|
+
* 可选 'highest', 'high', 'medium', 'low'
|
|
418
|
+
*/
|
|
419
|
+
quality?: keyof typeof GIF_QUALITY_TO_FFMPEG_ARGS;
|
|
420
|
+
};
|
|
421
|
+
type ExportMediaItemOptions = {
|
|
422
|
+
/**
|
|
423
|
+
* 尺寸
|
|
424
|
+
*/
|
|
425
|
+
size: [number, number];
|
|
426
|
+
/**
|
|
427
|
+
* 动效资源
|
|
428
|
+
*/
|
|
429
|
+
scene: spec.JSONScene;
|
|
430
|
+
/**
|
|
431
|
+
* 视频时长,目前仅在导出 MP4 / AlphaMaskVideo 时有效,默认取动效资源时长
|
|
432
|
+
*/
|
|
433
|
+
time?: number;
|
|
434
|
+
/**
|
|
435
|
+
* 是否生成音轨,默认 false,仅在导出 MP4 时有效
|
|
436
|
+
*/
|
|
437
|
+
audioEnable?: boolean;
|
|
438
|
+
/**
|
|
439
|
+
* 帧率, 默认 30
|
|
440
|
+
*/
|
|
441
|
+
fps?: number;
|
|
442
|
+
/**
|
|
443
|
+
* 是否循环,默认 true
|
|
444
|
+
*/
|
|
445
|
+
loop?: boolean;
|
|
446
|
+
/**
|
|
447
|
+
* 视频背景颜色,默认 #000000
|
|
448
|
+
*/
|
|
449
|
+
backgroundColor?: string;
|
|
450
|
+
/**
|
|
451
|
+
* 导出 MP4 时,设置的导出配置
|
|
452
|
+
*/
|
|
453
|
+
mp4Config?: MP4Config;
|
|
454
|
+
/**
|
|
455
|
+
* 导出 GIF 时,设置的导出配置
|
|
456
|
+
*/
|
|
457
|
+
gifConfig?: GifConfig;
|
|
458
|
+
/**
|
|
459
|
+
* 导出 APNG 时,设置的导出配置
|
|
460
|
+
*/
|
|
461
|
+
apngConfig?: ApngConfig;
|
|
462
|
+
};
|
|
463
|
+
type ExportMediaItemDownloadInfo = {
|
|
464
|
+
/**
|
|
465
|
+
* @description 导出文件夹名称
|
|
466
|
+
*/
|
|
467
|
+
folderName: string;
|
|
468
|
+
/**
|
|
469
|
+
* @description 导出视频名称
|
|
470
|
+
*/
|
|
471
|
+
name: string;
|
|
472
|
+
};
|
|
473
|
+
type ExportItemParams = ExportMediaItemOptions & ExportMediaItemDownloadInfo;
|
|
474
|
+
type ExportParams = ExportItemParams[];
|
|
475
|
+
type Buffers = FileBuffer[] | undefined;
|
|
476
|
+
type Extras = (FileBuffer | null)[] | null | undefined;
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* @description SDKItem 基础选项接口
|
|
480
|
+
* @description 支持扩展属性,允许添加任意额外属性
|
|
481
|
+
*/
|
|
482
|
+
type SDKItemOptions = {
|
|
483
|
+
/**
|
|
484
|
+
* @description 元素ID
|
|
485
|
+
*/
|
|
486
|
+
id: string;
|
|
487
|
+
/**
|
|
488
|
+
* @description 元素名称
|
|
489
|
+
*/
|
|
490
|
+
name: string;
|
|
491
|
+
/**
|
|
492
|
+
* @description 父节点ID
|
|
493
|
+
*/
|
|
494
|
+
parentId?: string;
|
|
495
|
+
/**
|
|
496
|
+
* @description 子元素ID列表
|
|
497
|
+
*/
|
|
498
|
+
children?: string[];
|
|
499
|
+
/**
|
|
500
|
+
* @description 元素生命周期
|
|
501
|
+
*/
|
|
502
|
+
duration?: number;
|
|
503
|
+
/**
|
|
504
|
+
* @description 元素生命周期延时
|
|
505
|
+
*/
|
|
506
|
+
delay?: number;
|
|
507
|
+
/**
|
|
508
|
+
* @description 可视状态
|
|
509
|
+
*/
|
|
510
|
+
visible?: boolean;
|
|
511
|
+
/**
|
|
512
|
+
* @description 元素结束行为
|
|
513
|
+
*/
|
|
514
|
+
endBehavior?: spec.EndBehavior;
|
|
515
|
+
/**
|
|
516
|
+
* @description 是否处于锁定状态
|
|
517
|
+
*/
|
|
518
|
+
isLocked?: boolean;
|
|
519
|
+
/**
|
|
520
|
+
* @description 关键属性是否可编辑
|
|
521
|
+
*/
|
|
522
|
+
isCoreEditable: boolean;
|
|
523
|
+
/**
|
|
524
|
+
* @description 扩展属性存储(属性名 -> 属性值)
|
|
525
|
+
*/
|
|
526
|
+
extension?: Record<string, any>;
|
|
527
|
+
/**
|
|
528
|
+
* @description 允许任意额外属性(用于兼容旧代码)
|
|
529
|
+
*/
|
|
530
|
+
[extraProp: string]: any;
|
|
531
|
+
};
|
|
532
|
+
/**
|
|
533
|
+
* @description Sprite SDKItem 选项
|
|
534
|
+
*/
|
|
535
|
+
type SpriteItemOptions = SDKItemOptions & {
|
|
536
|
+
/**
|
|
537
|
+
* @description 元素属性
|
|
538
|
+
*/
|
|
539
|
+
property?: Partial<SpriteItemProperty>;
|
|
540
|
+
};
|
|
541
|
+
/**
|
|
542
|
+
* @description Text SDKItem 选项
|
|
543
|
+
*/
|
|
544
|
+
type TextItemOptions = SDKItemOptions & {
|
|
545
|
+
/**
|
|
546
|
+
* @description 元素属性
|
|
547
|
+
*/
|
|
548
|
+
property?: Partial<TextItemProperty>;
|
|
549
|
+
};
|
|
550
|
+
/**
|
|
551
|
+
* @description Video SDKItem 选项
|
|
552
|
+
*/
|
|
553
|
+
type VideoItemOptions = SDKItemOptions & {
|
|
554
|
+
/**
|
|
555
|
+
* @description 元素属性
|
|
556
|
+
*/
|
|
557
|
+
property?: Partial<VideoItemProperty>;
|
|
558
|
+
};
|
|
559
|
+
/**
|
|
560
|
+
* @description Group SDKItem 选项(空节点/组)
|
|
561
|
+
*/
|
|
562
|
+
type GroupItemOptions = SDKItemOptions & {
|
|
563
|
+
/**
|
|
564
|
+
* @description 元素属性
|
|
565
|
+
*/
|
|
566
|
+
property?: Partial<GroupItemProperty>;
|
|
567
|
+
};
|
|
568
|
+
/**
|
|
569
|
+
* @description Generator SDKItem 选项(资源生成器)
|
|
570
|
+
* @description 支持 image 和 video 两种生成器类型
|
|
571
|
+
* @description 使用 GeneratorItemProperty 包含 generatorType
|
|
572
|
+
*/
|
|
573
|
+
type GeneratorItemOptions = SDKItemOptions & {
|
|
574
|
+
/**
|
|
575
|
+
* @description 元素属性(包含 generatorType)
|
|
576
|
+
*/
|
|
577
|
+
property?: Partial<GeneratorItemProperty>;
|
|
578
|
+
};
|
|
579
|
+
type EffectsItemOptions = SDKItemOptions & {
|
|
580
|
+
property?: Partial<EffectsItemProperty>;
|
|
581
|
+
};
|
|
582
|
+
/**
|
|
583
|
+
* @description Frame 画板元素 SDKItem 选项
|
|
584
|
+
*/
|
|
585
|
+
type FrameItemOptions = SDKItemOptions & {
|
|
586
|
+
/**
|
|
587
|
+
* @description 元素属性
|
|
588
|
+
*/
|
|
589
|
+
property?: Partial<FrameItemProperty>;
|
|
590
|
+
};
|
|
591
|
+
/**
|
|
592
|
+
* @description SDKItem 类型(独立于 spec.ItemType)
|
|
593
|
+
* @description 包含所有 SDK 层级的元素类型,包括虚拟类型如 generator
|
|
594
|
+
*/
|
|
595
|
+
declare enum SDKItemType {
|
|
596
|
+
SPRITE = "sprite",
|
|
597
|
+
TEXT = "text",
|
|
598
|
+
VIDEO = "video",
|
|
599
|
+
GROUP = "group",
|
|
600
|
+
GENERATOR = "generator",
|
|
601
|
+
EFFECTS = "effects",
|
|
602
|
+
FRAME = "frame"
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* @description SDKItem 抽象基类
|
|
607
|
+
* @description 支持属性扩展,允许添加任意自定义属性
|
|
608
|
+
*/
|
|
609
|
+
declare abstract class BaseItem {
|
|
610
|
+
/**
|
|
611
|
+
* @description 元素ID
|
|
612
|
+
*/
|
|
613
|
+
id: string;
|
|
614
|
+
/**
|
|
615
|
+
* @description 元素名称
|
|
616
|
+
*/
|
|
617
|
+
name: string;
|
|
618
|
+
/**
|
|
619
|
+
* @description 父节点ID
|
|
620
|
+
*/
|
|
621
|
+
parentId?: string;
|
|
622
|
+
/**
|
|
623
|
+
* @description 元素生命周期
|
|
624
|
+
*/
|
|
625
|
+
duration: number;
|
|
626
|
+
/**
|
|
627
|
+
* @description 元素生命周期延时
|
|
628
|
+
*/
|
|
629
|
+
delay: number;
|
|
630
|
+
/**
|
|
631
|
+
* @description 元素结束行为
|
|
632
|
+
*/
|
|
633
|
+
endBehavior: spec.EndBehavior;
|
|
634
|
+
/**
|
|
635
|
+
* @description 是否可见
|
|
636
|
+
*/
|
|
637
|
+
visible: boolean;
|
|
638
|
+
/**
|
|
639
|
+
* @description 是否处于锁定状态
|
|
640
|
+
*/
|
|
641
|
+
isLocked: boolean;
|
|
642
|
+
/**
|
|
643
|
+
* @description 核心数据是否支持编辑
|
|
644
|
+
*/
|
|
645
|
+
isCoreEditable: boolean;
|
|
646
|
+
/**
|
|
647
|
+
* @description 扩展属性存储(与 property 同级)
|
|
648
|
+
*/
|
|
649
|
+
extension: Map<string, any>;
|
|
650
|
+
/**
|
|
651
|
+
* @description 元素类型(由子类实现)
|
|
652
|
+
* @description 支持 spec.ItemType 或扩展的 SDKItemType
|
|
653
|
+
*/
|
|
654
|
+
abstract readonly type: SDKItemType;
|
|
655
|
+
/**
|
|
656
|
+
* @description 元素属性(由子类实现)
|
|
657
|
+
*/
|
|
658
|
+
abstract readonly property: BaseItemProperty;
|
|
659
|
+
constructor(options: SDKItemOptions);
|
|
660
|
+
/**
|
|
661
|
+
* @description 设置扩展属性
|
|
662
|
+
* @param key 属性名
|
|
663
|
+
* @param value 属性值
|
|
664
|
+
*/
|
|
665
|
+
setExtension(key: string, value: any): void;
|
|
666
|
+
/**
|
|
667
|
+
* @description 获取扩展属性
|
|
668
|
+
* @param key 属性名
|
|
669
|
+
* @returns 属性值
|
|
670
|
+
*/
|
|
671
|
+
getExtension(key: string): any;
|
|
672
|
+
/**
|
|
673
|
+
* @description 检查是否存在指定扩展属性
|
|
674
|
+
* @param key 属性名
|
|
675
|
+
* @returns 是否存在
|
|
192
676
|
*/
|
|
193
677
|
hasExtension(key: string): boolean;
|
|
194
678
|
/**
|
|
@@ -377,280 +861,57 @@ declare class TextItem extends BaseItem {
|
|
|
377
861
|
/**
|
|
378
862
|
* @description 描边宽度
|
|
379
863
|
*/
|
|
380
|
-
get outlineWidth(): number | undefined;
|
|
381
|
-
set outlineWidth(value: number | undefined);
|
|
382
|
-
/**
|
|
383
|
-
* @description 描边开关
|
|
384
|
-
*/
|
|
385
|
-
get outlineEnabled(): boolean;
|
|
386
|
-
set outlineEnabled(value: boolean);
|
|
387
|
-
/**
|
|
388
|
-
* @description 位置
|
|
389
|
-
*/
|
|
390
|
-
get position(): [number, number];
|
|
391
|
-
set position(value: [number, number]);
|
|
392
|
-
/**
|
|
393
|
-
* @description 旋转(二维旋转角度)
|
|
394
|
-
*/
|
|
395
|
-
get rotation(): number;
|
|
396
|
-
set rotation(value: number);
|
|
397
|
-
/**
|
|
398
|
-
* @description 转换为 CreateInfo
|
|
399
|
-
* @param withParent 是否包含父节点ID
|
|
400
|
-
*/
|
|
401
|
-
toCreateInfo(withParent?: boolean): TextCreateInfo;
|
|
402
|
-
/**
|
|
403
|
-
* @description 克隆 SDKItem
|
|
404
|
-
*/
|
|
405
|
-
clone(): TextItem;
|
|
406
|
-
}
|
|
407
|
-
/**
|
|
408
|
-
* @description 类型守卫:检查是否是 TextItem
|
|
409
|
-
*/
|
|
410
|
-
declare function isTextItem(obj: any): obj is TextItem;
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* @description 视频元素 SDKItem 类
|
|
414
|
-
* @description 支持属性扩展
|
|
415
|
-
*/
|
|
416
|
-
declare class VideoItem extends BaseItem {
|
|
417
|
-
/**
|
|
418
|
-
* @description 元素类型
|
|
419
|
-
*/
|
|
420
|
-
readonly type = SDKItemType.VIDEO;
|
|
421
|
-
/**
|
|
422
|
-
* @description 元素属性
|
|
423
|
-
*/
|
|
424
|
-
property: VideoItemProperty;
|
|
425
|
-
constructor(options: VideoItemOptions);
|
|
426
|
-
/**
|
|
427
|
-
* @description 视频地址
|
|
428
|
-
*/
|
|
429
|
-
get video(): string;
|
|
430
|
-
set video(value: string);
|
|
431
|
-
/**
|
|
432
|
-
* @description 位置
|
|
433
|
-
*/
|
|
434
|
-
get position(): [number, number];
|
|
435
|
-
set position(value: [number, number]);
|
|
436
|
-
/**
|
|
437
|
-
* @description 宽度
|
|
438
|
-
*/
|
|
439
|
-
get width(): number;
|
|
440
|
-
set width(value: number);
|
|
441
|
-
/**
|
|
442
|
-
* @description 高度
|
|
443
|
-
*/
|
|
444
|
-
get height(): number;
|
|
445
|
-
set height(value: number);
|
|
446
|
-
/**
|
|
447
|
-
* @description 旋转(二维旋转角度)
|
|
448
|
-
*/
|
|
449
|
-
get rotation(): number;
|
|
450
|
-
set rotation(value: number);
|
|
451
|
-
/**
|
|
452
|
-
* @description 完整旋转(包含 x, y, z)
|
|
453
|
-
*/
|
|
454
|
-
get fullRotation(): [number, number, number];
|
|
455
|
-
set fullRotation(value: [number, number, number]);
|
|
456
|
-
/**
|
|
457
|
-
* @description 是否正在编辑关键属性
|
|
458
|
-
* @deprecated 该属性即将废弃,使用 isCoreEditable 代替
|
|
459
|
-
*/
|
|
460
|
-
get keyPropertyEditing(): boolean;
|
|
461
|
-
set keyPropertyEditing(value: boolean);
|
|
462
|
-
/**
|
|
463
|
-
* @description 是否静音
|
|
464
|
-
*/
|
|
465
|
-
get muted(): boolean;
|
|
466
|
-
set muted(state: boolean);
|
|
467
|
-
/**
|
|
468
|
-
* @description 是否为透明视频
|
|
469
|
-
*/
|
|
470
|
-
get transparent(): boolean;
|
|
471
|
-
set transparent(state: boolean);
|
|
472
|
-
/**
|
|
473
|
-
* @description 播放音量
|
|
474
|
-
*/
|
|
475
|
-
get volume(): number;
|
|
476
|
-
set volume(value: number);
|
|
477
|
-
/**
|
|
478
|
-
* @description 播放速率
|
|
479
|
-
*/
|
|
480
|
-
get playbackRate(): number;
|
|
481
|
-
set playbackRate(value: number);
|
|
482
|
-
/**
|
|
483
|
-
* @description 转换为 CreateInfo
|
|
484
|
-
* @param withParent 是否包含父节点ID
|
|
485
|
-
*/
|
|
486
|
-
toCreateInfo(withParent?: boolean): VideoCreateInfo;
|
|
487
|
-
/**
|
|
488
|
-
* @description 克隆 SDKItem
|
|
489
|
-
*/
|
|
490
|
-
clone(): VideoItem;
|
|
491
|
-
}
|
|
492
|
-
/**
|
|
493
|
-
* @description 类型守卫:检查是否是 VideoItem
|
|
494
|
-
*/
|
|
495
|
-
declare function isVideoItem(obj: any): obj is VideoItem;
|
|
496
|
-
|
|
497
|
-
/**
|
|
498
|
-
* @description 空节点/组 SDKItem 类
|
|
499
|
-
* @description 支持属性扩展
|
|
500
|
-
*/
|
|
501
|
-
declare class GroupItem extends BaseItem {
|
|
502
|
-
/**
|
|
503
|
-
* @description 元素类型
|
|
504
|
-
*/
|
|
505
|
-
readonly type = SDKItemType.GROUP;
|
|
506
|
-
/**
|
|
507
|
-
* @description 元素属性
|
|
508
|
-
*/
|
|
509
|
-
property: GroupItemProperty;
|
|
510
|
-
constructor(options: GroupItemOptions);
|
|
511
|
-
/**
|
|
512
|
-
* @description 位置
|
|
513
|
-
*/
|
|
514
|
-
get position(): [number, number];
|
|
515
|
-
set position(value: [number, number]);
|
|
516
|
-
/**
|
|
517
|
-
* @description 大小
|
|
518
|
-
*/
|
|
519
|
-
get scale(): [number, number];
|
|
520
|
-
set scale(value: [number, number]);
|
|
521
|
-
/**
|
|
522
|
-
* @description 旋转(二维旋转角度)
|
|
523
|
-
*/
|
|
524
|
-
get rotation(): number;
|
|
525
|
-
set rotation(value: number);
|
|
526
|
-
/**
|
|
527
|
-
* @description 完整旋转(包含 x, y, z)
|
|
528
|
-
*/
|
|
529
|
-
get fullRotation(): [number, number, number];
|
|
530
|
-
set fullRotation(value: [number, number, number]);
|
|
531
|
-
/**
|
|
532
|
-
* @description 是否正在编辑关键属性
|
|
533
|
-
* @deprecated 该属性即将废弃,使用 isCoreEditable 代替
|
|
534
|
-
*/
|
|
535
|
-
get keyPropertyEditing(): boolean;
|
|
536
|
-
set keyPropertyEditing(value: boolean);
|
|
537
|
-
/**
|
|
538
|
-
* @description 转换为 CreateInfo
|
|
539
|
-
* @param withParent 是否包含父节点ID
|
|
540
|
-
*/
|
|
541
|
-
toCreateInfo(withParent?: boolean): GroupCreateInfo;
|
|
542
|
-
/**
|
|
543
|
-
* @description 克隆 SDKItem
|
|
544
|
-
*/
|
|
545
|
-
clone(): GroupItem;
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* @description 类型守卫:检查是否是 GroupItem
|
|
549
|
-
*/
|
|
550
|
-
declare function isGroupItem(obj: any): obj is GroupItem;
|
|
551
|
-
|
|
552
|
-
/**
|
|
553
|
-
* @description 资源生成器元素 SDKItem 类
|
|
554
|
-
* @description 支持 image 和 video 两种生成器类型
|
|
555
|
-
* @description 在 Player 中以透明 SpriteItem 形式渲染
|
|
556
|
-
* @description 支持属性扩展,可转换为 SpriteItem 或 VideoItem
|
|
557
|
-
*/
|
|
558
|
-
declare class GeneratorItem extends BaseItem {
|
|
559
|
-
/**
|
|
560
|
-
* @description 元素类型(独立类型,不属于 spec.ItemType)
|
|
561
|
-
*/
|
|
562
|
-
readonly type = SDKItemType.GENERATOR;
|
|
563
|
-
/**
|
|
564
|
-
* @description 元素属性(包含 generatorType)
|
|
565
|
-
*/
|
|
566
|
-
property: GeneratorItemProperty;
|
|
567
|
-
constructor(options: GeneratorItemOptions);
|
|
568
|
-
/**
|
|
569
|
-
* @description 生成器类型
|
|
570
|
-
*/
|
|
571
|
-
get generatorType(): 'image' | 'video';
|
|
572
|
-
set generatorType(value: 'image' | 'video');
|
|
573
|
-
/**
|
|
574
|
-
* @description 图片地址(生成器返回空)
|
|
575
|
-
*/
|
|
576
|
-
get image(): string;
|
|
577
|
-
set image(_value: string);
|
|
578
|
-
/**
|
|
579
|
-
* @description 位置
|
|
580
|
-
*/
|
|
581
|
-
get position(): [number, number];
|
|
582
|
-
set position(value: [number, number]);
|
|
583
|
-
/**
|
|
584
|
-
* @description 宽度
|
|
585
|
-
*/
|
|
586
|
-
get width(): number;
|
|
587
|
-
set width(value: number);
|
|
588
|
-
/**
|
|
589
|
-
* @description 高度
|
|
590
|
-
*/
|
|
591
|
-
get height(): number;
|
|
592
|
-
set height(value: number);
|
|
593
|
-
/**
|
|
594
|
-
* @description 旋转(二维旋转角度)
|
|
595
|
-
*/
|
|
596
|
-
get rotation(): number;
|
|
597
|
-
set rotation(value: number);
|
|
598
|
-
/**
|
|
599
|
-
* @description 完整旋转(包含 x, y, z)
|
|
600
|
-
*/
|
|
601
|
-
get fullRotation(): [number, number, number];
|
|
602
|
-
set fullRotation(value: [number, number, number]);
|
|
864
|
+
get outlineWidth(): number | undefined;
|
|
865
|
+
set outlineWidth(value: number | undefined);
|
|
603
866
|
/**
|
|
604
|
-
* @description
|
|
605
|
-
* @deprecated 该属性即将废弃,使用 isCoreEditable 代替
|
|
867
|
+
* @description 描边开关
|
|
606
868
|
*/
|
|
607
|
-
get
|
|
608
|
-
set
|
|
869
|
+
get outlineEnabled(): boolean;
|
|
870
|
+
set outlineEnabled(value: boolean);
|
|
609
871
|
/**
|
|
610
|
-
* @description
|
|
611
|
-
* @param withParent 是否包含父节点ID
|
|
872
|
+
* @description 位置
|
|
612
873
|
*/
|
|
613
|
-
|
|
874
|
+
get position(): [number, number];
|
|
875
|
+
set position(value: [number, number]);
|
|
614
876
|
/**
|
|
615
|
-
* @description
|
|
616
|
-
* @param videoUrl 视频资源地址
|
|
617
|
-
* @param withParent 是否包含父节点ID
|
|
877
|
+
* @description 旋转(二维旋转角度)
|
|
618
878
|
*/
|
|
619
|
-
|
|
879
|
+
get rotation(): number;
|
|
880
|
+
set rotation(value: number);
|
|
620
881
|
/**
|
|
621
|
-
* @description 转换为
|
|
622
|
-
* @param imageUrl 图片资源地址
|
|
882
|
+
* @description 转换为 CreateInfo
|
|
623
883
|
* @param withParent 是否包含父节点ID
|
|
624
884
|
*/
|
|
625
|
-
|
|
885
|
+
toCreateInfo(withParent?: boolean): TextCreateInfo;
|
|
626
886
|
/**
|
|
627
887
|
* @description 克隆 SDKItem
|
|
628
888
|
*/
|
|
629
|
-
clone():
|
|
889
|
+
clone(): TextItem;
|
|
630
890
|
}
|
|
631
891
|
/**
|
|
632
|
-
* @description 类型守卫:检查是否是
|
|
892
|
+
* @description 类型守卫:检查是否是 TextItem
|
|
633
893
|
*/
|
|
634
|
-
declare function
|
|
894
|
+
declare function isTextItem(obj: any): obj is TextItem;
|
|
635
895
|
|
|
636
896
|
/**
|
|
637
|
-
* @description
|
|
897
|
+
* @description 视频元素 SDKItem 类
|
|
898
|
+
* @description 支持属性扩展
|
|
638
899
|
*/
|
|
639
|
-
declare class
|
|
900
|
+
declare class VideoItem extends BaseItem {
|
|
640
901
|
/**
|
|
641
|
-
* @description
|
|
902
|
+
* @description 元素类型
|
|
642
903
|
*/
|
|
643
|
-
readonly type = SDKItemType.
|
|
904
|
+
readonly type = SDKItemType.VIDEO;
|
|
644
905
|
/**
|
|
645
906
|
* @description 元素属性
|
|
646
907
|
*/
|
|
647
|
-
property:
|
|
648
|
-
constructor(options:
|
|
908
|
+
property: VideoItemProperty;
|
|
909
|
+
constructor(options: VideoItemOptions);
|
|
649
910
|
/**
|
|
650
|
-
* @description
|
|
911
|
+
* @description 视频地址
|
|
651
912
|
*/
|
|
652
|
-
get
|
|
653
|
-
set
|
|
913
|
+
get video(): string;
|
|
914
|
+
set video(value: string);
|
|
654
915
|
/**
|
|
655
916
|
* @description 位置
|
|
656
917
|
*/
|
|
@@ -683,504 +944,363 @@ declare class EffectsItem extends BaseItem {
|
|
|
683
944
|
get keyPropertyEditing(): boolean;
|
|
684
945
|
set keyPropertyEditing(value: boolean);
|
|
685
946
|
/**
|
|
686
|
-
* @description
|
|
687
|
-
* @param withParent 是否包含父节点ID
|
|
688
|
-
*/
|
|
689
|
-
toCreateInfo(withParent?: boolean): EffectsCreateInfo;
|
|
690
|
-
/**
|
|
691
|
-
* @description 克隆 SDKItem
|
|
692
|
-
*/
|
|
693
|
-
clone(): EffectsItem;
|
|
694
|
-
}
|
|
695
|
-
/**
|
|
696
|
-
* @description 类型守卫:检查是否是 EffectsItem
|
|
697
|
-
*/
|
|
698
|
-
declare function isEffectsItem(obj: any): obj is EffectsItem;
|
|
699
|
-
|
|
700
|
-
/**
|
|
701
|
-
* @description 根据 item type 创建对应的 SDKItem 实例
|
|
702
|
-
* @param type 元素类型
|
|
703
|
-
* @param options SDKItem 选项
|
|
704
|
-
* @returns SDKItem 实例
|
|
705
|
-
*/
|
|
706
|
-
declare function createSDKItem(type: spec.ItemType, options: SDKItemOptions): BaseItem;
|
|
707
|
-
/**
|
|
708
|
-
* @description SDKItem 类型联合
|
|
709
|
-
* @description 用于替换原来的 SDKItem type
|
|
710
|
-
*/
|
|
711
|
-
type SDKItem$1 = SpriteItem | TextItem | VideoItem | GroupItem | GeneratorItem | EffectsItem;
|
|
712
|
-
|
|
713
|
-
/**
|
|
714
|
-
* @class 二维线段
|
|
715
|
-
*/
|
|
716
|
-
declare class Line2 {
|
|
717
|
-
start: Vector2;
|
|
718
|
-
end: Vector2;
|
|
719
|
-
constructor(start?: Vector2, end?: Vector2);
|
|
720
|
-
/**
|
|
721
|
-
* 设置二维线段
|
|
722
|
-
* @param {Vector2} start 线段起点
|
|
723
|
-
* @param {Vector2} end 线段终点
|
|
724
|
-
* @returns {Line2} 二维线段
|
|
725
|
-
*/
|
|
726
|
-
set(start: Vector2, end: Vector2): this;
|
|
727
|
-
/**
|
|
728
|
-
* 复制二维线段
|
|
729
|
-
* @param {Line2} line 复制对象
|
|
730
|
-
* @returns {Line2} 复制结果
|
|
731
|
-
*/
|
|
732
|
-
copyFrom(line: Line2): this;
|
|
733
|
-
/**
|
|
734
|
-
* 二维线段求方向
|
|
735
|
-
* @returns {Vector2} 二维线段方向
|
|
736
|
-
*/
|
|
737
|
-
direction(): Vector2;
|
|
738
|
-
/**
|
|
739
|
-
* 二维线段求中点
|
|
740
|
-
* @param {Vector2} [target=new Vector2()] 目标保存对象
|
|
741
|
-
* @returns {Vector2} 二维线段中点
|
|
742
|
-
*/
|
|
743
|
-
getCenter(target?: Vector2): Vector2;
|
|
744
|
-
/**
|
|
745
|
-
* 二维线段向量值
|
|
746
|
-
* @param {Vector2} [target=new Vector2()] 目标保存对象
|
|
747
|
-
* @returns {Vector2} 二维线段向量值
|
|
748
|
-
*/
|
|
749
|
-
delta(target?: Vector2): Vector2;
|
|
750
|
-
/**
|
|
751
|
-
* 二维线段欧式距离平方(应用于计算)
|
|
752
|
-
* @returns {number} 计算结果
|
|
753
|
-
*/
|
|
754
|
-
distanceSq(): number;
|
|
755
|
-
/**
|
|
756
|
-
* 二维线段欧式距离
|
|
757
|
-
* @returns {number} 计算结果
|
|
758
|
-
*/
|
|
759
|
-
distance(): number;
|
|
760
|
-
/**
|
|
761
|
-
* 求二维线段比例点
|
|
762
|
-
* @param {number} t 比例值
|
|
763
|
-
* @param {Vector2} target 目标保存对象
|
|
764
|
-
* @returns {Vector2} 比例点结果
|
|
765
|
-
*/
|
|
766
|
-
at(t: number, target?: Vector2): Vector2;
|
|
767
|
-
/**
|
|
768
|
-
* 求点与线段的最短距离
|
|
769
|
-
* @param {Vector2} point 二维空间点
|
|
770
|
-
* @param {boolean} clampToLine 是否限制于线段内
|
|
771
|
-
* @returns {number} 距离结果
|
|
947
|
+
* @description 是否静音
|
|
772
948
|
*/
|
|
773
|
-
|
|
949
|
+
get muted(): boolean;
|
|
950
|
+
set muted(state: boolean);
|
|
774
951
|
/**
|
|
775
|
-
*
|
|
776
|
-
* @param {Vector2} point 二维空间点
|
|
777
|
-
* @param {boolean} clampToLine 是否限制于线段内
|
|
778
|
-
* @param {Vector2} target 目标保存对象
|
|
779
|
-
* @returns {Vector2} 最近交点
|
|
952
|
+
* @description 是否为透明视频
|
|
780
953
|
*/
|
|
781
|
-
|
|
954
|
+
get transparent(): boolean;
|
|
955
|
+
set transparent(state: boolean);
|
|
782
956
|
/**
|
|
783
|
-
*
|
|
784
|
-
* @param {Line2} line 二维线段
|
|
785
|
-
* @returns {boolean} 判等结果
|
|
957
|
+
* @description 播放音量
|
|
786
958
|
*/
|
|
787
|
-
|
|
959
|
+
get volume(): number;
|
|
960
|
+
set volume(value: number);
|
|
788
961
|
/**
|
|
789
|
-
*
|
|
790
|
-
* @returns {Line2} 克隆结果
|
|
962
|
+
* @description 播放速率
|
|
791
963
|
*/
|
|
792
|
-
|
|
964
|
+
get playbackRate(): number;
|
|
965
|
+
set playbackRate(value: number);
|
|
793
966
|
/**
|
|
794
|
-
*
|
|
795
|
-
* @
|
|
967
|
+
* @description 转换为 CreateInfo
|
|
968
|
+
* @param withParent 是否包含父节点ID
|
|
796
969
|
*/
|
|
797
|
-
|
|
970
|
+
toCreateInfo(withParent?: boolean): VideoCreateInfo;
|
|
798
971
|
/**
|
|
799
|
-
*
|
|
800
|
-
* @param {Line2} other 二维线段
|
|
801
|
-
* @returns {boolean} 相交判断结果
|
|
972
|
+
* @description 克隆 SDKItem
|
|
802
973
|
*/
|
|
803
|
-
|
|
974
|
+
clone(): VideoItem;
|
|
804
975
|
}
|
|
976
|
+
/**
|
|
977
|
+
* @description 类型守卫:检查是否是 VideoItem
|
|
978
|
+
*/
|
|
979
|
+
declare function isVideoItem(obj: any): obj is VideoItem;
|
|
805
980
|
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
scaleByCenter(scalar: Vector2, anchor?: Vector2): this;
|
|
812
|
-
round(precision?: number): this;
|
|
981
|
+
/**
|
|
982
|
+
* @description 空节点/组 SDKItem 类
|
|
983
|
+
* @description 支持属性扩展
|
|
984
|
+
*/
|
|
985
|
+
declare class GroupItem extends BaseItem {
|
|
813
986
|
/**
|
|
814
|
-
*
|
|
815
|
-
* @returns {{d: number, t: number}} d表示距离,t表示最近点在直线的比例
|
|
987
|
+
* @description 元素类型
|
|
816
988
|
*/
|
|
817
|
-
|
|
818
|
-
d: number;
|
|
819
|
-
t: number;
|
|
820
|
-
};
|
|
989
|
+
readonly type = SDKItemType.GROUP;
|
|
821
990
|
/**
|
|
822
|
-
*
|
|
823
|
-
* @returns {number} 弧度值
|
|
991
|
+
* @description 元素属性
|
|
824
992
|
*/
|
|
825
|
-
|
|
993
|
+
property: GroupItemProperty;
|
|
994
|
+
constructor(options: GroupItemOptions);
|
|
826
995
|
/**
|
|
827
|
-
*
|
|
828
|
-
* @param {Vec2} center 旋转中心
|
|
829
|
-
* @param {number} angle 旋转角度
|
|
830
|
-
* @returns {Vec2} 旋转结果
|
|
996
|
+
* @description 位置
|
|
831
997
|
*/
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
/**
|
|
836
|
-
* @class 二维包围盒
|
|
837
|
-
*/
|
|
838
|
-
declare class Box2 {
|
|
998
|
+
get position(): [number, number];
|
|
999
|
+
set position(value: [number, number]);
|
|
839
1000
|
/**
|
|
840
|
-
* @
|
|
1001
|
+
* @description 大小
|
|
841
1002
|
*/
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
max: Vector2;
|
|
1003
|
+
get scale(): [number, number];
|
|
1004
|
+
set scale(value: [number, number]);
|
|
845
1005
|
/**
|
|
846
|
-
*
|
|
847
|
-
* @param {Vector2} [min=new Vector2(Infinity, Infinity)] 最小点
|
|
848
|
-
* @param {Vector2} [max=new Vector2(-Infinity, -Infinity)] 最大点
|
|
1006
|
+
* @description 旋转(二维旋转角度)
|
|
849
1007
|
*/
|
|
850
|
-
|
|
1008
|
+
get rotation(): number;
|
|
1009
|
+
set rotation(value: number);
|
|
851
1010
|
/**
|
|
852
|
-
*
|
|
853
|
-
* @param {Vector2} min 最小点
|
|
854
|
-
* @param {Vector2} max 最大点
|
|
855
|
-
* @returns {Box2} 二维包围盒
|
|
1011
|
+
* @description 完整旋转(包含 x, y, z)
|
|
856
1012
|
*/
|
|
857
|
-
|
|
1013
|
+
get fullRotation(): [number, number, number];
|
|
1014
|
+
set fullRotation(value: [number, number, number]);
|
|
858
1015
|
/**
|
|
859
|
-
*
|
|
860
|
-
* @
|
|
861
|
-
* @returns {Box2} 二维包围盒
|
|
1016
|
+
* @description 是否正在编辑关键属性
|
|
1017
|
+
* @deprecated 该属性即将废弃,使用 isCoreEditable 代替
|
|
862
1018
|
*/
|
|
863
|
-
|
|
1019
|
+
get keyPropertyEditing(): boolean;
|
|
1020
|
+
set keyPropertyEditing(value: boolean);
|
|
864
1021
|
/**
|
|
865
|
-
*
|
|
866
|
-
* @param
|
|
1022
|
+
* @description 转换为 CreateInfo
|
|
1023
|
+
* @param withParent 是否包含父节点ID
|
|
1024
|
+
*/
|
|
1025
|
+
toCreateInfo(withParent?: boolean): GroupCreateInfo;
|
|
1026
|
+
/**
|
|
1027
|
+
* @description 克隆 SDKItem
|
|
867
1028
|
*/
|
|
868
|
-
|
|
1029
|
+
clone(): GroupItem;
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* @description 类型守卫:检查是否是 GroupItem
|
|
1033
|
+
*/
|
|
1034
|
+
declare function isGroupItem(obj: any): obj is GroupItem;
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
* @description 资源生成器元素 SDKItem 类
|
|
1038
|
+
* @description 支持 image 和 video 两种生成器类型
|
|
1039
|
+
* @description 在 Player 中以透明 SpriteItem 形式渲染
|
|
1040
|
+
* @description 支持属性扩展,可转换为 SpriteItem 或 VideoItem
|
|
1041
|
+
*/
|
|
1042
|
+
declare class GeneratorItem extends BaseItem {
|
|
869
1043
|
/**
|
|
870
|
-
*
|
|
871
|
-
* @param {Vector2} center 二维中心点
|
|
872
|
-
* @param {Vector2} size 二维大小
|
|
873
|
-
* @returns {Box2} 二维包围盒
|
|
1044
|
+
* @description 元素类型(独立类型,不属于 spec.ItemType)
|
|
874
1045
|
*/
|
|
875
|
-
|
|
1046
|
+
readonly type = SDKItemType.GENERATOR;
|
|
876
1047
|
/**
|
|
877
|
-
*
|
|
878
|
-
* @returns {Box2} 克隆结果
|
|
1048
|
+
* @description 元素属性(包含 generatorType)
|
|
879
1049
|
*/
|
|
880
|
-
|
|
1050
|
+
property: GeneratorItemProperty;
|
|
1051
|
+
constructor(options: GeneratorItemOptions);
|
|
881
1052
|
/**
|
|
882
|
-
*
|
|
883
|
-
* @param {Box2} box 二维包围盒
|
|
884
|
-
* @returns {Box2} 复制结果
|
|
1053
|
+
* @description 生成器类型
|
|
885
1054
|
*/
|
|
886
|
-
|
|
1055
|
+
get generatorType(): 'image' | 'video';
|
|
1056
|
+
set generatorType(value: 'image' | 'video');
|
|
887
1057
|
/**
|
|
888
|
-
*
|
|
889
|
-
* @returns {Box2} 置空结果
|
|
1058
|
+
* @description 图片地址(生成器返回空)
|
|
890
1059
|
*/
|
|
891
|
-
|
|
1060
|
+
get image(): string;
|
|
1061
|
+
set image(_value: string);
|
|
892
1062
|
/**
|
|
893
|
-
*
|
|
894
|
-
* @returns {boolean} 判空结果
|
|
1063
|
+
* @description 位置
|
|
895
1064
|
*/
|
|
896
|
-
|
|
1065
|
+
get position(): [number, number];
|
|
1066
|
+
set position(value: [number, number]);
|
|
897
1067
|
/**
|
|
898
|
-
*
|
|
899
|
-
* @returns {Vector2[]} 二维包围盒角点
|
|
1068
|
+
* @description 宽度
|
|
900
1069
|
*/
|
|
901
|
-
|
|
1070
|
+
get width(): number;
|
|
1071
|
+
set width(value: number);
|
|
902
1072
|
/**
|
|
903
|
-
*
|
|
904
|
-
* @param {Vector2} [target=new Vector2()] 目标点(用以存放二维包围盒中心点)
|
|
905
|
-
* @returns {Vector2} 二维包围盒中心点
|
|
1073
|
+
* @description 高度
|
|
906
1074
|
*/
|
|
907
|
-
|
|
1075
|
+
get height(): number;
|
|
1076
|
+
set height(value: number);
|
|
908
1077
|
/**
|
|
909
|
-
*
|
|
910
|
-
* @param {Vector2} [target=new Vector2()] 目标向量(用以存放二维包围盒大小)
|
|
911
|
-
* @returns {Vector2} 二维包围盒大小
|
|
1078
|
+
* @description 旋转(二维旋转角度)
|
|
912
1079
|
*/
|
|
913
|
-
|
|
1080
|
+
get rotation(): number;
|
|
1081
|
+
set rotation(value: number);
|
|
914
1082
|
/**
|
|
915
|
-
*
|
|
916
|
-
* @param {Vector2} point 二维空间点
|
|
917
|
-
* @returns {Box2} 扩展包围盒
|
|
1083
|
+
* @description 完整旋转(包含 x, y, z)
|
|
918
1084
|
*/
|
|
919
|
-
|
|
1085
|
+
get fullRotation(): [number, number, number];
|
|
1086
|
+
set fullRotation(value: [number, number, number]);
|
|
920
1087
|
/**
|
|
921
|
-
*
|
|
922
|
-
* @
|
|
923
|
-
* @returns {Box2} 扩展结果
|
|
1088
|
+
* @description 是否正在编辑关键属性
|
|
1089
|
+
* @deprecated 该属性即将废弃,使用 isCoreEditable 代替
|
|
924
1090
|
*/
|
|
925
|
-
|
|
1091
|
+
get keyPropertyEditing(): boolean;
|
|
1092
|
+
set keyPropertyEditing(value: boolean);
|
|
926
1093
|
/**
|
|
927
|
-
*
|
|
928
|
-
* @param
|
|
929
|
-
* @returns {Box2} 扩展结果
|
|
1094
|
+
* @description 转换为 GeneratorCreateInfo
|
|
1095
|
+
* @param withParent 是否包含父节点ID
|
|
930
1096
|
*/
|
|
931
|
-
|
|
1097
|
+
toCreateInfo(withParent?: boolean): GeneratorCreateInfo;
|
|
932
1098
|
/**
|
|
933
|
-
*
|
|
934
|
-
* @param
|
|
935
|
-
* @param
|
|
936
|
-
* @returns {boolean} 点包含判断结果
|
|
1099
|
+
* @description 转换为 VideoCreateInfo(用于转换为视频元素)
|
|
1100
|
+
* @param videoUrl 视频资源地址
|
|
1101
|
+
* @param withParent 是否包含父节点ID
|
|
937
1102
|
*/
|
|
938
|
-
|
|
1103
|
+
toVideoCreateInfo(videoUrl: string, withParent?: boolean): VideoCreateInfo;
|
|
939
1104
|
/**
|
|
940
|
-
*
|
|
941
|
-
* @param
|
|
942
|
-
* @
|
|
1105
|
+
* @description 转换为 SpriteCreateInfo(用于转换为图片元素)
|
|
1106
|
+
* @param imageUrl 图片资源地址
|
|
1107
|
+
* @param withParent 是否包含父节点ID
|
|
943
1108
|
*/
|
|
944
|
-
|
|
1109
|
+
toSpriteCreateInfo(imageUrl: string, withParent?: boolean): SpriteCreateInfo;
|
|
945
1110
|
/**
|
|
946
|
-
*
|
|
947
|
-
* @param {Vector2} point 指定二维空间点
|
|
948
|
-
* @param {Vector2} [target=new Vector2()] 目标空间点
|
|
949
|
-
* @returns {Vector2} 计算结果空间点
|
|
1111
|
+
* @description 克隆 SDKItem
|
|
950
1112
|
*/
|
|
951
|
-
|
|
1113
|
+
clone(): GeneratorItem;
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* @description 类型守卫:检查是否是 GeneratorItem
|
|
1117
|
+
*/
|
|
1118
|
+
declare function isGeneratorItem(obj: any): obj is GeneratorItem;
|
|
1119
|
+
|
|
1120
|
+
/**
|
|
1121
|
+
* @description 特效产物 元素 SDKItem 类
|
|
1122
|
+
*/
|
|
1123
|
+
declare class EffectsItem extends BaseItem {
|
|
952
1124
|
/**
|
|
953
|
-
*
|
|
954
|
-
* @param {Vector2} point 二维空间点
|
|
955
|
-
* @param {Vector2} [target=new Vector2()] 结果点
|
|
956
|
-
* @returns {Vector2} 二维空间点
|
|
1125
|
+
* @description 元素类型(独立类型,不属于 spec.ItemType)
|
|
957
1126
|
*/
|
|
958
|
-
|
|
1127
|
+
readonly type = SDKItemType.EFFECTS;
|
|
959
1128
|
/**
|
|
960
|
-
*
|
|
961
|
-
* @param {Vector2} point 二维空间点
|
|
962
|
-
* @returns {number} 距离
|
|
1129
|
+
* @description 预合成元素ID
|
|
963
1130
|
*/
|
|
964
|
-
|
|
1131
|
+
subCompositionItemId: string;
|
|
965
1132
|
/**
|
|
966
|
-
*
|
|
967
|
-
* @param {Box2} box 二维包围盒
|
|
968
|
-
* @returns {Box2} 求交结果
|
|
1133
|
+
* @description 元素属性
|
|
969
1134
|
*/
|
|
970
|
-
|
|
1135
|
+
property: EffectsItemProperty;
|
|
1136
|
+
constructor(options: EffectsItemOptions);
|
|
971
1137
|
/**
|
|
972
|
-
*
|
|
973
|
-
* @param {Box2} box 二维包围盒
|
|
974
|
-
* @returns {Box2} 求并结果
|
|
1138
|
+
* @description 特效资源地址
|
|
975
1139
|
*/
|
|
976
|
-
|
|
1140
|
+
get effects(): string;
|
|
1141
|
+
set effects(value: string);
|
|
977
1142
|
/**
|
|
978
|
-
*
|
|
979
|
-
* @param {Vector2} offset 位移向量
|
|
980
|
-
* @returns {Box2} 位移结果
|
|
1143
|
+
* @description 位置
|
|
981
1144
|
*/
|
|
982
|
-
|
|
983
|
-
|
|
1145
|
+
get position(): [number, number];
|
|
1146
|
+
set position(value: [number, number]);
|
|
984
1147
|
/**
|
|
985
|
-
*
|
|
986
|
-
* @param {Box2} box 二维包围盒
|
|
987
|
-
* @returns {boolean} 判等结果
|
|
1148
|
+
* @description 宽度
|
|
988
1149
|
*/
|
|
989
|
-
|
|
1150
|
+
get width(): number;
|
|
1151
|
+
set width(value: number);
|
|
990
1152
|
/**
|
|
991
|
-
*
|
|
992
|
-
* @param {Box2} box 二维包围盒
|
|
993
|
-
* @param {boolean} [isOrthogonal=true] 正交判断(当前包围盒)
|
|
994
|
-
* @returns {boolean} 相交判断结果
|
|
1153
|
+
* @description 高度
|
|
995
1154
|
*/
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
type SizeAdaptDirection = 'x' | 'y';
|
|
1001
|
-
|
|
1002
|
-
declare const MEDIA_TYPE: {
|
|
1003
|
-
readonly APNG: "APNG";
|
|
1004
|
-
readonly MP4: "MP4";
|
|
1005
|
-
readonly WebM: "WebM";
|
|
1006
|
-
readonly Images: "Images";
|
|
1007
|
-
readonly WebP: "WebP";
|
|
1008
|
-
readonly GIF: "GIF";
|
|
1009
|
-
readonly AlphaMaskVideo: "AlphaMaskVideo";
|
|
1010
|
-
};
|
|
1011
|
-
/**
|
|
1012
|
-
* GIF 压缩参数
|
|
1013
|
-
* 核心通过参数 flags + palettegen + paletteuse 实现
|
|
1014
|
-
* highest: lanczos + max_colors=256 + dither=bayer
|
|
1015
|
-
* high: bicubic + max_colors=200 + dither=bayer
|
|
1016
|
-
* medium: bilinear + max_colors=64 + dither=bayer
|
|
1017
|
-
* low: neighbor + max_colors=32 + dither=none
|
|
1018
|
-
*/
|
|
1019
|
-
declare const GIF_QUALITY_TO_FFMPEG_ARGS: {
|
|
1020
|
-
highest: string;
|
|
1021
|
-
high: string;
|
|
1022
|
-
medium: string;
|
|
1023
|
-
low: string;
|
|
1024
|
-
};
|
|
1025
|
-
|
|
1026
|
-
declare global {
|
|
1027
|
-
interface Window {
|
|
1028
|
-
/**
|
|
1029
|
-
* @description 创建 WebP Core 实例
|
|
1030
|
-
*/
|
|
1031
|
-
createWebPCore: (config: any) => Promise<Img2WebPCore>;
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
type FileBuffer = ArrayBuffer | Uint8Array;
|
|
1035
|
-
type MediaType = typeof MEDIA_TYPE[keyof typeof MEDIA_TYPE];
|
|
1036
|
-
type FS = {
|
|
1037
|
-
writeFile: (path: string, data: Uint8Array | string) => void;
|
|
1038
|
-
readFile(path: string, opts: {
|
|
1039
|
-
encoding: 'binary';
|
|
1040
|
-
flags?: string | undefined;
|
|
1041
|
-
}): Uint8Array;
|
|
1042
|
-
readFile(path: string, opts: {
|
|
1043
|
-
encoding: 'utf8';
|
|
1044
|
-
flags?: string | undefined;
|
|
1045
|
-
}): string;
|
|
1046
|
-
readFile(path: string, opts?: {
|
|
1047
|
-
flags?: string | undefined;
|
|
1048
|
-
}): Uint8Array;
|
|
1049
|
-
unlink: (path: string) => void;
|
|
1050
|
-
quit: () => void;
|
|
1051
|
-
};
|
|
1052
|
-
type Pointer = number;
|
|
1053
|
-
type Img2WebPCore = {
|
|
1054
|
-
FS: FS;
|
|
1055
|
-
run: (...args: string[]) => number;
|
|
1056
|
-
cwrap: (ident: string, returnType: string, argTypes: string[]) => ((argc: number, argv: Pointer) => number);
|
|
1057
|
-
_malloc: (size: number) => Pointer;
|
|
1058
|
-
writeAsciiToMemory: (str: string, buffer: number, dontAddNull?: boolean) => void;
|
|
1059
|
-
setValue: (ptr: number, value: any, type: string, noSafe?: boolean) => void;
|
|
1060
|
-
};
|
|
1061
|
-
type ExportMediaInitOptions = {
|
|
1155
|
+
get height(): number;
|
|
1156
|
+
set height(value: number);
|
|
1062
1157
|
/**
|
|
1063
|
-
*
|
|
1158
|
+
* @description 旋转(二维旋转角度)
|
|
1064
1159
|
*/
|
|
1065
|
-
|
|
1160
|
+
get rotation(): number;
|
|
1161
|
+
set rotation(value: number);
|
|
1066
1162
|
/**
|
|
1067
|
-
*
|
|
1163
|
+
* @description 完整旋转(包含 x, y, z)
|
|
1068
1164
|
*/
|
|
1069
|
-
|
|
1165
|
+
get fullRotation(): [number, number, number];
|
|
1166
|
+
set fullRotation(value: [number, number, number]);
|
|
1070
1167
|
/**
|
|
1071
|
-
*
|
|
1072
|
-
*
|
|
1168
|
+
* @description 是否正在编辑关键属性
|
|
1169
|
+
* @deprecated 该属性即将废弃,使用 isCoreEditable 代替
|
|
1073
1170
|
*/
|
|
1074
|
-
|
|
1171
|
+
get keyPropertyEditing(): boolean;
|
|
1172
|
+
set keyPropertyEditing(value: boolean);
|
|
1075
1173
|
/**
|
|
1076
|
-
*
|
|
1174
|
+
* @description 转换为 EffectsCreateInfo
|
|
1175
|
+
* @param withParent 是否包含父节点ID
|
|
1077
1176
|
*/
|
|
1078
|
-
|
|
1177
|
+
toCreateInfo(withParent?: boolean): EffectsCreateInfo;
|
|
1079
1178
|
/**
|
|
1080
|
-
*
|
|
1179
|
+
* @description 克隆 SDKItem
|
|
1081
1180
|
*/
|
|
1082
|
-
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1181
|
+
clone(): EffectsItem;
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* @description 类型守卫:检查是否是 EffectsItem
|
|
1185
|
+
*/
|
|
1186
|
+
declare function isEffectsItem(obj: any): obj is EffectsItem;
|
|
1187
|
+
|
|
1188
|
+
/**
|
|
1189
|
+
* @description 画板/框架元素 SDKItem 类
|
|
1190
|
+
* @description 支持自动布局和自由布局两种模式
|
|
1191
|
+
* @description 底层以 composition 形式渲染
|
|
1192
|
+
*/
|
|
1193
|
+
declare class FrameItem extends BaseItem {
|
|
1085
1194
|
/**
|
|
1086
|
-
* @description
|
|
1195
|
+
* @description 元素类型
|
|
1087
1196
|
*/
|
|
1088
|
-
|
|
1089
|
-
};
|
|
1090
|
-
type GifConfig = {
|
|
1197
|
+
readonly type = SDKItemType.FRAME;
|
|
1091
1198
|
/**
|
|
1092
|
-
* @description
|
|
1199
|
+
* @description 预合成元素ID
|
|
1093
1200
|
*/
|
|
1094
|
-
|
|
1201
|
+
subCompositionItemId: string;
|
|
1095
1202
|
/**
|
|
1096
|
-
* @description
|
|
1097
|
-
* 默认 '-1:-1', 表示不缩放
|
|
1098
|
-
* 例如 '100:-1', 表示宽度 100,高度自动
|
|
1099
|
-
* 例如 '-1:100', 表示宽度自动,高度 100
|
|
1203
|
+
* @description 元素属性
|
|
1100
1204
|
*/
|
|
1101
|
-
|
|
1205
|
+
property: FrameItemProperty;
|
|
1206
|
+
constructor(options: FrameItemOptions);
|
|
1102
1207
|
/**
|
|
1103
|
-
* @description
|
|
1104
|
-
* 默认 'highest'
|
|
1105
|
-
* 可选 'highest', 'high', 'medium', 'low'
|
|
1208
|
+
* @description 子元素ID列表(只读)
|
|
1106
1209
|
*/
|
|
1107
|
-
|
|
1108
|
-
};
|
|
1109
|
-
type ApngConfig = {
|
|
1210
|
+
get children(): readonly string[];
|
|
1110
1211
|
/**
|
|
1111
|
-
* @description
|
|
1212
|
+
* @description 布局模式
|
|
1112
1213
|
*/
|
|
1113
|
-
|
|
1214
|
+
get layoutMode(): FrameLayoutMode;
|
|
1215
|
+
set layoutMode(value: FrameLayoutMode);
|
|
1114
1216
|
/**
|
|
1115
|
-
* @description
|
|
1116
|
-
* 默认 '-1:-1', 表示不缩放
|
|
1117
|
-
* 例如 '100:-1', 表示宽度 100,高度自动
|
|
1118
|
-
* 例如 '-1:100', 表示宽度自动,高度 100
|
|
1217
|
+
* @description 位置
|
|
1119
1218
|
*/
|
|
1120
|
-
|
|
1219
|
+
get position(): [number, number];
|
|
1220
|
+
set position(value: [number, number]);
|
|
1121
1221
|
/**
|
|
1122
|
-
* @description
|
|
1123
|
-
* 默认 'highest'
|
|
1124
|
-
* 可选 'highest', 'high', 'medium', 'low'
|
|
1222
|
+
* @description 宽度
|
|
1125
1223
|
*/
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
type ExportMediaItemOptions = {
|
|
1224
|
+
get width(): number;
|
|
1225
|
+
set width(value: number);
|
|
1129
1226
|
/**
|
|
1130
|
-
*
|
|
1227
|
+
* @description 高度
|
|
1131
1228
|
*/
|
|
1132
|
-
|
|
1229
|
+
get height(): number;
|
|
1230
|
+
set height(value: number);
|
|
1133
1231
|
/**
|
|
1134
|
-
*
|
|
1232
|
+
* @description 缩放
|
|
1135
1233
|
*/
|
|
1136
|
-
|
|
1234
|
+
get scale(): [number, number];
|
|
1235
|
+
set scale(value: [number, number]);
|
|
1137
1236
|
/**
|
|
1138
|
-
*
|
|
1237
|
+
* @description 旋转(二维旋转角度)
|
|
1139
1238
|
*/
|
|
1140
|
-
|
|
1239
|
+
get rotation(): number;
|
|
1240
|
+
set rotation(value: number);
|
|
1141
1241
|
/**
|
|
1142
|
-
*
|
|
1242
|
+
* @description 完整旋转(包含 x, y, z)
|
|
1143
1243
|
*/
|
|
1144
|
-
|
|
1244
|
+
get fullRotation(): [number, number, number];
|
|
1245
|
+
set fullRotation(value: [number, number, number]);
|
|
1145
1246
|
/**
|
|
1146
|
-
*
|
|
1247
|
+
* @description 添加子元素
|
|
1248
|
+
* @param itemId 子元素ID
|
|
1249
|
+
* @returns 是否添加成功
|
|
1147
1250
|
*/
|
|
1148
|
-
|
|
1251
|
+
addChild(itemId: string): boolean;
|
|
1149
1252
|
/**
|
|
1150
|
-
*
|
|
1253
|
+
* @description 批量添加子元素
|
|
1254
|
+
* @param itemIds 子元素ID列表
|
|
1151
1255
|
*/
|
|
1152
|
-
|
|
1256
|
+
addChildren(itemIds: string[]): void;
|
|
1153
1257
|
/**
|
|
1154
|
-
*
|
|
1258
|
+
* @description 移除子元素
|
|
1259
|
+
* @param itemId 子元素ID
|
|
1260
|
+
* @returns 是否移除成功
|
|
1155
1261
|
*/
|
|
1156
|
-
|
|
1262
|
+
removeChild(itemId: string): boolean;
|
|
1157
1263
|
/**
|
|
1158
|
-
*
|
|
1264
|
+
* @description 批量移除子元素
|
|
1265
|
+
* @param itemIds 子元素ID列表
|
|
1159
1266
|
*/
|
|
1160
|
-
|
|
1267
|
+
removeChildren(itemIds: string[]): void;
|
|
1161
1268
|
/**
|
|
1162
|
-
*
|
|
1269
|
+
* @description 是否包含指定子元素
|
|
1270
|
+
* @param itemId 子元素ID
|
|
1163
1271
|
*/
|
|
1164
|
-
|
|
1272
|
+
hasChild(itemId: string): boolean;
|
|
1165
1273
|
/**
|
|
1166
|
-
*
|
|
1274
|
+
* @description 清空所有子元素
|
|
1167
1275
|
*/
|
|
1168
|
-
|
|
1169
|
-
};
|
|
1170
|
-
type ExportMediaItemDownloadInfo = {
|
|
1276
|
+
clearChildren(): void;
|
|
1171
1277
|
/**
|
|
1172
|
-
* @description
|
|
1278
|
+
* @description 转换为 FrameCreateInfo
|
|
1279
|
+
* @param withParent 是否包含父节点ID
|
|
1173
1280
|
*/
|
|
1174
|
-
|
|
1281
|
+
toCreateInfo(withParent?: boolean): FrameCreateInfo;
|
|
1175
1282
|
/**
|
|
1176
|
-
* @description
|
|
1283
|
+
* @description 克隆 SDKItem
|
|
1177
1284
|
*/
|
|
1178
|
-
|
|
1179
|
-
}
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1285
|
+
clone(): FrameItem;
|
|
1286
|
+
}
|
|
1287
|
+
/**
|
|
1288
|
+
* @description 类型守卫:检查是否是 FrameItem
|
|
1289
|
+
*/
|
|
1290
|
+
declare function isFrameItem(obj: any): obj is FrameItem;
|
|
1291
|
+
|
|
1292
|
+
/**
|
|
1293
|
+
* @description 根据 item type 创建对应的 SDKItem 实例
|
|
1294
|
+
* @param type 元素类型
|
|
1295
|
+
* @param options SDKItem 选项
|
|
1296
|
+
* @returns SDKItem 实例
|
|
1297
|
+
*/
|
|
1298
|
+
declare function createSDKItem(type: spec.ItemType, options: SDKItemOptions): BaseItem;
|
|
1299
|
+
/**
|
|
1300
|
+
* @description SDKItem 类型联合
|
|
1301
|
+
* @description 用于替换原来的 SDKItem type
|
|
1302
|
+
*/
|
|
1303
|
+
type SDKItem = SpriteItem | TextItem | VideoItem | GroupItem | GeneratorItem | EffectsItem | FrameItem;
|
|
1184
1304
|
|
|
1185
1305
|
type BaseItemProperty = {
|
|
1186
1306
|
position: [number, number];
|
|
@@ -1210,6 +1330,10 @@ type TextItemProperty = BaseItemProperty & {
|
|
|
1210
1330
|
* @description 描边开关
|
|
1211
1331
|
*/
|
|
1212
1332
|
outlineEnabled?: boolean;
|
|
1333
|
+
/**
|
|
1334
|
+
* @description 文本字间距
|
|
1335
|
+
*/
|
|
1336
|
+
letterSpacing?: number;
|
|
1213
1337
|
fontUrl?: string;
|
|
1214
1338
|
};
|
|
1215
1339
|
type VideoItemProperty = BaseItemProperty & {
|
|
@@ -1242,6 +1366,27 @@ type GeneratorItemProperty = BaseItemProperty & {
|
|
|
1242
1366
|
};
|
|
1243
1367
|
type EffectsItemProperty = BaseItemProperty & {
|
|
1244
1368
|
effects: string;
|
|
1369
|
+
children?: string[];
|
|
1370
|
+
};
|
|
1371
|
+
/**
|
|
1372
|
+
* @description Frame 画板元素布局模式
|
|
1373
|
+
*/
|
|
1374
|
+
declare enum FrameLayoutMode {
|
|
1375
|
+
AUTO = "auto",
|
|
1376
|
+
FREE = "free"
|
|
1377
|
+
}
|
|
1378
|
+
/**
|
|
1379
|
+
* @description Frame 画板元素属性
|
|
1380
|
+
*/
|
|
1381
|
+
type FrameItemProperty = BaseItemProperty & {
|
|
1382
|
+
/**
|
|
1383
|
+
* @description 布局模式: auto - 自动布局, free - 自由布局
|
|
1384
|
+
*/
|
|
1385
|
+
layoutMode: FrameLayoutMode;
|
|
1386
|
+
/**
|
|
1387
|
+
* @description 子元素ID数组
|
|
1388
|
+
*/
|
|
1389
|
+
children: string[];
|
|
1245
1390
|
};
|
|
1246
1391
|
/**
|
|
1247
1392
|
* @description BaseItem 基础属性键名
|
|
@@ -1269,7 +1414,7 @@ type ItemPropertyMap = {
|
|
|
1269
1414
|
[SDKItemType.GROUP]: GroupItemProperty;
|
|
1270
1415
|
[SDKItemType.GENERATOR]: GeneratorItemProperty;
|
|
1271
1416
|
[SDKItemType.EFFECTS]: EffectsItemProperty;
|
|
1272
|
-
[SDKItemType.FRAME]:
|
|
1417
|
+
[SDKItemType.FRAME]: FrameItemProperty;
|
|
1273
1418
|
};
|
|
1274
1419
|
/**
|
|
1275
1420
|
* @description 场景1:单个元素单个属性设置
|
|
@@ -1541,13 +1686,6 @@ type ActiveData = {
|
|
|
1541
1686
|
*/
|
|
1542
1687
|
loadingItems?: string[];
|
|
1543
1688
|
};
|
|
1544
|
-
/**
|
|
1545
|
-
* @description 视图元素
|
|
1546
|
-
* @description 注意:SDKItem 现在已从类实现中导入,见 view-item/index.ts
|
|
1547
|
-
* @description SDKItem 现在是类实例而非普通对象,支持属性扩展
|
|
1548
|
-
* @description 保持类型兼容性:新 SDKItem 类拥有与旧类型相同的属性
|
|
1549
|
-
*/
|
|
1550
|
-
type SDKItem = SDKItem$1;
|
|
1551
1689
|
type SDKBackgroundType = 'color' | 'image' | 'chess-board' | 'dot-board';
|
|
1552
1690
|
/**
|
|
1553
1691
|
* @description 图层创建信息
|
|
@@ -1577,7 +1715,7 @@ type SpriteCreateInfo = {
|
|
|
1577
1715
|
/**
|
|
1578
1716
|
* @description 图片资源地址 | 数据
|
|
1579
1717
|
*/
|
|
1580
|
-
image
|
|
1718
|
+
image?: string;
|
|
1581
1719
|
/**
|
|
1582
1720
|
* @description 图层像素宽度
|
|
1583
1721
|
*/
|
|
@@ -1736,6 +1874,10 @@ type TextCreateInfo = {
|
|
|
1736
1874
|
* @description 字体文件地址
|
|
1737
1875
|
*/
|
|
1738
1876
|
fontUrl?: string;
|
|
1877
|
+
/**
|
|
1878
|
+
* @description 文本字间距
|
|
1879
|
+
*/
|
|
1880
|
+
letterSpacing?: number;
|
|
1739
1881
|
};
|
|
1740
1882
|
};
|
|
1741
1883
|
/**
|
|
@@ -1766,7 +1908,7 @@ type VideoCreateInfo = {
|
|
|
1766
1908
|
/**
|
|
1767
1909
|
* @description 视频资源地址 | 数据
|
|
1768
1910
|
*/
|
|
1769
|
-
video
|
|
1911
|
+
video?: string;
|
|
1770
1912
|
/**
|
|
1771
1913
|
* @description 视频元素像素宽度
|
|
1772
1914
|
*/
|
|
@@ -1963,14 +2105,72 @@ type EffectsCreateInfo = {
|
|
|
1963
2105
|
/**
|
|
1964
2106
|
* @description 动效资源地址
|
|
1965
2107
|
*/
|
|
1966
|
-
effects: string
|
|
2108
|
+
effects: string;
|
|
2109
|
+
};
|
|
2110
|
+
/**
|
|
2111
|
+
* @description 扩展属性
|
|
2112
|
+
*/
|
|
2113
|
+
extension?: Record<string, any>;
|
|
2114
|
+
};
|
|
2115
|
+
/**
|
|
2116
|
+
* @description Frame 画板元素创建信息
|
|
2117
|
+
*/
|
|
2118
|
+
type FrameCreateInfo = {
|
|
2119
|
+
/**
|
|
2120
|
+
* @description 元素类型 - 画板
|
|
2121
|
+
*/
|
|
2122
|
+
type: SDKItemType.FRAME;
|
|
2123
|
+
/**
|
|
2124
|
+
* @description 元素名称
|
|
2125
|
+
*/
|
|
2126
|
+
name?: string;
|
|
2127
|
+
/**
|
|
2128
|
+
* @description 元素id
|
|
2129
|
+
*/
|
|
2130
|
+
id?: string;
|
|
2131
|
+
/**
|
|
2132
|
+
* @description 父元素id
|
|
2133
|
+
*/
|
|
2134
|
+
parentId?: string;
|
|
2135
|
+
/**
|
|
2136
|
+
* @description 元素属性
|
|
2137
|
+
*/
|
|
2138
|
+
property: {
|
|
2139
|
+
/**
|
|
2140
|
+
* @description 画板像素宽度
|
|
2141
|
+
*/
|
|
2142
|
+
width: number;
|
|
2143
|
+
/**
|
|
2144
|
+
* @description 画板像素高度
|
|
2145
|
+
*/
|
|
2146
|
+
height: number;
|
|
2147
|
+
/**
|
|
2148
|
+
* @description 画板位置
|
|
2149
|
+
*/
|
|
2150
|
+
position: [number, number];
|
|
2151
|
+
/**
|
|
2152
|
+
* @description 画板旋转 z | [x, y, z]
|
|
2153
|
+
*/
|
|
2154
|
+
rotation?: number | [number, number, number];
|
|
2155
|
+
/**
|
|
2156
|
+
* @description 画板缩放
|
|
2157
|
+
*/
|
|
2158
|
+
scale?: [number, number];
|
|
2159
|
+
/**
|
|
2160
|
+
* @description 布局模式: 'auto' | 'free'
|
|
2161
|
+
*/
|
|
2162
|
+
layoutMode?: FrameLayoutMode;
|
|
2163
|
+
/**
|
|
2164
|
+
* @description 子元素序号
|
|
2165
|
+
*/
|
|
2166
|
+
children: string[];
|
|
1967
2167
|
};
|
|
1968
2168
|
/**
|
|
1969
2169
|
* @description 扩展属性
|
|
1970
2170
|
*/
|
|
1971
2171
|
extension?: Record<string, any>;
|
|
1972
2172
|
};
|
|
1973
|
-
type ItemCreateInfo = GroupCreateInfo | SpriteCreateInfo | TextCreateInfo | VideoCreateInfo | GeneratorCreateInfo | EffectsCreateInfo;
|
|
2173
|
+
type ItemCreateInfo = GroupCreateInfo | SpriteCreateInfo | TextCreateInfo | VideoCreateInfo | GeneratorCreateInfo | EffectsCreateInfo | FrameCreateInfo;
|
|
1974
2174
|
/**
|
|
1975
2175
|
* @description 场景创建信息
|
|
1976
2176
|
*/
|
|
@@ -2026,6 +2226,14 @@ type UpdateOperation = {
|
|
|
2026
2226
|
oldData: ItemCreateInfo[];
|
|
2027
2227
|
};
|
|
2028
2228
|
type Operation = CreateOperation | UpdateOperation | DeleteOperation;
|
|
2229
|
+
/**
|
|
2230
|
+
* 通用撤销重做操作类型
|
|
2231
|
+
*/
|
|
2232
|
+
type GizmoOperation<T> = {
|
|
2233
|
+
type: 'update';
|
|
2234
|
+
newData: T;
|
|
2235
|
+
oldData: T;
|
|
2236
|
+
};
|
|
2029
2237
|
declare class UndoRedo {
|
|
2030
2238
|
private index;
|
|
2031
2239
|
private operations;
|
|
@@ -2149,6 +2357,7 @@ type ExportConfig = {
|
|
|
2149
2357
|
*/
|
|
2150
2358
|
type ScreenShotConfig = {
|
|
2151
2359
|
enabled: boolean;
|
|
2360
|
+
defaultBackgroundColor: [number, number, number, number];
|
|
2152
2361
|
};
|
|
2153
2362
|
/**
|
|
2154
2363
|
* @description 尺寸自适应功能配置
|
|
@@ -2308,6 +2517,14 @@ type TransformGizmoConfig = {
|
|
|
2308
2517
|
* @description 视频Logo地址
|
|
2309
2518
|
*/
|
|
2310
2519
|
videoLogoUrl: string;
|
|
2520
|
+
/**
|
|
2521
|
+
* @description 画板Logo地址
|
|
2522
|
+
*/
|
|
2523
|
+
frameLogoUrl: string;
|
|
2524
|
+
/**
|
|
2525
|
+
* @description 特效Logo地址
|
|
2526
|
+
*/
|
|
2527
|
+
effectsLogoUrl: string;
|
|
2311
2528
|
/**
|
|
2312
2529
|
* @description 大小文字颜色
|
|
2313
2530
|
*/
|
|
@@ -2574,6 +2791,10 @@ type MaskGizmoConfig = {
|
|
|
2574
2791
|
* @description 蒙版透明度
|
|
2575
2792
|
*/
|
|
2576
2793
|
maskAlpha: number;
|
|
2794
|
+
/**
|
|
2795
|
+
* @description 蒙版图片
|
|
2796
|
+
*/
|
|
2797
|
+
maskImage?: HTMLImageElement;
|
|
2577
2798
|
/**
|
|
2578
2799
|
* @description 元素包围盒线框宽度
|
|
2579
2800
|
*/
|
|
@@ -2707,9 +2928,61 @@ type VideoPlayGizmoConfig = {
|
|
|
2707
2928
|
height: number;
|
|
2708
2929
|
};
|
|
2709
2930
|
type ItemCreateGizmoConfig = {
|
|
2710
|
-
|
|
2931
|
+
/**
|
|
2932
|
+
* @description 边框颜色
|
|
2933
|
+
*/
|
|
2934
|
+
frameBorderColor: number;
|
|
2935
|
+
/**
|
|
2936
|
+
* @description 边框宽度
|
|
2937
|
+
*/
|
|
2938
|
+
frameBorderWidth: number;
|
|
2939
|
+
/**
|
|
2940
|
+
* @description 边框透明度
|
|
2941
|
+
*/
|
|
2942
|
+
frameBorderAlpha: number;
|
|
2943
|
+
/**
|
|
2944
|
+
* @description 填充颜色
|
|
2945
|
+
*/
|
|
2946
|
+
frameFillColor: number;
|
|
2947
|
+
/**
|
|
2948
|
+
* @description 填充透明度
|
|
2949
|
+
*/
|
|
2950
|
+
frameFillAlpha: number;
|
|
2951
|
+
/**
|
|
2952
|
+
* @description 选中子元素包围盒透明度
|
|
2953
|
+
*/
|
|
2954
|
+
frameChildBoxAlpha: number;
|
|
2955
|
+
/**
|
|
2956
|
+
* @description 选中子元素包围盒颜色
|
|
2957
|
+
*/
|
|
2958
|
+
frameChildBoxColor: number;
|
|
2711
2959
|
};
|
|
2712
2960
|
|
|
2961
|
+
/**
|
|
2962
|
+
* @description 图片蒙版工具结果
|
|
2963
|
+
*/
|
|
2964
|
+
type MaskResult = {
|
|
2965
|
+
/**
|
|
2966
|
+
* @description 状态
|
|
2967
|
+
*/
|
|
2968
|
+
status: 'init' | 'done';
|
|
2969
|
+
/**
|
|
2970
|
+
* @description 包围盒
|
|
2971
|
+
*/
|
|
2972
|
+
box?: Box2;
|
|
2973
|
+
/**
|
|
2974
|
+
* @description 鼠标位置
|
|
2975
|
+
*/
|
|
2976
|
+
point?: Vector2;
|
|
2977
|
+
/**
|
|
2978
|
+
* @description 蒙版线条列表
|
|
2979
|
+
*/
|
|
2980
|
+
lines: {
|
|
2981
|
+
brushSize: number;
|
|
2982
|
+
points: Vector2[];
|
|
2983
|
+
type?: 'paint' | 'erase';
|
|
2984
|
+
}[];
|
|
2985
|
+
};
|
|
2713
2986
|
/**
|
|
2714
2987
|
* @description 精准改字功能初始化信息
|
|
2715
2988
|
*/
|
|
@@ -2753,6 +3026,35 @@ declare module '@pixi/graphics' {
|
|
|
2753
3026
|
}
|
|
2754
3027
|
}
|
|
2755
3028
|
|
|
3029
|
+
type LoadingGizmoTip = {
|
|
3030
|
+
text: string;
|
|
3031
|
+
fontSize?: number;
|
|
3032
|
+
fontFamily?: string;
|
|
3033
|
+
color?: number;
|
|
3034
|
+
};
|
|
3035
|
+
type LoadingGizmoItemOptions = {
|
|
3036
|
+
/** Loading 提示文案 */
|
|
3037
|
+
tip?: LoadingGizmoTip;
|
|
3038
|
+
/** 指定 Loading 区域 */
|
|
3039
|
+
loadingBox?: Box2;
|
|
3040
|
+
/** 清理选中 */
|
|
3041
|
+
clearSelected?: boolean;
|
|
3042
|
+
};
|
|
3043
|
+
|
|
3044
|
+
/**
|
|
3045
|
+
* 蒙版工具的撤销重做数据类型
|
|
3046
|
+
*/
|
|
3047
|
+
type MaskUndoRedoData = {
|
|
3048
|
+
lines: MaskResult['lines'];
|
|
3049
|
+
};
|
|
3050
|
+
|
|
3051
|
+
/**
|
|
3052
|
+
* 图片裁切工具的撤销重做数据类型
|
|
3053
|
+
*/
|
|
3054
|
+
type PictureCutUndoRedoData = {
|
|
3055
|
+
normalizeCutBox: Box2;
|
|
3056
|
+
};
|
|
3057
|
+
|
|
2756
3058
|
type SDKEvents = {
|
|
2757
3059
|
'loadingItemChange': [id: string[]];
|
|
2758
3060
|
'selectedItemChange': [id: string[]];
|
|
@@ -2768,7 +3070,7 @@ type SDKEvents = {
|
|
|
2768
3070
|
}];
|
|
2769
3071
|
'itemPropertyChange': [{
|
|
2770
3072
|
id: string;
|
|
2771
|
-
|
|
3073
|
+
propertyKeys: string[];
|
|
2772
3074
|
}];
|
|
2773
3075
|
'exportProgress': [progress?: number];
|
|
2774
3076
|
'exportDone': [item: ExportItemParams | undefined, success: boolean, buffer?: FileBuffer];
|
|
@@ -2782,6 +3084,8 @@ type SDKEvents = {
|
|
|
2782
3084
|
fontFamily: string;
|
|
2783
3085
|
}];
|
|
2784
3086
|
'undoRedoChange': [Operation];
|
|
3087
|
+
'maskGizmoUndoRedoChange': [GizmoOperation<MaskUndoRedoData>];
|
|
3088
|
+
'pictureCutGizmoUndoRedoChange': [GizmoOperation<PictureCutUndoRedoData>];
|
|
2785
3089
|
'viewportTransform': [{
|
|
2786
3090
|
zoom: number;
|
|
2787
3091
|
translation: [number, number];
|
|
@@ -2801,6 +3105,7 @@ type SDKEvents = {
|
|
|
2801
3105
|
'itemCreate': [{
|
|
2802
3106
|
type: ItemCreateType;
|
|
2803
3107
|
position: spec.vec2;
|
|
3108
|
+
id: string;
|
|
2804
3109
|
}];
|
|
2805
3110
|
'viewLost': [];
|
|
2806
3111
|
'viewRebuildFinish': [];
|
|
@@ -2828,7 +3133,7 @@ declare class SDK {
|
|
|
2828
3133
|
get undoRedo(): UndoRedo;
|
|
2829
3134
|
private get exportOptions();
|
|
2830
3135
|
dispose(): void;
|
|
2831
|
-
on: <E extends "progress" | "loadingItemChange" | "selectedItemChange" | "preSelectedItemChange" | "selectedViewChange" | "pageDataChange" | "zoomChange" | "itemPropertyChange" | "exportProgress" | "exportDone" | "exportComplete" | "sdkConfigChange" | "cutBoxChange" | "expandBoxChange" | "textInput" | "undoRedoChange" | "viewportTransform" | "itemOnDragStart" | "itemOnDrag" | "itemOnDragEnd" | "spriteTextClick" | "videoPlay" | "itemCreate" | "viewLost" | "viewRebuildFinish">(eventName: E, listener: _galacean_effects.EventEmitterListener<SDKEvents[E]>, options?: _galacean_effects.EventEmitterOptions) => () => void;
|
|
3136
|
+
on: <E extends "progress" | "loadingItemChange" | "selectedItemChange" | "preSelectedItemChange" | "selectedViewChange" | "pageDataChange" | "zoomChange" | "itemPropertyChange" | "exportProgress" | "exportDone" | "exportComplete" | "sdkConfigChange" | "cutBoxChange" | "expandBoxChange" | "textInput" | "undoRedoChange" | "maskGizmoUndoRedoChange" | "pictureCutGizmoUndoRedoChange" | "viewportTransform" | "itemOnDragStart" | "itemOnDrag" | "itemOnDragEnd" | "spriteTextClick" | "videoPlay" | "itemCreate" | "viewLost" | "viewRebuildFinish">(eventName: E, listener: _galacean_effects.EventEmitterListener<SDKEvents[E]>, options?: _galacean_effects.EventEmitterOptions) => () => void;
|
|
2832
3137
|
initPlayer(mode: SDKMode): void;
|
|
2833
3138
|
setSDKMode(mode: SDKMode): void;
|
|
2834
3139
|
private getInitParam;
|
|
@@ -2872,13 +3177,13 @@ declare class SDK {
|
|
|
2872
3177
|
* @param id 元素ID
|
|
2873
3178
|
* @returns 元素
|
|
2874
3179
|
* */
|
|
2875
|
-
getSDKItem(id: string): SDKItem
|
|
3180
|
+
getSDKItem(id: string): SDKItem | undefined;
|
|
2876
3181
|
/**
|
|
2877
3182
|
* @description 获取元素数组
|
|
2878
3183
|
* @param id 元素ID数组
|
|
2879
3184
|
* @returns 元素数组
|
|
2880
3185
|
* */
|
|
2881
|
-
getSDKItems(ids?: string[]): SDKItem
|
|
3186
|
+
getSDKItems(ids?: string[]): SDKItem[];
|
|
2882
3187
|
setPlayState(playState: 'play' | 'pause'): Promise<void>;
|
|
2883
3188
|
/**
|
|
2884
3189
|
* @description 获取场景预览图
|
|
@@ -3043,7 +3348,54 @@ declare class SDK {
|
|
|
3043
3348
|
* @param mode 模式类型:'paint' 表示涂抹,'erase' 表示擦除
|
|
3044
3349
|
*/
|
|
3045
3350
|
setMaskGizmoMode(mode: 'paint' | 'erase'): void;
|
|
3046
|
-
|
|
3351
|
+
/**
|
|
3352
|
+
* 撤销蒙版操作
|
|
3353
|
+
* @returns 是否成功撤销
|
|
3354
|
+
*/
|
|
3355
|
+
undoMaskGizmo(): boolean;
|
|
3356
|
+
/**
|
|
3357
|
+
* 重做蒙版操作
|
|
3358
|
+
* @returns 是否成功重做
|
|
3359
|
+
*/
|
|
3360
|
+
redoMaskGizmo(): boolean;
|
|
3361
|
+
/**
|
|
3362
|
+
* 检查蒙版是否可以撤销
|
|
3363
|
+
*/
|
|
3364
|
+
get canUndoMaskGizmo(): boolean;
|
|
3365
|
+
/**
|
|
3366
|
+
* 检查蒙版是否可以重做
|
|
3367
|
+
*/
|
|
3368
|
+
get canRedoMaskGizmo(): boolean;
|
|
3369
|
+
/**
|
|
3370
|
+
* 清空蒙版 undoRedo 历史
|
|
3371
|
+
*/
|
|
3372
|
+
clearMaskGizmoUndoRedo(): void;
|
|
3373
|
+
/**
|
|
3374
|
+
* 撤销图片裁切操作
|
|
3375
|
+
* @returns 是否成功撤销
|
|
3376
|
+
*/
|
|
3377
|
+
undoPictureCutGizmo(): boolean;
|
|
3378
|
+
/**
|
|
3379
|
+
* 重做图片裁切操作
|
|
3380
|
+
* @returns 是否成功重做
|
|
3381
|
+
*/
|
|
3382
|
+
redoPictureCutGizmo(): boolean;
|
|
3383
|
+
/**
|
|
3384
|
+
* 检查图片裁切是否可以撤销
|
|
3385
|
+
*/
|
|
3386
|
+
get canUndoPictureCutGizmo(): boolean;
|
|
3387
|
+
/**
|
|
3388
|
+
* 检查图片裁切是否可以重做
|
|
3389
|
+
*/
|
|
3390
|
+
get canRedoPictureCutGizmo(): boolean;
|
|
3391
|
+
/**
|
|
3392
|
+
* 清空图片裁切 undoRedo 历史
|
|
3393
|
+
*/
|
|
3394
|
+
clearPictureCutGizmoUndoRedo(): void;
|
|
3395
|
+
openLoadingGizmo(id: string, options?: LoadingGizmoItemOptions): void;
|
|
3396
|
+
updateLoadingGizmo(id: string, options: {
|
|
3397
|
+
tip?: LoadingGizmoTip;
|
|
3398
|
+
}): void;
|
|
3047
3399
|
closeLoadingGizmo(id: string): void;
|
|
3048
3400
|
/**
|
|
3049
3401
|
* @description 元素打组
|
|
@@ -3058,6 +3410,7 @@ declare class SDK {
|
|
|
3058
3410
|
getItemCreateInfo(id: string): ItemCreateInfo | undefined;
|
|
3059
3411
|
getItemCreateInfos(ids?: string[]): ItemCreateInfo[];
|
|
3060
3412
|
createScreenShotSceneByIds(idInfo: string | string[], time?: number): Promise<string | undefined>;
|
|
3413
|
+
createScreenShotByFrame(id: string): Promise<string | undefined>;
|
|
3061
3414
|
getChildrenIds(id: string): string[];
|
|
3062
3415
|
/**
|
|
3063
3416
|
* @description 更新元素在图层中的顺序
|
|
@@ -3078,21 +3431,14 @@ declare class SDK {
|
|
|
3078
3431
|
* @param extensions 扩展属性对象(支持同时设置多个)
|
|
3079
3432
|
* @returns 是否设置成功
|
|
3080
3433
|
*/
|
|
3081
|
-
|
|
3434
|
+
setItemExtension(id: string, extension: Record<string, any>): boolean;
|
|
3082
3435
|
/**
|
|
3083
3436
|
* @description 批量获取元素扩展属性
|
|
3084
3437
|
* @param id 元素ID
|
|
3085
3438
|
* @param keys 扩展属性名称列表(不传则返回所有扩展属性)
|
|
3086
3439
|
* @returns 扩展属性对象
|
|
3087
3440
|
*/
|
|
3088
|
-
|
|
3089
|
-
/**
|
|
3090
|
-
* @description 获取单个元素扩展属性
|
|
3091
|
-
* @param id 元素ID
|
|
3092
|
-
* @param key 扩展属性名称
|
|
3093
|
-
* @returns 扩展属性值
|
|
3094
|
-
*/
|
|
3095
|
-
getItemExtension(id: string, key: string): any;
|
|
3441
|
+
getItemExtension(id: string, keys?: string[]): Record<string, any> | undefined;
|
|
3096
3442
|
/**
|
|
3097
3443
|
* @description 删除元素扩展属性(支持批量删除)
|
|
3098
3444
|
* @param id 元素ID
|
|
@@ -3159,9 +3505,13 @@ declare class SDK {
|
|
|
3159
3505
|
setSpriteTextEditState(id: string, index: number, isEditing: boolean): void;
|
|
3160
3506
|
getVideoItemPlayTime(id: string): number;
|
|
3161
3507
|
setVideoItemPlayTime(id: string, time: number): void;
|
|
3508
|
+
getEffectsItemPlayTime(id: string): number | undefined;
|
|
3509
|
+
setEffectsItemPlayTime(id: string, time: number): void;
|
|
3510
|
+
setEffectsResource(id: string, effects: string): void;
|
|
3162
3511
|
getPixelPositionByViewPosition(viewPosition: Vector2): Vector2;
|
|
3163
3512
|
hitTest(x: number, y: number): string[] | undefined;
|
|
3164
3513
|
setInteractType(type: GestureHandlerInteractType): void;
|
|
3514
|
+
getInteractType(): GestureHandlerInteractType;
|
|
3165
3515
|
makeItemAlign(type: AlignType, ids?: string[]): void;
|
|
3166
3516
|
makeItemDistribute(type: DistributeType, ids?: string[]): void;
|
|
3167
3517
|
/**
|
|
@@ -3171,10 +3521,28 @@ declare class SDK {
|
|
|
3171
3521
|
*/
|
|
3172
3522
|
addGeneratorItem(createInfo: GeneratorCreateInfo): string;
|
|
3173
3523
|
/**
|
|
3174
|
-
* @description
|
|
3524
|
+
* @description 创建动效元素
|
|
3175
3525
|
* @param effectsInfo 动效创建信息
|
|
3176
3526
|
*/
|
|
3177
3527
|
addEffectsItem(effectsInfo: EffectsCreateInfo): Promise<string | undefined>;
|
|
3528
|
+
/**
|
|
3529
|
+
* @description 创建画板元素
|
|
3530
|
+
* @param createInfo 画板创建信息
|
|
3531
|
+
* @returns 画板元素ID
|
|
3532
|
+
*/
|
|
3533
|
+
addFrameItem(createInfo: FrameCreateInfo): Promise<string>;
|
|
3534
|
+
/**
|
|
3535
|
+
* @description 将元素移动到 Frame 中
|
|
3536
|
+
* @param itemIds 要移动的元素ID列表
|
|
3537
|
+
* @param frameId 目标 Frame ID
|
|
3538
|
+
*/
|
|
3539
|
+
moveItemsToFrame(itemIds: string[], frameId: string): void;
|
|
3540
|
+
/**
|
|
3541
|
+
* @description 将元素从 Frame 中移出到主场景
|
|
3542
|
+
* @param itemIds 要移动的元素ID列表
|
|
3543
|
+
* @param frameId 源 Frame ID(可选,如果不传则从元素的 parentId 推断)
|
|
3544
|
+
*/
|
|
3545
|
+
moveItemsOutOfFrame(itemIds: string[], frameId?: string): void;
|
|
3178
3546
|
/**
|
|
3179
3547
|
* @description 设置生成器资源,将生成器转换为对应的元素
|
|
3180
3548
|
* @param id 生成器元素ID
|
|
@@ -3205,4 +3573,4 @@ declare class SDK {
|
|
|
3205
3573
|
setSafeAreaPreviewVisible(id: number, type: 'url' | 'color', visible: boolean): void;
|
|
3206
3574
|
}
|
|
3207
3575
|
|
|
3208
|
-
export { type ActiveData, BaseItem, type BaseItemProperty, type BaseItemPropertyKey, type BaseItemPropertyValueMap, Box2, type CreateOperation, type DeleteOperation, type EffectsCreateInfo, EffectsItem, type EffectsItemOptions, type GeneratorCreateInfo, GeneratorItem, type GeneratorItemOptions, type GeneratorItemProperty, type GizmoType, type GroupCreateInfo, GroupItem, type GroupItemOptions, type ItemCreateInfo, ItemOrderAction, type ItemPropertyMap, type Operation, type PageData, type PageProperty, SDK, type SDKEvents, type SDKInputParam, type SDKItem
|
|
3576
|
+
export { type ActiveData, BaseItem, type BaseItemProperty, type BaseItemPropertyKey, type BaseItemPropertyValueMap, Box2, type CreateOperation, type DeleteOperation, type EffectsCreateInfo, EffectsItem, type EffectsItemOptions, type FrameCreateInfo, FrameItem, type FrameItemOptions, type FrameItemProperty, FrameLayoutMode, type GeneratorCreateInfo, GeneratorItem, type GeneratorItemOptions, type GeneratorItemProperty, type GizmoType, type GroupCreateInfo, GroupItem, type GroupItemOptions, type ItemCreateInfo, ItemOrderAction, type ItemPropertyMap, type Operation, type PageData, type PageProperty, SDK, type SDKEvents, type SDKInputParam, type SDKItem, type SDKItemOptions, SDKItemType, type SDKOptions, type SetItemPropertyParam, type SetSingleItemMultiplePropertiesParam, type SetSingleItemSinglePropertyParam, type SpriteCreateInfo, SpriteItem, type SpriteItemOptions, type SpriteItemProperty, type TextCreateInfo, TextItem, type TextItemOptions, type TextItemProperty, type UpdateOperation, Vector2, type VideoCreateInfo, VideoItem, type VideoItemOptions, type VideoItemProperty, type ViewParam, type ViewProperty, createSDKItem, isBaseItem, isEffectsItem, isFrameItem, isGeneratorItem, isGroupItem, isSpriteItem, isTextItem, isVideoItem };
|