@vvfx/sdk 0.0.0-alpha.6 → 0.0.0-alpha.60

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,6 +1,6 @@
1
- import { spec, Player } from '@galacean/effects';
2
- export { spec } from '@galacean/effects';
3
- import * as _galacean_effects_weapp from '@galacean/effects/weapp';
1
+ import * as _galacean_effects from '@galacean/effects';
2
+ import { spec, math, Player } from '@galacean/effects';
3
+ export { generateGUID, spec } from '@galacean/effects';
4
4
 
5
5
  type ViewItemTypedProperty = {
6
6
  [K in keyof PageFormTypeAndPropertyReference]: {
@@ -44,23 +44,1233 @@ type SetItemPropertyValueParam = {
44
44
  propertyValue: PageFormTypeAndPropertyReference[T][N];
45
45
  };
46
46
  }[keyof PageFormTypeAndPropertyReference[T]];
47
- }[keyof PageFormTypeAndPropertyReference];
47
+ }[keyof PageFormTypeAndPropertyReference] | {
48
+ itemId: string;
49
+ type: spec.ItemType;
50
+ propertyName: 'position' | 'size';
51
+ propertyValue: spec.vec2 | spec.vec3;
52
+ };
53
+
54
+ /**
55
+ * @class 二维线段
56
+ */
57
+ declare class Line2 {
58
+ start: Vector2;
59
+ end: Vector2;
60
+ constructor(start?: Vector2, end?: Vector2);
61
+ /**
62
+ * 设置二维线段
63
+ * @param {Vector2} start 线段起点
64
+ * @param {Vector2} end 线段终点
65
+ * @returns {Line2} 二维线段
66
+ */
67
+ set(start: Vector2, end: Vector2): this;
68
+ /**
69
+ * 复制二维线段
70
+ * @param {Line2} line 复制对象
71
+ * @returns {Line2} 复制结果
72
+ */
73
+ copyFrom(line: Line2): this;
74
+ /**
75
+ * 二维线段求方向
76
+ * @returns {Vector2} 二维线段方向
77
+ */
78
+ direction(): Vector2;
79
+ /**
80
+ * 二维线段求中点
81
+ * @param {Vector2} [target=new Vector2()] 目标保存对象
82
+ * @returns {Vector2} 二维线段中点
83
+ */
84
+ getCenter(target?: Vector2): Vector2;
85
+ /**
86
+ * 二维线段向量值
87
+ * @param {Vector2} [target=new Vector2()] 目标保存对象
88
+ * @returns {Vector2} 二维线段向量值
89
+ */
90
+ delta(target?: Vector2): Vector2;
91
+ /**
92
+ * 二维线段欧式距离平方(应用于计算)
93
+ * @returns {number} 计算结果
94
+ */
95
+ distanceSq(): number;
96
+ /**
97
+ * 二维线段欧式距离
98
+ * @returns {number} 计算结果
99
+ */
100
+ distance(): number;
101
+ /**
102
+ * 求二维线段比例点
103
+ * @param {number} t 比例值
104
+ * @param {Vector2} target 目标保存对象
105
+ * @returns {Vector2} 比例点结果
106
+ */
107
+ at(t: number, target?: Vector2): Vector2;
108
+ /**
109
+ * 求点与线段的最短距离
110
+ * @param {Vector2} point 二维空间点
111
+ * @param {boolean} clampToLine 是否限制于线段内
112
+ * @returns {number} 距离结果
113
+ */
114
+ closestPointToPointParameter(point: Vector2, clampToLine: boolean): number;
115
+ /**
116
+ * 求点与线段的最近交点
117
+ * @param {Vector2} point 二维空间点
118
+ * @param {boolean} clampToLine 是否限制于线段内
119
+ * @param {Vector2} target 目标保存对象
120
+ * @returns {Vector2} 最近交点
121
+ */
122
+ closestPointToPoint(point: Vector2, clampToLine: boolean, target?: Vector2): Vector2;
123
+ /**
124
+ * 二维线段判等
125
+ * @param {Line2} line 二维线段
126
+ * @returns {boolean} 判等结果
127
+ */
128
+ equals(line: Line2): boolean;
129
+ /**
130
+ * 克隆二维线段
131
+ * @returns {Line2} 克隆结果
132
+ */
133
+ clone(): Line2;
134
+ /**
135
+ * 二维线段求长度
136
+ * @returns {number} 长度
137
+ */
138
+ length(): number;
139
+ /**
140
+ * 二维线段判断相交
141
+ * @param {Line2} other 二维线段
142
+ * @returns {boolean} 相交判断结果
143
+ */
144
+ crossWithLine(other: Line2): boolean;
145
+ }
146
+
147
+ declare class Vector2 extends math.Vector2 {
148
+ subtract(other: Vector2): this;
149
+ toViewCoordinate(width: number, height: number): this;
150
+ clone(): Vector2;
151
+ distanceTo(other: Vector2): number;
152
+ scaleByCenter(scalar: Vector2, anchor?: Vector2): this;
153
+ round(precision?: number): this;
154
+ /**
155
+ * 点到直线的最短距离
156
+ * @returns {{d: number, t: number}} d表示距离,t表示最近点在直线的比例
157
+ */
158
+ distanceToLine(line: Line2): {
159
+ d: number;
160
+ t: number;
161
+ };
162
+ /**
163
+ * 二维向量与x轴夹角
164
+ * @returns {number} 弧度值
165
+ */
166
+ angle(): number;
167
+ /**
168
+ * 二维点绕点旋转
169
+ * @param {Vec2} center 旋转中心
170
+ * @param {number} angle 旋转角度
171
+ * @returns {Vec2} 旋转结果
172
+ */
173
+ rotateAround(center: Vector2, angle: number): this;
174
+ }
175
+
176
+ /**
177
+ * @class 二维包围盒
178
+ */
179
+ declare class Box2 {
180
+ /**
181
+ * @member {Vector2[]} corners 二维包围盒角点
182
+ */
183
+ corners: Vector2[];
184
+ min: Vector2;
185
+ max: Vector2;
186
+ /**
187
+ * 构造函数,传入值为空时表示空包围盒
188
+ * @param {Vector2} [min=new Vector2(Infinity, Infinity)] 最小点
189
+ * @param {Vector2} [max=new Vector2(-Infinity, -Infinity)] 最大点
190
+ */
191
+ constructor(min?: Vector2, max?: Vector2);
192
+ /**
193
+ * 通过最大最小点设置二维包围盒
194
+ * @param {Vector2} min 最小点
195
+ * @param {Vector2} max 最大点
196
+ * @returns {Box2} 二维包围盒
197
+ */
198
+ set(min: Vector2, max: Vector2): this;
199
+ /**
200
+ * 通过角点设置二维包围盒
201
+ * @param {Vector2[]} vecArray 二维空间点数组
202
+ * @returns {Box2} 二维包围盒
203
+ */
204
+ setFromVec2Array(vecArray: Vector2[]): this;
205
+ /**
206
+ * 通过屏幕坐标点设置二维包围盒 - 点为屏幕坐标点,x正方向为右,y正方向为向上
207
+ * @param vecArray 屏幕坐标点
208
+ */
209
+ setFromVec2ArrayWithOutCorners(vecArray: Vector2[]): this;
210
+ /**
211
+ * 通过中心与大小设置二维包围盒
212
+ * @param {Vector2} center 二维中心点
213
+ * @param {Vector2} size 二维大小
214
+ * @returns {Box2} 二维包围盒
215
+ */
216
+ setFromCenterAndSize(center: Vector2, size: Vector2): this;
217
+ /**
218
+ * 克隆二维包围盒
219
+ * @returns {Box2} 克隆结果
220
+ */
221
+ clone(): Box2;
222
+ /**
223
+ * 复制二维包围盒
224
+ * @param {Box2} box 二维包围盒
225
+ * @returns {Box2} 复制结果
226
+ */
227
+ copyFrom(box: Box2): this;
228
+ /**
229
+ * 二维包围盒置空
230
+ * @returns {Box2} 置空结果
231
+ */
232
+ makeEmpty(): this;
233
+ /**
234
+ * 二维包围盒判空
235
+ * @returns {boolean} 判空结果
236
+ */
237
+ isEmpty(): boolean;
238
+ /**
239
+ * 获取二维包围盒角点
240
+ * @returns {Vector2[]} 二维包围盒角点
241
+ */
242
+ getCorners(): Vector2[];
243
+ /**
244
+ * 获取二维包围盒中心点
245
+ * @param {Vector2} [target=new Vector2()] 目标点(用以存放二维包围盒中心点)
246
+ * @returns {Vector2} 二维包围盒中心点
247
+ */
248
+ getCenter(target?: Vector2): Vector2;
249
+ /**
250
+ * 获取二维包围盒大小
251
+ * @param {Vector2} [target=new Vector2()] 目标向量(用以存放二维包围盒大小)
252
+ * @returns {Vector2} 二维包围盒大小
253
+ */
254
+ getSize(target?: Vector2): Vector2;
255
+ /**
256
+ * 通过二维空间点扩展二维包围盒
257
+ * @param {Vector2} point 二维空间点
258
+ * @returns {Box2} 扩展包围盒
259
+ */
260
+ expandByPoint(point: Vector2): this;
261
+ /**
262
+ * 通过向量扩展二维包围盒
263
+ * @param {Vector2} vector 二维向量
264
+ * @returns {Box2} 扩展结果
265
+ */
266
+ expandByVector(vector: Vector2): this;
267
+ /**
268
+ * 通过大小扩展二维包围盒
269
+ * @param {number} scalar 扩展大小
270
+ * @returns {Box2} 扩展结果
271
+ */
272
+ expandByScalar(scalar: number): this;
273
+ /**
274
+ * 判断二维包围盒是否包含二维空间点
275
+ * @param {Vector2} point 二维空间点
276
+ * @param {boolean} [isOrthogonal=true] 包围盒正交判断(默认为true)
277
+ * @returns {boolean} 点包含判断结果
278
+ */
279
+ containsPoint(point: Vector2, isOrthogonal?: boolean): boolean;
280
+ /**
281
+ * 判断二维包围盒包含关系(if this contains other)
282
+ * @param {Box2} box 其它包围盒
283
+ * @returns {boolean} 二维包围盒包含判断结果
284
+ */
285
+ containsBox(box: Box2): boolean;
286
+ /**
287
+ * 获取点以包围盒左上角顶点为原点的相对位置
288
+ * @param {Vector2} point 指定二维空间点
289
+ * @param {Vector2} [target=new Vector2()] 目标空间点
290
+ * @returns {Vector2} 计算结果空间点
291
+ */
292
+ getParameter(point: Vector2, target?: Vector2): Vector2;
293
+ /**
294
+ * 求点与二维包围盒的最近点
295
+ * @param {Vector2} point 二维空间点
296
+ * @param {Vector2} [target=new Vector2()] 结果点
297
+ * @returns {Vector2} 二维空间点
298
+ */
299
+ clampPoint(point: Vector2, target?: Vector2): Vector2;
300
+ /**
301
+ * 求点到二维包围盒的距离
302
+ * @param {Vector2} point 二维空间点
303
+ * @returns {number} 距离
304
+ */
305
+ distanceToPoint(point: Vector2): number;
306
+ /**
307
+ * 二维包围盒求交集
308
+ * @param {Box2} box 二维包围盒
309
+ * @returns {Box2} 求交结果
310
+ */
311
+ intersect(box: Box2): this;
312
+ /**
313
+ * 二维包围盒求并集
314
+ * @param {Box2} box 二维包围盒
315
+ * @returns {Box2} 求并结果
316
+ */
317
+ union(box: Box2): this;
318
+ /**
319
+ * 二维包围盒位移
320
+ * @param {Vector2} offset 位移向量
321
+ * @returns {Box2} 位移结果
322
+ */
323
+ translate(offset: Vector2): this;
324
+ scale(scalar: number | Vector2, anchor?: Vector2): this;
325
+ /**
326
+ * 二维包围盒判等
327
+ * @param {Box2} box 二维包围盒
328
+ * @returns {boolean} 判等结果
329
+ */
330
+ equals(box: Box2): boolean;
331
+ /**
332
+ * 判断二维包围盒相交关系(if this intersect other)
333
+ * @param {Box2} box 二维包围盒
334
+ * @param {boolean} [isOrthogonal=true] 正交判断(当前包围盒)
335
+ * @returns {boolean} 相交判断结果
336
+ */
337
+ intersectsBox(box: Box2, isOrthogonal?: boolean): boolean;
338
+ rotate(angle: number, center?: Vector2): this;
339
+ }
340
+
341
+ type CreateOperation = {
342
+ type: 'create';
343
+ newData: ItemCreateInfo[];
344
+ };
345
+ type DeleteOperation = {
346
+ type: 'delete';
347
+ oldData: ItemCreateInfo[];
348
+ };
349
+ type UpdateOperation = {
350
+ type: 'update';
351
+ newData: ItemCreateInfo[];
352
+ oldData: ItemCreateInfo[];
353
+ };
354
+ type Operation = CreateOperation | UpdateOperation | DeleteOperation;
355
+ declare class UndoRedo {
356
+ private index;
357
+ private operations;
358
+ get canUndo(): boolean;
359
+ get canRedo(): boolean;
360
+ oldData?: ItemCreateInfo[];
361
+ push(operation: Operation): void;
362
+ undo(): Operation | undefined;
363
+ redo(): Operation | undefined;
364
+ clear(): void;
365
+ }
366
+
367
+ declare const MEDIA_TYPE: {
368
+ readonly APNG: "APNG";
369
+ readonly MP4: "MP4";
370
+ readonly WebM: "WebM";
371
+ readonly Images: "Images";
372
+ readonly WebP: "WebP";
373
+ readonly GIF: "GIF";
374
+ readonly AlphaMaskVideo: "AlphaMaskVideo";
375
+ };
376
+ /**
377
+ * GIF 压缩参数
378
+ * 核心通过参数 flags + palettegen + paletteuse 实现
379
+ * highest: lanczos + max_colors=256 + dither=bayer
380
+ * high: bicubic + max_colors=200 + dither=bayer
381
+ * medium: bilinear + max_colors=64 + dither=bayer
382
+ * low: neighbor + max_colors=32 + dither=none
383
+ */
384
+ declare const GIF_QUALITY_TO_FFMPEG_ARGS: {
385
+ highest: string;
386
+ high: string;
387
+ medium: string;
388
+ low: string;
389
+ };
390
+
391
+ declare global {
392
+ interface Window {
393
+ /**
394
+ * @description 创建 WebP Core 实例
395
+ */
396
+ createWebPCore: (config: any) => Promise<Img2WebPCore>;
397
+ }
398
+ }
399
+ type FileBuffer = ArrayBuffer | Uint8Array;
400
+ type MediaType = typeof MEDIA_TYPE[keyof typeof MEDIA_TYPE];
401
+ type FS = {
402
+ writeFile: (path: string, data: Uint8Array | string) => void;
403
+ readFile(path: string, opts: {
404
+ encoding: 'binary';
405
+ flags?: string | undefined;
406
+ }): Uint8Array;
407
+ readFile(path: string, opts: {
408
+ encoding: 'utf8';
409
+ flags?: string | undefined;
410
+ }): string;
411
+ readFile(path: string, opts?: {
412
+ flags?: string | undefined;
413
+ }): Uint8Array;
414
+ unlink: (path: string) => void;
415
+ quit: () => void;
416
+ };
417
+ type Pointer = number;
418
+ type Img2WebPCore = {
419
+ FS: FS;
420
+ run: (...args: string[]) => number;
421
+ cwrap: (ident: string, returnType: string, argTypes: string[]) => ((argc: number, argv: Pointer) => number);
422
+ _malloc: (size: number) => Pointer;
423
+ writeAsciiToMemory: (str: string, buffer: number, dontAddNull?: boolean) => void;
424
+ setValue: (ptr: number, value: any, type: string, noSafe?: boolean) => void;
425
+ };
426
+ type ExportMediaInitOptions = {
427
+ /**
428
+ * 导出类型
429
+ */
430
+ mediaType: MediaType;
431
+ /**
432
+ * 额外画布,导出透明视频时使用
433
+ */
434
+ extraCanvas?: HTMLCanvasElement | null;
435
+ /**
436
+ * 是否打印转码过程中的日志,仅在导出 MP4/AlphaMaskVideo 时有效, 默认 false
437
+ * 供开发调试使用
438
+ */
439
+ loggerInTranscoding?: boolean;
440
+ /**
441
+ * ffmpeg 转码是否开启多线程,默认 false,确保环境支持 SharedArrayBuffer
442
+ */
443
+ multiThreading?: boolean;
444
+ /**
445
+ * 是否输出 buffer,默认 false
446
+ */
447
+ isOutputBuffer?: boolean;
448
+ };
449
+ type GifConfig = {
450
+ /**
451
+ * @description GIF 导出时的帧率
452
+ */
453
+ fps?: number;
454
+ /**
455
+ * @description GIF 导出时的缩放比例
456
+ * 默认 '-1:-1', 表示不缩放
457
+ * 例如 '100:-1', 表示宽度 100,高度自动
458
+ * 例如 '-1:100', 表示宽度自动,高度 100
459
+ */
460
+ scale?: string;
461
+ /**
462
+ * @description GIF 导出时的质量
463
+ * 默认 'highest'
464
+ * 可选 'highest', 'high', 'medium', 'low'
465
+ */
466
+ quality?: keyof typeof GIF_QUALITY_TO_FFMPEG_ARGS;
467
+ };
468
+ type ApngConfig = {
469
+ /**
470
+ * @description APNG 导出时的帧率
471
+ */
472
+ fps?: number;
473
+ /**
474
+ * @description APNG 导出时的缩放比例
475
+ * 默认 '-1:-1', 表示不缩放
476
+ * 例如 '100:-1', 表示宽度 100,高度自动
477
+ * 例如 '-1:100', 表示宽度自动,高度 100
478
+ */
479
+ scale?: string;
480
+ /**
481
+ * @description APNG 导出时的质量
482
+ * 默认 'highest'
483
+ * 可选 'highest', 'high', 'medium', 'low'
484
+ */
485
+ quality?: keyof typeof GIF_QUALITY_TO_FFMPEG_ARGS;
486
+ };
487
+ type ExportMediaItemOptions = {
488
+ /**
489
+ * 尺寸
490
+ */
491
+ size: [number, number];
492
+ /**
493
+ * 动效资源
494
+ */
495
+ scene: spec.JSONScene;
496
+ /**
497
+ * 视频时长,目前仅在导出 MP4 / AlphaMaskVideo 时有效,默认取动效资源时长
498
+ */
499
+ time?: number;
500
+ /**
501
+ * 是否生成音轨,默认 false,仅在导出 MP4 时有效
502
+ */
503
+ audioEnable?: boolean;
504
+ /**
505
+ * 帧率, 默认 30
506
+ */
507
+ fps?: number;
508
+ /**
509
+ * 是否循环,默认 true
510
+ */
511
+ loop?: boolean;
512
+ /**
513
+ * 视频背景颜色,默认 #000000
514
+ */
515
+ backgroundColor?: string;
516
+ /**
517
+ * 导出 GIF 时,设置的导出配置
518
+ */
519
+ gifConfig?: GifConfig;
520
+ apngConfig?: ApngConfig;
521
+ };
522
+
523
+ type SDKMode = 'editor' | 'template';
524
+ /**
525
+ * @description SDK功能配置
526
+ */
527
+ type SDKConfig = {
528
+ /**
529
+ * @description SDK编辑模式 - 模板编辑 | 产物编辑
530
+ */
531
+ mode: SDKMode;
532
+ /**
533
+ * @description 页面功能配置
534
+ */
535
+ pageConfig: PageConfig$1;
536
+ /**
537
+ * @description 截图功能配置
538
+ */
539
+ screenShotConfig: ScreenShotConfig;
540
+ /**
541
+ * @description 导出视频功能配置
542
+ */
543
+ exportConfig: ExportConfig;
544
+ /**
545
+ * @description 尺寸自适应功能开关
546
+ */
547
+ sizeAdaptConfig: SizeAdaptConfig;
548
+ /**
549
+ * @description 辅助面板功能配置
550
+ */
551
+ gestureHandlerConfig: {
552
+ enabled: boolean;
553
+ adsorptionGizmoEnabled: boolean;
554
+ adsorptionGizmoConfig: AdsorptionGizmoConfig;
555
+ controlGizmoEnabled: boolean;
556
+ controlGizmoConfig: ControlGizmoConfig;
557
+ preferenceGizmoEnabled: boolean;
558
+ preferenceGizmoConfig: PreferenceGizmoConfig;
559
+ selectorGizmoEnabled: boolean;
560
+ selectorGizmoConfig: SelectorGizmoConfig;
561
+ transformGizmoEnabled: boolean;
562
+ transformGizmoConfig: TransformGizmoConfig;
563
+ pictureCutGizmoEnabled: boolean;
564
+ pictureCutGizmoConfig: PictureCutGizmoConfig;
565
+ pictureExpandGizmoEnabled: boolean;
566
+ pictureExpandGizmoConfig: PictureExpandGizmoConfig;
567
+ textGizmoEnbaled: boolean;
568
+ textGizmoConfig: TextGizmoConfig;
569
+ maskGizmoEnabled: boolean;
570
+ maskGizmoConfig: MaskGizmoConfig;
571
+ };
572
+ };
573
+ /**
574
+ * @description 页面功能配置
575
+ */
576
+ type PageConfig$1 = {
577
+ /**
578
+ * @description 同步修改功能开关
579
+ */
580
+ asncMode: boolean;
581
+ /**
582
+ * @description 静态预览【视图只提供播放预览功能】功能开关
583
+ */
584
+ staticPreview: boolean;
585
+ /**
586
+ * @description 静态预览视图名称
587
+ */
588
+ staticPreviewName: string;
589
+ /**
590
+ * @description 需过滤的元素名称
591
+ */
592
+ filterItemNames: string[];
593
+ /**
594
+ * @description 成组操作元素显隐
595
+ */
596
+ groupVisible: boolean;
597
+ /**
598
+ * @description 缩放最大值
599
+ */
600
+ maxZoom: number;
601
+ /**
602
+ * @description 缩放最小值
603
+ */
604
+ minZoom: number;
605
+ };
606
+ /**
607
+ * @description 视频导出功能配置
608
+ */
609
+ type ExportConfig = {
610
+ enabled: boolean;
611
+ } & ExportMediaInitOptions;
612
+ /**
613
+ * @description 截图功能配置
614
+ */
615
+ type ScreenShotConfig = {
616
+ enabled: boolean;
617
+ };
618
+ /**
619
+ * @description 尺寸自适应功能配置
620
+ */
621
+ type SizeAdaptConfig = {
622
+ enabled: boolean;
623
+ };
624
+ /**
625
+ * @description 对齐吸附功能参数
626
+ */
627
+ type AdsorptionGizmoConfig = {
628
+ /**
629
+ * @description 对齐吸附线宽
630
+ */
631
+ lineWidth: number;
632
+ /**
633
+ * @description 对齐线颜色
634
+ */
635
+ lineColor: number;
636
+ /**
637
+ * @description 对齐吸附距离
638
+ */
639
+ distance: number;
640
+ };
641
+ /**
642
+ * @description 视图控制功能参数
643
+ */
644
+ type ControlGizmoConfig = {
645
+ /**
646
+ * @description 缩放步长
647
+ */
648
+ zoomStep: number;
649
+ };
650
+ /**
651
+ * @description 视口展示功能参数
652
+ */
653
+ type PreferenceGizmoConfig = {
654
+ /**
655
+ * @description 视口窗包围盒颜色
656
+ */
657
+ boxColor: number;
658
+ /**
659
+ * @description 视口窗包围盒宽度
660
+ */
661
+ boxWidth: number;
662
+ /**
663
+ * @description 视口区域外遮罩颜色
664
+ */
665
+ markColor: number;
666
+ /**
667
+ * @description 视口区域外遮罩透明度
668
+ */
669
+ markAlpha: number;
670
+ /**
671
+ * @description 出血区预览开关
672
+ */
673
+ safeAreaEnabled: boolean;
674
+ /**
675
+ * @description 出血区颜色
676
+ */
677
+ safeAreaBoxColor: number;
678
+ /**
679
+ * @description 出血区透明度
680
+ */
681
+ safeAreaBoxAlpha: number;
682
+ };
683
+ /**
684
+ * @description 选择功能参数
685
+ */
686
+ type SelectorGizmoConfig = {
687
+ /**
688
+ * @description 预选框线宽
689
+ */
690
+ preSelectedWidth: number;
691
+ /**
692
+ * @description 预选框颜色
693
+ */
694
+ preSelectedColor: number;
695
+ /**
696
+ * @description 框选区域颜色
697
+ */
698
+ regionBoxColor: number;
699
+ /**
700
+ * @description 框选区域透明度
701
+ */
702
+ regionBoxAlpha: number;
703
+ /**
704
+ * @description 框选区域包围框颜色
705
+ */
706
+ regionWireframeColor: number;
707
+ /**
708
+ * @description 框选区域包围框透明度
709
+ */
710
+ regionWireframeAlpha: number;
711
+ /**
712
+ * @description 框选区域包围框宽度
713
+ */
714
+ regionWireframeWidth: number;
715
+ };
716
+ /**
717
+ * @description 变换功能参数
718
+ */
719
+ type TransformGizmoConfig = {
720
+ /**
721
+ * @description 变换交互框颜色
722
+ */
723
+ wireframeColor: number;
724
+ /**
725
+ * @description 变换交互框透明度
726
+ */
727
+ wireframeAlpha: number;
728
+ /**
729
+ * @description 变换交互框宽度
730
+ */
731
+ wireframeWidth: number;
732
+ /**
733
+ * @description 变换交互框角点填充色
734
+ */
735
+ cornerFillColor: number;
736
+ /**
737
+ * @description 变换交互框角点线框色
738
+ */
739
+ cornerLineColor: number;
740
+ /**
741
+ * @description 变换交互框角点线框宽度
742
+ */
743
+ cornerLineWidth: number;
744
+ /**
745
+ * @description 变换交互框角点线框透明度
746
+ */
747
+ cornerLineAlpha: number;
748
+ /**
749
+ * @description 交互框缩放圆半径
750
+ */
751
+ scaleCircleSize: number;
752
+ /**
753
+ * @description 交互框旋转圆半径
754
+ */
755
+ rotationCircleSize: number;
756
+ /**
757
+ * @description 图片Logo地址
758
+ */
759
+ pictureLogoUrl: string;
760
+ /**
761
+ * @description
762
+ */
763
+ nullLogoUrl: string;
764
+ /**
765
+ * @description 大小文字颜色
766
+ */
767
+ sizeTextColor: number;
768
+ /**
769
+ * @description 名称文字颜色
770
+ */
771
+ nameTextColor: number;
772
+ };
773
+ /**
774
+ * @description 图片裁切参数
775
+ */
776
+ type PictureCutGizmoConfig = {
777
+ /**
778
+ * @description 蒙版颜色
779
+ */
780
+ maskColor: number;
781
+ /**
782
+ * @description 蒙版透明度
783
+ */
784
+ maskAlpha: number;
785
+ /**
786
+ * @description 裁切包围盒线框宽度
787
+ */
788
+ cutBoxLineWidth: number;
789
+ /**
790
+ * @description 裁切包围盒线框颜色
791
+ */
792
+ cutBoxLineColor: number;
793
+ /**
794
+ * @description 裁切包围盒线框透明度
795
+ */
796
+ cutBoxLineAlpha: number;
797
+ /**
798
+ * @description 元素包围盒线框宽度
799
+ */
800
+ itemBoxLineWidth: number;
801
+ /**
802
+ * @description 元素包围盒线框颜色
803
+ */
804
+ itemBoxLineColor: number;
805
+ /**
806
+ * @description 元素包围盒线框透明度
807
+ */
808
+ itemBoxLineAlpha: number;
809
+ /**
810
+ * @description 裁切包围盒角度半径
811
+ */
812
+ cutBoxCornerRadius: number;
813
+ /**
814
+ * @description 裁切包围盒角点宽度
815
+ */
816
+ cutBoxCornerLineWidth: number;
817
+ /**
818
+ * @description 裁切包围盒角点颜色
819
+ */
820
+ cutBoxCornerLineColor: number;
821
+ /**
822
+ * @description 裁切包围盒角点透明度
823
+ */
824
+ cutBoxCornerLineAlpha: number;
825
+ /**
826
+ * @description 裁切包围盒角点填充色
827
+ */
828
+ cutBoxCornerFillColor: number;
829
+ /**
830
+ * @description 缩放判断距离
831
+ */
832
+ scaleInteractionDistance: number;
833
+ /**
834
+ * @description 单向缩放判断距离
835
+ */
836
+ directionScaleInteractionDistance: number;
837
+ };
838
+ /**
839
+ * @description 图片扩边参数
840
+ */
841
+ type PictureExpandGizmoConfig = {
842
+ /**
843
+ * @description 蒙版颜色
844
+ */
845
+ maskColor: number;
846
+ /**
847
+ * @description 蒙版透明度
848
+ */
849
+ maskAlpha: number;
850
+ /**
851
+ * @description 扩边包围盒线框宽度
852
+ */
853
+ expandBoxLineWidth: number;
854
+ /**
855
+ * @description 扩边包围盒线框颜色
856
+ */
857
+ expandBoxLineColor: number;
858
+ /**
859
+ * @description 扩边包围盒线框透明度
860
+ */
861
+ expandBoxLineAlpha: number;
862
+ /**
863
+ * @description 扩边包围盒角度半径
864
+ */
865
+ expandBoxCornerRadius: number;
866
+ /**
867
+ * @description 扩边包围盒角点宽度
868
+ */
869
+ expandBoxCornerLineWidth: number;
870
+ /**
871
+ * @description 扩边包围盒角点颜色
872
+ */
873
+ expandBoxCornerLineColor: number;
874
+ /**
875
+ * @description 扩边包围盒角点透明度
876
+ */
877
+ expandBoxCornerLineAlpha: number;
878
+ /**
879
+ * @description 扩边包围盒角点填充色
880
+ */
881
+ expandBoxCornerFillColor: number;
882
+ /**
883
+ * @description 缩放判断距离
884
+ */
885
+ scaleInteractionDistance: number;
886
+ /**
887
+ * @description 单向缩放判断距离
888
+ */
889
+ directionScaleInteractionDistance: number;
890
+ };
891
+ /**
892
+ * @description 文本交互控制器参数
893
+ */
894
+ type TextGizmoConfig = {
895
+ /**
896
+ * @description 包围盒线宽
897
+ */
898
+ boxLineWidth: number;
899
+ /**
900
+ * @description 包围盒线色
901
+ */
902
+ boxLineColor: number;
903
+ /**
904
+ * @description 缩放交互点半径
905
+ */
906
+ scaleCornerRadius: number;
907
+ /**
908
+ * @description 旋转交互点边长
909
+ */
910
+ rotationCornerWidth: number;
911
+ /**
912
+ * @description 旋转交互贴图地址
913
+ */
914
+ rotationCornerTexture: string;
915
+ /**
916
+ * @description 缩放交互点填充色
917
+ */
918
+ scaleCornerFillColor: number;
919
+ /**
920
+ * @description 缩放交互点描边宽度
921
+ */
922
+ scaleCornerStrokeWidth: number;
923
+ /**
924
+ * @description 缩放交互点描边颜色
925
+ */
926
+ scaleCornerStrokeColor: number;
927
+ };
928
+ /**
929
+ * @description 蒙版参数
930
+ */
931
+ type MaskGizmoConfig = {
932
+ /**
933
+ * @description 画笔大小
934
+ */
935
+ brushSize: number;
936
+ /**
937
+ * @description 笔刷颜色
938
+ */
939
+ brushColor: number;
940
+ /**
941
+ * @description 笔刷透明度
942
+ */
943
+ brushAlpha: number;
944
+ /**
945
+ * @description 蒙版颜色
946
+ */
947
+ maskColor: number;
948
+ /**
949
+ * @description 蒙版透明度
950
+ */
951
+ maskAlpha: number;
952
+ /**
953
+ * @description 元素包围盒线框宽度
954
+ */
955
+ boxLineWidth: number;
956
+ /**
957
+ * @description 元素包围盒线框颜色
958
+ */
959
+ boxLineColor: number;
960
+ /**
961
+ * @description 元素包围盒线框透明度
962
+ */
963
+ boxLineAlpha: number;
964
+ };
965
+
966
+ type SDKEvents = {
967
+ 'loadingItemChange': [id: string[]];
968
+ 'selectedItemChange': [id: string[]];
969
+ 'preSelectedItemChange': [id: string | undefined];
970
+ 'selectedViewChange': [id: number];
971
+ 'pageDataChange': [pageData: PageData];
972
+ 'zoomChange': [zoom: number];
973
+ 'progress': [{
974
+ duration: number;
975
+ time: number;
976
+ end: boolean;
977
+ paused: boolean;
978
+ }];
979
+ 'itemPropertyChange': [{
980
+ id: string;
981
+ property: string;
982
+ }];
983
+ 'exportProgress': [progress?: number];
984
+ 'exportDone': [item: ExportMediaItemOptions | undefined, success: boolean, buffer?: FileBuffer];
985
+ 'exportComplete': [success: boolean, taskInfos: ExportMediaItemOptions[], buffers?: FileBuffer[]];
986
+ 'sdkConfigChange': [preSDKConfig: SDKConfig, curSDKConfig: SDKConfig];
987
+ 'cutBoxChange': [box: Box2];
988
+ 'expandBoxChange': [box: Box2];
989
+ 'textInput': [{
990
+ text: string;
991
+ fontFamily: string;
992
+ }];
993
+ 'undoRedoChange': [Operation];
994
+ 'viewportTransform': [{
995
+ zoom: number;
996
+ translatoion: [number, number];
997
+ }];
998
+ };
999
+ declare class SDK {
1000
+ static config: SDKConfig;
1001
+ private _eventEmitter;
1002
+ private _pageData;
1003
+ private _screenShot;
1004
+ private _exporter?;
1005
+ private _pageDataUtils;
1006
+ private _sizeAdapt;
1007
+ private _gestureHandler;
1008
+ private disposables;
1009
+ private _isSwitchScene;
1010
+ private _undoRedo;
1011
+ player: Player;
1012
+ _container: HTMLElement;
1013
+ private _playerContainer;
1014
+ constructor(container: HTMLElement, mode?: SDKMode);
1015
+ get container(): HTMLElement;
1016
+ get pageData(): PageData | undefined;
1017
+ get exportStatus(): string | undefined;
1018
+ get undoRedo(): UndoRedo;
1019
+ private get exportOptions();
1020
+ dispose(): void;
1021
+ on: <E extends "progress" | "loadingItemChange" | "selectedItemChange" | "preSelectedItemChange" | "selectedViewChange" | "pageDataChange" | "zoomChange" | "itemPropertyChange" | "exportProgress" | "exportDone" | "exportComplete" | "sdkConfigChange" | "cutBoxChange" | "expandBoxChange" | "textInput" | "undoRedoChange" | "viewportTransform">(eventName: E, listener: _galacean_effects.EventEmitterListener<SDKEvents[E]>, options?: _galacean_effects.EventEmitterOptions) => () => void;
1022
+ setSDKMode(mode: SDKMode): void;
1023
+ private getInitParam;
1024
+ /**
1025
+ * 检测导出是否需要重新初始化
1026
+ * @param preExportVideoConfig
1027
+ * @param curExportVideoConfig
1028
+ */
1029
+ private checkExporter;
1030
+ private initExporter;
1031
+ private initSDK;
1032
+ run(param: SDKInputParam): Promise<void>;
1033
+ getPageData(): PageData;
1034
+ getActiveItems(): string[];
1035
+ setPreSelectedItem(id: string): void;
1036
+ getPreSelectedItem(): string;
1037
+ setSelectedItems(itemIds: string[]): void;
1038
+ /**
1039
+ * @description 获取目标元素的所有属性
1040
+ * @param param 元素ID、类型
1041
+ * @returns 元素属性
1042
+ */
1043
+ getItemProperty<T extends keyof PageFormTypeAndPropertyReference>(param: GetItemPropertyParam<T>): GetItemPropertyResult<T> | undefined;
1044
+ /**
1045
+ * @description 获取目标元素的指定属性
1046
+ * @param param 元素ID、类型、属性名
1047
+ * @returns 元素属性值
1048
+ */
1049
+ getItemPropertyValue<T extends keyof PageFormTypeAndPropertyReference, N extends keyof PageFormTypeAndPropertyReference[T]>(param: GetItemPropertyValueParam<T, N>): GetItemPropertyValueResult<T, N> | undefined;
1050
+ setItemPropertyValue(param: SetItemPropertyValueParam): Promise<void>;
1051
+ generateScreenShot(id: number, size?: [number, number], tick?: number, backgroundColor?: spec.vec4): Promise<string | undefined>;
1052
+ /**
1053
+ * @description 切换场景
1054
+ * @param index 场景索引
1055
+ */
1056
+ switchScene(index: number): Promise<void>;
1057
+ /**
1058
+ * @description 获取页面的 safeAreaPreview、zoom、adsorption 值
1059
+ * @returns 页面的 safeAreaPreview、zoom、adsorption 值
1060
+ */
1061
+ getPageConfig(): PageConfig;
1062
+ /**
1063
+ * 设置页面的 safeAreaPreview、zoom、adsorption 值
1064
+ * @param pageProperty 设置
1065
+ */
1066
+ setPageConfig(pageConfig: PageConfig): void;
1067
+ /**
1068
+ * @description 设置播放进度
1069
+ * @param progress 播放进度 0-100
1070
+ */
1071
+ setPlayProgress(progress: number): Promise<void>;
1072
+ getViewItems(): ViewItem[];
1073
+ setPlayState(playState: 'play' | 'pause'): Promise<void>;
1074
+ /**
1075
+ * @description 获取场景预览图
1076
+ * @returns 视图预览图
1077
+ */
1078
+ getViewThumbnail(): Promise<{
1079
+ id: number;
1080
+ thumbnail: string | undefined;
1081
+ }>[];
1082
+ /**
1083
+ * @description 获取视图JSON产物
1084
+ * @returns 当前所有视图JSON产物
1085
+ */
1086
+ getViewScene(): {
1087
+ id: number;
1088
+ thumbnail: spec.JSONScene;
1089
+ }[];
1090
+ private destroyCompositions;
1091
+ /**
1092
+ * @description 导出,支持导出媒体或其他,如MP4,未来支持 JSON 等;
1093
+ */
1094
+ onExport(): void;
1095
+ /**
1096
+ * @description 取消导出
1097
+ */
1098
+ cancelExport(): void;
1099
+ loadPageData(data: PageData): Promise<void>;
1100
+ runByPageData(data: PageData): Promise<void>;
1101
+ reloadPageDataByScene(scene: string | spec.JSONScene): Promise<void>;
1102
+ addViewParams(viewParams: ViewParam[]): Promise<void>;
1103
+ deleteViewParams(ids: number[]): Promise<void>;
1104
+ setExportParam(exportParam: Partial<ExportParam>, id?: number): void;
1105
+ /**
1106
+ * @description 设置视图缩放
1107
+ * @param zoom 缩放值
1108
+ */
1109
+ setPageZoom(zoom: number, center?: Vector2, ignoreClamp?: boolean): void;
1110
+ setPageMove(targetTranslation: Vector2): void;
1111
+ /**
1112
+ * @description 设置静态预览功能开关
1113
+ * @param enabled 功能开关
1114
+ */
1115
+ setStaticPreviewEnabled(enabled: boolean): void;
1116
+ /**
1117
+ * @description 设置静态预览视图名称
1118
+ * @param name 视图名称
1119
+ */
1120
+ setStaticPreviewName(name: string): void;
1121
+ /**
1122
+ * @description 设置同步修改功能开关
1123
+ * @param enabled 功能开关
1124
+ */
1125
+ setAsyncEnabled(enabled: boolean): void;
1126
+ /**
1127
+ * @description 设置 成组显影 开关
1128
+ */
1129
+ setGroupVisibleEnabled(enabled: boolean): void;
1130
+ /**
1131
+ * @description 新增过滤元素名称
1132
+ * @param itemNames 过滤元素名称
1133
+ */
1134
+ addFilterItemNames(itemNames: string[] | string): void;
1135
+ /**
1136
+ * @description 设置预览辅助层颜色
1137
+ * @param color 色值
1138
+ */
1139
+ setPreferenceBackgroundColor(color: [number, number, number, number]): void;
1140
+ /**
1141
+ * @description 设置出血区颜色
1142
+ * @param color 色值
1143
+ */
1144
+ setSafeAreaColor(color: [number, number, number, number]): void;
1145
+ /**
1146
+ * @description 设置 尺寸自适应拓展 功能开关
1147
+ * @param enabled 功能开关
1148
+ */
1149
+ setSizeAdaptEnabled(enabled: boolean): void;
1150
+ /**
1151
+ * @description 设置 截图 功能开关
1152
+ * @param enabled 功能开关
1153
+ */
1154
+ setScreenShotEnabled(enabled: boolean): void;
1155
+ /**
1156
+ * @description 设置导出功能初始化配置
1157
+ * @param exportConfig
1158
+ */
1159
+ setExportConfig(exportConfig: Partial<ExportConfig>): void;
1160
+ /**
1161
+ * @description 设置预选框参数
1162
+ * @param preSelectedColor 预选框颜色
1163
+ * @param preSelectedWidth 预选框线框宽度
1164
+ */
1165
+ setSelectorGizmoPreSelectConfig(preSelectedColor?: number, preSelectedWidth?: number): void;
1166
+ /**
1167
+ * @description 设置 变换控制器 交互框参数
1168
+ * @param config 参数
1169
+ */
1170
+ setTranformGizmoWireframeConfig(config: {
1171
+ wireframeColor?: number;
1172
+ wireframeAlpha?: number;
1173
+ wireframeWidth?: number;
1174
+ }): void;
1175
+ /**
1176
+ * @description 获取 SDK 配置参数
1177
+ * @returns SDK 配置参数
1178
+ */
1179
+ getSDKConfig(): SDKConfig;
1180
+ /**
1181
+ * @description 设置 SDK 配置参数
1182
+ * @param config SDK 配置参数
1183
+ */
1184
+ setSDKConfig(config: SDKConfig): void;
1185
+ /**
1186
+ * @description 设置SDK背景
1187
+ * @param type 背景类型
1188
+ * @param value 值
1189
+ */
1190
+ setSDKBackground(type: SDKBackgroundType, value?: string): void;
1191
+ /**
1192
+ * @description 创建图层元素
1193
+ * @param spriteInfo 图层元素信息
1194
+ */
1195
+ addSpriteItem(spriteInfo: SpriteCreateInfo, scene?: spec.JSONScene): Promise<string | undefined>;
1196
+ openPictureCutGizmo(): void;
1197
+ closePictureCutGizmo(): void;
1198
+ getCutInfo(): {
1199
+ cutBox: Box2;
1200
+ itemBox: Box2;
1201
+ } | undefined;
1202
+ setCutBox(min: Vector2, max: Vector2): Box2 | undefined;
1203
+ openPictureExpandGizmo(): void;
1204
+ closePictureExpandGizmo(): void;
1205
+ getExpandInfo(): {
1206
+ expandBox: Box2;
1207
+ itemBox: Box2;
1208
+ } | undefined;
1209
+ setExpandBox(min: Vector2, max: Vector2): Box2 | undefined;
1210
+ openMaskGizmo(brushSize: number): void;
1211
+ clearMaskGizmo(): void;
1212
+ closeMaskGizmo(): void;
1213
+ getMask(): string | null | undefined;
1214
+ setMaskGizmoConfig(config: Partial<MaskGizmoConfig>): void;
1215
+ openLoadingGizmo(id: string): void;
1216
+ closeLoadingGizmo(id: string): void;
1217
+ /**
1218
+ * @description 元素打组
1219
+ * @param children 子元素ID
1220
+ */
1221
+ groupItems(nullInfo: NullCreateInfo, scene?: spec.JSONScene): string | undefined;
1222
+ addTextItem(textInfo: TextCreateInfo, scene?: spec.JSONScene): Promise<void>;
1223
+ deleteItems(idInfo: string | string[]): void;
1224
+ getItemCreateInfo(idInfo: string | string[]): ItemCreateInfo[];
1225
+ createScreenShotSceneByIds(idInfo: string | string[], time?: number): Promise<string | undefined>;
1226
+ getChildrenIds(id: string): string[];
1227
+ /**
1228
+ * @description 更新元素在图层中的顺序
1229
+ * @param id 元素ID
1230
+ * @param action 排序操作:BringToFront(置于顶层)、SendToBack(置于底层)、BringForward(上移一层)、SendBackward(下移一层)
1231
+ */
1232
+ updateItemOrder(id: string, action: ItemOrderAction): void;
1233
+ /**
1234
+ * @description 导出JSON
1235
+ * @param idInfo 视图序号信息
1236
+ * @returns JSON数组
1237
+ */
1238
+ exportJSON(idInfo?: number | number[]): spec.JSONScene[];
1239
+ getViewBoxById(id: string): Box2;
1240
+ getViewItemById(id: string): ViewItem | undefined;
1241
+ getViewProperty(id: number): ViewProperty | undefined;
1242
+ pageMove(shift: [number, number]): void;
1243
+ pageZoom(shift: number, center?: [number, number]): void;
1244
+ setPictureCutGizmoLockScale(state: boolean): void;
1245
+ setPictureExpandGizmoLockScale(state: boolean): void;
1246
+ viewportFit(): void;
1247
+ getItemBoxById(idInfo: string): Box2;
1248
+ }
1249
+
1250
+ type SizeAdaptDirection = 'x' | 'y';
48
1251
 
