@vvfx/sdk 0.0.0-alpha.4 → 0.0.0-alpha.41
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 +677 -142
- package/dist/index.d.ts +677 -142
- package/dist/index.global.js +30 -3
- package/dist/index.js +1 -1
- package/package.json +18 -38
- package/README.md +0 -30
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare class Vector2 extends math.Vector2 {
|
|
6
|
-
subtract(other: Vector2): this;
|
|
7
|
-
toViewCoordinate(width: number, height: number): this;
|
|
8
|
-
clone(): Vector2;
|
|
9
|
-
distanceTo(other: Vector2): number;
|
|
10
|
-
scaleByCenter(scalar: Vector2, anchor?: Vector2): Vector2;
|
|
11
|
-
round(precision?: number): this;
|
|
12
|
-
}
|
|
1
|
+
import * as _galacean_effects from '@galacean/effects';
|
|
2
|
+
import { spec, Player } from '@galacean/effects';
|
|
3
|
+
export { generateGUID, spec } from '@galacean/effects';
|
|
13
4
|
|
|
14
5
|
type ViewItemTypedProperty = {
|
|
15
6
|
[K in keyof PageFormTypeAndPropertyReference]: {
|
|
@@ -55,10 +46,603 @@ type SetItemPropertyValueParam = {
|
|
|
55
46
|
}[keyof PageFormTypeAndPropertyReference[T]];
|
|
56
47
|
}[keyof PageFormTypeAndPropertyReference];
|
|
57
48
|
|
|
49
|
+
declare const MEDIA_TYPE: {
|
|
50
|
+
readonly APNG: "APNG";
|
|
51
|
+
readonly MP4: "MP4";
|
|
52
|
+
readonly WebM: "WebM";
|
|
53
|
+
readonly Images: "Images";
|
|
54
|
+
readonly WebP: "WebP";
|
|
55
|
+
readonly GIF: "GIF";
|
|
56
|
+
readonly AlphaMaskVideo: "AlphaMaskVideo";
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* GIF 压缩参数
|
|
60
|
+
* 核心通过参数 flags + palettegen + paletteuse 实现
|
|
61
|
+
* highest: lanczos + max_colors=256 + dither=bayer
|
|
62
|
+
* high: bicubic + max_colors=200 + dither=bayer
|
|
63
|
+
* medium: bilinear + max_colors=64 + dither=bayer
|
|
64
|
+
* low: neighbor + max_colors=32 + dither=none
|
|
65
|
+
*/
|
|
66
|
+
declare const GIF_QUALITY_TO_FFMPEG_ARGS: {
|
|
67
|
+
highest: string;
|
|
68
|
+
high: string;
|
|
69
|
+
medium: string;
|
|
70
|
+
low: string;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
declare global {
|
|
74
|
+
interface Window {
|
|
75
|
+
/**
|
|
76
|
+
* @description 创建 WebP Core 实例
|
|
77
|
+
*/
|
|
78
|
+
createWebPCore: (config: any) => Promise<Img2WebPCore>;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
type FileBuffer = ArrayBuffer | Uint8Array;
|
|
82
|
+
type MediaType = typeof MEDIA_TYPE[keyof typeof MEDIA_TYPE];
|
|
83
|
+
type FS = {
|
|
84
|
+
writeFile: (path: string, data: Uint8Array | string) => void;
|
|
85
|
+
readFile(path: string, opts: {
|
|
86
|
+
encoding: 'binary';
|
|
87
|
+
flags?: string | undefined;
|
|
88
|
+
}): Uint8Array;
|
|
89
|
+
readFile(path: string, opts: {
|
|
90
|
+
encoding: 'utf8';
|
|
91
|
+
flags?: string | undefined;
|
|
92
|
+
}): string;
|
|
93
|
+
readFile(path: string, opts?: {
|
|
94
|
+
flags?: string | undefined;
|
|
95
|
+
}): Uint8Array;
|
|
96
|
+
unlink: (path: string) => void;
|
|
97
|
+
quit: () => void;
|
|
98
|
+
};
|
|
99
|
+
type Pointer = number;
|
|
100
|
+
type Img2WebPCore = {
|
|
101
|
+
FS: FS;
|
|
102
|
+
run: (...args: string[]) => number;
|
|
103
|
+
cwrap: (ident: string, returnType: string, argTypes: string[]) => ((argc: number, argv: Pointer) => number);
|
|
104
|
+
_malloc: (size: number) => Pointer;
|
|
105
|
+
writeAsciiToMemory: (str: string, buffer: number, dontAddNull?: boolean) => void;
|
|
106
|
+
setValue: (ptr: number, value: any, type: string, noSafe?: boolean) => void;
|
|
107
|
+
};
|
|
108
|
+
type ExportMediaInitOptions = {
|
|
109
|
+
/**
|
|
110
|
+
* 导出类型
|
|
111
|
+
*/
|
|
112
|
+
mediaType: MediaType;
|
|
113
|
+
/**
|
|
114
|
+
* 额外画布,导出透明视频时使用
|
|
115
|
+
*/
|
|
116
|
+
extraCanvas?: HTMLCanvasElement | null;
|
|
117
|
+
/**
|
|
118
|
+
* 是否打印转码过程中的日志,仅在导出 MP4/AlphaMaskVideo 时有效, 默认 false
|
|
119
|
+
* 供开发调试使用
|
|
120
|
+
*/
|
|
121
|
+
loggerInTranscoding?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* ffmpeg 转码是否开启多线程,默认 false,确保环境支持 SharedArrayBuffer
|
|
124
|
+
*/
|
|
125
|
+
multiThreading?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* 是否输出 buffer,默认 false
|
|
128
|
+
*/
|
|
129
|
+
isOutputBuffer?: boolean;
|
|
130
|
+
};
|
|
131
|
+
type GifConfig = {
|
|
132
|
+
/**
|
|
133
|
+
* @description GIF 导出时的帧率
|
|
134
|
+
*/
|
|
135
|
+
fps?: number;
|
|
136
|
+
/**
|
|
137
|
+
* @description GIF 导出时的缩放比例
|
|
138
|
+
* 默认 '-1:-1', 表示不缩放
|
|
139
|
+
* 例如 '100:-1', 表示宽度 100,高度自动
|
|
140
|
+
* 例如 '-1:100', 表示宽度自动,高度 100
|
|
141
|
+
*/
|
|
142
|
+
scale?: string;
|
|
143
|
+
/**
|
|
144
|
+
* @description GIF 导出时的质量
|
|
145
|
+
* 默认 'highest'
|
|
146
|
+
* 可选 'highest', 'high', 'medium', 'low'
|
|
147
|
+
*/
|
|
148
|
+
quality?: keyof typeof GIF_QUALITY_TO_FFMPEG_ARGS;
|
|
149
|
+
};
|
|
150
|
+
type ApngConfig = {
|
|
151
|
+
/**
|
|
152
|
+
* @description APNG 导出时的帧率
|
|
153
|
+
*/
|
|
154
|
+
fps?: number;
|
|
155
|
+
/**
|
|
156
|
+
* @description APNG 导出时的缩放比例
|
|
157
|
+
* 默认 '-1:-1', 表示不缩放
|
|
158
|
+
* 例如 '100:-1', 表示宽度 100,高度自动
|
|
159
|
+
* 例如 '-1:100', 表示宽度自动,高度 100
|
|
160
|
+
*/
|
|
161
|
+
scale?: string;
|
|
162
|
+
/**
|
|
163
|
+
* @description APNG 导出时的质量
|
|
164
|
+
* 默认 'highest'
|
|
165
|
+
* 可选 'highest', 'high', 'medium', 'low'
|
|
166
|
+
*/
|
|
167
|
+
quality?: keyof typeof GIF_QUALITY_TO_FFMPEG_ARGS;
|
|
168
|
+
};
|
|
169
|
+
type ExportMediaItemOptions = {
|
|
170
|
+
/**
|
|
171
|
+
* 尺寸
|
|
172
|
+
*/
|
|
173
|
+
size: [number, number];
|
|
174
|
+
/**
|
|
175
|
+
* 动效资源
|
|
176
|
+
*/
|
|
177
|
+
scene: spec.JSONScene;
|
|
178
|
+
/**
|
|
179
|
+
* 视频时长,目前仅在导出 MP4 / AlphaMaskVideo 时有效,默认取动效资源时长
|
|
180
|
+
*/
|
|
181
|
+
time?: number;
|
|
182
|
+
/**
|
|
183
|
+
* 是否生成音轨,默认 false,仅在导出 MP4 时有效
|
|
184
|
+
*/
|
|
185
|
+
audioEnable?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* 帧率, 默认 30
|
|
188
|
+
*/
|
|
189
|
+
fps?: number;
|
|
190
|
+
/**
|
|
191
|
+
* 是否循环,默认 true
|
|
192
|
+
*/
|
|
193
|
+
loop?: boolean;
|
|
194
|
+
/**
|
|
195
|
+
* 视频背景颜色,默认 #000000
|
|
196
|
+
*/
|
|
197
|
+
backgroundColor?: string;
|
|
198
|
+
/**
|
|
199
|
+
* 导出 GIF 时,设置的导出配置
|
|
200
|
+
*/
|
|
201
|
+
gifConfig?: GifConfig;
|
|
202
|
+
apngConfig?: ApngConfig;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
type SDKMode = 'product' | 'template';
|
|
206
|
+
/**
|
|
207
|
+
* @description SDK功能配置
|
|
208
|
+
*/
|
|
209
|
+
type SDKConfig = {
|
|
210
|
+
/**
|
|
211
|
+
* @description SDK编辑模式 - 模板编辑 | 产物编辑
|
|
212
|
+
*/
|
|
213
|
+
mode: SDKMode;
|
|
214
|
+
/**
|
|
215
|
+
* @description 页面功能配置
|
|
216
|
+
*/
|
|
217
|
+
pageConfig: PageConfig$1;
|
|
218
|
+
/**
|
|
219
|
+
* @description 截图功能配置
|
|
220
|
+
*/
|
|
221
|
+
screenShotConfig: ScreenShotConfig;
|
|
222
|
+
/**
|
|
223
|
+
* @description 导出视频功能配置
|
|
224
|
+
*/
|
|
225
|
+
exportConfig: ExportConfig;
|
|
226
|
+
/**
|
|
227
|
+
* @description 尺寸自适应功能开关
|
|
228
|
+
*/
|
|
229
|
+
sizeAdaptConfig: SizeAdaptConfig;
|
|
230
|
+
/**
|
|
231
|
+
* @description 辅助面板功能配置
|
|
232
|
+
*/
|
|
233
|
+
gestureHandlerConfig: {
|
|
234
|
+
enabled: boolean;
|
|
235
|
+
adsorptionGizmoEnabled: boolean;
|
|
236
|
+
adsorptionGizmoConfig: AdsorptionGizmoConfig;
|
|
237
|
+
controlGizmoEnabled: boolean;
|
|
238
|
+
controlGizmoConfig: ControlGizmoConfig;
|
|
239
|
+
preferenceGizmoEnabled: boolean;
|
|
240
|
+
preferenceGizmoConfig: PreferenceGizmoConfig;
|
|
241
|
+
selectorGizmoEnabled: boolean;
|
|
242
|
+
selectorGizmoConfig: SelectorGizmoConfig;
|
|
243
|
+
transformGizmoEnabled: boolean;
|
|
244
|
+
transformGizmoConfig: TransformGizmoConfig;
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* @description 页面功能配置
|
|
249
|
+
*/
|
|
250
|
+
type PageConfig$1 = {
|
|
251
|
+
/**
|
|
252
|
+
* @description 同步修改功能开关
|
|
253
|
+
*/
|
|
254
|
+
asncMode: boolean;
|
|
255
|
+
/**
|
|
256
|
+
* @description 静态预览【视图只提供播放预览功能】功能开关
|
|
257
|
+
*/
|
|
258
|
+
staticPreview: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* @description 静态预览视图名称
|
|
261
|
+
*/
|
|
262
|
+
staticPreviewName: string;
|
|
263
|
+
/**
|
|
264
|
+
* @description 需过滤的元素名称
|
|
265
|
+
*/
|
|
266
|
+
filterItemNames: string[];
|
|
267
|
+
/**
|
|
268
|
+
* @description 成组操作元素显隐
|
|
269
|
+
*/
|
|
270
|
+
groupVisible: boolean;
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* @description 视频导出功能配置
|
|
274
|
+
*/
|
|
275
|
+
type ExportConfig = {
|
|
276
|
+
enabled: boolean;
|
|
277
|
+
} & ExportMediaInitOptions;
|
|
278
|
+
/**
|
|
279
|
+
* @description 截图功能配置
|
|
280
|
+
*/
|
|
281
|
+
type ScreenShotConfig = {
|
|
282
|
+
enabled: boolean;
|
|
283
|
+
};
|
|
284
|
+
/**
|
|
285
|
+
* @description 尺寸自适应功能配置
|
|
286
|
+
*/
|
|
287
|
+
type SizeAdaptConfig = {
|
|
288
|
+
enabled: boolean;
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
* @description 对齐吸附功能参数
|
|
292
|
+
*/
|
|
293
|
+
type AdsorptionGizmoConfig = {
|
|
294
|
+
/**
|
|
295
|
+
* @description 对齐吸附线宽
|
|
296
|
+
*/
|
|
297
|
+
lineWidth: number;
|
|
298
|
+
/**
|
|
299
|
+
* @description 对齐线颜色
|
|
300
|
+
*/
|
|
301
|
+
lineColor: number;
|
|
302
|
+
/**
|
|
303
|
+
* @description 对齐吸附距离
|
|
304
|
+
*/
|
|
305
|
+
distance: number;
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* @description 视图控制功能参数
|
|
309
|
+
*/
|
|
310
|
+
type ControlGizmoConfig = {
|
|
311
|
+
/**
|
|
312
|
+
* @description 缩放步长
|
|
313
|
+
*/
|
|
314
|
+
zoomStep: number;
|
|
315
|
+
};
|
|
316
|
+
/**
|
|
317
|
+
* @description 视口展示功能参数
|
|
318
|
+
*/
|
|
319
|
+
type PreferenceGizmoConfig = {
|
|
320
|
+
/**
|
|
321
|
+
* @description 视口窗包围盒颜色
|
|
322
|
+
*/
|
|
323
|
+
boxColor: number;
|
|
324
|
+
/**
|
|
325
|
+
* @description 视口窗包围盒宽度
|
|
326
|
+
*/
|
|
327
|
+
boxWidth: number;
|
|
328
|
+
/**
|
|
329
|
+
* @description 视口区域外遮罩颜色
|
|
330
|
+
*/
|
|
331
|
+
markColor: number;
|
|
332
|
+
/**
|
|
333
|
+
* @description 视口区域外遮罩透明度
|
|
334
|
+
*/
|
|
335
|
+
markAlpha: number;
|
|
336
|
+
/**
|
|
337
|
+
* @description 出血区预览开关
|
|
338
|
+
*/
|
|
339
|
+
safeAreaEnabled: boolean;
|
|
340
|
+
/**
|
|
341
|
+
* @description 出血区颜色
|
|
342
|
+
*/
|
|
343
|
+
safeAreaBoxColor: number;
|
|
344
|
+
/**
|
|
345
|
+
* @description 出血区透明度
|
|
346
|
+
*/
|
|
347
|
+
safeAreaBoxAlpha: number;
|
|
348
|
+
};
|
|
349
|
+
/**
|
|
350
|
+
* @description 选择功能参数
|
|
351
|
+
*/
|
|
352
|
+
type SelectorGizmoConfig = {
|
|
353
|
+
/**
|
|
354
|
+
* @description 预选框线宽
|
|
355
|
+
*/
|
|
356
|
+
preSelectedWidth: number;
|
|
357
|
+
/**
|
|
358
|
+
* @description 预选框颜色
|
|
359
|
+
*/
|
|
360
|
+
preSelectedColor: number;
|
|
361
|
+
/**
|
|
362
|
+
* @description 框选区域颜色
|
|
363
|
+
*/
|
|
364
|
+
regionBoxColor: number;
|
|
365
|
+
/**
|
|
366
|
+
* @description 框选区域透明度
|
|
367
|
+
*/
|
|
368
|
+
regionBoxAlpha: number;
|
|
369
|
+
/**
|
|
370
|
+
* @description 框选区域包围框颜色
|
|
371
|
+
*/
|
|
372
|
+
regionWireframeColor: number;
|
|
373
|
+
/**
|
|
374
|
+
* @description 框选区域包围框透明度
|
|
375
|
+
*/
|
|
376
|
+
regionWireframeAlpha: number;
|
|
377
|
+
/**
|
|
378
|
+
* @description 框选区域包围框宽度
|
|
379
|
+
*/
|
|
380
|
+
regionWireframeWidth: number;
|
|
381
|
+
};
|
|
382
|
+
/**
|
|
383
|
+
* @description 变换功能参数
|
|
384
|
+
*/
|
|
385
|
+
type TransformGizmoConfig = {
|
|
386
|
+
/**
|
|
387
|
+
* @description 变换交互框颜色
|
|
388
|
+
*/
|
|
389
|
+
wireframeColor: number;
|
|
390
|
+
/**
|
|
391
|
+
* @description 变换交互框透明度
|
|
392
|
+
*/
|
|
393
|
+
wireframeAlpha: number;
|
|
394
|
+
/**
|
|
395
|
+
* @description 变换交互框宽度
|
|
396
|
+
*/
|
|
397
|
+
wireframeWidth: number;
|
|
398
|
+
/**
|
|
399
|
+
* @description 变换交互框角点填充色
|
|
400
|
+
*/
|
|
401
|
+
cornerFillColor: number;
|
|
402
|
+
/**
|
|
403
|
+
* @description 变换交互框角点线框色
|
|
404
|
+
*/
|
|
405
|
+
cornerLineColor: number;
|
|
406
|
+
/**
|
|
407
|
+
* @description 变换交互框角点线框宽度
|
|
408
|
+
*/
|
|
409
|
+
cornerLineWidth: number;
|
|
410
|
+
/**
|
|
411
|
+
* @description 变换交互框角点线框透明度
|
|
412
|
+
*/
|
|
413
|
+
cornerLineAlpha: number;
|
|
414
|
+
/**
|
|
415
|
+
* @description 交互框缩放圆半径
|
|
416
|
+
*/
|
|
417
|
+
scaleCircleSize: number;
|
|
418
|
+
/**
|
|
419
|
+
* @description 交互框旋转圆半径
|
|
420
|
+
*/
|
|
421
|
+
rotationCircleSize: number;
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
type SDKEvents = {
|
|
425
|
+
'selectedItemChange': [id: string[]];
|
|
426
|
+
'preSelectedItemChange': [id: string | undefined];
|
|
427
|
+
'selectedViewChange': [id: number];
|
|
428
|
+
'pageDataChange': [pageData: PageData];
|
|
429
|
+
'zoomChange': [zoom: number];
|
|
430
|
+
'progress': [{
|
|
431
|
+
duration: number;
|
|
432
|
+
time: number;
|
|
433
|
+
end: boolean;
|
|
434
|
+
paused: boolean;
|
|
435
|
+
}];
|
|
436
|
+
'itemPropertyChange': [{
|
|
437
|
+
id: string;
|
|
438
|
+
property: string;
|
|
439
|
+
}];
|
|
440
|
+
'exportProgress': [progress?: number];
|
|
441
|
+
'exportDone': [item: ExportMediaItemOptions | undefined, success: boolean, buffer?: FileBuffer];
|
|
442
|
+
'exportComplete': [success: boolean, taskInfos: ExportMediaItemOptions[], buffers?: FileBuffer[]];
|
|
443
|
+
'sdkConfigChange': [preSDKConfig: SDKConfig, curSDKConfig: SDKConfig];
|
|
444
|
+
};
|
|
445
|
+
declare class SDK {
|
|
446
|
+
static config: SDKConfig;
|
|
447
|
+
private _eventEmitter;
|
|
448
|
+
private _pageData;
|
|
449
|
+
private _screenShot;
|
|
450
|
+
private _exporter?;
|
|
451
|
+
private _pageDataUtils;
|
|
452
|
+
private _sizeAdapt;
|
|
453
|
+
private _gestureHandler;
|
|
454
|
+
private disposables;
|
|
455
|
+
private _isSwitchScene;
|
|
456
|
+
player: Player;
|
|
457
|
+
_container: HTMLElement;
|
|
458
|
+
private _playerContainer;
|
|
459
|
+
constructor(container: HTMLElement);
|
|
460
|
+
get pageData(): PageData | undefined;
|
|
461
|
+
get exportStatus(): string | undefined;
|
|
462
|
+
private get exportOptions();
|
|
463
|
+
dispose(): void;
|
|
464
|
+
on: <E extends "progress" | "selectedItemChange" | "preSelectedItemChange" | "selectedViewChange" | "pageDataChange" | "zoomChange" | "itemPropertyChange" | "exportProgress" | "exportDone" | "exportComplete" | "sdkConfigChange">(eventName: E, listener: _galacean_effects.EventEmitterListener<SDKEvents[E]>, options?: _galacean_effects.EventEmitterOptions) => () => void;
|
|
465
|
+
private getInitParam;
|
|
466
|
+
/**
|
|
467
|
+
* 检测导出是否需要重新初始化
|
|
468
|
+
* @param preExportVideoConfig
|
|
469
|
+
* @param curExportVideoConfig
|
|
470
|
+
*/
|
|
471
|
+
private checkExporter;
|
|
472
|
+
private initExporter;
|
|
473
|
+
private initSDK;
|
|
474
|
+
run(param: SDKInputParam): Promise<void>;
|
|
475
|
+
getPageData(): PageData;
|
|
476
|
+
getActiveItems(): string[];
|
|
477
|
+
setPreSelectedItem(id: string): void;
|
|
478
|
+
getPreSelectedItem(): string;
|
|
479
|
+
setSelectedItems(itemIds: string[]): void;
|
|
480
|
+
/**
|
|
481
|
+
* @description 获取目标元素的所有属性
|
|
482
|
+
* @param param 元素ID、类型
|
|
483
|
+
* @returns 元素属性
|
|
484
|
+
*/
|
|
485
|
+
getItemProperty<T extends keyof PageFormTypeAndPropertyReference>(param: GetItemPropertyParam<T>): GetItemPropertyResult<T> | undefined;
|
|
486
|
+
/**
|
|
487
|
+
* @description 获取目标元素的指定属性
|
|
488
|
+
* @param param 元素ID、类型、属性名
|
|
489
|
+
* @returns 元素属性值
|
|
490
|
+
*/
|
|
491
|
+
getItemPropertyValue<T extends keyof PageFormTypeAndPropertyReference, N extends keyof PageFormTypeAndPropertyReference[T]>(param: GetItemPropertyValueParam<T, N>): GetItemPropertyValueResult<T, N> | undefined;
|
|
492
|
+
setItemPropertyValue(param: SetItemPropertyValueParam): Promise<void>;
|
|
493
|
+
generateScreenShot(id: number, size?: [number, number], tick?: number, backgroundColor?: spec.vec4): Promise<string | undefined>;
|
|
494
|
+
/**
|
|
495
|
+
* @description 切换场景
|
|
496
|
+
* @param index 场景索引
|
|
497
|
+
*/
|
|
498
|
+
switchScene(index: number): Promise<void>;
|
|
499
|
+
/**
|
|
500
|
+
* @description 获取页面的 safeAreaPreview、zoom、adsorption 值
|
|
501
|
+
* @returns 页面的 safeAreaPreview、zoom、adsorption 值
|
|
502
|
+
*/
|
|
503
|
+
getPageConfig(): PageConfig;
|
|
504
|
+
/**
|
|
505
|
+
* 设置页面的 safeAreaPreview、zoom、adsorption 值
|
|
506
|
+
* @param pageProperty 设置
|
|
507
|
+
*/
|
|
508
|
+
setPageConfig(pageConfig: PageConfig): void;
|
|
509
|
+
/**
|
|
510
|
+
* @description 设置播放进度
|
|
511
|
+
* @param progress 播放进度 0-100
|
|
512
|
+
*/
|
|
513
|
+
setPlayProgress(progress: number): Promise<void>;
|
|
514
|
+
getViewItems(): ViewItem[];
|
|
515
|
+
setPlayState(playState: 'play' | 'pause'): Promise<void>;
|
|
516
|
+
/**
|
|
517
|
+
* @description 获取场景预览图
|
|
518
|
+
* @returns 视图预览图
|
|
519
|
+
*/
|
|
520
|
+
getViewThumbnail(): {
|
|
521
|
+
id: number;
|
|
522
|
+
thumbnail: Promise<string | undefined>;
|
|
523
|
+
}[];
|
|
524
|
+
/**
|
|
525
|
+
* @description 获取视图JSON产物
|
|
526
|
+
* @returns 当前所有视图JSON产物
|
|
527
|
+
*/
|
|
528
|
+
getViewScene(): {
|
|
529
|
+
id: number;
|
|
530
|
+
thumbnail: spec.JSONScene;
|
|
531
|
+
}[];
|
|
532
|
+
private destroyCompositions;
|
|
533
|
+
/**
|
|
534
|
+
* @description 导出,支持导出媒体或其他,如MP4,未来支持 JSON 等;
|
|
535
|
+
*/
|
|
536
|
+
onExport(): void;
|
|
537
|
+
/**
|
|
538
|
+
* @description 取消导出
|
|
539
|
+
*/
|
|
540
|
+
cancelExport(): void;
|
|
541
|
+
loadPageData(data: PageData): Promise<void>;
|
|
542
|
+
runByPageData(data: PageData): Promise<void>;
|
|
543
|
+
reloadPageDataByScene(scene: string | spec.JSONScene): Promise<void>;
|
|
544
|
+
addViewParams(viewParams: ViewParam[]): Promise<void>;
|
|
545
|
+
deleteViewParams(ids: number[]): Promise<void>;
|
|
546
|
+
setExportParam(exportParam: Partial<ExportParam>, id?: number): void;
|
|
547
|
+
/**
|
|
548
|
+
* @description 设置视图缩放
|
|
549
|
+
* @param zoom 缩放值
|
|
550
|
+
*/
|
|
551
|
+
setPageZoom(zoom: number): void;
|
|
552
|
+
/**
|
|
553
|
+
* @description 设置静态预览功能开关
|
|
554
|
+
* @param enabled 功能开关
|
|
555
|
+
*/
|
|
556
|
+
setStaticPreviewEnabled(enabled: boolean): void;
|
|
557
|
+
/**
|
|
558
|
+
* @description 设置静态预览视图名称
|
|
559
|
+
* @param name 视图名称
|
|
560
|
+
*/
|
|
561
|
+
setStaticPreviewName(name: string): void;
|
|
562
|
+
/**
|
|
563
|
+
* @description 设置同步修改功能开关
|
|
564
|
+
* @param enabled 功能开关
|
|
565
|
+
*/
|
|
566
|
+
setAsyncEnabled(enabled: boolean): void;
|
|
567
|
+
/**
|
|
568
|
+
* @description 设置 成组显影 开关
|
|
569
|
+
*/
|
|
570
|
+
setGroupVisibleEnabled(enabled: boolean): void;
|
|
571
|
+
/**
|
|
572
|
+
* @description 新增过滤元素名称
|
|
573
|
+
* @param itemNames 过滤元素名称
|
|
574
|
+
*/
|
|
575
|
+
addFilterItemNames(itemNames: string[] | string): void;
|
|
576
|
+
/**
|
|
577
|
+
* @description 设置预览辅助层颜色
|
|
578
|
+
* @param color 色值
|
|
579
|
+
*/
|
|
580
|
+
setPreferenceBackgroundColor(color: [number, number, number, number]): void;
|
|
581
|
+
/**
|
|
582
|
+
* @description 设置出血区颜色
|
|
583
|
+
* @param color 色值
|
|
584
|
+
*/
|
|
585
|
+
setSafeAreaColor(color: [number, number, number, number]): void;
|
|
586
|
+
/**
|
|
587
|
+
* @description 设置 尺寸自适应拓展 功能开关
|
|
588
|
+
* @param enabled 功能开关
|
|
589
|
+
*/
|
|
590
|
+
setSizeAdaptEnabled(enabled: boolean): void;
|
|
591
|
+
/**
|
|
592
|
+
* @description 设置 截图 功能开关
|
|
593
|
+
* @param enabled 功能开关
|
|
594
|
+
*/
|
|
595
|
+
setScreenShotEnabled(enabled: boolean): void;
|
|
596
|
+
/**
|
|
597
|
+
* @description 设置导出功能初始化配置
|
|
598
|
+
* @param exportConfig
|
|
599
|
+
*/
|
|
600
|
+
setExportConfig(exportConfig: ExportConfig): void;
|
|
601
|
+
/**
|
|
602
|
+
* @description 设置预选框参数
|
|
603
|
+
* @param preSelectedColor 预选框颜色
|
|
604
|
+
* @param preSelectedWidth 预选框线框宽度
|
|
605
|
+
*/
|
|
606
|
+
setSelectorGizmoPreSelectConfig(preSelectedColor?: number, preSelectedWidth?: number): void;
|
|
607
|
+
/**
|
|
608
|
+
* @description 设置 变换控制器 交互框参数
|
|
609
|
+
* @param config 参数
|
|
610
|
+
*/
|
|
611
|
+
setTranformGizmoWireframeConfig(config: {
|
|
612
|
+
wireframeColor?: number;
|
|
613
|
+
wireframeAlpha?: number;
|
|
614
|
+
wireframeWidth?: number;
|
|
615
|
+
}): void;
|
|
616
|
+
/**
|
|
617
|
+
* @description 获取 SDK 配置参数
|
|
618
|
+
* @returns SDK 配置参数
|
|
619
|
+
*/
|
|
620
|
+
getSDKConfig(): SDKConfig;
|
|
621
|
+
/**
|
|
622
|
+
* @description 设置 SDK 配置参数
|
|
623
|
+
* @param config SDK 配置参数
|
|
624
|
+
*/
|
|
625
|
+
setSDKConfig(config: SDKConfig): void;
|
|
626
|
+
/**
|
|
627
|
+
* @description 设置SDK背景
|
|
628
|
+
* @param type 背景类型
|
|
629
|
+
* @param value 值
|
|
630
|
+
*/
|
|
631
|
+
setSDKBackground(type: SDKBackgroundType, value?: string): void;
|
|
632
|
+
/**
|
|
633
|
+
* @description 创建图层元素
|
|
634
|
+
* @param spriteInfo 图层元素信息
|
|
635
|
+
*/
|
|
636
|
+
addSpriteItem(spriteInfo: SpriteCreateInfo): Promise<void>;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
type SizeAdaptDirection = 'x' | 'y';
|
|
640
|
+
|
|
58
641
|
type BaseFormProperty = {
|
|
59
642
|
position: [number, number, number];
|
|
60
643
|
rotation: [number, number, number];
|
|
61
|
-
|
|
644
|
+
size: [number, number];
|
|
645
|
+
visible: boolean;
|
|
62
646
|
keyPropertyEditing: boolean;
|
|
63
647
|
};
|
|
64
648
|
type SpriteFormProperty = BaseFormProperty & {
|
|
@@ -102,26 +686,37 @@ type SpecificPageFormProps<T extends keyof PageFormTypeAndPropertyReference> = {
|
|
|
102
686
|
property: PageFormTypeAndPropertyReference[T];
|
|
103
687
|
onPropertyValueChange: <N extends keyof PageFormTypeAndPropertyReference[T]>(propertyName: N, propertyValue: PageFormTypeAndPropertyReference[T][N]) => void;
|
|
104
688
|
};
|
|
689
|
+
type SDKOptions = {
|
|
690
|
+
/** 导出视频时,是否开启转码日志 */
|
|
691
|
+
loggerInExportVideoTranscoding?: boolean;
|
|
692
|
+
};
|
|
693
|
+
type SDKInputParam = SDKTemplateInputParam | SDKEditorInputParam;
|
|
105
694
|
/**
|
|
106
695
|
* @description SDK入参
|
|
107
696
|
*/
|
|
108
|
-
type
|
|
697
|
+
type SDKTemplateInputParam = {
|
|
109
698
|
/**
|
|
110
699
|
* @description JSON地址
|
|
111
700
|
*/
|
|
112
|
-
scene: string;
|
|
701
|
+
scene: string | spec.JSONScene;
|
|
702
|
+
/**
|
|
703
|
+
* @description SDK模式 - 模板编辑模式
|
|
704
|
+
*/
|
|
705
|
+
mode: 'template';
|
|
113
706
|
/**
|
|
114
707
|
* @description 视图参数
|
|
115
708
|
*/
|
|
116
|
-
viewParams
|
|
709
|
+
viewParams?: ViewParam[];
|
|
117
710
|
/**
|
|
118
711
|
* @description 页面属性
|
|
119
712
|
*/
|
|
120
713
|
options: PageOptions;
|
|
714
|
+
};
|
|
715
|
+
type SDKEditorInputParam = {
|
|
121
716
|
/**
|
|
122
|
-
* @description
|
|
717
|
+
* @description SDK模式 - 编辑器模式
|
|
123
718
|
*/
|
|
124
|
-
|
|
719
|
+
mode: 'editor';
|
|
125
720
|
};
|
|
126
721
|
/**
|
|
127
722
|
* @description 页面属性
|
|
@@ -144,6 +739,10 @@ type PageOptions = {
|
|
|
144
739
|
* @description 页面数据
|
|
145
740
|
*/
|
|
146
741
|
type PageData = {
|
|
742
|
+
/**
|
|
743
|
+
* @description 基础场景数据
|
|
744
|
+
*/
|
|
745
|
+
scene: spec.JSONScene;
|
|
147
746
|
/**
|
|
148
747
|
* @description 页面属性
|
|
149
748
|
*/
|
|
@@ -185,6 +784,10 @@ type PageConfig = {
|
|
|
185
784
|
* @description 吸附开关
|
|
186
785
|
*/
|
|
187
786
|
adsorption: boolean;
|
|
787
|
+
/**
|
|
788
|
+
* @description 同步开关
|
|
789
|
+
*/
|
|
790
|
+
asyncMode: boolean;
|
|
188
791
|
};
|
|
189
792
|
/**
|
|
190
793
|
* @description 页面属性
|
|
@@ -201,7 +804,7 @@ type PageProperty = {
|
|
|
201
804
|
/**
|
|
202
805
|
* @description 偏移值
|
|
203
806
|
*/
|
|
204
|
-
translation:
|
|
807
|
+
translation: [number, number];
|
|
205
808
|
/**
|
|
206
809
|
* @description 吸附开关
|
|
207
810
|
*/
|
|
@@ -209,7 +812,7 @@ type PageProperty = {
|
|
|
209
812
|
/**
|
|
210
813
|
* @description 同步开关
|
|
211
814
|
*/
|
|
212
|
-
|
|
815
|
+
asyncMode: boolean;
|
|
213
816
|
};
|
|
214
817
|
/**
|
|
215
818
|
* @description 视图创建参数
|
|
@@ -218,50 +821,33 @@ type ViewParam = {
|
|
|
218
821
|
/**
|
|
219
822
|
* @description 页面尺寸
|
|
220
823
|
*/
|
|
221
|
-
size
|
|
824
|
+
size?: [number, number];
|
|
222
825
|
/**
|
|
223
826
|
* @description 出血区参数
|
|
224
827
|
*/
|
|
225
|
-
safeArea
|
|
828
|
+
safeArea?: [number, number, number, number];
|
|
226
829
|
/**
|
|
227
|
-
* @description
|
|
830
|
+
* @description 自适应方向 - 默认根据视图宽高决定
|
|
228
831
|
*/
|
|
229
|
-
|
|
230
|
-
};
|
|
231
|
-
/**
|
|
232
|
-
* @description 安全区数据
|
|
233
|
-
*/
|
|
234
|
-
type SafeAreaParam = {
|
|
832
|
+
adaptionDirection?: SizeAdaptDirection;
|
|
235
833
|
/**
|
|
236
|
-
* @description
|
|
834
|
+
* @description 自定义出血区 - 用于展示
|
|
237
835
|
*/
|
|
238
|
-
|
|
836
|
+
previewSafeAreas?: PreviewSafeAreaParam[];
|
|
239
837
|
/**
|
|
240
|
-
* @description
|
|
838
|
+
* @description 导出参数
|
|
241
839
|
*/
|
|
242
|
-
|
|
840
|
+
export: ExportParam;
|
|
243
841
|
};
|
|
244
842
|
/**
|
|
245
843
|
* @description 导出参数
|
|
246
844
|
*/
|
|
247
845
|
type ExportParam = {
|
|
248
846
|
/**
|
|
249
|
-
* @description
|
|
250
|
-
*/
|
|
251
|
-
time: number;
|
|
252
|
-
/**
|
|
253
|
-
* @description 导出大小上限 - 单位kb
|
|
254
|
-
*/
|
|
255
|
-
fileSizeLimit: number;
|
|
256
|
-
/**
|
|
257
|
-
* @description 是否开启音轨
|
|
258
|
-
*/
|
|
259
|
-
audioEnable: boolean;
|
|
260
|
-
/**
|
|
261
|
-
* @description 导出视频类型 - 预留参数
|
|
847
|
+
* @description 视频名称
|
|
262
848
|
*/
|
|
263
|
-
|
|
264
|
-
}
|
|
849
|
+
name?: string;
|
|
850
|
+
} & Omit<ExportMediaItemOptions, 'scene' | 'size'>;
|
|
265
851
|
/**
|
|
266
852
|
* @description 视图属性
|
|
267
853
|
*/
|
|
@@ -277,19 +863,36 @@ type ViewProperty = {
|
|
|
277
863
|
/**
|
|
278
864
|
* @description 出血区数据
|
|
279
865
|
*/
|
|
280
|
-
safeArea:
|
|
866
|
+
safeArea: [number, number, number, number];
|
|
281
867
|
/**
|
|
282
|
-
* @description
|
|
868
|
+
* @description 自定义出血区数据
|
|
283
869
|
*/
|
|
284
|
-
|
|
870
|
+
previewSafeAreas: PreviewSafeAreaParam[];
|
|
285
871
|
/**
|
|
286
|
-
* @description
|
|
872
|
+
* @description 视图场景数据
|
|
287
873
|
*/
|
|
288
|
-
|
|
874
|
+
scene: spec.JSONScene;
|
|
289
875
|
/**
|
|
290
876
|
* @description 导出参数
|
|
291
877
|
*/
|
|
292
878
|
export: ExportParam;
|
|
879
|
+
/**
|
|
880
|
+
* @description 忽略交互 - 仅供展示
|
|
881
|
+
*/
|
|
882
|
+
ignoreInteraction: boolean;
|
|
883
|
+
};
|
|
884
|
+
/**
|
|
885
|
+
* @description 自定义出血区数据
|
|
886
|
+
*/
|
|
887
|
+
type PreviewSafeAreaParam = {
|
|
888
|
+
/**
|
|
889
|
+
* @description 出血区包围盒 [left top width height]
|
|
890
|
+
*/
|
|
891
|
+
box: [number, number, number, number];
|
|
892
|
+
/**
|
|
893
|
+
* @description 出血区色块颜色 默认为 [255, 255, 255, 0.3]
|
|
894
|
+
*/
|
|
895
|
+
color?: [number, number, number, number];
|
|
293
896
|
};
|
|
294
897
|
/**
|
|
295
898
|
* @description 页面活跃数据
|
|
@@ -341,107 +944,39 @@ type ViewItem = {
|
|
|
341
944
|
*/
|
|
342
945
|
endBehavior: spec.EndBehavior;
|
|
343
946
|
} & ViewItemTypedProperty;
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
readonly ERROR: "error";
|
|
350
|
-
};
|
|
351
|
-
type ExportStatus = typeof ExportStatusMap[keyof typeof ExportStatusMap];
|
|
352
|
-
type SDKEvents = {
|
|
353
|
-
'selectedItemChange': [id: string[]];
|
|
354
|
-
'preSelectedItemChange': [id: string | undefined];
|
|
355
|
-
'pageDataChange': [pageData: PageData];
|
|
356
|
-
'zoomChange': [zoom: number];
|
|
357
|
-
'progress': [{
|
|
358
|
-
duration: number;
|
|
359
|
-
time: number;
|
|
360
|
-
end: boolean;
|
|
361
|
-
paused: boolean;
|
|
362
|
-
}];
|
|
363
|
-
'exportingChange': [status: ExportStatus, progress?: number];
|
|
364
|
-
'itemPropertyChange': [{
|
|
365
|
-
id: string;
|
|
366
|
-
property: string;
|
|
367
|
-
}];
|
|
368
|
-
};
|
|
369
|
-
declare class SDK {
|
|
370
|
-
private _eventEmitter;
|
|
371
|
-
private _pageData;
|
|
372
|
-
private _screenShotContainer;
|
|
373
|
-
private _screenShotPlayer;
|
|
374
|
-
private _SDKUtils;
|
|
375
|
-
private _ExportVideo;
|
|
376
|
-
private _gestureHandler;
|
|
377
|
-
private _playerContainer;
|
|
378
|
-
private _isExportReady;
|
|
379
|
-
private _exportStatus;
|
|
380
|
-
player: Player;
|
|
381
|
-
constructor(container: HTMLElement);
|
|
382
|
-
get pageData(): PageData | undefined;
|
|
383
|
-
get exportStatus(): ExportStatus;
|
|
384
|
-
private get exportVideoCanceled();
|
|
385
|
-
dispose(): void;
|
|
386
|
-
on: <E extends "progress" | "selectedItemChange" | "preSelectedItemChange" | "pageDataChange" | "zoomChange" | "exportingChange" | "itemPropertyChange">(eventName: E, listener: _galacean_effects_weapp.EventEmitterListener<SDKEvents[E]>, options?: _galacean_effects_weapp.EventEmitterOptions) => () => void;
|
|
387
|
-
private getInitParam;
|
|
388
|
-
private initSDK;
|
|
389
|
-
run(param: SDKInputParam): Promise<void>;
|
|
390
|
-
getPageData(): PageData;
|
|
391
|
-
getActiveItems(): string[];
|
|
392
|
-
setPreSelectedItem(id: string): void;
|
|
393
|
-
getPreSelectedItem(): string;
|
|
394
|
-
setSelectedItems(itemIds: string[]): void;
|
|
395
|
-
/**
|
|
396
|
-
* @description 获取目标元素的所有属性
|
|
397
|
-
* @param param 元素ID、类型
|
|
398
|
-
* @returns 元素属性
|
|
399
|
-
*/
|
|
400
|
-
getItemProperty<T extends keyof PageFormTypeAndPropertyReference>(param: GetItemPropertyParam<T>): GetItemPropertyResult<T> | undefined;
|
|
947
|
+
type SDKBackgroundType = 'color' | 'image' | 'chess-board';
|
|
948
|
+
/**
|
|
949
|
+
* @description 图层创建信息
|
|
950
|
+
*/
|
|
951
|
+
type SpriteCreateInfo = {
|
|
401
952
|
/**
|
|
402
|
-
* @description
|
|
403
|
-
* @param param 元素ID、类型、属性名
|
|
404
|
-
* @returns 元素属性值
|
|
953
|
+
* @description 图层名称
|
|
405
954
|
*/
|
|
406
|
-
|
|
407
|
-
setItemPropertyValue(param: SetItemPropertyValueParam): void;
|
|
408
|
-
generateScreenShot(id: number): Promise<string>;
|
|
955
|
+
name?: string;
|
|
409
956
|
/**
|
|
410
|
-
* @description
|
|
411
|
-
* @param index 场景索引
|
|
957
|
+
* @description 元素id
|
|
412
958
|
*/
|
|
413
|
-
|
|
959
|
+
id?: string;
|
|
414
960
|
/**
|
|
415
|
-
* @description
|
|
416
|
-
* @returns 页面的 safeAreaPreview、zoom、adsorption 值
|
|
961
|
+
* @description 图片资源地址
|
|
417
962
|
*/
|
|
418
|
-
|
|
963
|
+
url: string;
|
|
419
964
|
/**
|
|
420
|
-
*
|
|
421
|
-
* @param pageProperty 设置
|
|
965
|
+
* @description 图层元素像素大小
|
|
422
966
|
*/
|
|
423
|
-
|
|
967
|
+
size: spec.vec2;
|
|
424
968
|
/**
|
|
425
|
-
* @description
|
|
426
|
-
* @param progress 播放进度 0-100
|
|
969
|
+
* @description 图层元素缩放
|
|
427
970
|
*/
|
|
428
|
-
|
|
429
|
-
getViewItems(): ViewItem[];
|
|
430
|
-
setPlayState(playState: 'play' | 'pause'): void;
|
|
971
|
+
scale?: spec.vec2;
|
|
431
972
|
/**
|
|
432
|
-
* @description
|
|
433
|
-
* @returns 视图预览图
|
|
973
|
+
* @description 图层元素旋转
|
|
434
974
|
*/
|
|
435
|
-
|
|
436
|
-
id: number;
|
|
437
|
-
thumbnail: string;
|
|
438
|
-
}[];
|
|
975
|
+
rotation?: number;
|
|
439
976
|
/**
|
|
440
|
-
* @description
|
|
441
|
-
* @returns 导出视频的 ArrayBuffer 数组
|
|
977
|
+
* @description 图层元素二维位置
|
|
442
978
|
*/
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}
|
|
979
|
+
position: spec.vec2;
|
|
980
|
+
};
|
|
446
981
|
|
|
447
|
-
export { type ActiveData, type BaseFormProperty, type
|
|
982
|
+
export { type ActiveData, type BaseFormProperty, type PageData, type PageFormTypedProperty, type PageProperty, SDK, type SDKEvents, type SDKInputParam, type SDKOptions, type SpecificPageFormProps, type SpriteCreateInfo, type SpriteFormProperty, type TextFormProperty, type ViewItem, type ViewParam, type ViewProperty };
|