@vvfx/sdk 0.1.19-alpha.6 → 0.1.19-alpha.8
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 +852 -843
- package/dist/index.d.ts +852 -843
- 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,678 +1,755 @@
|
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
id: string;
|
|
9
|
+
declare class Line2 {
|
|
10
|
+
start: Vector2;
|
|
11
|
+
end: Vector2;
|
|
12
|
+
constructor(start?: Vector2, end?: Vector2);
|
|
15
13
|
/**
|
|
16
|
-
*
|
|
14
|
+
* 设置二维线段
|
|
15
|
+
* @param {Vector2} start 线段起点
|
|
16
|
+
* @param {Vector2} end 线段终点
|
|
17
|
+
* @returns {Line2} 二维线段
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
set(start: Vector2, end: Vector2): this;
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
+
* 复制二维线段
|
|
22
|
+
* @param {Line2} line 复制对象
|
|
23
|
+
* @returns {Line2} 复制结果
|
|
21
24
|
*/
|
|
22
|
-
|
|
25
|
+
copyFrom(line: Line2): this;
|
|
23
26
|
/**
|
|
24
|
-
*
|
|
27
|
+
* 二维线段求方向
|
|
28
|
+
* @returns {Vector2} 二维线段方向
|
|
25
29
|
*/
|
|
26
|
-
|
|
30
|
+
direction(): Vector2;
|
|
27
31
|
/**
|
|
28
|
-
*
|
|
32
|
+
* 二维线段求中点
|
|
33
|
+
* @param {Vector2} [target=new Vector2()] 目标保存对象
|
|
34
|
+
* @returns {Vector2} 二维线段中点
|
|
29
35
|
*/
|
|
30
|
-
|
|
36
|
+
getCenter(target?: Vector2): Vector2;
|
|
31
37
|
/**
|
|
32
|
-
*
|
|
38
|
+
* 二维线段向量值
|
|
39
|
+
* @param {Vector2} [target=new Vector2()] 目标保存对象
|
|
40
|
+
* @returns {Vector2} 二维线段向量值
|
|
33
41
|
*/
|
|
34
|
-
|
|
42
|
+
delta(target?: Vector2): Vector2;
|
|
35
43
|
/**
|
|
36
|
-
*
|
|
44
|
+
* 二维线段欧式距离平方(应用于计算)
|
|
45
|
+
* @returns {number} 计算结果
|
|
37
46
|
*/
|
|
38
|
-
|
|
47
|
+
distanceSq(): number;
|
|
39
48
|
/**
|
|
40
|
-
*
|
|
49
|
+
* 二维线段欧式距离
|
|
50
|
+
* @returns {number} 计算结果
|
|
41
51
|
*/
|
|
42
|
-
|
|
52
|
+
distance(): number;
|
|
43
53
|
/**
|
|
44
|
-
*
|
|
54
|
+
* 求二维线段比例点
|
|
55
|
+
* @param {number} t 比例值
|
|
56
|
+
* @param {Vector2} target 目标保存对象
|
|
57
|
+
* @returns {Vector2} 比例点结果
|
|
45
58
|
*/
|
|
46
|
-
|
|
59
|
+
at(t: number, target?: Vector2): Vector2;
|
|
47
60
|
/**
|
|
48
|
-
*
|
|
61
|
+
* 求点与线段的最短距离
|
|
62
|
+
* @param {Vector2} point 二维空间点
|
|
63
|
+
* @param {boolean} clampToLine 是否限制于线段内
|
|
64
|
+
* @returns {number} 距离结果
|
|
49
65
|
*/
|
|
50
|
-
|
|
66
|
+
closestPointToPointParameter(point: Vector2, clampToLine: boolean): number;
|
|
51
67
|
/**
|
|
52
|
-
*
|
|
68
|
+
* 求点与线段的最近交点
|
|
69
|
+
* @param {Vector2} point 二维空间点
|
|
70
|
+
* @param {boolean} clampToLine 是否限制于线段内
|
|
71
|
+
* @param {Vector2} target 目标保存对象
|
|
72
|
+
* @returns {Vector2} 最近交点
|
|
53
73
|
*/
|
|
54
|
-
|
|
74
|
+
closestPointToPoint(point: Vector2, clampToLine: boolean, target?: Vector2): Vector2;
|
|
55
75
|
/**
|
|
56
|
-
*
|
|
76
|
+
* 二维线段判等
|
|
77
|
+
* @param {Line2} line 二维线段
|
|
78
|
+
* @returns {boolean} 判等结果
|
|
57
79
|
*/
|
|
58
|
-
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* @description Sprite SDKItem 选项
|
|
62
|
-
*/
|
|
63
|
-
type SpriteItemOptions = SDKItemOptions & {
|
|
80
|
+
equals(line: Line2): boolean;
|
|
64
81
|
/**
|
|
65
|
-
*
|
|
82
|
+
* 克隆二维线段
|
|
83
|
+
* @returns {Line2} 克隆结果
|
|
66
84
|
*/
|
|
67
|
-
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* @description Text SDKItem 选项
|
|
71
|
-
*/
|
|
72
|
-
type TextItemOptions = SDKItemOptions & {
|
|
85
|
+
clone(): Line2;
|
|
73
86
|
/**
|
|
74
|
-
*
|
|
87
|
+
* 二维线段求长度
|
|
88
|
+
* @returns {number} 长度
|
|
75
89
|
*/
|
|
76
|
-
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* @description Video SDKItem 选项
|
|
80
|
-
*/
|
|
81
|
-
type VideoItemOptions = SDKItemOptions & {
|
|
90
|
+
length(): number;
|
|
82
91
|
/**
|
|
83
|
-
*
|
|
92
|
+
* 二维线段判断相交
|
|
93
|
+
* @param {Line2} other 二维线段
|
|
94
|
+
* @returns {boolean} 相交判断结果
|
|
84
95
|
*/
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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;
|
|
91
106
|
/**
|
|
92
|
-
*
|
|
107
|
+
* 点到直线的最短距离
|
|
108
|
+
* @returns {{d: number, t: number}} d表示距离,t表示最近点在直线的比例
|
|
93
109
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
* @description 支持 image 和 video 两种生成器类型
|
|
99
|
-
* @description 使用 GeneratorItemProperty 包含 generatorType
|
|
100
|
-
*/
|
|
101
|
-
type GeneratorItemOptions = SDKItemOptions & {
|
|
110
|
+
distanceToLine(line: Line2): {
|
|
111
|
+
d: number;
|
|
112
|
+
t: number;
|
|
113
|
+
};
|
|
102
114
|
/**
|
|
103
|
-
*
|
|
115
|
+
* 二维向量与x轴夹角
|
|
116
|
+
* @returns {number} 弧度值
|
|
104
117
|
*/
|
|
105
|
-
|
|
106
|
-
};
|
|
107
|
-
type EffectsItemOptions = SDKItemOptions & {
|
|
108
|
-
property?: Partial<EffectsItemProperty>;
|
|
109
|
-
};
|
|
110
|
-
/**
|
|
111
|
-
* @description Frame 画板元素 SDKItem 选项
|
|
112
|
-
*/
|
|
113
|
-
type FrameItemOptions = SDKItemOptions & {
|
|
118
|
+
angle(): number;
|
|
114
119
|
/**
|
|
115
|
-
*
|
|
120
|
+
* 二维点绕点旋转
|
|
121
|
+
* @param {Vec2} center 旋转中心
|
|
122
|
+
* @param {number} angle 旋转角度
|
|
123
|
+
* @returns {Vec2} 旋转结果
|
|
116
124
|
*/
|
|
117
|
-
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* @description SDKItem 类型(独立于 spec.ItemType)
|
|
121
|
-
* @description 包含所有 SDK 层级的元素类型,包括虚拟类型如 generator
|
|
122
|
-
*/
|
|
123
|
-
declare enum SDKItemType {
|
|
124
|
-
SPRITE = "sprite",
|
|
125
|
-
TEXT = "text",
|
|
126
|
-
VIDEO = "video",
|
|
127
|
-
GROUP = "group",
|
|
128
|
-
GENERATOR = "generator",
|
|
129
|
-
EFFECTS = "effects",
|
|
130
|
-
FRAME = "frame"
|
|
125
|
+
rotateAround(center: Vector2, angle: number): this;
|
|
131
126
|
}
|
|
132
127
|
|
|
133
128
|
/**
|
|
134
|
-
* @
|
|
135
|
-
* @description 支持属性扩展,允许添加任意自定义属性
|
|
129
|
+
* @class 二维包围盒
|
|
136
130
|
*/
|
|
137
|
-
declare
|
|
131
|
+
declare class Box2 {
|
|
138
132
|
/**
|
|
139
|
-
* @
|
|
133
|
+
* @member {Vector2[]} corners 二维包围盒角点
|
|
140
134
|
*/
|
|
141
|
-
|
|
135
|
+
corners: Vector2[];
|
|
136
|
+
min: Vector2;
|
|
137
|
+
max: Vector2;
|
|
142
138
|
/**
|
|
143
|
-
*
|
|
139
|
+
* 构造函数,传入值为空时表示空包围盒
|
|
140
|
+
* @param {Vector2} [min=new Vector2(Infinity, Infinity)] 最小点
|
|
141
|
+
* @param {Vector2} [max=new Vector2(-Infinity, -Infinity)] 最大点
|
|
144
142
|
*/
|
|
145
|
-
|
|
143
|
+
constructor(min?: Vector2, max?: Vector2);
|
|
146
144
|
/**
|
|
147
|
-
*
|
|
145
|
+
* 通过最大最小点设置二维包围盒
|
|
146
|
+
* @param {Vector2} min 最小点
|
|
147
|
+
* @param {Vector2} max 最大点
|
|
148
|
+
* @returns {Box2} 二维包围盒
|
|
148
149
|
*/
|
|
149
|
-
|
|
150
|
+
set(min: Vector2, max: Vector2): this;
|
|
150
151
|
/**
|
|
151
|
-
*
|
|
152
|
+
* 通过角点设置二维包围盒
|
|
153
|
+
* @param {Vector2[]} vecArray 二维空间点数组
|
|
154
|
+
* @returns {Box2} 二维包围盒
|
|
152
155
|
*/
|
|
153
|
-
|
|
156
|
+
setFromVec2Array(vecArray: Vector2[]): this;
|
|
154
157
|
/**
|
|
155
|
-
*
|
|
158
|
+
* 通过屏幕坐标点设置二维包围盒 - 点为屏幕坐标点,x正方向为右,y正方向为向上
|
|
159
|
+
* @param vecArray 屏幕坐标点
|
|
156
160
|
*/
|
|
157
|
-
|
|
161
|
+
setFromVec2ArrayWithOutCorners(vecArray: Vector2[]): this;
|
|
158
162
|
/**
|
|
159
|
-
*
|
|
163
|
+
* 通过中心与大小设置二维包围盒
|
|
164
|
+
* @param {Vector2} center 二维中心点
|
|
165
|
+
* @param {Vector2} size 二维大小
|
|
166
|
+
* @returns {Box2} 二维包围盒
|
|
160
167
|
*/
|
|
161
|
-
|
|
168
|
+
setFromCenterAndSize(center: Vector2, size: Vector2): this;
|
|
162
169
|
/**
|
|
163
|
-
*
|
|
170
|
+
* 克隆二维包围盒
|
|
171
|
+
* @returns {Box2} 克隆结果
|
|
164
172
|
*/
|
|
165
|
-
|
|
173
|
+
clone(): Box2;
|
|
166
174
|
/**
|
|
167
|
-
*
|
|
175
|
+
* 复制二维包围盒
|
|
176
|
+
* @param {Box2} box 二维包围盒
|
|
177
|
+
* @returns {Box2} 复制结果
|
|
168
178
|
*/
|
|
169
|
-
|
|
170
|
-
isCoreEditable: boolean;
|
|
179
|
+
copyFrom(box: Box2): this;
|
|
171
180
|
/**
|
|
172
|
-
*
|
|
181
|
+
* 二维包围盒置空
|
|
182
|
+
* @returns {Box2} 置空结果
|
|
173
183
|
*/
|
|
174
|
-
|
|
184
|
+
makeEmpty(): this;
|
|
175
185
|
/**
|
|
176
|
-
*
|
|
177
|
-
* @
|
|
186
|
+
* 二维包围盒判空
|
|
187
|
+
* @returns {boolean} 判空结果
|
|
178
188
|
*/
|
|
179
|
-
|
|
189
|
+
isEmpty(): boolean;
|
|
180
190
|
/**
|
|
181
|
-
*
|
|
191
|
+
* 获取二维包围盒角点
|
|
192
|
+
* @returns {Vector2[]} 二维包围盒角点
|
|
182
193
|
*/
|
|
183
|
-
|
|
184
|
-
constructor(options: SDKItemOptions);
|
|
194
|
+
getCorners(): Vector2[];
|
|
185
195
|
/**
|
|
186
|
-
*
|
|
187
|
-
* @param
|
|
188
|
-
* @
|
|
196
|
+
* 获取二维包围盒中心点
|
|
197
|
+
* @param {Vector2} [target=new Vector2()] 目标点(用以存放二维包围盒中心点)
|
|
198
|
+
* @returns {Vector2} 二维包围盒中心点
|
|
189
199
|
*/
|
|
190
|
-
|
|
200
|
+
getCenter(target?: Vector2): Vector2;
|
|
191
201
|
/**
|
|
192
|
-
*
|
|
193
|
-
* @param
|
|
194
|
-
* @returns
|
|
195
|
-
*/
|
|
196
|
-
getExtension(key: string): any;
|
|
197
|
-
/**
|
|
198
|
-
* @description 检查是否存在指定扩展属性
|
|
199
|
-
* @param key 属性名
|
|
200
|
-
* @returns 是否存在
|
|
202
|
+
* 获取二维包围盒大小
|
|
203
|
+
* @param {Vector2} [target=new Vector2()] 目标向量(用以存放二维包围盒大小)
|
|
204
|
+
* @returns {Vector2} 二维包围盒大小
|
|
201
205
|
*/
|
|
202
|
-
|
|
206
|
+
getSize(target?: Vector2): Vector2;
|
|
203
207
|
/**
|
|
204
|
-
*
|
|
205
|
-
* @param
|
|
206
|
-
* @returns
|
|
208
|
+
* 通过二维空间点扩展二维包围盒
|
|
209
|
+
* @param {Vector2} point 二维空间点
|
|
210
|
+
* @returns {Box2} 扩展包围盒
|
|
207
211
|
*/
|
|
208
|
-
|
|
212
|
+
expandByPoint(point: Vector2): this;
|
|
209
213
|
/**
|
|
210
|
-
*
|
|
211
|
-
* @
|
|
214
|
+
* 通过向量扩展二维包围盒
|
|
215
|
+
* @param {Vector2} vector 二维向量
|
|
216
|
+
* @returns {Box2} 扩展结果
|
|
212
217
|
*/
|
|
213
|
-
|
|
218
|
+
expandByVector(vector: Vector2): this;
|
|
214
219
|
/**
|
|
215
|
-
*
|
|
216
|
-
* @
|
|
220
|
+
* 通过大小扩展二维包围盒
|
|
221
|
+
* @param {number} scalar 扩展大小
|
|
222
|
+
* @returns {Box2} 扩展结果
|
|
217
223
|
*/
|
|
218
|
-
|
|
224
|
+
expandByScalar(scalar: number): this;
|
|
219
225
|
/**
|
|
220
|
-
*
|
|
221
|
-
* @param
|
|
226
|
+
* 判断二维包围盒是否包含二维空间点
|
|
227
|
+
* @param {Vector2} point 二维空间点
|
|
228
|
+
* @param {boolean} [isOrthogonal=true] 包围盒正交判断(默认为true)
|
|
229
|
+
* @returns {boolean} 点包含判断结果
|
|
222
230
|
*/
|
|
223
|
-
|
|
231
|
+
containsPoint(point: Vector2, isOrthogonal?: boolean): boolean;
|
|
224
232
|
/**
|
|
225
|
-
*
|
|
233
|
+
* 判断二维包围盒包含关系(if this contains other)
|
|
234
|
+
* @param {Box2} box 其它包围盒
|
|
235
|
+
* @returns {boolean} 二维包围盒包含判断结果
|
|
226
236
|
*/
|
|
227
|
-
|
|
237
|
+
containsBox(box: Box2): boolean;
|
|
228
238
|
/**
|
|
229
|
-
*
|
|
230
|
-
* @param
|
|
231
|
-
* @
|
|
239
|
+
* 获取点以包围盒左上角顶点为原点的相对位置
|
|
240
|
+
* @param {Vector2} point 指定二维空间点
|
|
241
|
+
* @param {Vector2} [target=new Vector2()] 目标空间点
|
|
242
|
+
* @returns {Vector2} 计算结果空间点
|
|
232
243
|
*/
|
|
233
|
-
|
|
244
|
+
getParameter(point: Vector2, target?: Vector2): Vector2;
|
|
234
245
|
/**
|
|
235
|
-
*
|
|
236
|
-
* @
|
|
246
|
+
* 求点与二维包围盒的最近点
|
|
247
|
+
* @param {Vector2} point 二维空间点
|
|
248
|
+
* @param {Vector2} [target=new Vector2()] 结果点
|
|
249
|
+
* @returns {Vector2} 二维空间点
|
|
237
250
|
*/
|
|
238
|
-
|
|
251
|
+
clampPoint(point: Vector2, target?: Vector2): Vector2;
|
|
239
252
|
/**
|
|
240
|
-
*
|
|
241
|
-
* @
|
|
253
|
+
* 求点到二维包围盒的距离
|
|
254
|
+
* @param {Vector2} point 二维空间点
|
|
255
|
+
* @returns {number} 距离
|
|
242
256
|
*/
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* @description 类型守卫函数:检查对象是否是 BaseItem
|
|
247
|
-
* @param obj 要检查的对象
|
|
248
|
-
* @returns 是否是 BaseItem 实例
|
|
249
|
-
*/
|
|
250
|
-
declare function isBaseItem(obj: any): obj is BaseItem;
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* @description 图片元素 SDKItem 类
|
|
254
|
-
* @description 支持属性扩展
|
|
255
|
-
*/
|
|
256
|
-
declare class SpriteItem extends BaseItem {
|
|
257
|
+
distanceToPoint(point: Vector2): number;
|
|
257
258
|
/**
|
|
258
|
-
*
|
|
259
|
+
* 二维包围盒求交集
|
|
260
|
+
* @param {Box2} box 二维包围盒
|
|
261
|
+
* @returns {Box2} 求交结果
|
|
259
262
|
*/
|
|
260
|
-
|
|
263
|
+
intersect(box: Box2): this;
|
|
261
264
|
/**
|
|
262
|
-
*
|
|
265
|
+
* 二维包围盒求并集
|
|
266
|
+
* @param {Box2} box 二维包围盒
|
|
267
|
+
* @returns {Box2} 求并结果
|
|
263
268
|
*/
|
|
264
|
-
|
|
265
|
-
constructor(options: SpriteItemOptions);
|
|
269
|
+
union(target: Box2 | Vector2): this;
|
|
266
270
|
/**
|
|
267
|
-
*
|
|
271
|
+
* 二维包围盒位移
|
|
272
|
+
* @param {Vector2} offset 位移向量
|
|
273
|
+
* @returns {Box2} 位移结果
|
|
268
274
|
*/
|
|
269
|
-
|
|
270
|
-
|
|
275
|
+
translate(offset: Vector2): this;
|
|
276
|
+
scale(scalar: number | Vector2, anchor?: Vector2): this;
|
|
271
277
|
/**
|
|
272
|
-
*
|
|
278
|
+
* 二维包围盒判等
|
|
279
|
+
* @param {Box2} box 二维包围盒
|
|
280
|
+
* @returns {boolean} 判等结果
|
|
273
281
|
*/
|
|
274
|
-
|
|
275
|
-
set position(value: [number, number]);
|
|
276
|
-
get width(): number;
|
|
277
|
-
set width(value: number);
|
|
278
|
-
get height(): number;
|
|
279
|
-
set height(value: number);
|
|
282
|
+
equals(box: Box2): boolean;
|
|
280
283
|
/**
|
|
281
|
-
*
|
|
284
|
+
* 判断二维包围盒相交关系(if this intersect other)
|
|
285
|
+
* @param {Box2} box 二维包围盒
|
|
286
|
+
* @param {boolean} [isOrthogonal=true] 正交判断(当前包围盒)
|
|
287
|
+
* @returns {boolean} 相交判断结果
|
|
282
288
|
*/
|
|
283
|
-
|
|
284
|
-
|
|
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 = {
|
|
285
355
|
/**
|
|
286
|
-
*
|
|
356
|
+
* 导出类型
|
|
287
357
|
*/
|
|
288
|
-
|
|
289
|
-
set fullRotation(value: [number, number, number]);
|
|
358
|
+
mediaType: MediaType;
|
|
290
359
|
/**
|
|
291
|
-
*
|
|
292
|
-
* @deprecated 该属性即将废弃,使用 isCoreEditable 代替
|
|
360
|
+
* 额外画布,导出透明视频时使用
|
|
293
361
|
*/
|
|
294
|
-
|
|
295
|
-
set keyPropertyEditing(value: boolean);
|
|
362
|
+
extraCanvas?: HTMLCanvasElement | null;
|
|
296
363
|
/**
|
|
297
|
-
*
|
|
298
|
-
*
|
|
364
|
+
* 是否打印转码过程中的日志,仅在导出 MP4/AlphaMaskVideo 时有效, 默认 false
|
|
365
|
+
* 供开发调试使用
|
|
299
366
|
*/
|
|
300
|
-
|
|
367
|
+
loggerInTranscoding?: boolean;
|
|
301
368
|
/**
|
|
302
|
-
*
|
|
369
|
+
* ffmpeg 转码是否开启多线程,默认 false,确保环境支持 SharedArrayBuffer
|
|
303
370
|
*/
|
|
304
|
-
|
|
371
|
+
multiThreading?: boolean;
|
|
305
372
|
/**
|
|
306
|
-
*
|
|
307
|
-
* @param withParent 是否包含父节点ID
|
|
308
|
-
* @param extraProps 额外的属性
|
|
373
|
+
* 是否输出 buffer,默认 false
|
|
309
374
|
*/
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
* @description 类型守卫:检查是否是 SpriteItem
|
|
314
|
-
*/
|
|
315
|
-
declare function isSpriteItem(obj: any): obj is SpriteItem;
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* @description 文本元素 SDKItem 类
|
|
319
|
-
* @description 支持属性扩展
|
|
320
|
-
*/
|
|
321
|
-
declare class TextItem extends BaseItem {
|
|
375
|
+
isOutputBuffer?: boolean;
|
|
376
|
+
};
|
|
377
|
+
type MP4Config = {
|
|
322
378
|
/**
|
|
323
|
-
* @description
|
|
379
|
+
* @description MP4 导出时是否需要导出最后一帧 PNG
|
|
324
380
|
*/
|
|
325
|
-
|
|
381
|
+
isExportLastFrameJPEG?: boolean;
|
|
382
|
+
};
|
|
383
|
+
type GifConfig = {
|
|
326
384
|
/**
|
|
327
|
-
* @description
|
|
385
|
+
* @description GIF 导出时的帧率
|
|
328
386
|
*/
|
|
329
|
-
|
|
330
|
-
constructor(options: TextItemOptions);
|
|
387
|
+
fps?: number;
|
|
331
388
|
/**
|
|
332
|
-
* @description
|
|
389
|
+
* @description GIF 导出时的缩放比例
|
|
390
|
+
* 默认 '-1:-1', 表示不缩放
|
|
391
|
+
* 例如 '100:-1', 表示宽度 100,高度自动
|
|
392
|
+
* 例如 '-1:100', 表示宽度自动,高度 100
|
|
333
393
|
*/
|
|
334
|
-
|
|
335
|
-
set text(value: string);
|
|
394
|
+
scale?: string;
|
|
336
395
|
/**
|
|
337
|
-
* @description
|
|
396
|
+
* @description GIF 导出时的质量
|
|
397
|
+
* 默认 'highest'
|
|
398
|
+
* 可选 'highest', 'high', 'medium', 'low'
|
|
338
399
|
*/
|
|
339
|
-
|
|
340
|
-
|
|
400
|
+
quality?: keyof typeof GIF_QUALITY_TO_FFMPEG_ARGS;
|
|
401
|
+
};
|
|
402
|
+
type ApngConfig = {
|
|
341
403
|
/**
|
|
342
|
-
* @description
|
|
404
|
+
* @description APNG 导出时的帧率
|
|
343
405
|
*/
|
|
344
|
-
|
|
345
|
-
set fontSize(value: number);
|
|
406
|
+
fps?: number;
|
|
346
407
|
/**
|
|
347
|
-
* @description
|
|
408
|
+
* @description APNG 导出时的缩放比例
|
|
409
|
+
* 默认 '-1:-1', 表示不缩放
|
|
410
|
+
* 例如 '100:-1', 表示宽度 100,高度自动
|
|
411
|
+
* 例如 '-1:100', 表示宽度自动,高度 100
|
|
348
412
|
*/
|
|
349
|
-
|
|
350
|
-
set fontWeight(value: spec.TextWeight);
|
|
413
|
+
scale?: string;
|
|
351
414
|
/**
|
|
352
|
-
* @description
|
|
415
|
+
* @description APNG 导出时的质量
|
|
416
|
+
* 默认 'highest'
|
|
417
|
+
* 可选 'highest', 'high', 'medium', 'low'
|
|
353
418
|
*/
|
|
354
|
-
|
|
355
|
-
|
|
419
|
+
quality?: keyof typeof GIF_QUALITY_TO_FFMPEG_ARGS;
|
|
420
|
+
};
|
|
421
|
+
type ExportMediaItemOptions = {
|
|
356
422
|
/**
|
|
357
|
-
*
|
|
423
|
+
* 尺寸
|
|
358
424
|
*/
|
|
359
|
-
|
|
360
|
-
set textAlign(value: spec.TextAlignment);
|
|
425
|
+
size: [number, number];
|
|
361
426
|
/**
|
|
362
|
-
*
|
|
427
|
+
* 动效资源
|
|
363
428
|
*/
|
|
364
|
-
|
|
365
|
-
set color(value: [number, number, number, number]);
|
|
429
|
+
scene: spec.JSONScene;
|
|
366
430
|
/**
|
|
367
|
-
*
|
|
431
|
+
* 视频时长,目前仅在导出 MP4 / AlphaMaskVideo 时有效,默认取动效资源时长
|
|
368
432
|
*/
|
|
369
|
-
|
|
370
|
-
set width(value: number);
|
|
433
|
+
time?: number;
|
|
371
434
|
/**
|
|
372
|
-
*
|
|
435
|
+
* 是否生成音轨,默认 false,仅在导出 MP4 时有效
|
|
373
436
|
*/
|
|
374
|
-
|
|
375
|
-
set lineHeight(value: number);
|
|
437
|
+
audioEnable?: boolean;
|
|
376
438
|
/**
|
|
377
|
-
*
|
|
439
|
+
* 帧率, 默认 30
|
|
378
440
|
*/
|
|
379
|
-
|
|
380
|
-
set height(value: number);
|
|
441
|
+
fps?: number;
|
|
381
442
|
/**
|
|
382
|
-
*
|
|
443
|
+
* 是否循环,默认 true
|
|
383
444
|
*/
|
|
384
|
-
|
|
385
|
-
set outlineColor(value: spec.vec4 | undefined);
|
|
445
|
+
loop?: boolean;
|
|
386
446
|
/**
|
|
387
|
-
*
|
|
447
|
+
* 视频背景颜色,默认 #000000
|
|
388
448
|
*/
|
|
389
|
-
|
|
390
|
-
set outlineWidth(value: number | undefined);
|
|
449
|
+
backgroundColor?: string;
|
|
391
450
|
/**
|
|
392
|
-
*
|
|
451
|
+
* 导出 MP4 时,设置的导出配置
|
|
393
452
|
*/
|
|
394
|
-
|
|
395
|
-
set outlineEnabled(value: boolean);
|
|
453
|
+
mp4Config?: MP4Config;
|
|
396
454
|
/**
|
|
397
|
-
*
|
|
455
|
+
* 导出 GIF 时,设置的导出配置
|
|
398
456
|
*/
|
|
399
|
-
|
|
400
|
-
set position(value: [number, number]);
|
|
457
|
+
gifConfig?: GifConfig;
|
|
401
458
|
/**
|
|
402
|
-
*
|
|
459
|
+
* 导出 APNG 时,设置的导出配置
|
|
403
460
|
*/
|
|
404
|
-
|
|
405
|
-
|
|
461
|
+
apngConfig?: ApngConfig;
|
|
462
|
+
};
|
|
463
|
+
type ExportMediaItemDownloadInfo = {
|
|
406
464
|
/**
|
|
407
|
-
* @description
|
|
408
|
-
* @param withParent 是否包含父节点ID
|
|
465
|
+
* @description 导出文件夹名称
|
|
409
466
|
*/
|
|
410
|
-
|
|
467
|
+
folderName: string;
|
|
411
468
|
/**
|
|
412
|
-
* @description
|
|
469
|
+
* @description 导出视频名称
|
|
413
470
|
*/
|
|
414
|
-
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
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;
|
|
420
477
|
|
|
421
478
|
/**
|
|
422
|
-
* @description
|
|
423
|
-
* @description
|
|
479
|
+
* @description SDKItem 基础选项接口
|
|
480
|
+
* @description 支持扩展属性,允许添加任意额外属性
|
|
424
481
|
*/
|
|
425
|
-
|
|
482
|
+
type SDKItemOptions = {
|
|
426
483
|
/**
|
|
427
|
-
* @description
|
|
484
|
+
* @description 元素ID
|
|
428
485
|
*/
|
|
429
|
-
|
|
486
|
+
id: string;
|
|
430
487
|
/**
|
|
431
|
-
* @description
|
|
488
|
+
* @description 元素名称
|
|
432
489
|
*/
|
|
433
|
-
|
|
434
|
-
constructor(options: VideoItemOptions);
|
|
490
|
+
name: string;
|
|
435
491
|
/**
|
|
436
|
-
* @description
|
|
492
|
+
* @description 父节点ID
|
|
437
493
|
*/
|
|
438
|
-
|
|
439
|
-
set video(value: string);
|
|
494
|
+
parentId?: string;
|
|
440
495
|
/**
|
|
441
|
-
* @description
|
|
496
|
+
* @description 子元素ID列表
|
|
442
497
|
*/
|
|
443
|
-
|
|
444
|
-
set position(value: [number, number]);
|
|
498
|
+
children?: string[];
|
|
445
499
|
/**
|
|
446
|
-
* @description
|
|
500
|
+
* @description 元素生命周期
|
|
501
|
+
*/
|
|
502
|
+
duration?: number;
|
|
503
|
+
/**
|
|
504
|
+
* @description 元素生命周期延时
|
|
505
|
+
*/
|
|
506
|
+
delay?: number;
|
|
507
|
+
/**
|
|
508
|
+
* @description 可视状态
|
|
509
|
+
*/
|
|
510
|
+
visible?: boolean;
|
|
511
|
+
/**
|
|
512
|
+
* @description 元素结束行为
|
|
447
513
|
*/
|
|
448
|
-
|
|
449
|
-
set width(value: number);
|
|
514
|
+
endBehavior?: spec.EndBehavior;
|
|
450
515
|
/**
|
|
451
|
-
* @description
|
|
516
|
+
* @description 是否处于锁定状态
|
|
452
517
|
*/
|
|
453
|
-
|
|
454
|
-
set height(value: number);
|
|
518
|
+
isLocked?: boolean;
|
|
455
519
|
/**
|
|
456
|
-
* @description
|
|
520
|
+
* @description 关键属性是否可编辑
|
|
457
521
|
*/
|
|
458
|
-
|
|
459
|
-
set rotation(value: number);
|
|
522
|
+
isCoreEditable: boolean;
|
|
460
523
|
/**
|
|
461
|
-
* @description
|
|
524
|
+
* @description 扩展属性存储(属性名 -> 属性值)
|
|
462
525
|
*/
|
|
463
|
-
|
|
464
|
-
set fullRotation(value: [number, number, number]);
|
|
526
|
+
extension?: Record<string, any>;
|
|
465
527
|
/**
|
|
466
|
-
* @description
|
|
467
|
-
* @deprecated 该属性即将废弃,使用 isCoreEditable 代替
|
|
528
|
+
* @description 允许任意额外属性(用于兼容旧代码)
|
|
468
529
|
*/
|
|
469
|
-
|
|
470
|
-
|
|
530
|
+
[extraProp: string]: any;
|
|
531
|
+
};
|
|
532
|
+
/**
|
|
533
|
+
* @description Sprite SDKItem 选项
|
|
534
|
+
*/
|
|
535
|
+
type SpriteItemOptions = SDKItemOptions & {
|
|
471
536
|
/**
|
|
472
|
-
* @description
|
|
537
|
+
* @description 元素属性
|
|
473
538
|
*/
|
|
474
|
-
|
|
475
|
-
|
|
539
|
+
property?: Partial<SpriteItemProperty>;
|
|
540
|
+
};
|
|
541
|
+
/**
|
|
542
|
+
* @description Text SDKItem 选项
|
|
543
|
+
*/
|
|
544
|
+
type TextItemOptions = SDKItemOptions & {
|
|
476
545
|
/**
|
|
477
|
-
* @description
|
|
546
|
+
* @description 元素属性
|
|
478
547
|
*/
|
|
479
|
-
|
|
480
|
-
|
|
548
|
+
property?: Partial<TextItemProperty>;
|
|
549
|
+
};
|
|
550
|
+
/**
|
|
551
|
+
* @description Video SDKItem 选项
|
|
552
|
+
*/
|
|
553
|
+
type VideoItemOptions = SDKItemOptions & {
|
|
481
554
|
/**
|
|
482
|
-
* @description
|
|
555
|
+
* @description 元素属性
|
|
483
556
|
*/
|
|
484
|
-
|
|
485
|
-
|
|
557
|
+
property?: Partial<VideoItemProperty>;
|
|
558
|
+
};
|
|
559
|
+
/**
|
|
560
|
+
* @description Group SDKItem 选项(空节点/组)
|
|
561
|
+
*/
|
|
562
|
+
type GroupItemOptions = SDKItemOptions & {
|
|
486
563
|
/**
|
|
487
|
-
* @description
|
|
564
|
+
* @description 元素属性
|
|
488
565
|
*/
|
|
489
|
-
|
|
490
|
-
|
|
566
|
+
property?: Partial<GroupItemProperty>;
|
|
567
|
+
};
|
|
568
|
+
/**
|
|
569
|
+
* @description Generator SDKItem 选项(资源生成器)
|
|
570
|
+
* @description 支持 image 和 video 两种生成器类型
|
|
571
|
+
* @description 使用 GeneratorItemProperty 包含 generatorType
|
|
572
|
+
*/
|
|
573
|
+
type GeneratorItemOptions = SDKItemOptions & {
|
|
491
574
|
/**
|
|
492
|
-
* @description
|
|
493
|
-
* @param withParent 是否包含父节点ID
|
|
575
|
+
* @description 元素属性(包含 generatorType)
|
|
494
576
|
*/
|
|
495
|
-
|
|
577
|
+
property?: Partial<GeneratorItemProperty>;
|
|
578
|
+
};
|
|
579
|
+
type EffectsItemOptions = SDKItemOptions & {
|
|
580
|
+
property?: Partial<EffectsItemProperty>;
|
|
581
|
+
};
|
|
582
|
+
/**
|
|
583
|
+
* @description Frame 画板元素 SDKItem 选项
|
|
584
|
+
*/
|
|
585
|
+
type FrameItemOptions = SDKItemOptions & {
|
|
496
586
|
/**
|
|
497
|
-
* @description
|
|
587
|
+
* @description 元素属性
|
|
498
588
|
*/
|
|
499
|
-
|
|
500
|
-
}
|
|
589
|
+
property?: Partial<FrameItemProperty>;
|
|
590
|
+
};
|
|
501
591
|
/**
|
|
502
|
-
* @description
|
|
592
|
+
* @description SDKItem 类型(独立于 spec.ItemType)
|
|
593
|
+
* @description 包含所有 SDK 层级的元素类型,包括虚拟类型如 generator
|
|
503
594
|
*/
|
|
504
|
-
declare
|
|
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
|
+
}
|
|
505
604
|
|
|
506
605
|
/**
|
|
507
|
-
* @description
|
|
508
|
-
* @description
|
|
606
|
+
* @description SDKItem 抽象基类
|
|
607
|
+
* @description 支持属性扩展,允许添加任意自定义属性
|
|
509
608
|
*/
|
|
510
|
-
declare class
|
|
609
|
+
declare abstract class BaseItem {
|
|
511
610
|
/**
|
|
512
|
-
* @description
|
|
611
|
+
* @description 元素ID
|
|
513
612
|
*/
|
|
514
|
-
|
|
613
|
+
id: string;
|
|
515
614
|
/**
|
|
516
|
-
* @description
|
|
615
|
+
* @description 元素名称
|
|
517
616
|
*/
|
|
518
|
-
|
|
519
|
-
constructor(options: GroupItemOptions);
|
|
617
|
+
name: string;
|
|
520
618
|
/**
|
|
521
|
-
* @description
|
|
619
|
+
* @description 父节点ID
|
|
522
620
|
*/
|
|
523
|
-
|
|
524
|
-
set position(value: [number, number]);
|
|
621
|
+
parentId?: string;
|
|
525
622
|
/**
|
|
526
|
-
* @description
|
|
623
|
+
* @description 元素生命周期
|
|
527
624
|
*/
|
|
528
|
-
|
|
529
|
-
set scale(value: [number, number]);
|
|
625
|
+
duration: number;
|
|
530
626
|
/**
|
|
531
|
-
* @description
|
|
627
|
+
* @description 元素生命周期延时
|
|
532
628
|
*/
|
|
533
|
-
|
|
534
|
-
set rotation(value: number);
|
|
629
|
+
delay: number;
|
|
535
630
|
/**
|
|
536
|
-
* @description
|
|
631
|
+
* @description 元素结束行为
|
|
537
632
|
*/
|
|
538
|
-
|
|
539
|
-
set fullRotation(value: [number, number, number]);
|
|
633
|
+
endBehavior: spec.EndBehavior;
|
|
540
634
|
/**
|
|
541
|
-
* @description
|
|
542
|
-
* @deprecated 该属性即将废弃,使用 isCoreEditable 代替
|
|
635
|
+
* @description 是否可见
|
|
543
636
|
*/
|
|
544
|
-
|
|
545
|
-
set keyPropertyEditing(value: boolean);
|
|
637
|
+
visible: boolean;
|
|
546
638
|
/**
|
|
547
|
-
* @description
|
|
548
|
-
* @param withParent 是否包含父节点ID
|
|
639
|
+
* @description 是否处于锁定状态
|
|
549
640
|
*/
|
|
550
|
-
|
|
641
|
+
isLocked: boolean;
|
|
551
642
|
/**
|
|
552
|
-
* @description
|
|
643
|
+
* @description 核心数据是否支持编辑
|
|
553
644
|
*/
|
|
554
|
-
|
|
555
|
-
}
|
|
556
|
-
/**
|
|
557
|
-
* @description 类型守卫:检查是否是 GroupItem
|
|
558
|
-
*/
|
|
559
|
-
declare function isGroupItem(obj: any): obj is GroupItem;
|
|
560
|
-
|
|
561
|
-
/**
|
|
562
|
-
* @description 资源生成器元素 SDKItem 类
|
|
563
|
-
* @description 支持 image 和 video 两种生成器类型
|
|
564
|
-
* @description 在 Player 中以透明 SpriteItem 形式渲染
|
|
565
|
-
* @description 支持属性扩展,可转换为 SpriteItem 或 VideoItem
|
|
566
|
-
*/
|
|
567
|
-
declare class GeneratorItem extends BaseItem {
|
|
645
|
+
isCoreEditable: boolean;
|
|
568
646
|
/**
|
|
569
|
-
* @description
|
|
647
|
+
* @description 扩展属性存储(与 property 同级)
|
|
570
648
|
*/
|
|
571
|
-
|
|
649
|
+
extension: Map<string, any>;
|
|
572
650
|
/**
|
|
573
|
-
* @description
|
|
651
|
+
* @description 元素类型(由子类实现)
|
|
652
|
+
* @description 支持 spec.ItemType 或扩展的 SDKItemType
|
|
574
653
|
*/
|
|
575
|
-
|
|
576
|
-
constructor(options: GeneratorItemOptions);
|
|
654
|
+
abstract readonly type: SDKItemType;
|
|
577
655
|
/**
|
|
578
|
-
* @description
|
|
656
|
+
* @description 元素属性(由子类实现)
|
|
579
657
|
*/
|
|
580
|
-
|
|
581
|
-
|
|
658
|
+
abstract readonly property: BaseItemProperty;
|
|
659
|
+
constructor(options: SDKItemOptions);
|
|
582
660
|
/**
|
|
583
|
-
* @description
|
|
661
|
+
* @description 设置扩展属性
|
|
662
|
+
* @param key 属性名
|
|
663
|
+
* @param value 属性值
|
|
584
664
|
*/
|
|
585
|
-
|
|
586
|
-
set image(_value: string);
|
|
665
|
+
setExtension(key: string, value: any): void;
|
|
587
666
|
/**
|
|
588
|
-
* @description
|
|
667
|
+
* @description 获取扩展属性
|
|
668
|
+
* @param key 属性名
|
|
669
|
+
* @returns 属性值
|
|
589
670
|
*/
|
|
590
|
-
|
|
591
|
-
set position(value: [number, number]);
|
|
671
|
+
getExtension(key: string): any;
|
|
592
672
|
/**
|
|
593
|
-
* @description
|
|
673
|
+
* @description 检查是否存在指定扩展属性
|
|
674
|
+
* @param key 属性名
|
|
675
|
+
* @returns 是否存在
|
|
594
676
|
*/
|
|
595
|
-
|
|
596
|
-
set width(value: number);
|
|
677
|
+
hasExtension(key: string): boolean;
|
|
597
678
|
/**
|
|
598
|
-
* @description
|
|
679
|
+
* @description 删除扩展属性
|
|
680
|
+
* @param key 属性名
|
|
681
|
+
* @returns 是否删除成功
|
|
599
682
|
*/
|
|
600
|
-
|
|
601
|
-
set height(value: number);
|
|
683
|
+
deleteExtension(key: string): boolean;
|
|
602
684
|
/**
|
|
603
|
-
* @description
|
|
685
|
+
* @description 获取所有扩展属性的键名列表
|
|
686
|
+
* @returns 键名数组
|
|
604
687
|
*/
|
|
605
|
-
|
|
606
|
-
set rotation(value: number);
|
|
688
|
+
getExtensionKeys(): string[];
|
|
607
689
|
/**
|
|
608
|
-
* @description
|
|
690
|
+
* @description 获取所有扩展属性
|
|
691
|
+
* @returns 扩展属性对象
|
|
609
692
|
*/
|
|
610
|
-
|
|
611
|
-
set fullRotation(value: [number, number, number]);
|
|
693
|
+
getAllExtension(): Record<string, any>;
|
|
612
694
|
/**
|
|
613
|
-
* @description
|
|
614
|
-
* @
|
|
695
|
+
* @description 批量设置扩展属性
|
|
696
|
+
* @param extensions 扩展属性对象
|
|
615
697
|
*/
|
|
616
|
-
|
|
617
|
-
set keyPropertyEditing(value: boolean);
|
|
698
|
+
setExtensions(extensions: Record<string, any>): void;
|
|
618
699
|
/**
|
|
619
|
-
* @description
|
|
620
|
-
* @param withParent 是否包含父节点ID
|
|
700
|
+
* @description 清空所有扩展属性
|
|
621
701
|
*/
|
|
622
|
-
|
|
702
|
+
clearExtension(): void;
|
|
623
703
|
/**
|
|
624
|
-
* @description 转换为
|
|
625
|
-
* @param videoUrl 视频资源地址
|
|
704
|
+
* @description 转换为 CreateInfo(用于元素复制/导出)
|
|
626
705
|
* @param withParent 是否包含父节点ID
|
|
706
|
+
* @returns CreateInfo 对象
|
|
627
707
|
*/
|
|
628
|
-
|
|
708
|
+
abstract toCreateInfo(withParent?: boolean): ItemCreateInfo;
|
|
629
709
|
/**
|
|
630
|
-
* @description
|
|
631
|
-
* @
|
|
632
|
-
* @param withParent 是否包含父节点ID
|
|
710
|
+
* @description 克隆 SDKItem
|
|
711
|
+
* @returns 新的 SDKItem 实例
|
|
633
712
|
*/
|
|
634
|
-
|
|
713
|
+
abstract clone(): BaseItem;
|
|
635
714
|
/**
|
|
636
|
-
* @description
|
|
715
|
+
* @description 获取基础属性的 JSON 对象,转换为普通对象(用于序列化)
|
|
716
|
+
* @returns 普通对象
|
|
637
717
|
*/
|
|
638
|
-
|
|
718
|
+
toJSON(): Record<string, any>;
|
|
639
719
|
}
|
|
640
720
|
/**
|
|
641
|
-
* @description
|
|
721
|
+
* @description 类型守卫函数:检查对象是否是 BaseItem
|
|
722
|
+
* @param obj 要检查的对象
|
|
723
|
+
* @returns 是否是 BaseItem 实例
|
|
642
724
|
*/
|
|
643
|
-
declare function
|
|
725
|
+
declare function isBaseItem(obj: any): obj is BaseItem;
|
|
644
726
|
|
|
645
727
|
/**
|
|
646
|
-
* @description
|
|
728
|
+
* @description 图片元素 SDKItem 类
|
|
729
|
+
* @description 支持属性扩展
|
|
647
730
|
*/
|
|
648
|
-
declare class
|
|
731
|
+
declare class SpriteItem extends BaseItem {
|
|
649
732
|
/**
|
|
650
|
-
* @description
|
|
733
|
+
* @description 元素类型
|
|
651
734
|
*/
|
|
652
|
-
readonly type = SDKItemType.
|
|
735
|
+
readonly type = SDKItemType.SPRITE;
|
|
653
736
|
/**
|
|
654
737
|
* @description 元素属性
|
|
655
738
|
*/
|
|
656
|
-
property:
|
|
657
|
-
constructor(options:
|
|
739
|
+
property: SpriteItemProperty;
|
|
740
|
+
constructor(options: SpriteItemOptions);
|
|
658
741
|
/**
|
|
659
|
-
* @description
|
|
742
|
+
* @description 图片地址
|
|
660
743
|
*/
|
|
661
|
-
get
|
|
662
|
-
set
|
|
744
|
+
get image(): string;
|
|
745
|
+
set image(value: string);
|
|
663
746
|
/**
|
|
664
747
|
* @description 位置
|
|
665
748
|
*/
|
|
666
749
|
get position(): [number, number];
|
|
667
750
|
set position(value: [number, number]);
|
|
668
|
-
/**
|
|
669
|
-
* @description 宽度
|
|
670
|
-
*/
|
|
671
751
|
get width(): number;
|
|
672
752
|
set width(value: number);
|
|
673
|
-
/**
|
|
674
|
-
* @description 高度
|
|
675
|
-
*/
|
|
676
753
|
get height(): number;
|
|
677
754
|
set height(value: number);
|
|
678
755
|
/**
|
|
@@ -692,604 +769,534 @@ declare class EffectsItem extends BaseItem {
|
|
|
692
769
|
get keyPropertyEditing(): boolean;
|
|
693
770
|
set keyPropertyEditing(value: boolean);
|
|
694
771
|
/**
|
|
695
|
-
* @description 转换为
|
|
772
|
+
* @description 转换为 CreateInfo
|
|
696
773
|
* @param withParent 是否包含父节点ID
|
|
697
774
|
*/
|
|
698
|
-
toCreateInfo(withParent?: boolean):
|
|
775
|
+
toCreateInfo(withParent?: boolean): SpriteCreateInfo;
|
|
699
776
|
/**
|
|
700
777
|
* @description 克隆 SDKItem
|
|
701
778
|
*/
|
|
702
|
-
clone():
|
|
779
|
+
clone(): SpriteItem;
|
|
780
|
+
/**
|
|
781
|
+
* @description 创建包含扩展属性的 CreateInfo
|
|
782
|
+
* @param withParent 是否包含父节点ID
|
|
783
|
+
* @param extraProps 额外的属性
|
|
784
|
+
*/
|
|
785
|
+
toCreateInfoWithExtensions(withParent?: boolean, extraProps?: Record<string, any>): SpriteCreateInfo;
|
|
703
786
|
}
|
|
704
787
|
/**
|
|
705
|
-
* @description 类型守卫:检查是否是
|
|
788
|
+
* @description 类型守卫:检查是否是 SpriteItem
|
|
706
789
|
*/
|
|
707
|
-
declare function
|
|
790
|
+
declare function isSpriteItem(obj: any): obj is SpriteItem;
|
|
708
791
|
|
|
709
792
|
/**
|
|
710
|
-
* @description
|
|
711
|
-
* @description
|
|
712
|
-
* @description 底层以 composition 形式渲染
|
|
793
|
+
* @description 文本元素 SDKItem 类
|
|
794
|
+
* @description 支持属性扩展
|
|
713
795
|
*/
|
|
714
|
-
declare class
|
|
796
|
+
declare class TextItem extends BaseItem {
|
|
715
797
|
/**
|
|
716
798
|
* @description 元素类型
|
|
717
799
|
*/
|
|
718
|
-
readonly type = SDKItemType.
|
|
800
|
+
readonly type = SDKItemType.TEXT;
|
|
719
801
|
/**
|
|
720
802
|
* @description 元素属性
|
|
721
803
|
*/
|
|
722
|
-
property:
|
|
723
|
-
constructor(options:
|
|
804
|
+
property: TextItemProperty;
|
|
805
|
+
constructor(options: TextItemOptions);
|
|
724
806
|
/**
|
|
725
|
-
* @description
|
|
807
|
+
* @description 文本内容
|
|
726
808
|
*/
|
|
727
|
-
get
|
|
809
|
+
get text(): string;
|
|
810
|
+
set text(value: string);
|
|
728
811
|
/**
|
|
729
|
-
* @description
|
|
812
|
+
* @description 字体名称
|
|
730
813
|
*/
|
|
731
|
-
get
|
|
732
|
-
set
|
|
814
|
+
get fontFamily(): string;
|
|
815
|
+
set fontFamily(value: string);
|
|
733
816
|
/**
|
|
734
|
-
* @description
|
|
817
|
+
* @description 字号
|
|
735
818
|
*/
|
|
736
|
-
get
|
|
737
|
-
set
|
|
819
|
+
get fontSize(): number;
|
|
820
|
+
set fontSize(value: number);
|
|
738
821
|
/**
|
|
739
|
-
* @description
|
|
822
|
+
* @description 字重
|
|
740
823
|
*/
|
|
741
|
-
get
|
|
742
|
-
set
|
|
824
|
+
get fontWeight(): spec.TextWeight;
|
|
825
|
+
set fontWeight(value: spec.TextWeight);
|
|
743
826
|
/**
|
|
744
|
-
* @description
|
|
827
|
+
* @description 字体样式
|
|
745
828
|
*/
|
|
746
|
-
get
|
|
747
|
-
set
|
|
829
|
+
get fontStyle(): spec.FontStyle;
|
|
830
|
+
set fontStyle(value: spec.FontStyle);
|
|
748
831
|
/**
|
|
749
|
-
* @description
|
|
832
|
+
* @description 文本对齐方式
|
|
750
833
|
*/
|
|
751
|
-
get
|
|
752
|
-
set
|
|
834
|
+
get textAlign(): spec.TextAlignment;
|
|
835
|
+
set textAlign(value: spec.TextAlignment);
|
|
753
836
|
/**
|
|
754
|
-
* @description
|
|
837
|
+
* @description 文本颜色 [r, g, b, a]
|
|
755
838
|
*/
|
|
756
|
-
get
|
|
757
|
-
set
|
|
839
|
+
get color(): [number, number, number, number];
|
|
840
|
+
set color(value: [number, number, number, number]);
|
|
758
841
|
/**
|
|
759
|
-
* @description
|
|
842
|
+
* @description 文本宽度
|
|
760
843
|
*/
|
|
761
|
-
get
|
|
762
|
-
set
|
|
844
|
+
get width(): number;
|
|
845
|
+
set width(value: number);
|
|
763
846
|
/**
|
|
764
|
-
* @description
|
|
765
|
-
* @param itemId 子元素ID
|
|
766
|
-
* @returns 是否添加成功
|
|
847
|
+
* @description 行高
|
|
767
848
|
*/
|
|
768
|
-
|
|
849
|
+
get lineHeight(): number;
|
|
850
|
+
set lineHeight(value: number);
|
|
769
851
|
/**
|
|
770
|
-
* @description
|
|
771
|
-
* @param itemIds 子元素ID列表
|
|
852
|
+
* @description 文本高度
|
|
772
853
|
*/
|
|
773
|
-
|
|
854
|
+
get height(): number;
|
|
855
|
+
set height(value: number);
|
|
774
856
|
/**
|
|
775
|
-
* @description
|
|
776
|
-
* @param itemId 子元素ID
|
|
777
|
-
* @returns 是否移除成功
|
|
857
|
+
* @description 描边颜色
|
|
778
858
|
*/
|
|
779
|
-
|
|
859
|
+
get outlineColor(): spec.vec4 | undefined;
|
|
860
|
+
set outlineColor(value: spec.vec4 | undefined);
|
|
780
861
|
/**
|
|
781
|
-
* @description
|
|
782
|
-
* @param itemIds 子元素ID列表
|
|
862
|
+
* @description 描边宽度
|
|
783
863
|
*/
|
|
784
|
-
|
|
864
|
+
get outlineWidth(): number | undefined;
|
|
865
|
+
set outlineWidth(value: number | undefined);
|
|
785
866
|
/**
|
|
786
|
-
* @description
|
|
787
|
-
* @param itemId 子元素ID
|
|
867
|
+
* @description 描边开关
|
|
788
868
|
*/
|
|
789
|
-
|
|
869
|
+
get outlineEnabled(): boolean;
|
|
870
|
+
set outlineEnabled(value: boolean);
|
|
790
871
|
/**
|
|
791
|
-
* @description
|
|
872
|
+
* @description 位置
|
|
792
873
|
*/
|
|
793
|
-
|
|
874
|
+
get position(): [number, number];
|
|
875
|
+
set position(value: [number, number]);
|
|
794
876
|
/**
|
|
795
|
-
* @description
|
|
877
|
+
* @description 旋转(二维旋转角度)
|
|
878
|
+
*/
|
|
879
|
+
get rotation(): number;
|
|
880
|
+
set rotation(value: number);
|
|
881
|
+
/**
|
|
882
|
+
* @description 转换为 CreateInfo
|
|
796
883
|
* @param withParent 是否包含父节点ID
|
|
797
884
|
*/
|
|
798
|
-
toCreateInfo(withParent?: boolean):
|
|
885
|
+
toCreateInfo(withParent?: boolean): TextCreateInfo;
|
|
799
886
|
/**
|
|
800
887
|
* @description 克隆 SDKItem
|
|
801
888
|
*/
|
|
802
|
-
clone():
|
|
889
|
+
clone(): TextItem;
|
|
803
890
|
}
|
|
804
891
|
/**
|
|
805
|
-
* @description 类型守卫:检查是否是
|
|
806
|
-
*/
|
|
807
|
-
declare function isFrameItem(obj: any): obj is FrameItem;
|
|
808
|
-
|
|
809
|
-
/**
|
|
810
|
-
* @description 根据 item type 创建对应的 SDKItem 实例
|
|
811
|
-
* @param type 元素类型
|
|
812
|
-
* @param options SDKItem 选项
|
|
813
|
-
* @returns SDKItem 实例
|
|
814
|
-
*/
|
|
815
|
-
declare function createSDKItem(type: spec.ItemType, options: SDKItemOptions): BaseItem;
|
|
816
|
-
/**
|
|
817
|
-
* @description SDKItem 类型联合
|
|
818
|
-
* @description 用于替换原来的 SDKItem type
|
|
892
|
+
* @description 类型守卫:检查是否是 TextItem
|
|
819
893
|
*/
|
|
820
|
-
|
|
894
|
+
declare function isTextItem(obj: any): obj is TextItem;
|
|
821
895
|
|
|
822
896
|
/**
|
|
823
|
-
* @
|
|
897
|
+
* @description 视频元素 SDKItem 类
|
|
898
|
+
* @description 支持属性扩展
|
|
824
899
|
*/
|
|
825
|
-
declare class
|
|
826
|
-
start: Vector2;
|
|
827
|
-
end: Vector2;
|
|
828
|
-
constructor(start?: Vector2, end?: Vector2);
|
|
900
|
+
declare class VideoItem extends BaseItem {
|
|
829
901
|
/**
|
|
830
|
-
*
|
|
831
|
-
* @param {Vector2} start 线段起点
|
|
832
|
-
* @param {Vector2} end 线段终点
|
|
833
|
-
* @returns {Line2} 二维线段
|
|
902
|
+
* @description 元素类型
|
|
834
903
|
*/
|
|
835
|
-
|
|
904
|
+
readonly type = SDKItemType.VIDEO;
|
|
836
905
|
/**
|
|
837
|
-
*
|
|
838
|
-
* @param {Line2} line 复制对象
|
|
839
|
-
* @returns {Line2} 复制结果
|
|
906
|
+
* @description 元素属性
|
|
840
907
|
*/
|
|
841
|
-
|
|
908
|
+
property: VideoItemProperty;
|
|
909
|
+
constructor(options: VideoItemOptions);
|
|
842
910
|
/**
|
|
843
|
-
*
|
|
844
|
-
* @returns {Vector2} 二维线段方向
|
|
911
|
+
* @description 视频地址
|
|
845
912
|
*/
|
|
846
|
-
|
|
913
|
+
get video(): string;
|
|
914
|
+
set video(value: string);
|
|
847
915
|
/**
|
|
848
|
-
*
|
|
849
|
-
* @param {Vector2} [target=new Vector2()] 目标保存对象
|
|
850
|
-
* @returns {Vector2} 二维线段中点
|
|
916
|
+
* @description 位置
|
|
851
917
|
*/
|
|
852
|
-
|
|
918
|
+
get position(): [number, number];
|
|
919
|
+
set position(value: [number, number]);
|
|
853
920
|
/**
|
|
854
|
-
*
|
|
855
|
-
* @param {Vector2} [target=new Vector2()] 目标保存对象
|
|
856
|
-
* @returns {Vector2} 二维线段向量值
|
|
921
|
+
* @description 宽度
|
|
857
922
|
*/
|
|
858
|
-
|
|
923
|
+
get width(): number;
|
|
924
|
+
set width(value: number);
|
|
859
925
|
/**
|
|
860
|
-
*
|
|
861
|
-
* @returns {number} 计算结果
|
|
926
|
+
* @description 高度
|
|
862
927
|
*/
|
|
863
|
-
|
|
928
|
+
get height(): number;
|
|
929
|
+
set height(value: number);
|
|
864
930
|
/**
|
|
865
|
-
*
|
|
866
|
-
* @returns {number} 计算结果
|
|
931
|
+
* @description 旋转(二维旋转角度)
|
|
867
932
|
*/
|
|
868
|
-
|
|
933
|
+
get rotation(): number;
|
|
934
|
+
set rotation(value: number);
|
|
869
935
|
/**
|
|
870
|
-
*
|
|
871
|
-
* @param {number} t 比例值
|
|
872
|
-
* @param {Vector2} target 目标保存对象
|
|
873
|
-
* @returns {Vector2} 比例点结果
|
|
936
|
+
* @description 完整旋转(包含 x, y, z)
|
|
874
937
|
*/
|
|
875
|
-
|
|
938
|
+
get fullRotation(): [number, number, number];
|
|
939
|
+
set fullRotation(value: [number, number, number]);
|
|
876
940
|
/**
|
|
877
|
-
*
|
|
878
|
-
* @
|
|
879
|
-
* @param {boolean} clampToLine 是否限制于线段内
|
|
880
|
-
* @returns {number} 距离结果
|
|
941
|
+
* @description 是否正在编辑关键属性
|
|
942
|
+
* @deprecated 该属性即将废弃,使用 isCoreEditable 代替
|
|
881
943
|
*/
|
|
882
|
-
|
|
944
|
+
get keyPropertyEditing(): boolean;
|
|
945
|
+
set keyPropertyEditing(value: boolean);
|
|
883
946
|
/**
|
|
884
|
-
*
|
|
885
|
-
* @param {Vector2} point 二维空间点
|
|
886
|
-
* @param {boolean} clampToLine 是否限制于线段内
|
|
887
|
-
* @param {Vector2} target 目标保存对象
|
|
888
|
-
* @returns {Vector2} 最近交点
|
|
947
|
+
* @description 是否静音
|
|
889
948
|
*/
|
|
890
|
-
|
|
949
|
+
get muted(): boolean;
|
|
950
|
+
set muted(state: boolean);
|
|
891
951
|
/**
|
|
892
|
-
*
|
|
893
|
-
* @param {Line2} line 二维线段
|
|
894
|
-
* @returns {boolean} 判等结果
|
|
952
|
+
* @description 是否为透明视频
|
|
895
953
|
*/
|
|
896
|
-
|
|
954
|
+
get transparent(): boolean;
|
|
955
|
+
set transparent(state: boolean);
|
|
956
|
+
/**
|
|
957
|
+
* @description 播放音量
|
|
958
|
+
*/
|
|
959
|
+
get volume(): number;
|
|
960
|
+
set volume(value: number);
|
|
897
961
|
/**
|
|
898
|
-
*
|
|
899
|
-
* @returns {Line2} 克隆结果
|
|
962
|
+
* @description 播放速率
|
|
900
963
|
*/
|
|
901
|
-
|
|
964
|
+
get playbackRate(): number;
|
|
965
|
+
set playbackRate(value: number);
|
|
902
966
|
/**
|
|
903
|
-
*
|
|
904
|
-
* @
|
|
967
|
+
* @description 转换为 CreateInfo
|
|
968
|
+
* @param withParent 是否包含父节点ID
|
|
905
969
|
*/
|
|
906
|
-
|
|
970
|
+
toCreateInfo(withParent?: boolean): VideoCreateInfo;
|
|
907
971
|
/**
|
|
908
|
-
*
|
|
909
|
-
* @param {Line2} other 二维线段
|
|
910
|
-
* @returns {boolean} 相交判断结果
|
|
972
|
+
* @description 克隆 SDKItem
|
|
911
973
|
*/
|
|
912
|
-
|
|
974
|
+
clone(): VideoItem;
|
|
913
975
|
}
|
|
976
|
+
/**
|
|
977
|
+
* @description 类型守卫:检查是否是 VideoItem
|
|
978
|
+
*/
|
|
979
|
+
declare function isVideoItem(obj: any): obj is VideoItem;
|
|
914
980
|
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
scaleByCenter(scalar: Vector2, anchor?: Vector2): this;
|
|
921
|
-
round(precision?: number): this;
|
|
981
|
+
/**
|
|
982
|
+
* @description 空节点/组 SDKItem 类
|
|
983
|
+
* @description 支持属性扩展
|
|
984
|
+
*/
|
|
985
|
+
declare class GroupItem extends BaseItem {
|
|
922
986
|
/**
|
|
923
|
-
*
|
|
924
|
-
* @returns {{d: number, t: number}} d表示距离,t表示最近点在直线的比例
|
|
987
|
+
* @description 元素类型
|
|
925
988
|
*/
|
|
926
|
-
|
|
927
|
-
d: number;
|
|
928
|
-
t: number;
|
|
929
|
-
};
|
|
989
|
+
readonly type = SDKItemType.GROUP;
|
|
930
990
|
/**
|
|
931
|
-
*
|
|
932
|
-
* @returns {number} 弧度值
|
|
991
|
+
* @description 元素属性
|
|
933
992
|
*/
|
|
934
|
-
|
|
993
|
+
property: GroupItemProperty;
|
|
994
|
+
constructor(options: GroupItemOptions);
|
|
935
995
|
/**
|
|
936
|
-
*
|
|
937
|
-
* @param {Vec2} center 旋转中心
|
|
938
|
-
* @param {number} angle 旋转角度
|
|
939
|
-
* @returns {Vec2} 旋转结果
|
|
996
|
+
* @description 位置
|
|
940
997
|
*/
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
/**
|
|
945
|
-
* @class 二维包围盒
|
|
946
|
-
*/
|
|
947
|
-
declare class Box2 {
|
|
998
|
+
get position(): [number, number];
|
|
999
|
+
set position(value: [number, number]);
|
|
948
1000
|
/**
|
|
949
|
-
* @
|
|
1001
|
+
* @description 大小
|
|
950
1002
|
*/
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
max: Vector2;
|
|
1003
|
+
get scale(): [number, number];
|
|
1004
|
+
set scale(value: [number, number]);
|
|
954
1005
|
/**
|
|
955
|
-
*
|
|
956
|
-
* @param {Vector2} [min=new Vector2(Infinity, Infinity)] 最小点
|
|
957
|
-
* @param {Vector2} [max=new Vector2(-Infinity, -Infinity)] 最大点
|
|
1006
|
+
* @description 旋转(二维旋转角度)
|
|
958
1007
|
*/
|
|
959
|
-
|
|
1008
|
+
get rotation(): number;
|
|
1009
|
+
set rotation(value: number);
|
|
960
1010
|
/**
|
|
961
|
-
*
|
|
962
|
-
* @param {Vector2} min 最小点
|
|
963
|
-
* @param {Vector2} max 最大点
|
|
964
|
-
* @returns {Box2} 二维包围盒
|
|
1011
|
+
* @description 完整旋转(包含 x, y, z)
|
|
965
1012
|
*/
|
|
966
|
-
|
|
1013
|
+
get fullRotation(): [number, number, number];
|
|
1014
|
+
set fullRotation(value: [number, number, number]);
|
|
967
1015
|
/**
|
|
968
|
-
*
|
|
969
|
-
* @
|
|
970
|
-
* @returns {Box2} 二维包围盒
|
|
1016
|
+
* @description 是否正在编辑关键属性
|
|
1017
|
+
* @deprecated 该属性即将废弃,使用 isCoreEditable 代替
|
|
971
1018
|
*/
|
|
972
|
-
|
|
1019
|
+
get keyPropertyEditing(): boolean;
|
|
1020
|
+
set keyPropertyEditing(value: boolean);
|
|
973
1021
|
/**
|
|
974
|
-
*
|
|
975
|
-
* @param
|
|
1022
|
+
* @description 转换为 CreateInfo
|
|
1023
|
+
* @param withParent 是否包含父节点ID
|
|
976
1024
|
*/
|
|
977
|
-
|
|
1025
|
+
toCreateInfo(withParent?: boolean): GroupCreateInfo;
|
|
978
1026
|
/**
|
|
979
|
-
*
|
|
980
|
-
* @param {Vector2} center 二维中心点
|
|
981
|
-
* @param {Vector2} size 二维大小
|
|
982
|
-
* @returns {Box2} 二维包围盒
|
|
1027
|
+
* @description 克隆 SDKItem
|
|
983
1028
|
*/
|
|
984
|
-
|
|
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 {
|
|
985
1043
|
/**
|
|
986
|
-
*
|
|
987
|
-
* @returns {Box2} 克隆结果
|
|
1044
|
+
* @description 元素类型(独立类型,不属于 spec.ItemType)
|
|
988
1045
|
*/
|
|
989
|
-
|
|
1046
|
+
readonly type = SDKItemType.GENERATOR;
|
|
990
1047
|
/**
|
|
991
|
-
*
|
|
992
|
-
* @param {Box2} box 二维包围盒
|
|
993
|
-
* @returns {Box2} 复制结果
|
|
1048
|
+
* @description 元素属性(包含 generatorType)
|
|
994
1049
|
*/
|
|
995
|
-
|
|
1050
|
+
property: GeneratorItemProperty;
|
|
1051
|
+
constructor(options: GeneratorItemOptions);
|
|
996
1052
|
/**
|
|
997
|
-
*
|
|
998
|
-
* @returns {Box2} 置空结果
|
|
1053
|
+
* @description 生成器类型
|
|
999
1054
|
*/
|
|
1000
|
-
|
|
1055
|
+
get generatorType(): 'image' | 'video';
|
|
1056
|
+
set generatorType(value: 'image' | 'video');
|
|
1001
1057
|
/**
|
|
1002
|
-
*
|
|
1003
|
-
* @returns {boolean} 判空结果
|
|
1058
|
+
* @description 图片地址(生成器返回空)
|
|
1004
1059
|
*/
|
|
1005
|
-
|
|
1060
|
+
get image(): string;
|
|
1061
|
+
set image(_value: string);
|
|
1006
1062
|
/**
|
|
1007
|
-
*
|
|
1008
|
-
* @returns {Vector2[]} 二维包围盒角点
|
|
1063
|
+
* @description 位置
|
|
1009
1064
|
*/
|
|
1010
|
-
|
|
1065
|
+
get position(): [number, number];
|
|
1066
|
+
set position(value: [number, number]);
|
|
1011
1067
|
/**
|
|
1012
|
-
*
|
|
1013
|
-
* @param {Vector2} [target=new Vector2()] 目标点(用以存放二维包围盒中心点)
|
|
1014
|
-
* @returns {Vector2} 二维包围盒中心点
|
|
1068
|
+
* @description 宽度
|
|
1015
1069
|
*/
|
|
1016
|
-
|
|
1070
|
+
get width(): number;
|
|
1071
|
+
set width(value: number);
|
|
1017
1072
|
/**
|
|
1018
|
-
*
|
|
1019
|
-
* @param {Vector2} [target=new Vector2()] 目标向量(用以存放二维包围盒大小)
|
|
1020
|
-
* @returns {Vector2} 二维包围盒大小
|
|
1073
|
+
* @description 高度
|
|
1021
1074
|
*/
|
|
1022
|
-
|
|
1075
|
+
get height(): number;
|
|
1076
|
+
set height(value: number);
|
|
1023
1077
|
/**
|
|
1024
|
-
*
|
|
1025
|
-
* @param {Vector2} point 二维空间点
|
|
1026
|
-
* @returns {Box2} 扩展包围盒
|
|
1078
|
+
* @description 旋转(二维旋转角度)
|
|
1027
1079
|
*/
|
|
1028
|
-
|
|
1080
|
+
get rotation(): number;
|
|
1081
|
+
set rotation(value: number);
|
|
1029
1082
|
/**
|
|
1030
|
-
*
|
|
1031
|
-
* @param {Vector2} vector 二维向量
|
|
1032
|
-
* @returns {Box2} 扩展结果
|
|
1083
|
+
* @description 完整旋转(包含 x, y, z)
|
|
1033
1084
|
*/
|
|
1034
|
-
|
|
1085
|
+
get fullRotation(): [number, number, number];
|
|
1086
|
+
set fullRotation(value: [number, number, number]);
|
|
1035
1087
|
/**
|
|
1036
|
-
*
|
|
1037
|
-
* @
|
|
1038
|
-
* @returns {Box2} 扩展结果
|
|
1088
|
+
* @description 是否正在编辑关键属性
|
|
1089
|
+
* @deprecated 该属性即将废弃,使用 isCoreEditable 代替
|
|
1039
1090
|
*/
|
|
1040
|
-
|
|
1091
|
+
get keyPropertyEditing(): boolean;
|
|
1092
|
+
set keyPropertyEditing(value: boolean);
|
|
1041
1093
|
/**
|
|
1042
|
-
*
|
|
1043
|
-
* @param
|
|
1044
|
-
* @param {boolean} [isOrthogonal=true] 包围盒正交判断(默认为true)
|
|
1045
|
-
* @returns {boolean} 点包含判断结果
|
|
1094
|
+
* @description 转换为 GeneratorCreateInfo
|
|
1095
|
+
* @param withParent 是否包含父节点ID
|
|
1046
1096
|
*/
|
|
1047
|
-
|
|
1097
|
+
toCreateInfo(withParent?: boolean): GeneratorCreateInfo;
|
|
1048
1098
|
/**
|
|
1049
|
-
*
|
|
1050
|
-
* @param
|
|
1051
|
-
* @
|
|
1099
|
+
* @description 转换为 VideoCreateInfo(用于转换为视频元素)
|
|
1100
|
+
* @param videoUrl 视频资源地址
|
|
1101
|
+
* @param withParent 是否包含父节点ID
|
|
1052
1102
|
*/
|
|
1053
|
-
|
|
1103
|
+
toVideoCreateInfo(videoUrl: string, withParent?: boolean): VideoCreateInfo;
|
|
1054
1104
|
/**
|
|
1055
|
-
*
|
|
1056
|
-
* @param
|
|
1057
|
-
* @param
|
|
1058
|
-
* @returns {Vector2} 计算结果空间点
|
|
1105
|
+
* @description 转换为 SpriteCreateInfo(用于转换为图片元素)
|
|
1106
|
+
* @param imageUrl 图片资源地址
|
|
1107
|
+
* @param withParent 是否包含父节点ID
|
|
1059
1108
|
*/
|
|
1060
|
-
|
|
1109
|
+
toSpriteCreateInfo(imageUrl: string, withParent?: boolean): SpriteCreateInfo;
|
|
1061
1110
|
/**
|
|
1062
|
-
*
|
|
1063
|
-
* @param {Vector2} point 二维空间点
|
|
1064
|
-
* @param {Vector2} [target=new Vector2()] 结果点
|
|
1065
|
-
* @returns {Vector2} 二维空间点
|
|
1111
|
+
* @description 克隆 SDKItem
|
|
1066
1112
|
*/
|
|
1067
|
-
|
|
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 {
|
|
1068
1124
|
/**
|
|
1069
|
-
*
|
|
1070
|
-
* @param {Vector2} point 二维空间点
|
|
1071
|
-
* @returns {number} 距离
|
|
1125
|
+
* @description 元素类型(独立类型,不属于 spec.ItemType)
|
|
1072
1126
|
*/
|
|
1073
|
-
|
|
1127
|
+
readonly type = SDKItemType.EFFECTS;
|
|
1074
1128
|
/**
|
|
1075
|
-
*
|
|
1076
|
-
* @param {Box2} box 二维包围盒
|
|
1077
|
-
* @returns {Box2} 求交结果
|
|
1129
|
+
* @description 元素属性
|
|
1078
1130
|
*/
|
|
1079
|
-
|
|
1131
|
+
property: EffectsItemProperty;
|
|
1132
|
+
constructor(options: EffectsItemOptions);
|
|
1080
1133
|
/**
|
|
1081
|
-
*
|
|
1082
|
-
* @param {Box2} box 二维包围盒
|
|
1083
|
-
* @returns {Box2} 求并结果
|
|
1134
|
+
* @description 特效资源地址
|
|
1084
1135
|
*/
|
|
1085
|
-
|
|
1136
|
+
get effects(): string;
|
|
1137
|
+
set effects(value: string);
|
|
1086
1138
|
/**
|
|
1087
|
-
*
|
|
1088
|
-
* @param {Vector2} offset 位移向量
|
|
1089
|
-
* @returns {Box2} 位移结果
|
|
1139
|
+
* @description 位置
|
|
1090
1140
|
*/
|
|
1091
|
-
|
|
1092
|
-
|
|
1141
|
+
get position(): [number, number];
|
|
1142
|
+
set position(value: [number, number]);
|
|
1093
1143
|
/**
|
|
1094
|
-
*
|
|
1095
|
-
* @param {Box2} box 二维包围盒
|
|
1096
|
-
* @returns {boolean} 判等结果
|
|
1144
|
+
* @description 宽度
|
|
1097
1145
|
*/
|
|
1098
|
-
|
|
1146
|
+
get width(): number;
|
|
1147
|
+
set width(value: number);
|
|
1099
1148
|
/**
|
|
1100
|
-
*
|
|
1101
|
-
* @param {Box2} box 二维包围盒
|
|
1102
|
-
* @param {boolean} [isOrthogonal=true] 正交判断(当前包围盒)
|
|
1103
|
-
* @returns {boolean} 相交判断结果
|
|
1149
|
+
* @description 高度
|
|
1104
1150
|
*/
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
type SizeAdaptDirection = 'x' | 'y';
|
|
1110
|
-
|
|
1111
|
-
declare const MEDIA_TYPE: {
|
|
1112
|
-
readonly APNG: "APNG";
|
|
1113
|
-
readonly MP4: "MP4";
|
|
1114
|
-
readonly WebM: "WebM";
|
|
1115
|
-
readonly Images: "Images";
|
|
1116
|
-
readonly WebP: "WebP";
|
|
1117
|
-
readonly GIF: "GIF";
|
|
1118
|
-
readonly AlphaMaskVideo: "AlphaMaskVideo";
|
|
1119
|
-
};
|
|
1120
|
-
/**
|
|
1121
|
-
* GIF 压缩参数
|
|
1122
|
-
* 核心通过参数 flags + palettegen + paletteuse 实现
|
|
1123
|
-
* highest: lanczos + max_colors=256 + dither=bayer
|
|
1124
|
-
* high: bicubic + max_colors=200 + dither=bayer
|
|
1125
|
-
* medium: bilinear + max_colors=64 + dither=bayer
|
|
1126
|
-
* low: neighbor + max_colors=32 + dither=none
|
|
1127
|
-
*/
|
|
1128
|
-
declare const GIF_QUALITY_TO_FFMPEG_ARGS: {
|
|
1129
|
-
highest: string;
|
|
1130
|
-
high: string;
|
|
1131
|
-
medium: string;
|
|
1132
|
-
low: string;
|
|
1133
|
-
};
|
|
1134
|
-
|
|
1135
|
-
declare global {
|
|
1136
|
-
interface Window {
|
|
1137
|
-
/**
|
|
1138
|
-
* @description 创建 WebP Core 实例
|
|
1139
|
-
*/
|
|
1140
|
-
createWebPCore: (config: any) => Promise<Img2WebPCore>;
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
type FileBuffer = ArrayBuffer | Uint8Array;
|
|
1144
|
-
type MediaType = typeof MEDIA_TYPE[keyof typeof MEDIA_TYPE];
|
|
1145
|
-
type FS = {
|
|
1146
|
-
writeFile: (path: string, data: Uint8Array | string) => void;
|
|
1147
|
-
readFile(path: string, opts: {
|
|
1148
|
-
encoding: 'binary';
|
|
1149
|
-
flags?: string | undefined;
|
|
1150
|
-
}): Uint8Array;
|
|
1151
|
-
readFile(path: string, opts: {
|
|
1152
|
-
encoding: 'utf8';
|
|
1153
|
-
flags?: string | undefined;
|
|
1154
|
-
}): string;
|
|
1155
|
-
readFile(path: string, opts?: {
|
|
1156
|
-
flags?: string | undefined;
|
|
1157
|
-
}): Uint8Array;
|
|
1158
|
-
unlink: (path: string) => void;
|
|
1159
|
-
quit: () => void;
|
|
1160
|
-
};
|
|
1161
|
-
type Pointer = number;
|
|
1162
|
-
type Img2WebPCore = {
|
|
1163
|
-
FS: FS;
|
|
1164
|
-
run: (...args: string[]) => number;
|
|
1165
|
-
cwrap: (ident: string, returnType: string, argTypes: string[]) => ((argc: number, argv: Pointer) => number);
|
|
1166
|
-
_malloc: (size: number) => Pointer;
|
|
1167
|
-
writeAsciiToMemory: (str: string, buffer: number, dontAddNull?: boolean) => void;
|
|
1168
|
-
setValue: (ptr: number, value: any, type: string, noSafe?: boolean) => void;
|
|
1169
|
-
};
|
|
1170
|
-
type ExportMediaInitOptions = {
|
|
1151
|
+
get height(): number;
|
|
1152
|
+
set height(value: number);
|
|
1171
1153
|
/**
|
|
1172
|
-
*
|
|
1154
|
+
* @description 旋转(二维旋转角度)
|
|
1173
1155
|
*/
|
|
1174
|
-
|
|
1156
|
+
get rotation(): number;
|
|
1157
|
+
set rotation(value: number);
|
|
1175
1158
|
/**
|
|
1176
|
-
*
|
|
1159
|
+
* @description 完整旋转(包含 x, y, z)
|
|
1177
1160
|
*/
|
|
1178
|
-
|
|
1161
|
+
get fullRotation(): [number, number, number];
|
|
1162
|
+
set fullRotation(value: [number, number, number]);
|
|
1179
1163
|
/**
|
|
1180
|
-
*
|
|
1181
|
-
*
|
|
1164
|
+
* @description 是否正在编辑关键属性
|
|
1165
|
+
* @deprecated 该属性即将废弃,使用 isCoreEditable 代替
|
|
1182
1166
|
*/
|
|
1183
|
-
|
|
1167
|
+
get keyPropertyEditing(): boolean;
|
|
1168
|
+
set keyPropertyEditing(value: boolean);
|
|
1184
1169
|
/**
|
|
1185
|
-
*
|
|
1170
|
+
* @description 转换为 EffectsCreateInfo
|
|
1171
|
+
* @param withParent 是否包含父节点ID
|
|
1186
1172
|
*/
|
|
1187
|
-
|
|
1173
|
+
toCreateInfo(withParent?: boolean): EffectsCreateInfo;
|
|
1188
1174
|
/**
|
|
1189
|
-
*
|
|
1175
|
+
* @description 克隆 SDKItem
|
|
1190
1176
|
*/
|
|
1191
|
-
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1177
|
+
clone(): EffectsItem;
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* @description 类型守卫:检查是否是 EffectsItem
|
|
1181
|
+
*/
|
|
1182
|
+
declare function isEffectsItem(obj: any): obj is EffectsItem;
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* @description 画板/框架元素 SDKItem 类
|
|
1186
|
+
* @description 支持自动布局和自由布局两种模式
|
|
1187
|
+
* @description 底层以 composition 形式渲染
|
|
1188
|
+
*/
|
|
1189
|
+
declare class FrameItem extends BaseItem {
|
|
1194
1190
|
/**
|
|
1195
|
-
* @description
|
|
1191
|
+
* @description 元素类型
|
|
1196
1192
|
*/
|
|
1197
|
-
|
|
1198
|
-
};
|
|
1199
|
-
type GifConfig = {
|
|
1193
|
+
readonly type = SDKItemType.FRAME;
|
|
1200
1194
|
/**
|
|
1201
|
-
* @description
|
|
1195
|
+
* @description 预合成元素ID
|
|
1202
1196
|
*/
|
|
1203
|
-
|
|
1197
|
+
subCompositionId: string;
|
|
1204
1198
|
/**
|
|
1205
|
-
* @description
|
|
1206
|
-
* 默认 '-1:-1', 表示不缩放
|
|
1207
|
-
* 例如 '100:-1', 表示宽度 100,高度自动
|
|
1208
|
-
* 例如 '-1:100', 表示宽度自动,高度 100
|
|
1199
|
+
* @description 元素属性
|
|
1209
1200
|
*/
|
|
1210
|
-
|
|
1201
|
+
property: FrameItemProperty;
|
|
1202
|
+
constructor(options: FrameItemOptions);
|
|
1211
1203
|
/**
|
|
1212
|
-
* @description
|
|
1213
|
-
* 默认 'highest'
|
|
1214
|
-
* 可选 'highest', 'high', 'medium', 'low'
|
|
1204
|
+
* @description 子元素ID列表(只读)
|
|
1215
1205
|
*/
|
|
1216
|
-
|
|
1217
|
-
};
|
|
1218
|
-
type ApngConfig = {
|
|
1206
|
+
get children(): readonly string[];
|
|
1219
1207
|
/**
|
|
1220
|
-
* @description
|
|
1208
|
+
* @description 布局模式
|
|
1221
1209
|
*/
|
|
1222
|
-
|
|
1210
|
+
get layoutMode(): FrameLayoutMode;
|
|
1211
|
+
set layoutMode(value: FrameLayoutMode);
|
|
1223
1212
|
/**
|
|
1224
|
-
* @description
|
|
1225
|
-
* 默认 '-1:-1', 表示不缩放
|
|
1226
|
-
* 例如 '100:-1', 表示宽度 100,高度自动
|
|
1227
|
-
* 例如 '-1:100', 表示宽度自动,高度 100
|
|
1213
|
+
* @description 位置
|
|
1228
1214
|
*/
|
|
1229
|
-
|
|
1215
|
+
get position(): [number, number];
|
|
1216
|
+
set position(value: [number, number]);
|
|
1230
1217
|
/**
|
|
1231
|
-
* @description
|
|
1232
|
-
* 默认 'highest'
|
|
1233
|
-
* 可选 'highest', 'high', 'medium', 'low'
|
|
1218
|
+
* @description 宽度
|
|
1234
1219
|
*/
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
type ExportMediaItemOptions = {
|
|
1220
|
+
get width(): number;
|
|
1221
|
+
set width(value: number);
|
|
1238
1222
|
/**
|
|
1239
|
-
*
|
|
1223
|
+
* @description 高度
|
|
1240
1224
|
*/
|
|
1241
|
-
|
|
1225
|
+
get height(): number;
|
|
1226
|
+
set height(value: number);
|
|
1242
1227
|
/**
|
|
1243
|
-
*
|
|
1228
|
+
* @description 缩放
|
|
1244
1229
|
*/
|
|
1245
|
-
|
|
1230
|
+
get scale(): [number, number];
|
|
1231
|
+
set scale(value: [number, number]);
|
|
1246
1232
|
/**
|
|
1247
|
-
*
|
|
1233
|
+
* @description 旋转(二维旋转角度)
|
|
1248
1234
|
*/
|
|
1249
|
-
|
|
1235
|
+
get rotation(): number;
|
|
1236
|
+
set rotation(value: number);
|
|
1250
1237
|
/**
|
|
1251
|
-
*
|
|
1238
|
+
* @description 完整旋转(包含 x, y, z)
|
|
1252
1239
|
*/
|
|
1253
|
-
|
|
1240
|
+
get fullRotation(): [number, number, number];
|
|
1241
|
+
set fullRotation(value: [number, number, number]);
|
|
1254
1242
|
/**
|
|
1255
|
-
*
|
|
1243
|
+
* @description 添加子元素
|
|
1244
|
+
* @param itemId 子元素ID
|
|
1245
|
+
* @returns 是否添加成功
|
|
1256
1246
|
*/
|
|
1257
|
-
|
|
1247
|
+
addChild(itemId: string): boolean;
|
|
1258
1248
|
/**
|
|
1259
|
-
*
|
|
1249
|
+
* @description 批量添加子元素
|
|
1250
|
+
* @param itemIds 子元素ID列表
|
|
1260
1251
|
*/
|
|
1261
|
-
|
|
1252
|
+
addChildren(itemIds: string[]): void;
|
|
1262
1253
|
/**
|
|
1263
|
-
*
|
|
1254
|
+
* @description 移除子元素
|
|
1255
|
+
* @param itemId 子元素ID
|
|
1256
|
+
* @returns 是否移除成功
|
|
1264
1257
|
*/
|
|
1265
|
-
|
|
1258
|
+
removeChild(itemId: string): boolean;
|
|
1266
1259
|
/**
|
|
1267
|
-
*
|
|
1260
|
+
* @description 批量移除子元素
|
|
1261
|
+
* @param itemIds 子元素ID列表
|
|
1268
1262
|
*/
|
|
1269
|
-
|
|
1263
|
+
removeChildren(itemIds: string[]): void;
|
|
1270
1264
|
/**
|
|
1271
|
-
*
|
|
1265
|
+
* @description 是否包含指定子元素
|
|
1266
|
+
* @param itemId 子元素ID
|
|
1272
1267
|
*/
|
|
1273
|
-
|
|
1268
|
+
hasChild(itemId: string): boolean;
|
|
1274
1269
|
/**
|
|
1275
|
-
*
|
|
1270
|
+
* @description 清空所有子元素
|
|
1276
1271
|
*/
|
|
1277
|
-
|
|
1278
|
-
};
|
|
1279
|
-
type ExportMediaItemDownloadInfo = {
|
|
1272
|
+
clearChildren(): void;
|
|
1280
1273
|
/**
|
|
1281
|
-
* @description
|
|
1274
|
+
* @description 转换为 FrameCreateInfo
|
|
1275
|
+
* @param withParent 是否包含父节点ID
|
|
1282
1276
|
*/
|
|
1283
|
-
|
|
1277
|
+
toCreateInfo(withParent?: boolean): FrameCreateInfo;
|
|
1284
1278
|
/**
|
|
1285
|
-
* @description
|
|
1279
|
+
* @description 克隆 SDKItem
|
|
1286
1280
|
*/
|
|
1287
|
-
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1281
|
+
clone(): FrameItem;
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* @description 类型守卫:检查是否是 FrameItem
|
|
1285
|
+
*/
|
|
1286
|
+
declare function isFrameItem(obj: any): obj is FrameItem;
|
|
1287
|
+
|
|
1288
|
+
/**
|
|
1289
|
+
* @description 根据 item type 创建对应的 SDKItem 实例
|
|
1290
|
+
* @param type 元素类型
|
|
1291
|
+
* @param options SDKItem 选项
|
|
1292
|
+
* @returns SDKItem 实例
|
|
1293
|
+
*/
|
|
1294
|
+
declare function createSDKItem(type: spec.ItemType, options: SDKItemOptions): BaseItem;
|
|
1295
|
+
/**
|
|
1296
|
+
* @description SDKItem 类型联合
|
|
1297
|
+
* @description 用于替换原来的 SDKItem type
|
|
1298
|
+
*/
|
|
1299
|
+
type SDKItem = SpriteItem | TextItem | VideoItem | GroupItem | GeneratorItem | EffectsItem | FrameItem;
|
|
1293
1300
|
|
|
1294
1301
|
type BaseItemProperty = {
|
|
1295
1302
|
position: [number, number];
|
|
@@ -1351,6 +1358,7 @@ type GeneratorItemProperty = BaseItemProperty & {
|
|
|
1351
1358
|
};
|
|
1352
1359
|
type EffectsItemProperty = BaseItemProperty & {
|
|
1353
1360
|
effects: string;
|
|
1361
|
+
children?: string[];
|
|
1354
1362
|
};
|
|
1355
1363
|
/**
|
|
1356
1364
|
* @description Frame 画板元素布局模式
|
|
@@ -1670,13 +1678,6 @@ type ActiveData = {
|
|
|
1670
1678
|
*/
|
|
1671
1679
|
loadingItems?: string[];
|
|
1672
1680
|
};
|
|
1673
|
-
/**
|
|
1674
|
-
* @description 视图元素
|
|
1675
|
-
* @description 注意:SDKItem 现在已从类实现中导入,见 view-item/index.ts
|
|
1676
|
-
* @description SDKItem 现在是类实例而非普通对象,支持属性扩展
|
|
1677
|
-
* @description 保持类型兼容性:新 SDKItem 类拥有与旧类型相同的属性
|
|
1678
|
-
*/
|
|
1679
|
-
type SDKItem = SDKItem$1;
|
|
1680
1681
|
type SDKBackgroundType = 'color' | 'image' | 'chess-board' | 'dot-board';
|
|
1681
1682
|
/**
|
|
1682
1683
|
* @description 图层创建信息
|
|
@@ -2147,6 +2148,10 @@ type FrameCreateInfo = {
|
|
|
2147
2148
|
* @description 布局模式: 'auto' | 'free'
|
|
2148
2149
|
*/
|
|
2149
2150
|
layoutMode?: FrameLayoutMode;
|
|
2151
|
+
/**
|
|
2152
|
+
* @description 子元素序号
|
|
2153
|
+
*/
|
|
2154
|
+
children: string[];
|
|
2150
2155
|
};
|
|
2151
2156
|
/**
|
|
2152
2157
|
* @description 扩展属性
|
|
@@ -2332,6 +2337,7 @@ type ExportConfig = {
|
|
|
2332
2337
|
*/
|
|
2333
2338
|
type ScreenShotConfig = {
|
|
2334
2339
|
enabled: boolean;
|
|
2340
|
+
defaultBackgroundColor: [number, number, number, number];
|
|
2335
2341
|
};
|
|
2336
2342
|
/**
|
|
2337
2343
|
* @description 尺寸自适应功能配置
|
|
@@ -3094,13 +3100,13 @@ declare class SDK {
|
|
|
3094
3100
|
* @param id 元素ID
|
|
3095
3101
|
* @returns 元素
|
|
3096
3102
|
* */
|
|
3097
|
-
getSDKItem(id: string): SDKItem
|
|
3103
|
+
getSDKItem(id: string): SDKItem | undefined;
|
|
3098
3104
|
/**
|
|
3099
3105
|
* @description 获取元素数组
|
|
3100
3106
|
* @param id 元素ID数组
|
|
3101
3107
|
* @returns 元素数组
|
|
3102
3108
|
* */
|
|
3103
|
-
getSDKItems(ids?: string[]): SDKItem
|
|
3109
|
+
getSDKItems(ids?: string[]): SDKItem[];
|
|
3104
3110
|
setPlayState(playState: 'play' | 'pause'): Promise<void>;
|
|
3105
3111
|
/**
|
|
3106
3112
|
* @description 获取场景预览图
|
|
@@ -3421,6 +3427,9 @@ declare class SDK {
|
|
|
3421
3427
|
setSpriteTextEditState(id: string, index: number, isEditing: boolean): void;
|
|
3422
3428
|
getVideoItemPlayTime(id: string): number;
|
|
3423
3429
|
setVideoItemPlayTime(id: string, time: number): void;
|
|
3430
|
+
getEffectsItemPlayTime(id: string): number | undefined;
|
|
3431
|
+
setEffectsItemPlayTime(id: string, time: number): void;
|
|
3432
|
+
setEffectsResource(id: string, effects: string): void;
|
|
3424
3433
|
getPixelPositionByViewPosition(viewPosition: Vector2): Vector2;
|
|
3425
3434
|
hitTest(x: number, y: number): string[] | undefined;
|
|
3426
3435
|
setInteractType(type: GestureHandlerInteractType): void;
|
|
@@ -3433,7 +3442,7 @@ declare class SDK {
|
|
|
3433
3442
|
*/
|
|
3434
3443
|
addGeneratorItem(createInfo: GeneratorCreateInfo): string;
|
|
3435
3444
|
/**
|
|
3436
|
-
* @description
|
|
3445
|
+
* @description 创建动效元素
|
|
3437
3446
|
* @param effectsInfo 动效创建信息
|
|
3438
3447
|
*/
|
|
3439
3448
|
addEffectsItem(effectsInfo: EffectsCreateInfo): Promise<string | undefined>;
|
|
@@ -3442,7 +3451,7 @@ declare class SDK {
|
|
|
3442
3451
|
* @param createInfo 画板创建信息
|
|
3443
3452
|
* @returns 画板元素ID
|
|
3444
3453
|
*/
|
|
3445
|
-
addFrameItem(createInfo: FrameCreateInfo): string
|
|
3454
|
+
addFrameItem(createInfo: FrameCreateInfo): Promise<string>;
|
|
3446
3455
|
/**
|
|
3447
3456
|
* @description 设置生成器资源,将生成器转换为对应的元素
|
|
3448
3457
|
* @param id 生成器元素ID
|
|
@@ -3473,4 +3482,4 @@ declare class SDK {
|
|
|
3473
3482
|
setSafeAreaPreviewVisible(id: number, type: 'url' | 'color', visible: boolean): void;
|
|
3474
3483
|
}
|
|
3475
3484
|
|
|
3476
|
-
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
|
|
3485
|
+
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 };
|