49
1252
  type BaseFormProperty = {
50
- position: [number, number, number];
1253
+ position: [number, number];
51
1254
  rotation: [number, number, number];
52
- scale: [number, number, number];
1255
+ size: [number, number];
1256
+ visible: boolean;
53
1257
  keyPropertyEditing: boolean;
54
1258
  };
55
1259
  type SpriteFormProperty = BaseFormProperty & {
56
1260
  image: string;
57
1261
  };
58
1262
  type TextFormProperty = BaseFormProperty & {
59
- font: string;
60
- color: [number, number, number, number];
61
- weight: spec.TextWeight;
1263
+ fontFamily: string;
1264
+ textColor: [number, number, number, number];
1265
+ fontWeight: spec.TextWeight;
62
1266
  text: string;
63
- alignment: spec.TextAlignment;
1267
+ textAlign: spec.TextAlignment;
1268
+ fontSize: number;
1269
+ fontStyle: spec.FontStyle;
1270
+ textWidth: number;
1271
+ lineHeight: number;
1272
+ outlineColor?: spec.vec4;
1273
+ outlineWidth?: number;
64
1274
  };
65
1275
  /**
66
1276
  * @description 页面表单类型和属性引用
@@ -93,26 +1303,37 @@ type SpecificPageFormProps<T extends keyof PageFormTypeAndPropertyReference> = {
93
1303
  property: PageFormTypeAndPropertyReference[T];
94
1304
  onPropertyValueChange: <N extends keyof PageFormTypeAndPropertyReference[T]>(propertyName: N, propertyValue: PageFormTypeAndPropertyReference[T][N]) => void;
95
1305
  };
1306
+ type SDKOptions = {
1307
+ /** 导出视频时,是否开启转码日志 */
1308
+ loggerInExportVideoTranscoding?: boolean;
1309
+ };
1310
+ type SDKInputParam = SDKTemplateInputParam | SDKEditorInputParam;
96
1311
  /**
97
1312
  * @description SDK入参
98
1313
  */
