@vvfx/sdk 0.0.0-alpha.4 → 0.0.0-alpha.40

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.d.cts CHANGED
@@ -1,15 +1,6 @@
1
- import { math, spec, Player } from '@galacean/effects';
1
+ import * as _galacean_effects from '@galacean/effects';
2
+ import { spec, Player } from '@galacean/effects';
2
3
  export { spec } from '@galacean/effects';
3
- import * as _galacean_effects_weapp from '@galacean/effects/weapp';
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
- }
13
4
 
14
5
  type ViewItemTypedProperty = {
15
6
  [K in keyof PageFormTypeAndPropertyReference]: {
@@ -55,10 +46,597 @@ 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
+ exportVideoConfig: VideoExportConfig;
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 VideoExportConfig = {
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
+ private initExporter;
467
+ private initSDK;
468
+ run(param: SDKInputParam): Promise<void>;
469
+ getPageData(): PageData;
470
+ getActiveItems(): string[];
471
+ setPreSelectedItem(id: string): void;
472
+ getPreSelectedItem(): string;
473
+ setSelectedItems(itemIds: string[]): void;
474
+ /**
475
+ * @description 获取目标元素的所有属性
476
+ * @param param 元素ID、类型
477
+ * @returns 元素属性
478
+ */
479
+ getItemProperty<T extends keyof PageFormTypeAndPropertyReference>(param: GetItemPropertyParam<T>): GetItemPropertyResult<T> | undefined;
480
+ /**
481
+ * @description 获取目标元素的指定属性
482
+ * @param param 元素ID、类型、属性名
483
+ * @returns 元素属性值
484
+ */
485
+ getItemPropertyValue<T extends keyof PageFormTypeAndPropertyReference, N extends keyof PageFormTypeAndPropertyReference[T]>(param: GetItemPropertyValueParam<T, N>): GetItemPropertyValueResult<T, N> | undefined;
486
+ setItemPropertyValue(param: SetItemPropertyValueParam): Promise<void>;
487
+ generateScreenShot(id: number, size?: [number, number], tick?: number, backgroundColor?: spec.vec4): Promise<string | undefined>;
488
+ /**
489
+ * @description 切换场景
490
+ * @param index 场景索引
491
+ */
492
+ switchScene(index: number): Promise<void>;
493
+ /**
494
+ * @description 获取页面的 safeAreaPreview、zoom、adsorption 值
495
+ * @returns 页面的 safeAreaPreview、zoom、adsorption 值
496
+ */
497
+ getPageConfig(): PageConfig;
498
+ /**
499
+ * 设置页面的 safeAreaPreview、zoom、adsorption 值
500
+ * @param pageProperty 设置
501
+ */
502
+ setPageConfig(pageConfig: PageConfig): void;
503
+ /**
504
+ * @description 设置播放进度
505
+ * @param progress 播放进度 0-100
506
+ */
507
+ setPlayProgress(progress: number): Promise<void>;
508
+ getViewItems(): ViewItem[];
509
+ setPlayState(playState: 'play' | 'pause'): Promise<void>;
510
+ /**
511
+ * @description 获取场景预览图
512
+ * @returns 视图预览图
513
+ */
514
+ getViewThumbnail(): {
515
+ id: number;
516
+ thumbnail: Promise<string | undefined>;
517
+ }[];
518
+ /**
519
+ * @description 获取视图JSON产物
520
+ * @returns 当前所有视图JSON产物
521
+ */
522
+ getViewScene(): {
523
+ id: number;
524
+ thumbnail: spec.JSONScene;
525
+ }[];
526
+ private destroyCompositions;
527
+ /**
528
+ * @description 导出,支持导出媒体或其他,如MP4,未来支持 JSON 等;
529
+ */
530
+ onExport(): void;
531
+ /**
532
+ * @description 取消导出
533
+ */
534
+ cancelExport(): void;
535
+ loadPageData(data: PageData): Promise<void>;
536
+ runByPageData(data: PageData): Promise<void>;
537
+ reloadPageDataByScene(scene: string | spec.JSONScene): Promise<void>;
538
+ addViewParams(viewParams: ViewParam[]): Promise<void>;
539
+ deleteViewParams(ids: number[]): Promise<void>;
540
+ setExportParam(exportParam: ExportParam, id?: number): void;
541
+ /**
542
+ * @description 设置视图缩放
543
+ * @param zoom 缩放值
544
+ */
545
+ setPageZoom(zoom: number): void;
546
+ /**
547
+ * @description 设置静态预览功能开关
548
+ * @param enabled 功能开关
549
+ */
550
+ setStaticPreviewEnabled(enabled: boolean): void;
551
+ /**
552
+ * @description 设置静态预览视图名称
553
+ * @param name 视图名称
554
+ */
555
+ setStaticPreviewName(name: string): void;
556
+ /**
557
+ * @description 设置同步修改功能开关
558
+ * @param enabled 功能开关
559
+ */
560
+ setAsyncEnabled(enabled: boolean): void;
561
+ /**
562
+ * @description 设置 成组显影 开关
563
+ */
564
+ setGroupVisibleEnabled(enabled: boolean): void;
565
+ /**
566
+ * @description 新增过滤元素名称
567
+ * @param itemNames 过滤元素名称
568
+ */
569
+ addFilterItemNames(itemNames: string[] | string): void;
570
+ /**
571
+ * @description 设置预览辅助层颜色
572
+ * @param color 色值
573
+ */
574
+ setPreferenceBackgroundColor(color: [number, number, number, number]): void;
575
+ /**
576
+ * @description 设置出血区颜色
577
+ * @param color 色值
578
+ */
579
+ setSafeAreaColor(color: [number, number, number, number]): void;
580
+ /**
581
+ * @description 设置 尺寸自适应拓展 功能开关
582
+ * @param enabled 功能开关
583
+ */
584
+ setSizeAdaptEnabled(enabled: boolean): void;
585
+ /**
586
+ * @description 设置 截图 功能开关
587
+ * @param enabled 功能开关
588
+ */
589
+ setScreenShotEnabled(enabled: boolean): void;
590
+ /**
591
+ * @description 设置 导出 功能开关
592
+ * @param enabled
593
+ */
594
+ setExportVideoEnabled(enabled: boolean): void;
595
+ /**
596
+ * @description 设置预选框参数
597
+ * @param preSelectedColor 预选框颜色
598
+ * @param preSelectedWidth 预选框线框宽度
599
+ */
600
+ setSelectorGizmoPreSelectConfig(preSelectedColor?: number, preSelectedWidth?: number): void;
601
+ /**
602
+ * @description 设置 变换控制器 交互框参数
603
+ * @param config 参数
604
+ */
605
+ setTranformGizmoWireframeConfig(config: {
606
+ wireframeColor?: number;
607
+ wireframeAlpha?: number;
608
+ wireframeWidth?: number;
609
+ }): void;
610
+ /**
611
+ * @description 获取 SDK 配置参数
612
+ * @returns SDK 配置参数
613
+ */
614
+ getSDKConfig(): SDKConfig;
615
+ /**
616
+ * @description 设置 SDK 配置参数
617
+ * @param config SDK 配置参数
618
+ */
619
+ setSDKConfig(config: SDKConfig): void;
620
+ /**
621
+ * @description 设置SDK背景
622
+ * @param type 背景类型
623
+ * @param value 值
624
+ */
625
+ setSDKBackground(type: SDKBackgroundType, value?: string): void;
626
+ /**
627
+ * @description 创建图层元素
628
+ * @param spriteInfo 图层元素信息
629
+ */
630
+ addSpriteItem(spriteInfo: SpriteCreateInfo): Promise<void>;
631
+ }
632
+
633
+ type SizeAdaptDirection = 'x' | 'y';
634
+
58
635
  type BaseFormProperty = {
59
636
  position: [number, number, number];
60
637
  rotation: [number, number, number];
61
- scale: [number, number, number];
638
+ size: [number, number];
639
+ visible: boolean;
62
640
  keyPropertyEditing: boolean;
63
641
  };
64
642
  type SpriteFormProperty = BaseFormProperty & {
@@ -102,26 +680,37 @@ type SpecificPageFormProps<T extends keyof PageFormTypeAndPropertyReference> = {
102
680
  property: PageFormTypeAndPropertyReference[T];
103
681
  onPropertyValueChange: <N extends keyof PageFormTypeAndPropertyReference[T]>(propertyName: N, propertyValue: PageFormTypeAndPropertyReference[T][N]) => void;
104
682
  };
683
+ type SDKOptions = {
684
+ /** 导出视频时,是否开启转码日志 */
685
+ loggerInExportVideoTranscoding?: boolean;
686
+ };
687
+ type SDKInputParam = SDKTemplateInputParam | SDKEditorInputParam;
105
688
  /**
106
689
  * @description SDK入参
107
690
  */
108
- type SDKInputParam = {
691
+ type SDKTemplateInputParam = {
109
692
  /**
110
693
  * @description JSON地址
111
694
  */
112
- scene: string;
695
+ scene: string | spec.JSONScene;
696
+ /**
697
+ * @description SDK模式 - 模板编辑模式
698
+ */
699
+ mode: 'template';
113
700
  /**
114
701
  * @description 视图参数
115
702
  */
116
- viewParams: ViewParam[];
703
+ viewParams?: ViewParam[];
117
704
  /**
118
705
  * @description 页面属性
119
706
  */
120
707
  options: PageOptions;
708
+ };
709
+ type SDKEditorInputParam = {
121
710
  /**
122
- * @description 是否开启出血区强制变换
711
+ * @description SDK模式 - 编辑器模式
123
712
  */
124
- keepSafe: boolean;
713
+ mode: 'editor';
125
714
  };
126
715
  /**
127
716
  * @description 页面属性
@@ -144,6 +733,10 @@ type PageOptions = {
144
733
  * @description 页面数据
145
734
  */
146
735
  type PageData = {
736
+ /**
737
+ * @description 基础场景数据
738
+ */
739
+ scene: spec.JSONScene;
147
740
  /**
148
741
  * @description 页面属性
149
742
  */
@@ -185,6 +778,10 @@ type PageConfig = {
185
778
  * @description 吸附开关
186
779
  */
187
780
  adsorption: boolean;
781
+ /**
782
+ * @description 同步开关
783
+ */
784
+ asyncMode: boolean;
188
785
  };
189
786
  /**
190
787
  * @description 页面属性
@@ -201,7 +798,7 @@ type PageProperty = {
201
798
  /**
202
799
  * @description 偏移值
203
800
  */
204
- translation: Vector2;
801
+ translation: [number, number];
205
802
  /**
206
803
  * @description 吸附开关
207
804
  */
@@ -209,7 +806,7 @@ type PageProperty = {
209
806
  /**
210
807
  * @description 同步开关
211
808
  */
212
- sync: boolean;
809
+ asyncMode: boolean;
213
810
  };
214
811
  /**
215
812
  * @description 视图创建参数
@@ -218,50 +815,37 @@ type ViewParam = {
218
815
  /**
219
816
  * @description 页面尺寸
220
817
  */
221
- size: [number, number];
818
+ size?: [number, number];
222
819
  /**
223
820
  * @description 出血区参数
224
821
  */
225
- safeArea: SafeAreaParam;
822
+ safeArea?: [number, number, number, number];
226
823
  /**
227
- * @description 导出参数
824
+ * @description 自适应方向 - 默认根据视图宽高决定
228
825
  */
229
- export: ExportParam;
230
- };
231
- /**
232
- * @description 安全区数据
233
- */
234
- type SafeAreaParam = {
826
+ adaptionDirection?: SizeAdaptDirection;
235
827
  /**
236
- * @description 出血区大小 - [上, 下, 左, 右]
828
+ * @description 自定义出血区 - 用于展示
237
829
  */
238
- size: [number, number, number, number];
830
+ previewSafeAreas?: PreviewSafeAreaParam[];
239
831
  /**
240
- * @description 元素名称关键字
832
+ * @description 导出参数
241
833
  */
242
- keyWords: string[];
834
+ export: ExportParam;
243
835
  };
244
836
  /**
245
837
  * @description 导出参数
246
838
  */
247
839
  type ExportParam = {
248
- /**
249
- * @description 导出视频时长
250
- */
251
- time: number;
252
- /**
253
- * @description 导出大小上限 - 单位kb
254
- */
255
- fileSizeLimit: number;
256
- /**
257
- * @description 是否开启音轨
258
- */
259
- audioEnable: boolean;
260
840
  /**
261
841
  * @description 导出视频类型 - 预留参数
262
842
  */
263
843
  type?: string;
264
- };
844
+ /**
845
+ * @description 视频名称
846
+ */
847
+ name?: string;
848
+ } & Omit<ExportMediaItemOptions, 'scene' | 'size'>;
265
849
  /**
266
850
  * @description 视图属性
267
851
  */
@@ -277,19 +861,36 @@ type ViewProperty = {
277
861
  /**
278
862
  * @description 出血区数据
279
863
  */
280
- safeArea: SafeAreaParam;
864
+ safeArea: [number, number, number, number];
281
865
  /**
282
- * @description 视图场景数据
866
+ * @description 自定义出血区数据
283
867
  */
284
- scene: spec.JSONScene;
868
+ previewSafeAreas: PreviewSafeAreaParam[];
285
869
  /**
286
- * @description 预览图数据
870
+ * @description 视图场景数据
287
871
  */
288
- thumbnail: string;
872
+ scene: spec.JSONScene;
289
873
  /**
290
874
  * @description 导出参数
291
875
  */
292
876
  export: ExportParam;
877
+ /**
878
+ * @description 忽略交互 - 仅供展示
879
+ */
880
+ ignoreInteraction: boolean;
881
+ };
882
+ /**
883
+ * @description 自定义出血区数据
884
+ */
885
+ type PreviewSafeAreaParam = {
886
+ /**
887
+ * @description 出血区包围盒 [left top width height]
888
+ */
889
+ box: [number, number, number, number];
890
+ /**
891
+ * @description 出血区色块颜色 默认为 [255, 255, 255, 0.3]
892
+ */
893
+ color?: [number, number, number, number];
293
894
  };
294
895
  /**
295
896
  * @description 页面活跃数据
@@ -341,107 +942,39 @@ type ViewItem = {
341
942
  */
342
943
  endBehavior: spec.EndBehavior;
343
944
  } & ViewItemTypedProperty;
344
-
345
- declare const ExportStatusMap: {
346
- readonly DEFAULT: "default";
347
- readonly EXPORTING: "exporting";
348
- readonly SUCCESS: "success";
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;
945
+ type SDKBackgroundType = 'color' | 'image' | 'chess-board';
946
+ /**
947
+ * @description 图层创建信息
948
+ */
949
+ type SpriteCreateInfo = {
401
950
  /**
402
- * @description 获取目标元素的指定属性
403
- * @param param 元素ID、类型、属性名
404
- * @returns 元素属性值
951
+ * @description 图层名称
405
952
  */
406
- getItemPropertyValue<T extends keyof PageFormTypeAndPropertyReference, N extends keyof PageFormTypeAndPropertyReference[T]>(param: GetItemPropertyValueParam<T, N>): GetItemPropertyValueResult<T, N> | undefined;
407
- setItemPropertyValue(param: SetItemPropertyValueParam): void;
408
- generateScreenShot(id: number): Promise<string>;
953
+ name?: string;
409
954
  /**
410
- * @description 切换场景
411
- * @param index 场景索引
955
+ * @description 元素id
412
956
  */
413
- switchScene(index: number): Promise<void>;
957
+ id?: string;
414
958
  /**
415
- * @description 获取页面的 safeAreaPreview、zoom、adsorption 值
416
- * @returns 页面的 safeAreaPreview、zoom、adsorption 值
959
+ * @description 图片资源地址
417
960
  */
418
- getConfig(): PageConfig;
961
+ url: string;
419
962
  /**
420
- * 设置页面的 safeAreaPreview、zoom、adsorption 值
421
- * @param pageProperty 设置
963
+ * @description 图层元素像素大小
422
964
  */
423
- setConfig(pageConfig: PageConfig): void;
965
+ size: spec.vec2;
424
966
  /**
425
- * @description 设置播放进度
426
- * @param progress 播放进度 0-100
967
+ * @description 图层元素缩放
427
968
  */
428
- setPlayProgress(progress: number): void;
429
- getViewItems(): ViewItem[];
430
- setPlayState(playState: 'play' | 'pause'): void;
969
+ scale?: spec.vec2;
431
970
  /**
432
- * @description 获取场景预览图
433
- * @returns 视图预览图
971
+ * @description 图层元素旋转
434
972
  */
435
- getViewThumbnail(): {
436
- id: number;
437
- thumbnail: string;
438
- }[];
973
+ rotation?: number;
439
974
  /**
440
- * @description 导出所有视频
441
- * @returns 导出视频的 ArrayBuffer 数组
975
+ * @description 图层元素二维位置
442
976
  */
443
- exportAllVideos(): Promise<void>;
444
- cancelExportAllVideos(): void;
445
- }
977
+ position: spec.vec2;
978
+ };
446
979
 
447
- export { type ActiveData, type BaseFormProperty, type ExportStatus, ExportStatusMap, type PageData, type PageFormTypedProperty, type PageProperty, SDK, type SDKEvents, type SDKInputParam, type SpecificPageFormProps, type SpriteFormProperty, type TextFormProperty, type ViewItem, type ViewParam, type ViewProperty };
980
+ export { type ActiveData, type BaseFormProperty, type PageData, type PageFormTypedProperty, type PageProperty, SDK, type SDKEvents, type SDKInputParam, type SDKOptions, type SpecificPageFormProps, type SpriteFormProperty, type TextFormProperty, type ViewItem, type ViewParam, type ViewProperty };