99
- type SDKInputParam = {
1314
+ type SDKTemplateInputParam = {
100
1315
  /**
101
1316
  * @description JSON地址
102
1317
  */
103
1318
  scene: string | spec.JSONScene;
1319
+ /**
1320
+ * @description SDK模式 - 模板编辑模式
1321
+ */
1322
+ mode: 'template';
104
1323
  /**
105
1324
  * @description 视图参数
106
1325
  */
107
- viewParams: ViewParam[];
1326
+ viewParams?: ViewParam[];
108
1327
  /**
109
1328
  * @description 页面属性
110
1329
  */
111
1330
  options: PageOptions;
1331
+ };
1332
+ type SDKEditorInputParam = {
112
1333
  /**
113
- * @description 是否开启出血区强制变换
1334
+ * @description SDK模式 - 编辑器模式
114
1335
  */
115
- keepSafe: boolean;
1336
+ mode: 'editor';
116
1337
  };
117
1338
  /**
118
1339
  * @description 页面属性
@@ -135,6 +1356,10 @@ type PageOptions = {
135
1356
  * @description 页面数据
136
1357
  */
137
1358
  type PageData = {
1359
+ /**
1360
+ * @description 基础场景数据
1361
+ */
1362
+ scene: spec.JSONScene;
138
1363
  /**
139
1364
  * @description 页面属性
140
1365
  */
@@ -179,7 +1404,7 @@ type PageConfig = {
179
1404
  /**
180
1405
  * @description 同步开关
181
1406
  */
182
- sync: boolean;
1407
+ asyncMode: boolean;
183
1408
  };
184
1409
  /**
185
1410
  * @description 页面属性
@@ -204,7 +1429,7 @@ type PageProperty = {
204
1429
  /**
205
1430
  * @description 同步开关
206
1431
  */
207
- sync: boolean;
1432
+ asyncMode: boolean;
208
1433
  };
209
1434
  /**
210
1435
  * @description 视图创建参数
@@ -213,11 +1438,19 @@ type ViewParam = {
213
1438
  /**
214
1439
  * @description 页面尺寸
215
1440
  */
216
- size: [number, number];
1441
+ size?: [number, number];
217
1442
  /**
218
1443
  * @description 出血区参数
219
1444
  */
220
- safeArea: [number, number, number, number];
1445
+ safeArea?: [number, number, number, number];
1446
+ /**
1447
+ * @description 自适应方向 - 默认根据视图宽高决定
1448
+ */
1449
+ adaptionDirection?: SizeAdaptDirection;
1450
+ /**
1451
+ * @description 自定义出血区 - 用于展示
1452
+ */
1453
+ previewSafeAreas?: PreviewSafeAreaParam[];
221
1454
  /**
222
1455
  * @description 导出参数
223
1456
  */
@@ -228,22 +1461,10 @@ type ViewParam = {
228
1461
  */
229
1462
  type ExportParam = {
230
1463
  /**
231
- * @description 导出视频时长
232
- */
233
- time: number;
234
- /**
235
- * @description 导出大小上限 - 单位kb
1464
+ * @description 视频名称
236
1465
  */
237
- fileSizeLimit: number;
238
- /**
239
- * @description 是否开启音轨
240
- */
241
- audioEnable: boolean;
242
- /**
243
- * @description 导出视频类型 - 预留参数
244
- */
245
- type?: string;
246
- };
1466
+ name?: string;
1467
+ } & Omit<ExportMediaItemOptions, 'scene' | 'size'>;
247
1468
  /**
248
1469
  * @description 视图属性
249
1470
  */
@@ -261,13 +1482,13 @@ type ViewProperty = {
261
1482
  */
262
1483
  safeArea: [number, number, number, number];
263
1484
  /**
264
- * @description 视图场景数据
1485
+ * @description 自定义出血区数据
265
1486
  */
266
- scene: spec.JSONScene;
1487
+ previewSafeAreas: PreviewSafeAreaParam[];
267
1488
  /**
268
- * @description 预览图数据
1489
+ * @description 视图场景数据
269
1490
  */
270
- thumbnail: string;
1491
+ scene: spec.JSONScene;
271
1492
  /**
272
1493
  * @description 导出参数
273
1494
  */
@@ -277,6 +1498,19 @@ type ViewProperty = {
277
1498
  */
278
1499
  ignoreInteraction: boolean;
279
1500
  };
1501
+ /**
1502
+ * @description 自定义出血区数据
1503
+ */
1504
+ type PreviewSafeAreaParam = {
1505
+ /**
1506
+ * @description 出血区包围盒 [left top width height]
1507
+ */
1508
+ box: [number, number, number, number];
1509
+ /**
1510
+ * @description 出血区色块颜色 默认为 [255, 255, 255, 0.3]
1511
+ */
1512
+ color?: [number, number, number, number];
1513
+ };
280
1514
  /**
281
1515
  * @description 页面活跃数据
282
1516
  */
@@ -293,6 +1527,10 @@ type ActiveData = {
293
1527
  * @description 预选中元素
294
1528
  */
295
1529
  preSelectedItem?: string;
1530
+ /**
1531
+ * @description 执行中元素
1532
+ */
1533
+ loadingItems?: string[];
296
1534
  };
297
1535
  /**
298
1536
  * @description 视图元素
@@ -327,113 +1565,163 @@ type ViewItem = {
327
1565
  */
328
1566
  endBehavior: spec.EndBehavior;
329
1567
  } & ViewItemTypedProperty;
330
-
331
- declare const ExportStatusMap: {
332
- readonly DEFAULT: "default";
333
- readonly EXPORTING: "exporting";
334
- readonly SUCCESS: "success";
335
- readonly ERROR: "error";
1568
+ type SDKBackgroundType = 'color' | 'image' | 'chess-board';
1569
+ /**
1570
+ * @description 图层创建信息
1571
+ */
1572
+ type SpriteCreateInfo = {
1573
+ type: 'sprite';
1574
+ /**
1575
+ * @description 图层名称
1576
+ */
1577
+ name?: string;
1578
+ /**
1579
+ * @description 元素id
1580
+ */
1581
+ id?: string;
1582
+ /**
1583
+ * @description 父节点id
1584
+ */
1585
+ parentId?: string;
1586
+ /**
1587
+ * @description 图片资源地址
1588
+ */
1589
+ url: string;
1590
+ /**
1591
+ * @description 图层元素像素大小
1592
+ */
1593
+ size: spec.vec2;
1594
+ /**
1595
+ * @description 图层元素缩放
1596
+ */
1597
+ scale?: spec.vec2;
1598
+ /**
1599
+ * @description 图层元素旋转
1600
+ */
1601
+ rotation?: number;
1602
+ /**
1603
+ * @description 图层元素二维位置
1604
+ */
1605
+ position: spec.vec2;
336
1606
  };
337
- type ExportStatus = typeof ExportStatusMap[keyof typeof ExportStatusMap];
338
- type SDKEvents = {
339
- 'selectedItemChange': [id: string[]];
340
- 'preSelectedItemChange': [id: string | undefined];
341
- 'selectedViewChange': [id: number];
342
- 'pageDataChange': [pageData: PageData];
343
- 'zoomChange': [zoom: number];
344
- 'progress': [{
345
- duration: number;
346
- time: number;
347
- end: boolean;
348
- paused: boolean;
349
- }];
350
- 'itemPropertyChange': [{
351
- id: string;
352
- property: string;
353
- }];
354
- 'exportProgress': [progress?: number];
355
- 'exportComplete': [success: boolean];
1607
+ /**
1608
+ * @description 空节点创建信息
1609
+ */
1610
+ type NullCreateInfo = {
1611
+ type: 'null';
1612
+ /**
1613
+ * @description 元素id
1614
+ */
1615
+ id?: string;
1616
+ /**
1617
+ * @description 父节点id
1618
+ */
1619
+ parentId?: string;
1620
+ /**
1621
+ * @description 元素名称
1622
+ */
1623
+ name?: string;
1624
+ /**
1625
+ * @description 空节点缩放
1626
+ */
1627
+ scale?: spec.vec2;
1628
+ /**
1629
+ * @description 子元素id
1630
+ */
1631
+ children: string[];
1632
+ /**
1633
+ * @description 空节点旋转
1634
+ */
1635
+ rotation?: number;
1636
+ /**
1637
+ * @description 空节点位移
1638
+ */
1639
+ position?: spec.vec2;
356
1640
  };
357
- declare class SDK {
358
- private _eventEmitter;
359
- private _pageData;
360
- private _screenShotContainer;
361
- private _screenShotPlayer;
362
- private _SDKUtils;
363
- private _ExportVideo;
364
- private _gestureHandler;
365
- private _playerContainer;
366
- private _exportStatus;
367
- private disposables;
368
- player: Player;
369
- constructor(container: HTMLElement);
370
- get pageData(): PageData | undefined;
371
- get exportStatus(): ExportStatus;
372
- private get exportOptions();
373
- dispose(): void;
374
- on: <E extends "progress" | "selectedItemChange" | "preSelectedItemChange" | "selectedViewChange" | "pageDataChange" | "zoomChange" | "itemPropertyChange" | "exportProgress" | "exportComplete">(eventName: E, listener: _galacean_effects_weapp.EventEmitterListener<SDKEvents[E]>, options?: _galacean_effects_weapp.EventEmitterOptions) => () => void;
375
- private getInitParam;
376
- private initSDK;
377
- run(param: SDKInputParam): Promise<void>;
378
- getPageData(): PageData;
379
- getActiveItems(): string[];
380
- setPreSelectedItem(id: string): void;
381
- getPreSelectedItem(): string;
382
- setSelectedItems(itemIds: string[]): void;
1641
+ /**
1642
+ * @description 文本创建信息
1643
+ */
1644
+ type TextCreateInfo = {
1645
+ type: 'text';
383
1646
  /**
384
- * @description 获取目标元素的所有属性
385
- * @param param 元素ID、类型
386
- * @returns 元素属性
1647
+ * @description 元素id
387
1648
  */
388
- getItemProperty<T extends keyof PageFormTypeAndPropertyReference>(param: GetItemPropertyParam<T>): GetItemPropertyResult<T> | undefined;
1649
+ id?: string;
389
1650
  /**
390
- * @description 获取目标元素的指定属性
391
- * @param param 元素ID、类型、属性名
392
- * @returns 元素属性值
1651
+ * @description 父节点id
393
1652
  */
394
- getItemPropertyValue<T extends keyof PageFormTypeAndPropertyReference, N extends keyof PageFormTypeAndPropertyReference[T]>(param: GetItemPropertyValueParam<T, N>): GetItemPropertyValueResult<T, N> | undefined;
395
- setItemPropertyValue(param: SetItemPropertyValueParam): Promise<void>;
396
- generateScreenShot(id: number): Promise<string>;
1653
+ parentId?: string;
397
1654
  /**
398
- * @description 切换场景
399
- * @param index 场景索引
1655
+ * @description 元素名称
400
1656
  */
401
- switchScene(index: number): Promise<void>;
1657
+ name?: string;
402
1658
  /**
403
- * @description 获取页面的 safeAreaPreview、zoom、adsorption 值
404
- * @returns 页面的 safeAreaPreview、zoom、adsorption 值
1659
+ * @description 单行高度
405
1660
  */
406
- getConfig(): PageConfig;
1661
+ lineHeight: number;
407
1662
  /**
408
- * 设置页面的 safeAreaPreview、zoom、adsorption 值
409
- * @param pageProperty 设置
1663
+ * @description 文本高度
410
1664
  */
411
- setConfig(pageConfig: PageConfig): void;
1665
+ textHeight?: number;
412
1666
  /**
413
- * @description 设置播放进度
414
- * @param progress 播放进度 0-100
1667
+ * @description 宽度
415
1668
  */
416
- setPlayProgress(progress: number): Promise<void>;
417
- getViewItems(): ViewItem[];
418
- setPlayState(playState: 'play' | 'pause'): void;
1669
+ textWidth: number;
419
1670
  /**
420
- * @description 获取场景预览图
421
- * @returns 视图预览图
1671
+ * @description 字体名称
422
1672
  */
423
- getViewThumbnail(): {
424
- id: number;
425
- thumbnail: string;
426
- }[];
427
- private onExportProgress;
428
- private onExportFinish;
429
- private onExportError;
1673
+ fontFamily: string;
430
1674
  /**
431
- * @description 导出视频
1675
+ * @description 文本位置
432
1676
  */
433
- exportAllVideos(): void;
434
- cancelExportAllVideos(): void;
435
- loadPageData(data: PageData): Promise<void>;
436
- runByPageData(data: PageData): Promise<void>;
1677
+ position?: spec.vec2;
1678
+ /**
1679
+ * @description 文本旋转
1680
+ */
1681
+ rotation?: number;
1682
+ /**
1683
+ * @description 文字大小
1684
+ */
1685
+ fontSize: number;
1686
+ /**
1687
+ * @description 字重
1688
+ */
1689
+ fontWeight?: spec.TextWeight;
1690
+ /**
1691
+ * @description 字体格式
1692
+ */
1693
+ fontStyle?: spec.FontStyle;
1694
+ /**
1695
+ * @description 对齐方式
1696
+ */
1697
+ textAlign?: spec.TextAlignment;
1698
+ /**
1699
+ * @description 文本信息
1700
+ */
1701
+ text: string;
1702
+ /**
1703
+ * @description 填充色
1704
+ */
1705
+ textColor: spec.vec4;
1706
+ /**
1707
+ * @description 描边色
1708
+ */
1709
+ outlineColor?: spec.vec4;
1710
+ /**
1711
+ * @description 描边宽度
1712
+ */
1713
+ outlineWidth?: number;
1714
+ /**
1715
+ * @description 字体文件地址
1716
+ */
1717
+ url?: string;
1718
+ };
1719
+ type ItemCreateInfo = NullCreateInfo | SpriteCreateInfo | TextCreateInfo;
1720
+ declare enum ItemOrderAction {
1721
+ BringToFront = 0,
1722
+ SendToBack = 1,
1723
+ BringForward = 2,
1724
+ SendBackward = 3
437
1725
  }
438
1726
 
439
- 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 };
1727
+ export { type ActiveData, type BaseFormProperty, Box2, type CreateOperation, type DeleteOperation, type ItemCreateInfo, ItemOrderAction, type NullCreateInfo, type Operation, type PageData, type PageFormTypedProperty, type PageProperty, SDK, type SDKEvents, type SDKInputParam, type SDKOptions, type SetItemPropertyValueParam, type SpecificPageFormProps, type SpriteCreateInfo, type SpriteFormProperty, type TextCreateInfo, type TextFormProperty, type UpdateOperation, Vector2, type ViewItem, type ViewItemTypedProperty, type ViewParam, type ViewProperty };