@vvfx/sdk 0.1.19-alpha.37 → 0.1.19-alpha.38

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.
Files changed (96) hide show
  1. package/LICENSE +22 -0
  2. package/dist/index.js +87037 -14
  3. package/dist/index.js.map +1 -0
  4. package/dist/index.mjs +87141 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/dist/src/config.d.ts +855 -0
  7. package/dist/src/exporter/config.d.ts +18 -0
  8. package/dist/src/exporter/const.d.ts +71 -0
  9. package/dist/src/exporter/export-media.d.ts +68 -0
  10. package/dist/src/exporter/exporter.d.ts +22 -0
  11. package/dist/src/exporter/index.d.ts +2 -0
  12. package/dist/src/exporter/types.d.ts +194 -0
  13. package/dist/src/exporter/utils.d.ts +22 -0
  14. package/dist/src/exporter/wav-audio.d.ts +27 -0
  15. package/dist/src/gesture-handler/gizmo/adsorption-gizmo.d.ts +68 -0
  16. package/dist/src/gesture-handler/gizmo/control-gizmo.d.ts +67 -0
  17. package/dist/src/gesture-handler/gizmo/gizmo.d.ts +59 -0
  18. package/dist/src/gesture-handler/gizmo/icon-gizmo.d.ts +44 -0
  19. package/dist/src/gesture-handler/gizmo/index.d.ts +6 -0
  20. package/dist/src/gesture-handler/gizmo/item-create-gizmo.d.ts +43 -0
  21. package/dist/src/gesture-handler/gizmo/loading-gizmo.d.ts +48 -0
  22. package/dist/src/gesture-handler/gizmo/mask-gizmo.d.ts +113 -0
  23. package/dist/src/gesture-handler/gizmo/picture-cut-gizmo.d.ts +94 -0
  24. package/dist/src/gesture-handler/gizmo/picture-expand-gizmo.d.ts +57 -0
  25. package/dist/src/gesture-handler/gizmo/preference-gizmo.d.ts +32 -0
  26. package/dist/src/gesture-handler/gizmo/selector-gizmo.d.ts +101 -0
  27. package/dist/src/gesture-handler/gizmo/sprite-text-edit-gizmo.d.ts +36 -0
  28. package/dist/src/gesture-handler/gizmo/text-gizmo.d.ts +128 -0
  29. package/dist/src/gesture-handler/gizmo/transform-gizmo.d.ts +233 -0
  30. package/dist/src/gesture-handler/gizmo/type.d.ts +402 -0
  31. package/dist/src/gesture-handler/index.d.ts +3 -0
  32. package/dist/src/gesture-handler/src/gesture-handler.d.ts +143 -0
  33. package/dist/src/gesture-handler/src/icons.d.ts +7 -0
  34. package/dist/src/gesture-handler/utils.d.ts +2 -0
  35. package/dist/src/html-overlay/document-runtime.d.ts +3 -0
  36. package/dist/src/html-overlay/document-transform.d.ts +7 -0
  37. package/dist/src/html-overlay/index.d.ts +1 -0
  38. package/dist/src/html-overlay/manager.d.ts +43 -0
  39. package/dist/src/html-overlay/mime-utils.d.ts +2 -0
  40. package/dist/src/html-overlay/path-utils.d.ts +8 -0
  41. package/dist/src/index.d.ts +14 -0
  42. package/dist/src/math/box2.d.ts +166 -0
  43. package/dist/src/math/circle.d.ts +82 -0
  44. package/dist/src/math/euler.d.ts +20 -0
  45. package/dist/src/math/index.d.ts +13 -0
  46. package/dist/src/math/line2.d.ts +93 -0
  47. package/dist/src/math/line3.d.ts +17 -0
  48. package/dist/src/math/matrix4.d.ts +28 -0
  49. package/dist/src/math/plane.d.ts +14 -0
  50. package/dist/src/math/quaternion.d.ts +3 -0
  51. package/dist/src/math/ray-caster.d.ts +10 -0
  52. package/dist/src/math/ray.d.ts +18 -0
  53. package/dist/src/math/type.d.ts +32 -0
  54. package/dist/src/math/utils.d.ts +19 -0
  55. package/dist/src/math/vector2.d.ts +30 -0
  56. package/dist/src/math/vector3.d.ts +29 -0
  57. package/dist/src/screen-shot/index.d.ts +1 -0
  58. package/dist/src/screen-shot/screen-shot.d.ts +35 -0
  59. package/dist/src/sdk-item/base-item.d.ts +126 -0
  60. package/dist/src/sdk-item/card-item.d.ts +57 -0
  61. package/dist/src/sdk-item/effects-item.d.ts +70 -0
  62. package/dist/src/sdk-item/frame-item.d.ts +112 -0
  63. package/dist/src/sdk-item/generator-item.d.ts +86 -0
  64. package/dist/src/sdk-item/group-item.d.ts +57 -0
  65. package/dist/src/sdk-item/index.d.ts +36 -0
  66. package/dist/src/sdk-item/sprite-item.d.ts +67 -0
  67. package/dist/src/sdk-item/text-item.d.ts +107 -0
  68. package/dist/src/sdk-item/types.d.ts +153 -0
  69. package/dist/src/sdk-item/video-item.d.ts +87 -0
  70. package/dist/src/sdk.d.ts +589 -0
  71. package/dist/src/service/UndoRedo.d.ts +48 -0
  72. package/dist/src/shared/index.d.ts +1 -0
  73. package/dist/src/shared/player.d.ts +9 -0
  74. package/dist/src/size-adapte/index.d.ts +1 -0
  75. package/dist/src/size-adapte/size-adapt.d.ts +28 -0
  76. package/dist/src/types.d.ts +1235 -0
  77. package/dist/src/utils/background-manager.d.ts +72 -0
  78. package/dist/src/utils/common-utils.d.ts +28 -0
  79. package/dist/src/utils/index.d.ts +8 -0
  80. package/dist/src/utils/interaction-utils.d.ts +60 -0
  81. package/dist/src/utils/json-data-utils.d.ts +165 -0
  82. package/dist/src/utils/layout-utils.d.ts +219 -0
  83. package/dist/src/utils/page-data-utils.d.ts +370 -0
  84. package/dist/src/utils/player-data-utils.d.ts +11 -0
  85. package/dist/src/utils/types.d.ts +114 -0
  86. package/dist/src/wireframe/common/box.d.ts +1 -0
  87. package/dist/src/wireframe/common/dashed-line.d.ts +1 -0
  88. package/dist/src/wireframe/common/line.d.ts +1 -0
  89. package/dist/src/wireframe/common/pixi-ext.d.ts +11 -0
  90. package/dist/src/wireframe/common/pixi.d.ts +18 -0
  91. package/dist/src/wireframe/index.d.ts +4 -0
  92. package/package.json +41 -23
  93. package/dist/index.cjs +0 -14
  94. package/dist/index.d.cts +0 -4891
  95. package/dist/index.d.ts +0 -4891
  96. package/dist/index.global.js +0 -333
package/dist/index.d.cts DELETED
@@ -1,4891 +0,0 @@
1
- import * as _galacean_effects from '@galacean/effects';
2
- import { math, spec, Player, EventEmitter, Composition, VFXItem, Constructor, Component } from '@galacean/effects';
3
- export { generateGUID, spec } from '@galacean/effects';
4
- import { Point } from '@pixi/constants';
5
-
6
- /**
7
- * @class 二维线段
8
- */
9
- declare class Line2 {
10
- start: Vector2;
11
- end: Vector2;
12
- constructor(start?: Vector2, end?: Vector2);
13
- /**
14
- * 设置二维线段
15
- * @param {Vector2} start 线段起点
16
- * @param {Vector2} end 线段终点
17
- * @returns {Line2} 二维线段
18
- */
19
- set(start: Vector2, end: Vector2): this;
20
- /**
21
- * 复制二维线段
22
- * @param {Line2} line 复制对象
23
- * @returns {Line2} 复制结果
24
- */
25
- copyFrom(line: Line2): this;
26
- /**
27
- * 二维线段求方向
28
- * @returns {Vector2} 二维线段方向
29
- */
30
- direction(): Vector2;
31
- /**
32
- * 二维线段求中点
33
- * @param {Vector2} [target=new Vector2()] 目标保存对象
34
- * @returns {Vector2} 二维线段中点
35
- */
36
- getCenter(target?: Vector2): Vector2;
37
- /**
38
- * 二维线段向量值
39
- * @param {Vector2} [target=new Vector2()] 目标保存对象
40
- * @returns {Vector2} 二维线段向量值
41
- */
42
- delta(target?: Vector2): Vector2;
43
- /**
44
- * 二维线段欧式距离平方(应用于计算)
45
- * @returns {number} 计算结果
46
- */
47
- distanceSq(): number;
48
- /**
49
- * 二维线段欧式距离
50
- * @returns {number} 计算结果
51
- */
52
- distance(): number;
53
- /**
54
- * 求二维线段比例点
55
- * @param {number} t 比例值
56
- * @param {Vector2} target 目标保存对象
57
- * @returns {Vector2} 比例点结果
58
- */
59
- at(t: number, target?: Vector2): Vector2;
60
- /**
61
- * 求点与线段的最短距离
62
- * @param {Vector2} point 二维空间点
63
- * @param {boolean} clampToLine 是否限制于线段内
64
- * @returns {number} 距离结果
65
- */
66
- closestPointToPointParameter(point: Vector2, clampToLine: boolean): number;
67
- /**
68
- * 求点与线段的最近交点
69
- * @param {Vector2} point 二维空间点
70
- * @param {boolean} clampToLine 是否限制于线段内
71
- * @param {Vector2} target 目标保存对象
72
- * @returns {Vector2} 最近交点
73
- */
74
- closestPointToPoint(point: Vector2, clampToLine: boolean, target?: Vector2): Vector2;
75
- /**
76
- * 二维线段判等
77
- * @param {Line2} line 二维线段
78
- * @returns {boolean} 判等结果
79
- */
80
- equals(line: Line2): boolean;
81
- /**
82
- * 克隆二维线段
83
- * @returns {Line2} 克隆结果
84
- */
85
- clone(): Line2;
86
- /**
87
- * 二维线段求长度
88
- * @returns {number} 长度
89
- */
90
- length(): number;
91
- /**
92
- * 二维线段判断相交
93
- * @param {Line2} other 二维线段
94
- * @returns {boolean} 相交判断结果
95
- */
96
- crossWithLine(other: Line2): boolean;
97
- }
98
-
99
- declare class Vector2 extends math.Vector2 {
100
- subtract(other: Vector2): this;
101
- toViewCoordinate(width: number, height: number): this;
102
- clone(): Vector2;
103
- distanceTo(other: Vector2): number;
104
- scaleByCenter(scalar: Vector2, anchor?: Vector2): this;
105
- round(precision?: number): this;
106
- /**
107
- * 点到直线的最短距离
108
- * @returns {{d: number, t: number}} d表示距离,t表示最近点在直线的比例
109
- */
110
- distanceToLine(line: Line2): {
111
- d: number;
112
- t: number;
113
- };
114
- /**
115
- * 二维向量与x轴夹角
116
- * @returns {number} 弧度值
117
- */
118
- angle(): number;
119
- /**
120
- * 二维点绕点旋转
121
- * @param {Vec2} center 旋转中心
122
- * @param {number} angle 旋转角度
123
- * @returns {Vec2} 旋转结果
124
- */
125
- rotateAround(center: Vector2, angle: number): this;
126
- }
127
-
128
- /**
129
- * @class 二维包围盒
130
- */
131
- declare class Box2 {
132
- /**
133
- * @member {Vector2[]} corners 二维包围盒角点
134
- */
135
- corners: Vector2[];
136
- min: Vector2;
137
- max: Vector2;
138
- /**
139
- * 构造函数,传入值为空时表示空包围盒
140
- * @param {Vector2} [min=new Vector2(Infinity, Infinity)] 最小点
141
- * @param {Vector2} [max=new Vector2(-Infinity, -Infinity)] 最大点
142
- */
143
- constructor(min?: Vector2, max?: Vector2);
144
- /**
145
- * 通过最大最小点设置二维包围盒
146
- * @param {Vector2} min 最小点
147
- * @param {Vector2} max 最大点
148
- * @returns {Box2} 二维包围盒
149
- */
150
- set(min: Vector2, max: Vector2): this;
151
- /**
152
- * 通过角点设置二维包围盒
153
- * @param {Vector2[]} vecArray 二维空间点数组
154
- * @returns {Box2} 二维包围盒
155
- */
156
- setFromVec2Array(vecArray: Vector2[]): this;
157
- /**
158
- * 通过屏幕坐标点设置二维包围盒 - 点为屏幕坐标点,x正方向为右,y正方向为向上
159
- * @param vecArray 屏幕坐标点
160
- */
161
- setFromVec2ArrayWithOutCorners(vecArray: Vector2[]): this;
162
- /**
163
- * 通过中心与大小设置二维包围盒
164
- * @param {Vector2} center 二维中心点
165
- * @param {Vector2} size 二维大小
166
- * @returns {Box2} 二维包围盒
167
- */
168
- setFromCenterAndSize(center: Vector2, size: Vector2): this;
169
- /**
170
- * 克隆二维包围盒
171
- * @returns {Box2} 克隆结果
172
- */
173
- clone(): Box2;
174
- /**
175
- * 复制二维包围盒
176
- * @param {Box2} box 二维包围盒
177
- * @returns {Box2} 复制结果
178
- */
179
- copyFrom(box: Box2): this;
180
- /**
181
- * 二维包围盒置空
182
- * @returns {Box2} 置空结果
183
- */
184
- makeEmpty(): this;
185
- /**
186
- * 二维包围盒判空
187
- * @returns {boolean} 判空结果
188
- */
189
- isEmpty(): boolean;
190
- /**
191
- * 获取二维包围盒角点
192
- * @returns {Vector2[]} 二维包围盒角点
193
- */
194
- getCorners(): Vector2[];
195
- /**
196
- * 获取二维包围盒中心点
197
- * @param {Vector2} [target=new Vector2()] 目标点(用以存放二维包围盒中心点)
198
- * @returns {Vector2} 二维包围盒中心点
199
- */
200
- getCenter(target?: Vector2): Vector2;
201
- /**
202
- * 获取二维包围盒大小
203
- * @param {Vector2} [target=new Vector2()] 目标向量(用以存放二维包围盒大小)
204
- * @returns {Vector2} 二维包围盒大小
205
- */
206
- getSize(target?: Vector2): Vector2;
207
- /**
208
- * 通过二维空间点扩展二维包围盒
209
- * @param {Vector2} point 二维空间点
210
- * @returns {Box2} 扩展包围盒
211
- */
212
- expandByPoint(point: Vector2): this;
213
- /**
214
- * 通过向量扩展二维包围盒
215
- * @param {Vector2} vector 二维向量
216
- * @returns {Box2} 扩展结果
217
- */
218
- expandByVector(vector: Vector2): this;
219
- /**
220
- * 通过大小扩展二维包围盒
221
- * @param {number} scalar 扩展大小
222
- * @returns {Box2} 扩展结果
223
- */
224
- expandByScalar(scalar: number): this;
225
- /**
226
- * 判断二维包围盒是否包含二维空间点
227
- * @param {Vector2} point 二维空间点
228
- * @param {boolean} [isOrthogonal=true] 包围盒正交判断(默认为true)
229
- * @returns {boolean} 点包含判断结果
230
- */
231
- containsPoint(point: Vector2, isOrthogonal?: boolean): boolean;
232
- /**
233
- * 判断二维包围盒包含关系(if this contains other)
234
- * @param {Box2} box 其它包围盒
235
- * @returns {boolean} 二维包围盒包含判断结果
236
- */
237
- containsBox(box: Box2): boolean;
238
- /**
239
- * 获取点以包围盒左上角顶点为原点的相对位置
240
- * @param {Vector2} point 指定二维空间点
241
- * @param {Vector2} [target=new Vector2()] 目标空间点
242
- * @returns {Vector2} 计算结果空间点
243
- */
244
- getParameter(point: Vector2, target?: Vector2): Vector2;
245
- /**
246
- * 求点与二维包围盒的最近点
247
- * @param {Vector2} point 二维空间点
248
- * @param {Vector2} [target=new Vector2()] 结果点
249
- * @returns {Vector2} 二维空间点
250
- */
251
- clampPoint(point: Vector2, target?: Vector2): Vector2;
252
- /**
253
- * 求点到二维包围盒的距离
254
- * @param {Vector2} point 二维空间点
255
- * @returns {number} 距离
256
- */
257
- distanceToPoint(point: Vector2): number;
258
- /**
259
- * 二维包围盒求交集
260
- * @param {Box2} box 二维包围盒
261
- * @returns {Box2} 求交结果
262
- */
263
- intersect(box: Box2): this;
264
- /**
265
- * 二维包围盒求并集
266
- * @param {Box2} box 二维包围盒
267
- * @returns {Box2} 求并结果
268
- */
269
- union(target: Box2 | Vector2): this;
270
- /**
271
- * 二维包围盒位移
272
- * @param {Vector2} offset 位移向量
273
- * @returns {Box2} 位移结果
274
- */
275
- translate(offset: Vector2): this;
276
- scale(scalar: number | Vector2, anchor?: Vector2): this;
277
- /**
278
- * 二维包围盒判等
279
- * @param {Box2} box 二维包围盒
280
- * @returns {boolean} 判等结果
281
- */
282
- equals(box: Box2): boolean;
283
- /**
284
- * 判断二维包围盒相交关系(if this intersect other)
285
- * @param {Box2} box 二维包围盒
286
- * @param {boolean} [isOrthogonal=true] 正交判断(当前包围盒)
287
- * @returns {boolean} 相交判断结果
288
- */
289
- intersectsBox(box: Box2, isOrthogonal?: boolean): boolean;
290
- rotate(angle: number, center?: Vector2): this;
291
- }
292
-
293
- declare class Quaternion extends math.Quaternion {
294
- }
295
-
296
- declare class Vector3 extends math.Vector3 {
297
- clone(): Vector3;
298
- /**
299
- * 由空间变换矩阵保存三维分量
300
- * @param {Matrix4} m 四维矩阵
301
- * @param {number} index 下标
302
- * @returns {Vec3} 指定三维分量
303
- */
304
- setFromMatrixColumn(m: Matrix4, index: number): this;
305
- applyEuler(euler: Euler, _out?: Vector3): this;
306
- /**
307
- * 三维点根据四元数绕点的旋转
308
- * @param {Quaternion} q 四元数
309
- * @param {Vec3} [center=new Vec3()] 旋转中心
310
- * @returns {Vec3} 旋转结果
311
- */
312
- applyQuaternion(q: Quaternion, center?: Vector3): this;
313
- /**
314
- * 由空间变换矩阵保存三维偏移值
315
- * @param {Matrix4} m 四维矩阵
316
- * @returns {Vec3} 偏移值
317
- */
318
- setFromMatrixPosition(m: Matrix4): this;
319
- applyMatrix(matrix: Matrix4, center?: Vector3): this;
320
- }
321
-
322
- declare class Matrix4 extends math.Matrix4 {
323
- /**
324
- * 通过数组创建矩阵
325
- * @param array - 数组
326
- * @param [offset=0] - 起始偏移值
327
- * @returns 矩阵
328
- */
329
- static fromArray(array: math.Matrix4DataType, offset?: number): Matrix4;
330
- clone(): Matrix4;
331
- compose(translation: Vector3, rotation: Quaternion, scale: Vector3, anchor?: math.Vector3): this;
332
- /**
333
- * 导出四维矩阵[三维空间变换矩阵]旋转部分
334
- * @param {Matrix4} m 四维矩阵
335
- * @returns {Matrix4} 导出结果
336
- */
337
- extractRotation(m: Matrix4): this;
338
- /**
339
- * 由欧拉角设置四维矩阵
340
- * @param {Euler} euler 欧拉角
341
- * @returns {Matrix4} 四维矩阵
342
- */
343
- makeRotationFromEuler(euler: Euler): this;
344
- setPosition(position: Vector3): this;
345
- }
346
-
347
- declare class Euler extends math.Euler {
348
- constructor(x?: number, y?: number, z?: number, order?: math.EulerOrder);
349
- getInvertMatrixByEuler(): Matrix4;
350
- /**
351
- * 欧拉角保存于三维向量(应用于计算)
352
- * @param {Vector3} [optionalResult] 目标保存对象
353
- * @returns {Vector3} 保存结果
354
- */
355
- toDegreeVector3(optionalResult?: Vector3): Vector3;
356
- /**
357
- * 由角度三维向量构建欧拉角
358
- * @param {Vector3} v 角度三维向量
359
- * @param {EulerOrder} [order] 欧拉角顺序,默认为ZYX
360
- * @returns {Euler} 欧拉角
361
- */
362
- setFromDegreeVector3(degree: Vector3, order?: math.EulerOrder): this;
363
- }
364
-
365
- declare class Plane {
366
- distance: number;
367
- normal: Vector3;
368
- constructor(distance?: number, normal?: Vector3);
369
- static set(distance: number, normal: Vector3): Plane;
370
- set(distance: number, normal: Vector3): this;
371
- static copy(target: Plane): Plane;
372
- copy(target: Plane): this;
373
- static setFromNormalAndCoplanarPoint(point: Vector3, normal: Vector3): Plane;
374
- setFromNormalAndCoplanarPoint(point: Vector3, normal: Vector3): this;
375
- clone(): Plane;
376
- distanceToPoint(point: Vector3): number;
377
- }
378
-
379
- declare class Ray extends math.Ray {
380
- origin: Vector3;
381
- direction: Vector3;
382
- constructor(origin?: Vector3, direction?: Vector3);
383
- clone(): Ray;
384
- rayCastPlane(plane: Plane, _target: Vector3): number;
385
- at(t: number): Vector3;
386
- /**
387
- * 射线到平面的距离
388
- * 当两个向量都是单位向量的时候,从a投影到b的距离等于从b投影到a的距离
389
- * @param plane 平面
390
- * @returns 射线到平面的距离
391
- */
392
- distanceToPlane(plane: Plane): number;
393
- }
394
-
395
- type SizeAdaptDirection = 'x' | 'y';
396
-
397
- declare const MEDIA_TYPE: {
398
- readonly APNG: "APNG";
399
- readonly MP4: "MP4";
400
- readonly WebM: "WebM";
401
- readonly Images: "Images";
402
- readonly WebP: "WebP";
403
- readonly GIF: "GIF";
404
- readonly AlphaMaskVideo: "AlphaMaskVideo";
405
- };
406
- /**
407
- * GIF 压缩参数
408
- * 核心通过参数 flags + palettegen + paletteuse 实现
409
- * highest: lanczos + max_colors=256 + dither=bayer
410
- * high: bicubic + max_colors=200 + dither=bayer
411
- * medium: bilinear + max_colors=64 + dither=bayer
412
- * low: neighbor + max_colors=32 + dither=none
413
- */
414
- declare const GIF_QUALITY_TO_FFMPEG_ARGS: {
415
- highest: string;
416
- high: string;
417
- medium: string;
418
- low: string;
419
- };
420
-
421
- declare global {
422
- interface Window {
423
- /**
424
- * @description 创建 WebP Core 实例
425
- */
426
- createWebPCore: (config: any) => Promise<Img2WebPCore>;
427
- }
428
- }
429
- type FileBuffer = ArrayBuffer | Uint8Array;
430
- type MediaType = typeof MEDIA_TYPE[keyof typeof MEDIA_TYPE];
431
- type FS = {
432
- writeFile: (path: string, data: Uint8Array | string) => void;
433
- readFile(path: string, opts: {
434
- encoding: 'binary';
435
- flags?: string | undefined;
436
- }): Uint8Array;
437
- readFile(path: string, opts: {
438
- encoding: 'utf8';
439
- flags?: string | undefined;
440
- }): string;
441
- readFile(path: string, opts?: {
442
- flags?: string | undefined;
443
- }): Uint8Array;
444
- unlink: (path: string) => void;
445
- quit: () => void;
446
- };
447
- type Pointer = number;
448
- type Img2WebPCore = {
449
- FS: FS;
450
- run: (...args: string[]) => number;
451
- cwrap: (ident: string, returnType: string, argTypes: string[]) => ((argc: number, argv: Pointer) => number);
452
- _malloc: (size: number) => Pointer;
453
- writeAsciiToMemory: (str: string, buffer: number, dontAddNull?: boolean) => void;
454
- setValue: (ptr: number, value: any, type: string, noSafe?: boolean) => void;
455
- };
456
- type ExportMediaInitOptions = {
457
- /**
458
- * 导出类型
459
- */
460
- mediaType: MediaType;
461
- /**
462
- * 额外画布,导出透明视频时使用
463
- */
464
- extraCanvas?: HTMLCanvasElement | null;
465
- /**
466
- * 是否打印转码过程中的日志,仅在导出 MP4/AlphaMaskVideo 时有效, 默认 false
467
- * 供开发调试使用
468
- */
469
- loggerInTranscoding?: boolean;
470
- /**
471
- * ffmpeg 转码是否开启多线程,默认 false,确保环境支持 SharedArrayBuffer
472
- */
473
- multiThreading?: boolean;
474
- /**
475
- * 是否输出 buffer,默认 false
476
- */
477
- isOutputBuffer?: boolean;
478
- };
479
- type MP4Config = {
480
- /**
481
- * @description MP4 导出时是否需要导出最后一帧 PNG
482
- */
483
- isExportLastFrameJPEG?: boolean;
484
- };
485
- type GifConfig = {
486
- /**
487
- * @description GIF 导出时的帧率
488
- */
489
- fps?: number;
490
- /**
491
- * @description GIF 导出时的缩放比例
492
- * 默认 '-1:-1', 表示不缩放
493
- * 例如 '100:-1', 表示宽度 100,高度自动
494
- * 例如 '-1:100', 表示宽度自动,高度 100
495
- */
496
- scale?: string;
497
- /**
498
- * @description GIF 导出时的质量
499
- * 默认 'highest'
500
- * 可选 'highest', 'high', 'medium', 'low'
501
- */
502
- quality?: keyof typeof GIF_QUALITY_TO_FFMPEG_ARGS;
503
- };
504
- type ApngConfig = {
505
- /**
506
- * @description APNG 导出时的帧率
507
- */
508
- fps?: number;
509
- /**
510
- * @description APNG 导出时的缩放比例
511
- * 默认 '-1:-1', 表示不缩放
512
- * 例如 '100:-1', 表示宽度 100,高度自动
513
- * 例如 '-1:100', 表示宽度自动,高度 100
514
- */
515
- scale?: string;
516
- /**
517
- * @description APNG 导出时的质量
518
- * 默认 'highest'
519
- * 可选 'highest', 'high', 'medium', 'low'
520
- */
521
- quality?: keyof typeof GIF_QUALITY_TO_FFMPEG_ARGS;
522
- };
523
- type ExportMediaItemOptions = {
524
- /**
525
- * 尺寸
526
- */
527
- size: [number, number];
528
- /**
529
- * 动效资源
530
- */
531
- scene: spec.JSONScene;
532
- /**
533
- * 视频时长,目前仅在导出 MP4 / AlphaMaskVideo 时有效,默认取动效资源时长
534
- */
535
- time?: number;
536
- /**
537
- * 是否生成音轨,默认 false,仅在导出 MP4 时有效
538
- */
539
- audioEnable?: boolean;
540
- /**
541
- * 帧率, 默认 30
542
- */
543
- fps?: number;
544
- /**
545
- * 是否循环,默认 true
546
- */
547
- loop?: boolean;
548
- /**
549
- * 视频背景颜色,默认 #000000
550
- */
551
- backgroundColor?: string;
552
- /**
553
- * 导出 MP4 时,设置的导出配置
554
- */
555
- mp4Config?: MP4Config;
556
- /**
557
- * 导出 GIF 时,设置的导出配置
558
- */
559
- gifConfig?: GifConfig;
560
- /**
561
- * 导出 APNG 时,设置的导出配置
562
- */
563
- apngConfig?: ApngConfig;
564
- };
565
- type ExportMediaItemDownloadInfo = {
566
- /**
567
- * @description 导出文件夹名称
568
- */
569
- folderName: string;
570
- /**
571
- * @description 导出视频名称
572
- */
573
- name: string;
574
- };
575
- type ExportItemParams = ExportMediaItemOptions & ExportMediaItemDownloadInfo;
576
- type ExportParams = ExportItemParams[];
577
- type Buffers = FileBuffer[] | undefined;
578
- type Extras = (FileBuffer | null)[] | null | undefined;
579
-
580
- /**
581
- * @description SDKItem 基础选项接口
582
- * @description 支持扩展属性,允许添加任意额外属性
583
- */
584
- type SDKItemOptions = {
585
- /**
586
- * @description 元素ID
587
- */
588
- id: string;
589
- /**
590
- * @description 元素名称
591
- */
592
- name: string;
593
- /**
594
- * @description 父节点ID
595
- */
596
- parentId?: string;
597
- /**
598
- * @description 子元素ID列表
599
- */
600
- children?: string[];
601
- /**
602
- * @description 元素生命周期
603
- */
604
- duration?: number;
605
- /**
606
- * @description 元素生命周期延时
607
- */
608
- delay?: number;
609
- /**
610
- * @description 可视状态
611
- */
612
- visible?: boolean;
613
- /**
614
- * @description 元素结束行为
615
- */
616
- endBehavior?: spec.EndBehavior;
617
- /**
618
- * @description 是否处于锁定状态
619
- */
620
- isLocked?: boolean;
621
- /**
622
- * @description 关键属性是否可编辑
623
- */
624
- isCoreEditable: boolean;
625
- /**
626
- * @description 扩展属性存储(属性名 -> 属性值)
627
- */
628
- extension?: Record<string, any>;
629
- /**
630
- * @description 允许任意额外属性(用于兼容旧代码)
631
- */
632
- [extraProp: string]: any;
633
- };
634
- /**
635
- * @description Sprite SDKItem 选项
636
- */
637
- type SpriteItemOptions = SDKItemOptions & {
638
- /**
639
- * @description 元素属性
640
- */
641
- property?: Partial<SpriteItemProperty>;
642
- };
643
- /**
644
- * @description Text SDKItem 选项
645
- */
646
- type TextItemOptions = SDKItemOptions & {
647
- /**
648
- * @description 元素属性
649
- */
650
- property?: Partial<TextItemProperty>;
651
- };
652
- /**
653
- * @description Video SDKItem 选项
654
- */
655
- type VideoItemOptions = SDKItemOptions & {
656
- /**
657
- * @description 元素属性
658
- */
659
- property?: Partial<VideoItemProperty>;
660
- };
661
- /**
662
- * @description Group SDKItem 选项(空节点/组)
663
- */
664
- type GroupItemOptions = SDKItemOptions & {
665
- /**
666
- * @description 元素属性
667
- */
668
- property?: Partial<GroupItemProperty>;
669
- };
670
- /**
671
- * @description Generator SDKItem 选项(资源生成器)
672
- * @description 支持 image 和 video 两种生成器类型
673
- * @description 使用 GeneratorItemProperty 包含 generatorType
674
- */
675
- type GeneratorItemOptions = SDKItemOptions & {
676
- /**
677
- * @description 元素属性(包含 generatorType)
678
- */
679
- property?: Partial<GeneratorItemProperty>;
680
- };
681
- type EffectsItemOptions = SDKItemOptions & {
682
- property?: Partial<EffectsItemProperty>;
683
- };
684
- /**
685
- * @description Frame 画板元素 SDKItem 选项
686
- */
687
- type FrameItemOptions = SDKItemOptions & {
688
- /**
689
- * @description 元素属性
690
- */
691
- property?: Partial<FrameItemProperty>;
692
- };
693
- /**
694
- * @description SDKItem 类型(独立于 spec.ItemType)
695
- * @description 包含所有 SDK 层级的元素类型,包括虚拟类型如 generator
696
- */
697
- declare enum SDKItemType {
698
- SPRITE = "sprite",
699
- TEXT = "text",
700
- VIDEO = "video",
701
- GROUP = "group",
702
- GENERATOR = "generator",
703
- EFFECTS = "effects",
704
- FRAME = "frame"
705
- }
706
-
707
- /**
708
- * @description SDKItem 抽象基类
709
- * @description 支持属性扩展,允许添加任意自定义属性
710
- */
711
- declare abstract class BaseItem {
712
- /**
713
- * @description 元素ID
714
- */
715
- id: string;
716
- /**
717
- * @description 元素名称
718
- */
719
- name: string;
720
- /**
721
- * @description 父节点ID
722
- */
723
- parentId?: string;
724
- /**
725
- * @description 元素生命周期
726
- */
727
- duration: number;
728
- /**
729
- * @description 元素生命周期延时
730
- */
731
- delay: number;
732
- /**
733
- * @description 元素结束行为
734
- */
735
- endBehavior: spec.EndBehavior;
736
- /**
737
- * @description 是否可见
738
- */
739
- visible: boolean;
740
- /**
741
- * @description 是否处于锁定状态
742
- */
743
- isLocked: boolean;
744
- /**
745
- * @description 核心数据是否支持编辑
746
- */
747
- isCoreEditable: boolean;
748
- /**
749
- * @description 扩展属性存储(与 property 同级)
750
- */
751
- extension: Map<string, any>;
752
- /**
753
- * @description 元素类型(由子类实现)
754
- * @description 支持 spec.ItemType 或扩展的 SDKItemType
755
- */
756
- abstract readonly type: SDKItemType;
757
- /**
758
- * @description 元素属性(由子类实现)
759
- */
760
- abstract readonly property: BaseItemProperty;
761
- constructor(options: SDKItemOptions);
762
- get pixelWidth(): number;
763
- get pixelHeight(): number;
764
- /**
765
- * @description 设置扩展属性
766
- * @param key 属性名
767
- * @param value 属性值
768
- */
769
- setExtension(key: string, value: any): void;
770
- /**
771
- * @description 获取扩展属性
772
- * @param key 属性名
773
- * @returns 属性值
774
- */
775
- getExtension(key: string): any;
776
- /**
777
- * @description 检查是否存在指定扩展属性
778
- * @param key 属性名
779
- * @returns 是否存在
780
- */
781
- hasExtension(key: string): boolean;
782
- /**
783
- * @description 删除扩展属性
784
- * @param key 属性名
785
- * @returns 是否删除成功
786
- */
787
- deleteExtension(key: string): boolean;
788
- /**
789
- * @description 获取所有扩展属性的键名列表
790
- * @returns 键名数组
791
- */
792
- getExtensionKeys(): string[];
793
- /**
794
- * @description 获取所有扩展属性
795
- * @returns 扩展属性对象
796
- */
797
- getAllExtension(): Record<string, any>;
798
- /**
799
- * @description 批量设置扩展属性
800
- * @param extensions 扩展属性对象
801
- */
802
- setExtensions(extensions: Record<string, any>): void;
803
- /**
804
- * @description 清空所有扩展属性
805
- */
806
- clearExtension(): void;
807
- /**
808
- * @description 转换为 CreateInfo(用于元素复制/导出)
809
- * @param withParent 是否包含父节点ID
810
- * @returns CreateInfo 对象
811
- */
812
- abstract toCreateInfo(withParent?: boolean): ItemCreateInfo;
813
- /**
814
- * @description 克隆 SDKItem
815
- * @returns 新的 SDKItem 实例
816
- */
817
- abstract clone(): BaseItem;
818
- /**
819
- * @description 获取基础属性的 JSON 对象,转换为普通对象(用于序列化)
820
- * @returns 普通对象
821
- */
822
- toJSON(): Record<string, any>;
823
- }
824
- /**
825
- * @description 类型守卫函数:检查对象是否是 BaseItem
826
- * @param obj 要检查的对象
827
- * @returns 是否是 BaseItem 实例
828
- */
829
- declare function isBaseItem(obj: any): obj is BaseItem;
830
-
831
- /**
832
- * @description 图片元素 SDKItem 类
833
- * @description 支持属性扩展
834
- */
835
- declare class SpriteItem extends BaseItem {
836
- /**
837
- * @description 元素类型
838
- */
839
- readonly type = SDKItemType.SPRITE;
840
- /**
841
- * @description 元素属性
842
- */
843
- property: SpriteItemProperty;
844
- constructor(options: SpriteItemOptions);
845
- /**
846
- * @description 图片地址
847
- */
848
- get image(): string;
849
- set image(value: string);
850
- /**
851
- * @description 位置
852
- */
853
- get position(): [number, number];
854
- set position(value: [number, number]);
855
- get width(): number;
856
- set width(value: number);
857
- get height(): number;
858
- set height(value: number);
859
- /**
860
- * @description 旋转(二维旋转角度)
861
- */
862
- get rotation(): number;
863
- set rotation(value: number);
864
- /**
865
- * @description 完整旋转(包含 x, y, z)
866
- */
867
- get fullRotation(): [number, number, number];
868
- set fullRotation(value: [number, number, number]);
869
- /**
870
- * @description 是否正在编辑关键属性
871
- * @deprecated 该属性即将废弃,使用 isCoreEditable 代替
872
- */
873
- get keyPropertyEditing(): boolean;
874
- set keyPropertyEditing(value: boolean);
875
- /**
876
- * @description 转换为 CreateInfo
877
- * @param withParent 是否包含父节点ID
878
- */
879
- toCreateInfo(withParent?: boolean): SpriteCreateInfo;
880
- /**
881
- * @description 克隆 SDKItem
882
- */
883
- clone(): SpriteItem;
884
- /**
885
- * @description 创建包含扩展属性的 CreateInfo
886
- * @param withParent 是否包含父节点ID
887
- * @param extraProps 额外的属性
888
- */
889
- toCreateInfoWithExtensions(withParent?: boolean, extraProps?: Record<string, any>): SpriteCreateInfo;
890
- }
891
- /**
892
- * @description 类型守卫:检查是否是 SpriteItem
893
- */
894
- declare function isSpriteItem(obj: any): obj is SpriteItem;
895
-
896
- /**
897
- * @description 文本元素 SDKItem 类
898
- * @description 支持属性扩展
899
- */
900
- declare class TextItem extends BaseItem {
901
- /**
902
- * @description 元素类型
903
- */
904
- readonly type = SDKItemType.TEXT;
905
- /**
906
- * @description 元素属性
907
- */
908
- property: TextItemProperty;
909
- constructor(options: TextItemOptions);
910
- /**
911
- * @description 文本内容
912
- */
913
- get text(): string;
914
- set text(value: string);
915
- /**
916
- * @description 字体名称
917
- */
918
- get fontFamily(): string;
919
- set fontFamily(value: string);
920
- /**
921
- * @description 字号
922
- */
923
- get fontSize(): number;
924
- set fontSize(value: number);
925
- /**
926
- * @description 字重
927
- */
928
- get fontWeight(): spec.TextWeight;
929
- set fontWeight(value: spec.TextWeight);
930
- /**
931
- * @description 字体样式
932
- */
933
- get fontStyle(): spec.FontStyle;
934
- set fontStyle(value: spec.FontStyle);
935
- /**
936
- * @description 文本对齐方式
937
- */
938
- get textAlign(): spec.TextAlignment;
939
- set textAlign(value: spec.TextAlignment);
940
- /**
941
- * @description 文本颜色 [r, g, b, a]
942
- */
943
- get color(): [number, number, number, number];
944
- set color(value: [number, number, number, number]);
945
- /**
946
- * @description 文本宽度
947
- */
948
- get width(): number;
949
- set width(value: number);
950
- /**
951
- * @description 行高
952
- */
953
- get lineHeight(): number;
954
- set lineHeight(value: number);
955
- /**
956
- * @description 文本高度
957
- */
958
- get height(): number;
959
- set height(value: number);
960
- /**
961
- * @description 描边颜色
962
- */
963
- get outlineColor(): spec.vec4 | undefined;
964
- set outlineColor(value: spec.vec4 | undefined);
965
- /**
966
- * @description 描边宽度
967
- */
968
- get outlineWidth(): number | undefined;
969
- set outlineWidth(value: number | undefined);
970
- /**
971
- * @description 描边开关
972
- */
973
- get outlineEnabled(): boolean;
974
- set outlineEnabled(value: boolean);
975
- /**
976
- * @description 位置
977
- */
978
- get position(): [number, number];
979
- set position(value: [number, number]);
980
- /**
981
- * @description 旋转(二维旋转角度)
982
- */
983
- get rotation(): number;
984
- set rotation(value: number);
985
- /**
986
- * @description 转换为 CreateInfo
987
- * @param withParent 是否包含父节点ID
988
- */
989
- toCreateInfo(withParent?: boolean): TextCreateInfo;
990
- /**
991
- * @description 克隆 SDKItem
992
- */
993
- clone(): TextItem;
994
- }
995
- /**
996
- * @description 类型守卫:检查是否是 TextItem
997
- */
998
- declare function isTextItem(obj: any): obj is TextItem;
999
-
1000
- /**
1001
- * @description 视频元素 SDKItem 类
1002
- * @description 支持属性扩展
1003
- */
1004
- declare class VideoItem extends BaseItem {
1005
- /**
1006
- * @description 元素类型
1007
- */
1008
- readonly type = SDKItemType.VIDEO;
1009
- /**
1010
- * @description 元素属性
1011
- */
1012
- property: VideoItemProperty;
1013
- constructor(options: VideoItemOptions);
1014
- /**
1015
- * @description 视频地址
1016
- */
1017
- get video(): string;
1018
- set video(value: string);
1019
- /**
1020
- * @description 位置
1021
- */
1022
- get position(): [number, number];
1023
- set position(value: [number, number]);
1024
- /**
1025
- * @description 宽度
1026
- */
1027
- get width(): number;
1028
- set width(value: number);
1029
- /**
1030
- * @description 高度
1031
- */
1032
- get height(): number;
1033
- set height(value: number);
1034
- /**
1035
- * @description 旋转(二维旋转角度)
1036
- */
1037
- get rotation(): number;
1038
- set rotation(value: number);
1039
- /**
1040
- * @description 完整旋转(包含 x, y, z)
1041
- */
1042
- get fullRotation(): [number, number, number];
1043
- set fullRotation(value: [number, number, number]);
1044
- /**
1045
- * @description 是否正在编辑关键属性
1046
- * @deprecated 该属性即将废弃,使用 isCoreEditable 代替
1047
- */
1048
- get keyPropertyEditing(): boolean;
1049
- set keyPropertyEditing(value: boolean);
1050
- /**
1051
- * @description 是否静音
1052
- */
1053
- get muted(): boolean;
1054
- set muted(state: boolean);
1055
- /**
1056
- * @description 是否为透明视频
1057
- */
1058
- get transparent(): boolean;
1059
- set transparent(state: boolean);
1060
- /**
1061
- * @description 播放音量
1062
- */
1063
- get volume(): number;
1064
- set volume(value: number);
1065
- /**
1066
- * @description 播放速率
1067
- */
1068
- get playbackRate(): number;
1069
- set playbackRate(value: number);
1070
- /**
1071
- * @description 转换为 CreateInfo
1072
- * @param withParent 是否包含父节点ID
1073
- */
1074
- toCreateInfo(withParent?: boolean): VideoCreateInfo;
1075
- /**
1076
- * @description 克隆 SDKItem
1077
- */
1078
- clone(): VideoItem;
1079
- }
1080
- /**
1081
- * @description 类型守卫:检查是否是 VideoItem
1082
- */
1083
- declare function isVideoItem(obj: any): obj is VideoItem;
1084
-
1085
- /**
1086
- * @description 空节点/组 SDKItem 类
1087
- * @description 支持属性扩展
1088
- */
1089
- declare class GroupItem extends BaseItem {
1090
- /**
1091
- * @description 元素类型
1092
- */
1093
- readonly type = SDKItemType.GROUP;
1094
- /**
1095
- * @description 元素属性
1096
- */
1097
- property: GroupItemProperty;
1098
- constructor(options: GroupItemOptions);
1099
- /**
1100
- * @description 位置
1101
- */
1102
- get position(): [number, number];
1103
- set position(value: [number, number]);
1104
- /**
1105
- * @description 大小
1106
- */
1107
- get scale(): [number, number];
1108
- set scale(value: [number, number]);
1109
- /**
1110
- * @description 旋转(二维旋转角度)
1111
- */
1112
- get rotation(): number;
1113
- set rotation(value: number);
1114
- /**
1115
- * @description 完整旋转(包含 x, y, z)
1116
- */
1117
- get fullRotation(): [number, number, number];
1118
- set fullRotation(value: [number, number, number]);
1119
- /**
1120
- * @description 是否正在编辑关键属性
1121
- * @deprecated 该属性即将废弃,使用 isCoreEditable 代替
1122
- */
1123
- get keyPropertyEditing(): boolean;
1124
- set keyPropertyEditing(value: boolean);
1125
- /**
1126
- * @description 转换为 CreateInfo
1127
- * @param withParent 是否包含父节点ID
1128
- */
1129
- toCreateInfo(withParent?: boolean): GroupCreateInfo;
1130
- /**
1131
- * @description 克隆 SDKItem
1132
- */
1133
- clone(): GroupItem;
1134
- }
1135
- /**
1136
- * @description 类型守卫:检查是否是 GroupItem
1137
- */
1138
- declare function isGroupItem(obj: any): obj is GroupItem;
1139
-
1140
- /**
1141
- * @description 资源生成器元素 SDKItem 类
1142
- * @description 支持 image 和 video 两种生成器类型
1143
- * @description 在 Player 中以透明 SpriteItem 形式渲染
1144
- * @description 支持属性扩展,可转换为 SpriteItem 或 VideoItem
1145
- */
1146
- declare class GeneratorItem extends BaseItem {
1147
- /**
1148
- * @description 元素类型(独立类型,不属于 spec.ItemType)
1149
- */
1150
- readonly type = SDKItemType.GENERATOR;
1151
- /**
1152
- * @description 元素属性(包含 generatorType)
1153
- */
1154
- property: GeneratorItemProperty;
1155
- constructor(options: GeneratorItemOptions);
1156
- /**
1157
- * @description 生成器类型
1158
- */
1159
- get generatorType(): 'image' | 'video';
1160
- set generatorType(value: 'image' | 'video');
1161
- /**
1162
- * @description 图片地址(生成器返回空)
1163
- */
1164
- get image(): string;
1165
- set image(_value: string);
1166
- /**
1167
- * @description 位置
1168
- */
1169
- get position(): [number, number];
1170
- set position(value: [number, number]);
1171
- /**
1172
- * @description 宽度
1173
- */
1174
- get width(): number;
1175
- set width(value: number);
1176
- /**
1177
- * @description 高度
1178
- */
1179
- get height(): number;
1180
- set height(value: number);
1181
- /**
1182
- * @description 旋转(二维旋转角度)
1183
- */
1184
- get rotation(): number;
1185
- set rotation(value: number);
1186
- /**
1187
- * @description 完整旋转(包含 x, y, z)
1188
- */
1189
- get fullRotation(): [number, number, number];
1190
- set fullRotation(value: [number, number, number]);
1191
- /**
1192
- * @description 是否正在编辑关键属性
1193
- * @deprecated 该属性即将废弃,使用 isCoreEditable 代替
1194
- */
1195
- get keyPropertyEditing(): boolean;
1196
- set keyPropertyEditing(value: boolean);
1197
- /**
1198
- * @description 转换为 GeneratorCreateInfo
1199
- * @param withParent 是否包含父节点ID
1200
- */
1201
- toCreateInfo(withParent?: boolean): GeneratorCreateInfo;
1202
- /**
1203
- * @description 转换为 VideoCreateInfo(用于转换为视频元素)
1204
- * @param videoUrl 视频资源地址
1205
- * @param withParent 是否包含父节点ID
1206
- */
1207
- toVideoCreateInfo(videoUrl: string, withParent?: boolean): VideoCreateInfo;
1208
- /**
1209
- * @description 转换为 SpriteCreateInfo(用于转换为图片元素)
1210
- * @param imageUrl 图片资源地址
1211
- * @param withParent 是否包含父节点ID
1212
- */
1213
- toSpriteCreateInfo(imageUrl: string, withParent?: boolean): SpriteCreateInfo;
1214
- /**
1215
- * @description 克隆 SDKItem
1216
- */
1217
- clone(): GeneratorItem;
1218
- }
1219
- /**
1220
- * @description 类型守卫:检查是否是 GeneratorItem
1221
- */
1222
- declare function isGeneratorItem(obj: any): obj is GeneratorItem;
1223
-
1224
- /**
1225
- * @description 特效产物 元素 SDKItem 类
1226
- */
1227
- declare class EffectsItem extends BaseItem {
1228
- /**
1229
- * @description 元素类型(独立类型,不属于 spec.ItemType)
1230
- */
1231
- readonly type = SDKItemType.EFFECTS;
1232
- /**
1233
- * @description 预合成元素ID
1234
- */
1235
- subCompositionItemId: string;
1236
- /**
1237
- * @description 元素属性
1238
- */
1239
- property: EffectsItemProperty;
1240
- constructor(options: EffectsItemOptions);
1241
- /**
1242
- * @description 特效资源地址
1243
- */
1244
- get effects(): string;
1245
- set effects(value: string);
1246
- /**
1247
- * @description 位置
1248
- */
1249
- get position(): [number, number];
1250
- set position(value: [number, number]);
1251
- /**
1252
- * @description 宽度
1253
- */
1254
- get width(): number;
1255
- set width(value: number);
1256
- /**
1257
- * @description 高度
1258
- */
1259
- get height(): number;
1260
- set height(value: number);
1261
- /**
1262
- * @description 旋转(二维旋转角度)
1263
- */
1264
- get rotation(): number;
1265
- set rotation(value: number);
1266
- /**
1267
- * @description 完整旋转(包含 x, y, z)
1268
- */
1269
- get fullRotation(): [number, number, number];
1270
- set fullRotation(value: [number, number, number]);
1271
- /**
1272
- * @description 是否正在编辑关键属性
1273
- * @deprecated 该属性即将废弃,使用 isCoreEditable 代替
1274
- */
1275
- get keyPropertyEditing(): boolean;
1276
- set keyPropertyEditing(value: boolean);
1277
- /**
1278
- * @description 转换为 EffectsCreateInfo
1279
- * @param withParent 是否包含父节点ID
1280
- */
1281
- toCreateInfo(withParent?: boolean): EffectsCreateInfo;
1282
- /**
1283
- * @description 克隆 SDKItem
1284
- */
1285
- clone(): EffectsItem;
1286
- }
1287
- /**
1288
- * @description 类型守卫:检查是否是 EffectsItem
1289
- */
1290
- declare function isEffectsItem(obj: any): obj is EffectsItem;
1291
-
1292
- /**
1293
- * @description 画板/框架元素 SDKItem 类
1294
- * @description 支持自动布局和自由布局两种模式
1295
- * @description 底层以 composition 形式渲染
1296
- */
1297
- declare class FrameItem extends BaseItem {
1298
- /**
1299
- * @description 元素类型
1300
- */
1301
- readonly type = SDKItemType.FRAME;
1302
- /**
1303
- * @description 预合成元素ID
1304
- */
1305
- subCompositionItemId: string;
1306
- /**
1307
- * @description 元素属性
1308
- */
1309
- property: FrameItemProperty;
1310
- constructor(options: FrameItemOptions);
1311
- /**
1312
- * @description 子元素ID列表(只读)
1313
- */
1314
- get children(): readonly string[];
1315
- /**
1316
- * @description 布局模式
1317
- */
1318
- get layoutMode(): FrameLayoutMode;
1319
- set layoutMode(value: FrameLayoutMode);
1320
- /**
1321
- * @description 布局信息
1322
- */
1323
- get layoutInfos(): Record<string, LayoutInfo> | undefined;
1324
- set layoutInfos(info: Record<string, LayoutInfo> | undefined);
1325
- /**
1326
- * @description 位置
1327
- */
1328
- get position(): [number, number];
1329
- set position(value: [number, number]);
1330
- /**
1331
- * @description 宽度
1332
- */
1333
- get width(): number;
1334
- set width(value: number);
1335
- /**
1336
- * @description 高度
1337
- */
1338
- get height(): number;
1339
- set height(value: number);
1340
- /**
1341
- * @description 缩放
1342
- */
1343
- get scale(): [number, number];
1344
- set scale(value: [number, number]);
1345
- /**
1346
- * @description 旋转(二维旋转角度)
1347
- */
1348
- get rotation(): number;
1349
- set rotation(value: number);
1350
- /**
1351
- * @description 完整旋转(包含 x, y, z)
1352
- */
1353
- get fullRotation(): [number, number, number];
1354
- set fullRotation(value: [number, number, number]);
1355
- /**
1356
- * @description 添加子元素
1357
- * @param itemId 子元素ID
1358
- * @returns 是否添加成功
1359
- */
1360
- addChild(itemId: string): boolean;
1361
- /**
1362
- * @description 批量添加子元素
1363
- * @param itemIds 子元素ID列表
1364
- */
1365
- addChildren(itemIds: string[]): void;
1366
- /**
1367
- * @description 移除子元素
1368
- * @param itemId 子元素ID
1369
- * @returns 是否移除成功
1370
- */
1371
- removeChild(itemId: string): boolean;
1372
- /**
1373
- * @description 批量移除子元素
1374
- * @param itemIds 子元素ID列表
1375
- */
1376
- removeChildren(itemIds: string[]): void;
1377
- /**
1378
- * @description 是否包含指定子元素
1379
- * @param itemId 子元素ID
1380
- */
1381
- hasChild(itemId: string): boolean;
1382
- /**
1383
- * @description 清空所有子元素
1384
- */
1385
- clearChildren(): void;
1386
- /**
1387
- * @description 转换为 FrameCreateInfo
1388
- * @param withParent 是否包含父节点ID
1389
- */
1390
- toCreateInfo(withParent?: boolean): FrameCreateInfo;
1391
- /**
1392
- * @description 克隆 SDKItem
1393
- */
1394
- clone(): FrameItem;
1395
- }
1396
- /**
1397
- * @description 类型守卫:检查是否是 FrameItem
1398
- */
1399
- declare function isFrameItem(obj: any): obj is FrameItem;
1400
-
1401
- /**
1402
- * @description 根据 item type 创建对应的 SDKItem 实例
1403
- * @param type 元素类型
1404
- * @param options SDKItem 选项
1405
- * @returns SDKItem 实例
1406
- */
1407
- declare function createSDKItem(type: spec.ItemType, options: SDKItemOptions): BaseItem;
1408
- /**
1409
- * @description SDKItem 类型联合
1410
- * @description 用于替换原来的 SDKItem type
1411
- */
1412
- type SDKItem = SpriteItem | TextItem | VideoItem | GroupItem | GeneratorItem | EffectsItem | FrameItem;
1413
-
1414
- declare function arrAdd<T>(arr: T[], item: T): void;
1415
- declare function isObj(item: any): item is object;
1416
- declare function deepEquals<T>(a: T, b: T): boolean;
1417
- declare function deepClone<T>(target: T): T;
1418
- declare function getColorByNormalizeColor(color: [number, number, number, number]): [number, number, number, number];
1419
- declare function getNormalizeColorByColor(color: [number, number, number, number]): [number, number, number, number];
1420
- declare function getTransformRatioByViewAndCamera(viewSize: Vector2, cameraPosition: Vector3, cameraFov: number, cameraNear: number, cameraFar: number, isReverse: boolean): {
1421
- xRatio: number;
1422
- yRatio: number;
1423
- };
1424
- declare function assertExist<T>(item: T | undefined | null, msg?: string): asserts item is T;
1425
- declare function asserts(condition: any, msg?: string): asserts condition;
1426
- /**
1427
- * @example
1428
- * Input: logger('log', ['VVFX', 'SDK'], 'xx is required');
1429
- * Output: [VVFX SDK] xx is required
1430
- */
1431
- type Level = 'error' | 'info' | 'debug' | 'warn' | 'log';
1432
- declare function logger(level: Level, prefixs: string[], ...args: any[]): void;
1433
- declare function loadScriptAsync(src: string, attrs?: Record<string, string>): Promise<unknown>;
1434
- declare function downloadBlob(buffer: BlobPart | BlobPart[], filename: string, mimeType?: string): void;
1435
- declare function getUniqueName(name: string, names: string[]): string;
1436
- /**
1437
- * 深度比较两个值是否相等
1438
- */
1439
- declare function isEqual(a: unknown, b: unknown): boolean;
1440
-
1441
- /**
1442
- * @description 交互状态视图信息
1443
- */
1444
- type ViewInteractionParam = {
1445
- /**
1446
- * @description 视口宽度 - 红框区域像素大小
1447
- */
1448
- width: number;
1449
- /**
1450
- * @description 视口高度 - 红框区域像素大小
1451
- */
1452
- height: number;
1453
- /**
1454
- * @description 视口缩放比例
1455
- */
1456
- scale: number;
1457
- /**
1458
- * @description 视口位移信息
1459
- */
1460
- translation: Vector2;
1461
- /**
1462
- * @description 标尺宽度
1463
- */
1464
- rulerWidth: number;
1465
- };
1466
- /**
1467
- * @description 交互状态相机信息
1468
- */
1469
- type CameraInteractionParam = {
1470
- /**
1471
- * @description 位置
1472
- */
1473
- position: Vector3;
1474
- /**
1475
- * @description 旋转角度
1476
- */
1477
- rotation: Vector3;
1478
- /**
1479
- * @description 视野初始中心
1480
- */
1481
- focusPosition: Vector3;
1482
- /**
1483
- * @description 视野初始角度
1484
- */
1485
- focusRotation: Vector3;
1486
- /**
1487
- * @description 投影矩阵
1488
- */
1489
- viewProjectionMatrix: Matrix4;
1490
- /**
1491
- * @description 逆投影矩阵
1492
- */
1493
- inverseViewProjectionMatrix: Matrix4;
1494
- };
1495
- declare const SafeConstraint: {
1496
- topAdsorption: string;
1497
- leftAdsorption: string;
1498
- rightAdsorption: string;
1499
- bottomAdsorption: string;
1500
- centerAdsorption: string;
1501
- bottomCenterAdsorption: string;
1502
- };
1503
- type ItemJSONInfo = {
1504
- item: spec.VFXItemData;
1505
- components: spec.ComponentData[];
1506
- tracks: any[];
1507
- playableAssets: any[];
1508
- };
1509
- type AlignType = 'left' | 'right' | 'horizontal-center' | 'top' | 'bottom' | 'vertical-center';
1510
- type DistributeType = 'vertical-spacing' | 'horizontal-spacing';
1511
- /**
1512
- * @description 背景类型预设配置
1513
- */
1514
- type BackgroundPreset = {
1515
- /**
1516
- * @description 背景颜色
1517
- */
1518
- color?: string;
1519
- /**
1520
- * @description 背景图片/渐变
1521
- */
1522
- image?: string;
1523
- /**
1524
- * @description 背景重复方式
1525
- */
1526
- repeat?: string;
1527
- /**
1528
- * @description 背景位置
1529
- */
1530
- position?: string;
1531
- /**
1532
- * @description 背景大小
1533
- */
1534
- size?: string;
1535
- };
1536
- /**
1537
- * @description 背景网格配置
1538
- */
1539
- type BackgroundGridConfig = {
1540
- /**
1541
- * @description 基础网格大小(像素)
1542
- */
1543
- baseSize: number;
1544
- /**
1545
- * @description 缩放循环阈值(默认 2,即 2x 时重置)
1546
- */
1547
- zoomCycle: number;
1548
- /**
1549
- * @description 最小网格大小限制
1550
- */
1551
- minSize: number;
1552
- };
1553
-
1554
- /**
1555
- * @description 背景管理器
1556
- * 负责管理画布背景的配置、渲染和跟随变换
1557
- */
1558
- declare class BackgroundManager {
1559
- /**
1560
- * @description 默认网格配置
1561
- */
1562
- static readonly DEFAULT_GRID_CONFIG: BackgroundGridConfig;
1563
- /**
1564
- * @description 背景预设配置
1565
- */
1566
- static readonly PRESETS: Record<string, BackgroundPreset>;
1567
- private container;
1568
- private config;
1569
- /**
1570
- * @description 当前背景位置(用于跟随移动)
1571
- */
1572
- private offsetX;
1573
- private offsetY;
1574
- constructor(config?: Partial<BackgroundGridConfig>);
1575
- /**
1576
- * @description 绑定容器元素
1577
- * @param element 画布容器元素
1578
- */
1579
- attach(element: HTMLElement): void;
1580
- /**
1581
- * @description 解绑容器元素
1582
- */
1583
- detach(): void;
1584
- /**
1585
- * @description 应用背景预设
1586
- * @param presetName 预设名称
1587
- * @param color 可选的背景色覆盖
1588
- */
1589
- applyPreset(presetName: string, color?: string): boolean;
1590
- /**
1591
- * @description 设置纯色背景
1592
- * @param color 颜色值
1593
- */
1594
- setColorBackground(color: string): void;
1595
- /**
1596
- * @description 设置图片背景
1597
- * @param url 图片 URL
1598
- */
1599
- setImageBackground(url: string): void;
1600
- /**
1601
- * @description 更新背景变换(跟随画布移动和缩放)
1602
- * @param shift 画布移动的偏移量
1603
- * @param zoom 当前缩放比例
1604
- */
1605
- updateTransform(shift: {
1606
- x: number;
1607
- y: number;
1608
- }, zoom: number): void;
1609
- /**
1610
- * @description 重置背景位置和大小
1611
- */
1612
- reset(): void;
1613
- /**
1614
- * @description 清除背景样式
1615
- */
1616
- private clearBackground;
1617
- /**
1618
- * @description 计算循环缩放比例
1619
- * zoom 在 [1, 2) 时,bgZoom = zoom
1620
- * zoom 在 [2, 4) 时,bgZoom = zoom / 2
1621
- * zoom 在 [0.5, 1) 时,bgZoom = zoom / 0.5
1622
- */
1623
- private calculateZoomCycle;
1624
- }
1625
-
1626
- type CreateOperation = {
1627
- type: 'create';
1628
- newData: ItemCreateInfo[];
1629
- };
1630
- type DeleteOperation = {
1631
- type: 'delete';
1632
- oldData: ItemCreateInfo[];
1633
- };
1634
- type UpdateOperation = {
1635
- type: 'update';
1636
- newData: ItemCreateInfo[];
1637
- oldData: ItemCreateInfo[];
1638
- };
1639
- type Operation = CreateOperation | UpdateOperation | DeleteOperation;
1640
- /**
1641
- * 通用撤销重做操作类型
1642
- */
1643
- type GizmoOperation<T> = {
1644
- type: 'update';
1645
- newData: T;
1646
- oldData: T;
1647
- };
1648
- declare class UndoRedo {
1649
- private index;
1650
- private operations;
1651
- get canUndo(): boolean;
1652
- get canRedo(): boolean;
1653
- oldData?: ItemCreateInfo[];
1654
- push(operation: Operation): void;
1655
- undo(): Operation | undefined;
1656
- redo(): Operation | undefined;
1657
- clear(): void;
1658
- }
1659
-
1660
- type SDKMode = 'editor' | 'template';
1661
- /**
1662
- * @description SDK功能配置
1663
- */
1664
- type SDKConfig = {
1665
- /**
1666
- * @description SDK编辑模式 - 模板编辑模式 | 编辑器模式
1667
- */
1668
- mode: SDKMode;
1669
- /**
1670
- * @description 页面功能配置
1671
- */
1672
- pageConfig: PageConfig$1;
1673
- /**
1674
- * @description 异步加载功能配置
1675
- */
1676
- asyncLoadConfig: AsyncLoadConfig;
1677
- /**
1678
- * @description 截图功能配置
1679
- */
1680
- screenShotConfig: ScreenShotConfig;
1681
- /**
1682
- * @description 导出视频功能配置
1683
- */
1684
- exportConfig: ExportConfig;
1685
- /**
1686
- * @description 尺寸自适应功能开关
1687
- */
1688
- sizeAdaptConfig: SizeAdaptConfig;
1689
- /**
1690
- * @description 辅助面板功能配置
1691
- */
1692
- gestureHandlerConfig: {
1693
- enabled: boolean;
1694
- loadingGizmoConfig: LoadingGizmoConfig;
1695
- adsorptionGizmoEnabled: boolean;
1696
- adsorptionGizmoConfig: AdsorptionGizmoConfig;
1697
- controlGizmoEnabled: boolean;
1698
- controlGizmoConfig: ControlGizmoConfig;
1699
- preferenceGizmoEnabled: boolean;
1700
- preferenceGizmoConfig: PreferenceGizmoConfig;
1701
- selectorGizmoEnabled: boolean;
1702
- selectorGizmoConfig: SelectorGizmoConfig;
1703
- transformGizmoEnabled: boolean;
1704
- transformGizmoConfig: TransformGizmoConfig;
1705
- pictureCutGizmoEnabled: boolean;
1706
- pictureCutGizmoConfig: PictureCutGizmoConfig;
1707
- pictureExpandGizmoEnabled: boolean;
1708
- pictureExpandGizmoConfig: PictureExpandGizmoConfig;
1709
- textGizmoEnbaled: boolean;
1710
- textGizmoConfig: TextGizmoConfig;
1711
- maskGizmoEnabled: boolean;
1712
- maskGizmoConfig: MaskGizmoConfig;
1713
- spriteTextEditGizmoEnabled: boolean;
1714
- spriteTextEditGizmoConfig: SpriteTextEditGizmoConfig;
1715
- iconGizmoEnabled: boolean;
1716
- iconGizmoConfig: IconGizmoConfig;
1717
- itemCreateGizmoEnabled: boolean;
1718
- itemCreateGizmoConfig: ItemCreateGizmoConfig;
1719
- /**
1720
- * @description 自动布局指示器配置
1721
- */
1722
- autoLayoutIndicatorConfig: AutoLayoutIndicatorConfig;
1723
- };
1724
- /**
1725
- * @description 元素配置
1726
- */
1727
- itemConfig: {
1728
- /**
1729
- * @description 画板元素参数配置
1730
- */
1731
- frameConfig: FrameConfig;
1732
- /**
1733
- * @description 生成器元素参数配置
1734
- */
1735
- generatorConfig: GeneratorConfig;
1736
- };
1737
- };
1738
- /**
1739
- * @description 画板元素参数配置
1740
- */
1741
- type FrameConfig = {
1742
- /**
1743
- * @description 自动布局边距
1744
- */
1745
- layoutPadding: number;
1746
- /**
1747
- * @description 自动布局元素间隔
1748
- */
1749
- layoutGap: number;
1750
- /**
1751
- * @description 默认画板[无子元素时]宽度
1752
- */
1753
- defaultWidth: number;
1754
- /**
1755
- * @description 默认画板[无子元素时]高度
1756
- */
1757
- defaultHeight: number;
1758
- /**
1759
- * @description 自动布局背景颜色
1760
- */
1761
- autoLayoutBackgroundColor: [number, number, number, number];
1762
- /**
1763
- * @description 自由布局背景颜色
1764
- */
1765
- freeLayoutBackgroundColor: [number, number, number, number];
1766
- };
1767
- /**
1768
- * @description 生成器元素参数配置
1769
- */
1770
- type GeneratorConfig = {
1771
- /**
1772
- * @description 生成器背景颜色
1773
- */
1774
- backgroundColor: [number, number, number, number];
1775
- };
1776
- /**
1777
- * @description 自动布局指示器配置
1778
- */
1779
- type AutoLayoutIndicatorConfig = {
1780
- /**
1781
- * @description 指示线宽度
1782
- */
1783
- lineWidth: number;
1784
- /**
1785
- * @description 指示线颜色
1786
- */
1787
- lineColor: number;
1788
- };
1789
- /**
1790
- * @description 页面功能配置
1791
- */
1792
- type PageConfig$1 = {
1793
- /**
1794
- * @description 同步修改功能开关
1795
- */
1796
- asncMode: boolean;
1797
- /**
1798
- * @description 静态预览【视图只提供播放预览功能】功能开关
1799
- */
1800
- staticPreview: boolean;
1801
- /**
1802
- * @description 静态预览视图名称
1803
- */
1804
- staticPreviewName: string;
1805
- /**
1806
- * @description 需过滤的元素名称
1807
- */
1808
- filterItemNames: string[];
1809
- /**
1810
- * @description 成组操作元素显隐
1811
- */
1812
- groupVisible: boolean;
1813
- /**
1814
- * @description 缩放最大值
1815
- */
1816
- maxZoom: number;
1817
- /**
1818
- * @description 缩放最小值
1819
- */
1820
- minZoom: number;
1821
- /**
1822
- * @description 全局自适应排布模式
1823
- */
1824
- autoLayoutDefaultMode: GlobalLayoutMode;
1825
- /**
1826
- * @description 全局自适应排布间隔
1827
- */
1828
- autoLayoutDefaultGap: number;
1829
- };
1830
- /**
1831
- * @description 异步加载配置
1832
- */
1833
- type AsyncLoadConfig = {
1834
- enabled: boolean;
1835
- loadingTextureUrl: string;
1836
- };
1837
- /**
1838
- * @description 视频导出功能配置
1839
- */
1840
- type ExportConfig = {
1841
- enabled: boolean;
1842
- } & ExportMediaInitOptions;
1843
- /**
1844
- * @description 截图功能配置
1845
- */
1846
- type ScreenShotConfig = {
1847
- enabled: boolean;
1848
- defaultBackgroundColor: [number, number, number, number];
1849
- };
1850
- /**
1851
- * @description 尺寸自适应功能配置
1852
- */
1853
- type SizeAdaptConfig = {
1854
- enabled: boolean;
1855
- };
1856
- /**
1857
- * @description 对齐吸附功能参数
1858
- */
1859
- type AdsorptionGizmoConfig = {
1860
- /**
1861
- * @description 对齐吸附线宽
1862
- */
1863
- lineWidth: number;
1864
- /**
1865
- * @description 对齐线颜色
1866
- */
1867
- lineColor: number;
1868
- /**
1869
- * @description 对齐吸附距离
1870
- */
1871
- distance: number;
1872
- };
1873
- /**
1874
- * @description 视图控制功能参数
1875
- */
1876
- type ControlGizmoConfig = {
1877
- /**
1878
- * @description 缩放步长
1879
- */
1880
- zoomStep: number;
1881
- };
1882
- /**
1883
- * @description 视口展示功能参数
1884
- */
1885
- type PreferenceGizmoConfig = {
1886
- /**
1887
- * @description 视口窗包围盒颜色
1888
- */
1889
- boxColor: number;
1890
- /**
1891
- * @description 视口窗包围盒宽度
1892
- */
1893
- boxWidth: number;
1894
- /**
1895
- * @description 视口区域外遮罩颜色
1896
- */
1897
- markColor: number;
1898
- /**
1899
- * @description 视口区域外遮罩透明度
1900
- */
1901
- markAlpha: number;
1902
- /**
1903
- * @description 出血区预览开关
1904
- */
1905
- safeAreaEnabled: boolean;
1906
- /**
1907
- * @description 出血区颜色
1908
- */
1909
- safeAreaBoxColor: number;
1910
- /**
1911
- * @description 出血区透明度
1912
- */
1913
- safeAreaBoxAlpha: number;
1914
- };
1915
- /**
1916
- * @description 选择功能参数
1917
- */
1918
- type SelectorGizmoConfig = {
1919
- /**
1920
- * @description 视频预选中时
1921
- */
1922
- videoPreSelectedPlay: boolean;
1923
- /**
1924
- * @description 预选框线宽
1925
- */
1926
- preSelectedWidth: number;
1927
- /**
1928
- * @description 预选框颜色
1929
- */
1930
- preSelectedColor: number;
1931
- /**
1932
- * @description 框选区域颜色
1933
- */
1934
- regionBoxColor: number;
1935
- /**
1936
- * @description 框选区域透明度
1937
- */
1938
- regionBoxAlpha: number;
1939
- /**
1940
- * @description 框选区域包围框颜色
1941
- */
1942
- regionWireframeColor: number;
1943
- /**
1944
- * @description 框选区域包围框透明度
1945
- */
1946
- regionWireframeAlpha: number;
1947
- /**
1948
- * @description 框选区域包围框宽度
1949
- */
1950
- regionWireframeWidth: number;
1951
- };
1952
- /**
1953
- * @description 变换功能参数
1954
- */
1955
- type TransformGizmoConfig = {
1956
- /**
1957
- * @description 变换交互框颜色
1958
- */
1959
- wireframeColor: number;
1960
- /**
1961
- * @description 变换交互框透明度
1962
- */
1963
- wireframeAlpha: number;
1964
- /**
1965
- * @description 变换交互框宽度
1966
- */
1967
- wireframeWidth: number;
1968
- /**
1969
- * @description 变换交互框角点填充色
1970
- */
1971
- cornerFillColor: number;
1972
- /**
1973
- * @description 变换交互框角点线框色
1974
- */
1975
- cornerLineColor: number;
1976
- /**
1977
- * @description 变换交互框角点线框宽度
1978
- */
1979
- cornerLineWidth: number;
1980
- /**
1981
- * @description 变换交互框角点线框透明度
1982
- */
1983
- cornerLineAlpha: number;
1984
- /**
1985
- * @description 交互框缩放圆半径
1986
- */
1987
- scaleCircleSize: number;
1988
- /**
1989
- * @description 交互框旋转圆半径
1990
- */
1991
- rotationCircleSize: number;
1992
- /**
1993
- * @description 图片Logo地址
1994
- */
1995
- pictureLogoUrl: string;
1996
- /**
1997
- * @description 空节点Logo地址
1998
- */
1999
- groupLogoUrl: string;
2000
- /**
2001
- * @description 文本Logo地址
2002
- */
2003
- textLogoUrl: string;
2004
- /**
2005
- * @description 视频Logo地址
2006
- */
2007
- videoLogoUrl: string;
2008
- /**
2009
- * @description 画板Logo地址
2010
- */
2011
- frameLogoUrl: string;
2012
- /**
2013
- * @description 特效Logo地址
2014
- */
2015
- effectsLogoUrl: string;
2016
- /**
2017
- * @description 大小文字颜色
2018
- */
2019
- sizeTextColor: number;
2020
- /**
2021
- * @description 名称文字颜色
2022
- */
2023
- nameTextColor: number;
2024
- /**
2025
- * @description 选中信息展示
2026
- */
2027
- infoShowEnabled: boolean;
2028
- };
2029
- /**
2030
- * @description 图片裁切参数
2031
- */
2032
- type PictureCutGizmoConfig = {
2033
- /**
2034
- * @description 蒙版颜色
2035
- */
2036
- maskColor: number;
2037
- /**
2038
- * @description 蒙版透明度
2039
- */
2040
- maskAlpha: number;
2041
- /**
2042
- * @description 裁切包围盒线框宽度
2043
- */
2044
- cutBoxLineWidth: number;
2045
- /**
2046
- * @description 裁切包围盒线框颜色
2047
- */
2048
- cutBoxLineColor: number;
2049
- /**
2050
- * @description 裁切包围盒线框透明度
2051
- */
2052
- cutBoxLineAlpha: number;
2053
- /**
2054
- * @description 元素包围盒线框宽度
2055
- */
2056
- itemBoxLineWidth: number;
2057
- /**
2058
- * @description 元素包围盒线框颜色
2059
- */
2060
- itemBoxLineColor: number;
2061
- /**
2062
- * @description 元素包围盒线框透明度
2063
- */
2064
- itemBoxLineAlpha: number;
2065
- /**
2066
- * @description 裁切包围盒角度半径
2067
- */
2068
- cutBoxCornerRadius: number;
2069
- /**
2070
- * @description 裁切包围盒角点宽度
2071
- */
2072
- cutBoxCornerLineWidth: number;
2073
- /**
2074
- * @description 裁切包围盒角点颜色
2075
- */
2076
- cutBoxCornerLineColor: number;
2077
- /**
2078
- * @description 裁切包围盒角点透明度
2079
- */
2080
- cutBoxCornerLineAlpha: number;
2081
- /**
2082
- * @description 裁切包围盒角点填充色
2083
- */
2084
- cutBoxCornerFillColor: number;
2085
- /**
2086
- * @description 缩放判断距离
2087
- */
2088
- scaleInteractionDistance: number;
2089
- /**
2090
- * @description 单向缩放判断距离
2091
- */
2092
- directionScaleInteractionDistance: number;
2093
- /**
2094
- * @description 网格线数量
2095
- */
2096
- gridCount: number;
2097
- /**
2098
- * @description 网格线颜色
2099
- */
2100
- gridLineColor: number;
2101
- /**
2102
- * @description 网格线宽度
2103
- */
2104
- gridLineWidth: number;
2105
- /**
2106
- * @description 网格线透明度
2107
- */
2108
- gridLineAlpha: number;
2109
- };
2110
- /**
2111
- * @description 图片扩边参数
2112
- */
2113
- type PictureExpandGizmoConfig = {
2114
- /**
2115
- * @description 蒙版颜色
2116
- */
2117
- maskColor: number;
2118
- /**
2119
- * @description 蒙版透明度
2120
- */
2121
- maskAlpha: number;
2122
- /**
2123
- * @description 扩边包围盒线框宽度
2124
- */
2125
- expandBoxLineWidth: number;
2126
- /**
2127
- * @description 扩边包围盒线框颜色
2128
- */
2129
- expandBoxLineColor: number;
2130
- /**
2131
- * @description 扩边包围盒线框透明度
2132
- */
2133
- expandBoxLineAlpha: number;
2134
- /**
2135
- * @description 扩边包围盒角度半径
2136
- */
2137
- expandBoxCornerRadius: number;
2138
- /**
2139
- * @description 扩边包围盒角点宽度
2140
- */
2141
- expandBoxCornerLineWidth: number;
2142
- /**
2143
- * @description 扩边包围盒角点颜色
2144
- */
2145
- expandBoxCornerLineColor: number;
2146
- /**
2147
- * @description 扩边包围盒角点透明度
2148
- */
2149
- expandBoxCornerLineAlpha: number;
2150
- /**
2151
- * @description 扩边包围盒角点填充色
2152
- */
2153
- expandBoxCornerFillColor: number;
2154
- /**
2155
- * @description 缩放判断距离
2156
- */
2157
- scaleInteractionDistance: number;
2158
- /**
2159
- * @description 单向缩放判断距离
2160
- */
2161
- directionScaleInteractionDistance: number;
2162
- /**
2163
- * @description 网格线数量
2164
- */
2165
- gridCount: number;
2166
- /**
2167
- * @description 网格线颜色
2168
- */
2169
- gridLineColor: number;
2170
- /**
2171
- * @description 网格线宽度
2172
- */
2173
- gridLineWidth: number;
2174
- /**
2175
- * @description 网格线透明度
2176
- */
2177
- gridLineAlpha: number;
2178
- };
2179
- /**
2180
- * @description 文本交互控制器旋转交互模式
2181
- * 'corner': 角点旋转
2182
- * 'top-center': 顶部中心旋转
2183
- */
2184
- type TextGizmoRotateInteractMode = 'corner' | 'top-center';
2185
- /**
2186
- * @description 文本交互控制器参数
2187
- */
2188
- type TextGizmoConfig = {
2189
- /**
2190
- * @description 旋转交互模式
2191
- */
2192
- rotateInteractMode: TextGizmoRotateInteractMode;
2193
- /**
2194
- * @description 包围盒线宽
2195
- */
2196
- boxLineWidth: number;
2197
- /**
2198
- * @description 包围盒线色
2199
- */
2200
- boxLineColor: number;
2201
- /**
2202
- * @description 旋转交互点边长 - 用于 top-center 交互模式
2203
- */
2204
- rotationCornerWidth: number;
2205
- /**
2206
- * @description 旋转交互贴图地址
2207
- */
2208
- rotationCornerTexture: string;
2209
- /**
2210
- * @description 旋转交互点半径
2211
- */
2212
- rotationCornerRadius: number;
2213
- /**
2214
- * @description top-center 模式旋转交互距离
2215
- */
2216
- rotationTopCenterInteractionDistance: number;
2217
- /**
2218
- * @description 旋转交互点填充色
2219
- */
2220
- rotationCornerFillColor: number;
2221
- /**
2222
- * @description 旋转交互点描边宽度
2223
- */
2224
- rotationCornerStrokeWidth: number;
2225
- /**
2226
- * @description 旋转交互点描边颜色
2227
- */
2228
- rotationCornerStrokeColor: number;
2229
- /**
2230
- * @description Corner 模式旋转交互距离
2231
- */
2232
- rotationCornerInteractionDistance: number;
2233
- /**
2234
- * @description 缩放交互点半径
2235
- */
2236
- scaleCornerRadius: number;
2237
- /**
2238
- * @description 缩放交互点填充色
2239
- */
2240
- scaleCornerFillColor: number;
2241
- /**
2242
- * @description 缩放交互点描边宽度
2243
- */
2244
- scaleCornerStrokeWidth: number;
2245
- /**
2246
- * @description 缩放交互点描边颜色
2247
- */
2248
- scaleCornerStrokeColor: number;
2249
- /**
2250
- * @description 触发缩放交互的距离
2251
- */
2252
- scaleInteractionDistance: number;
2253
- /**
2254
- * @description 触发边缩放交互的距离
2255
- */
2256
- widthScaleInteractionDistance: number;
2257
- /**
2258
- * @description 画板线框颜色
2259
- */
2260
- wireframeColor: number;
2261
- /**
2262
- * @description 画板线框透明度
2263
- */
2264
- wireframeAlpha: number;
2265
- /**
2266
- * @description 画板线框线宽
2267
- */
2268
- wireframeWidth: number;
2269
- };
2270
- /**
2271
- * @description 蒙版参数
2272
- */
2273
- type MaskGizmoConfig = {
2274
- /**
2275
- * @description 画笔大小
2276
- */
2277
- brushSize: number;
2278
- /**
2279
- * @description 笔刷颜色
2280
- */
2281
- brushColor: number;
2282
- /**
2283
- * @description 笔刷透明度
2284
- */
2285
- brushAlpha: number;
2286
- /**
2287
- * @description 蒙版颜色
2288
- */
2289
- maskColor: number;
2290
- /**
2291
- * @description 蒙版背景色
2292
- */
2293
- maskBackgroundColor: number;
2294
- /**
2295
- * @description 蒙版透明度
2296
- */
2297
- maskAlpha: number;
2298
- /**
2299
- * @description 蒙版图片
2300
- */
2301
- maskImage?: HTMLImageElement;
2302
- /**
2303
- * @description 元素包围盒线框宽度
2304
- */
2305
- boxLineWidth: number;
2306
- /**
2307
- * @description 元素包围盒线框颜色
2308
- */
2309
- boxLineColor: number;
2310
- /**
2311
- * @description 元素包围盒线框透明度
2312
- */
2313
- boxLineAlpha: number;
2314
- };
2315
- /**
2316
- * @description Loading 参数
2317
- */
2318
- type LoadingGizmoConfig = {
2319
- /**
2320
- * @description 加载中 effect fragment
2321
- */
2322
- loadingFragment?: string;
2323
- };
2324
- /**
2325
- * @description 精准改字编辑参数
2326
- */
2327
- type SpriteTextEditGizmoConfig = {
2328
- /**
2329
- * @description 文案颜色
2330
- */
2331
- textColor: number;
2332
- /**
2333
- * @description 包围盒线框宽度
2334
- */
2335
- boxLineWidth: number;
2336
- /**
2337
- * @description 包围盒间隔线长度
2338
- */
2339
- dashLineDash: number;
2340
- /**
2341
- * @description 包围盒间隔线间隔
2342
- */
2343
- dashLineGap: number;
2344
- /**
2345
- * @description 预选中文案颜色
2346
- */
2347
- preSelectedTextColor: number;
2348
- /**
2349
- * @description 标记包围盒颜色
2350
- */
2351
- editBoxColor: number;
2352
- /**
2353
- * @description 编辑包围盒透明度
2354
- */
2355
- editBoxAlpha: number;
2356
- /**
2357
- * @description 编辑包围盒线框颜色
2358
- */
2359
- editBoxLineColor: number;
2360
- /**
2361
- * @description 编辑包围盒线框透明度
2362
- */
2363
- editBoxLineAlpha: number;
2364
- /**
2365
- * @description 已更改编辑包围盒颜色
2366
- */
2367
- hasChangedEditBoxColor: number;
2368
- /**
2369
- * @description 已更改编辑包围盒透明度
2370
- */
2371
- hasChangedEditBoxAlpha: number;
2372
- /**
2373
- * @description 已更改编辑包围盒线框颜色
2374
- */
2375
- hasChangedEditBoxLineColor: number;
2376
- /**
2377
- * @description 已更改编辑包围盒线框透明度
2378
- */
2379
- hasChangedEditBoxLineAlpha: number;
2380
- /**
2381
- * @description 编辑包围盒预选颜色
2382
- */
2383
- editBoxPreSelectedColor: number;
2384
- /**
2385
- * @description 编辑包围盒预选透明度
2386
- */
2387
- editBoxPreSelectedAlpha: number;
2388
- /**
2389
- * @description 编辑包围盒预选线框颜色
2390
- */
2391
- editBoxLinePreSelectedColor: number;
2392
- /**
2393
- * @description 编辑包围盒预选线框透明度
2394
- */
2395
- editBoxLinePreSelectedAlpha: number;
2396
- /**
2397
- * @description 已更改编辑包围盒预选颜色
2398
- */
2399
- hasChangedEditBoxPreSelectedColor: number;
2400
- /**
2401
- * @description 已更改编辑包围盒预选透明度
2402
- */
2403
- hasChangedEditBoxPreSelectedAlpha: number;
2404
- /**
2405
- * @description 已更改编辑包围盒线框颜色
2406
- */
2407
- hasChangedEditBoxLinePreSelectedColor: number;
2408
- /**
2409
- * @description 已更改编辑包围盒线框透明度
2410
- */
2411
- hasChangedEditBoxLinePreSelectedAlpha: number;
2412
- /**
2413
- * @description 选中状态标记包围盒颜色
2414
- */
2415
- editBoxSelectedColor: number;
2416
- /**
2417
- * @description 选中状态标记包围盒颜色
2418
- */
2419
- editBoxSelectedAlpha: number;
2420
- };
2421
- type IconGizmoConfig = {
2422
- /**
2423
- * @description 自动展示
2424
- */
2425
- autoShow: boolean;
2426
- /**
2427
- * @description 图标地址
2428
- */
2429
- videoPlayUrl: string;
2430
- /**
2431
- * @description 距离右下角偏移值
2432
- */
2433
- videoPlayShift: [number, number];
2434
- /**
2435
- * @description 宽
2436
- */
2437
- videoPlayWidth: number;
2438
- /**
2439
- * @description 高
2440
- */
2441
- videoPlayHeight: number;
2442
- imageGeneratorUrl: string;
2443
- videoGeneratorUrl: string;
2444
- generatorWidth: number;
2445
- generatorHeight: number;
2446
- };
2447
- type ItemCreateGizmoConfig = {
2448
- /**
2449
- * @description 边框颜色
2450
- */
2451
- frameBorderColor: number;
2452
- /**
2453
- * @description 边框宽度
2454
- */
2455
- frameBorderWidth: number;
2456
- /**
2457
- * @description 边框透明度
2458
- */
2459
- frameBorderAlpha: number;
2460
- /**
2461
- * @description 填充颜色
2462
- */
2463
- frameFillColor: number;
2464
- /**
2465
- * @description 填充透明度
2466
- */
2467
- frameFillAlpha: number;
2468
- /**
2469
- * @description 选中子元素包围盒透明度
2470
- */
2471
- frameChildBoxAlpha: number;
2472
- /**
2473
- * @description 选中子元素包围盒颜色
2474
- */
2475
- frameChildBoxColor: number;
2476
- };
2477
-
2478
- /**
2479
- * @description 图片蒙版工具结果
2480
- */
2481
- type MaskResult = {
2482
- /**
2483
- * @description 状态
2484
- */
2485
- status: 'init' | 'done';
2486
- /**
2487
- * @description 包围盒
2488
- */
2489
- box?: Box2;
2490
- /**
2491
- * @description 鼠标位置
2492
- */
2493
- point?: Vector2;
2494
- /**
2495
- * @description 蒙版线条列表
2496
- */
2497
- lines: {
2498
- brushSize: number;
2499
- points: Vector2[];
2500
- type?: 'paint' | 'erase';
2501
- }[];
2502
- };
2503
- /**
2504
- * @description 精准改字功能初始化信息
2505
- */
2506
- type SpriteTextInitParam = {
2507
- /**
2508
- * @description 元素ID
2509
- */
2510
- id: string;
2511
- /**
2512
- * @description 改字信息
2513
- */
2514
- info: SpriteTextInitInfo[];
2515
- };
2516
- type SpriteTextInitInfo = {
2517
- /**
2518
- * @description 是否被修改过
2519
- */
2520
- hasChanged: boolean;
2521
- /**
2522
- * @description 文字内容
2523
- */
2524
- text: string;
2525
- /**
2526
- * @description 包围盒信息
2527
- */
2528
- box: [spec.vec2, spec.vec2, spec.vec2, spec.vec2];
2529
- };
2530
- type ItemCreateType = 'none' | 'text' | 'video-generator' | 'sprite-generator' | 'frame';
2531
- type GizmoType = 'null' | 'selector' | 'transform' | 'control' | 'adsorption' | 'preference' | 'picture-cut' | 'text' | 'mask' | 'loading' | 'picture-expand' | 'sprite-text-edit' | 'icon' | 'item-create';
2532
- type GestureHandlerInteractType = 'select' | 'hand';
2533
-
2534
- declare module '@pixi/graphics' {
2535
- interface Graphics {
2536
- fillBox(box: Box2): void;
2537
- drawBox(box: Box2): void;
2538
- drawLine(line: Line2 | Point[]): void;
2539
- drawDashLine(toX: number, toY: number, dash: number, gap: number): void;
2540
- }
2541
- }
2542
-
2543
- type LoadingGizmoTip = {
2544
- text: string;
2545
- fontSize?: number;
2546
- fontFamily?: string;
2547
- color?: number;
2548
- };
2549
- type LoadingGizmoItemOptions = {
2550
- /** Loading 提示文案 */
2551
- tip?: LoadingGizmoTip;
2552
- /** 指定 Loading 区域 */
2553
- loadingBox?: Box2;
2554
- /** 清理选中 */
2555
- clearSelected?: boolean;
2556
- };
2557
-
2558
- /**
2559
- * 蒙版工具的撤销重做数据类型
2560
- */
2561
- type MaskUndoRedoData = {
2562
- lines: MaskResult['lines'];
2563
- };
2564
-
2565
- /**
2566
- * 图片裁切工具的撤销重做数据类型
2567
- */
2568
- type PictureCutUndoRedoData = {
2569
- normalizeCutBox: Box2;
2570
- };
2571
-
2572
- type SDKEvents = {
2573
- 'loadingItemChange': [id: string[]];
2574
- 'selectedItemChange': [id: string[]];
2575
- 'preSelectedItemChange': [id: string | undefined];
2576
- 'selectedViewChange': [id: number];
2577
- 'pageDataChange': [pageData: PageData];
2578
- 'zoomChange': [zoom: number];
2579
- 'progress': [{
2580
- duration: number;
2581
- time: number;
2582
- end: boolean;
2583
- paused: boolean;
2584
- }];
2585
- 'itemPropertyChange': [{
2586
- id: string;
2587
- propertyKeys: string[];
2588
- }];
2589
- 'exportProgress': [progress?: number];
2590
- 'exportDone': [item: ExportItemParams | undefined, success: boolean, buffer?: FileBuffer];
2591
- 'exportComplete': [success: boolean, taskInfos: ExportParams, buffers: Buffers, extras: Extras];
2592
- 'sdkConfigChange': [preSDKConfig: SDKConfig, curSDKConfig: SDKConfig];
2593
- 'cutBoxChange': [box: Box2];
2594
- 'expandBoxChange': [box: Box2];
2595
- 'textInput': [{
2596
- itemId: string;
2597
- text: string;
2598
- fontFamily: string;
2599
- }];
2600
- 'undoRedoChange': [Operation];
2601
- 'maskGizmoUndoRedoChange': [GizmoOperation<MaskUndoRedoData>];
2602
- 'pictureCutGizmoUndoRedoChange': [GizmoOperation<PictureCutUndoRedoData>];
2603
- 'viewportTransform': [{
2604
- zoom: number;
2605
- translation: [number, number];
2606
- }];
2607
- 'itemOnDragStart': [type: GizmoType];
2608
- 'itemOnDrag': [type: GizmoType];
2609
- 'itemOnDragEnd': [type: GizmoType];
2610
- 'spriteTextClick': [{
2611
- id: string;
2612
- index: number;
2613
- text: string;
2614
- } | undefined];
2615
- 'videoPlay': [{
2616
- id: string;
2617
- time: number;
2618
- }];
2619
- 'itemCreate': [{
2620
- type: ItemCreateType;
2621
- position: spec.vec2;
2622
- id: string;
2623
- }];
2624
- 'viewLost': [];
2625
- 'viewRebuildFinish': [];
2626
- };
2627
- declare class SDK {
2628
- static config: SDKConfig;
2629
- private _eventEmitter;
2630
- private _pageData;
2631
- private _screenShot;
2632
- private _exporter?;
2633
- private _pageDataUtils;
2634
- private _sizeAdapt;
2635
- private _gestureHandler;
2636
- private disposables;
2637
- private _isSwitchScene;
2638
- private _undoRedo;
2639
- private _backgroundManager;
2640
- player: Player;
2641
- _container: HTMLElement;
2642
- private _playerContainer;
2643
- constructor(container: HTMLElement, mode?: SDKMode);
2644
- get backgroundManager(): BackgroundManager;
2645
- get container(): HTMLElement;
2646
- get pageData(): PageData | undefined;
2647
- private get initExporterEnabled();
2648
- get exportStatus(): string | undefined;
2649
- get undoRedo(): UndoRedo;
2650
- private get exportOptions();
2651
- dispose(): void;
2652
- on: <E extends "progress" | "loadingItemChange" | "selectedItemChange" | "preSelectedItemChange" | "selectedViewChange" | "pageDataChange" | "zoomChange" | "itemPropertyChange" | "exportProgress" | "exportDone" | "exportComplete" | "sdkConfigChange" | "cutBoxChange" | "expandBoxChange" | "textInput" | "undoRedoChange" | "maskGizmoUndoRedoChange" | "pictureCutGizmoUndoRedoChange" | "viewportTransform" | "itemOnDragStart" | "itemOnDrag" | "itemOnDragEnd" | "spriteTextClick" | "videoPlay" | "itemCreate" | "viewLost" | "viewRebuildFinish">(eventName: E, listener: _galacean_effects.EventEmitterListener<SDKEvents[E]>, options?: _galacean_effects.EventEmitterOptions) => () => void;
2653
- initPlayer(mode: SDKMode): void;
2654
- setSDKMode(mode: SDKMode): void;
2655
- private getInitParam;
2656
- private initExporter;
2657
- private initSDK;
2658
- run(param: SDKInputParam): Promise<void>;
2659
- getActiveItems(): string[];
2660
- setPreSelectedItem(id: string): void;
2661
- getPreSelectedItem(): string;
2662
- setSelectedItems(itemIds: string[]): void;
2663
- /**
2664
- * @description 设置元素属性(支持单个元素的单/多属性设置)
2665
- * @param param 设置参数,支持两种场景:
2666
- * 1. 单个元素单个属性: { itemId, type, propertyName, propertyValue }
2667
- * 2. 单个元素多个属性: { itemId, type, property }
2668
- */
2669
- setItemProperty<T extends SDKItemType>(param: SetItemPropertyParam<T>): Promise<void>;
2670
- generateScreenShot(id: number, size?: [number, number], tick?: number, backgroundColor?: spec.vec4): Promise<string | undefined>;
2671
- /**
2672
- * @description 切换场景
2673
- * @param index 场景索引
2674
- */
2675
- switchScene(index: number): Promise<void>;
2676
- /**
2677
- * @description 获取页面的 safeAreaPreview、zoom、adsorption、translation 值
2678
- * @returns 页面的 safeAreaPreview、zoom、adsorption、translation 值
2679
- */
2680
- getPageConfig(): PageConfig;
2681
- /**
2682
- * 设置页面的 safeAreaPreview、zoom、adsorption 值
2683
- * @param pageProperty 设置
2684
- */
2685
- setPageConfig(pageConfig: PageConfig): void;
2686
- /**
2687
- * @description 设置播放进度
2688
- * @param progress 播放进度 0-100
2689
- */
2690
- setPlayProgress(progress: number): Promise<void>;
2691
- /**
2692
- * @description 获取元素
2693
- * @param id 元素ID
2694
- * @returns 元素
2695
- * */
2696
- getSDKItem(id: string): SDKItem | undefined;
2697
- /**
2698
- * @description 获取元素数组
2699
- * @param id 元素ID数组
2700
- * @returns 元素数组
2701
- * */
2702
- getSDKItems(ids?: string[]): SDKItem[];
2703
- setPlayState(playState: 'play' | 'pause'): Promise<void>;
2704
- /**
2705
- * @description 获取场景预览图
2706
- * @returns 视图预览图
2707
- */
2708
- getViewThumbnail(): Promise<{
2709
- id: number;
2710
- thumbnail: string | undefined;
2711
- }>[];
2712
- /**
2713
- * @description 获取视图JSON产物
2714
- * @returns 当前所有视图JSON产物
2715
- */
2716
- getViewScene(): {
2717
- id: number;
2718
- thumbnail: spec.JSONScene;
2719
- }[];
2720
- private destroyCompositions;
2721
- /**
2722
- * @description 以媒体格式 buffer 下载
2723
- */
2724
- downloadByMediaBuffersOfExporter(params: ExportMediaItemDownloadInfo[], buffers: Buffers, extras: Extras): void;
2725
- /**
2726
- * @description 导出
2727
- * 支持导出媒体或其他,如MP4,未来支持 JSON 等;
2728
- */
2729
- onExport(): void;
2730
- /**
2731
- * @description 取消导出
2732
- */
2733
- cancelExport(): void;
2734
- loadPageData(data: PageData): Promise<void>;
2735
- runByPageData(data: PageData): Promise<void>;
2736
- reloadPageDataByScene(scene: string | spec.JSONScene): Promise<void>;
2737
- /**
2738
- * @description 新增视图数据
2739
- * @param viewParams 视图参数
2740
- * @param scene 场景数据 - 无输入时为默认场景数据
2741
- */
2742
- addViewParams(viewParams: ViewParam[], scene?: spec.JSONScene): Promise<void>;
2743
- deleteViewParams(ids: number[]): Promise<void>;
2744
- setExportParam(exportParam: Partial<ExportParam>, id?: number): void;
2745
- /**
2746
- * @description 设置视图缩放
2747
- * @param zoom 缩放值
2748
- * @param center 缩放中心
2749
- * @param ignoreClamp 是否忽视约束
2750
- */
2751
- setPageZoom(zoom: number, center?: Vector2, ignoreClamp?: boolean): void;
2752
- /**
2753
- * @description 设置元素移动
2754
- * @param targetTranslation 目标移动值
2755
- */
2756
- setPageMove(targetTranslation: Vector2): void;
2757
- /**
2758
- * @description 设置静态预览功能开关
2759
- * @param enabled 功能开关
2760
- */
2761
- setStaticPreviewEnabled(enabled: boolean): void;
2762
- /**
2763
- * @description 设置静态预览视图名称
2764
- * @param name 视图名称
2765
- */
2766
- setStaticPreviewName(name: string): void;
2767
- /**
2768
- * @description 设置同步修改功能开关
2769
- * @param enabled 功能开关
2770
- */
2771
- setAsyncEnabled(enabled: boolean): void;
2772
- /**
2773
- * @description 设置 成组显影 开关
2774
- */
2775
- setGroupVisibleEnabled(enabled: boolean): void;
2776
- /**
2777
- * @description 新增过滤元素名称
2778
- * @param itemNames 过滤元素名称
2779
- */
2780
- addFilterItemNames(itemNames: string[] | string): void;
2781
- /**
2782
- * @description 设置预览辅助层颜色
2783
- * @param color 色值
2784
- */
2785
- setPreferenceBackgroundColor(color: [number, number, number, number]): void;
2786
- /**
2787
- * @description 设置出血区颜色
2788
- * @param color 色值
2789
- */
2790
- setSafeAreaColor(color: [number, number, number, number]): void;
2791
- /**
2792
- * @description 设置 尺寸自适应拓展 功能开关
2793
- * @param enabled 功能开关
2794
- */
2795
- setSizeAdaptEnabled(enabled: boolean): void;
2796
- /**
2797
- * @description 设置 截图 功能开关
2798
- * @param enabled 功能开关
2799
- */
2800
- setScreenShotEnabled(enabled: boolean): void;
2801
- /**
2802
- * @description 设置导出功能初始化配置
2803
- * @param exportConfig
2804
- */
2805
- setExportConfig(exportConfig: Partial<ExportConfig>): void;
2806
- /**
2807
- * @description 设置预选框参数
2808
- * @param preSelectedColor 预选框颜色
2809
- * @param preSelectedWidth 预选框线框宽度
2810
- */
2811
- setSelectorGizmoPreSelectConfig(preSelectedColor?: number, preSelectedWidth?: number): void;
2812
- /**
2813
- * @description 设置 变换控制器 交互框参数
2814
- * @param config 参数
2815
- */
2816
- setTranformGizmoWireframeConfig(config: {
2817
- wireframeColor?: number;
2818
- wireframeAlpha?: number;
2819
- wireframeWidth?: number;
2820
- }): void;
2821
- /**
2822
- * @description 获取 SDK 配置参数
2823
- * @returns SDK 配置参数
2824
- */
2825
- getSDKConfig(): SDKConfig;
2826
- /**
2827
- * @description 设置 SDK 配置参数
2828
- * @param config SDK 配置参数
2829
- */
2830
- setSDKConfig(config: SDKConfig): void;
2831
- /**
2832
- * @description 设置SDK背景
2833
- * @param type 背景类型
2834
- * @param value 值
2835
- */
2836
- setSDKBackground(type: SDKBackgroundType, value?: string): void;
2837
- /**
2838
- * @description 创建图层元素
2839
- * @param spriteInfo 图层元素信息
2840
- */
2841
- addSpriteItem(spriteInfo: SpriteCreateInfo, scene?: spec.JSONScene): Promise<string>;
2842
- addVideoItem(videoInfo: VideoCreateInfo, scene?: spec.JSONScene): Promise<string>;
2843
- openPictureCutGizmo(): void;
2844
- closePictureCutGizmo(): void;
2845
- getCutInfo(): {
2846
- cutBox: Box2;
2847
- itemBox: Box2;
2848
- } | undefined;
2849
- setCutBox(min: Vector2, max: Vector2): Box2 | undefined;
2850
- openPictureExpandGizmo(): void;
2851
- closePictureExpandGizmo(): void;
2852
- getExpandInfo(): {
2853
- expandBox: Box2;
2854
- itemBox: Box2;
2855
- } | undefined;
2856
- setExpandBox(min: Vector2, max: Vector2): Box2 | undefined;
2857
- openMaskGizmo(brushSize: number): void;
2858
- clearMaskGizmo(): void;
2859
- closeMaskGizmo(): void;
2860
- getMask(): string | null | undefined;
2861
- setMaskGizmoConfig(config: Partial<MaskGizmoConfig>): void;
2862
- /**
2863
- * @description 设置蒙版工具模式
2864
- * @param mode 模式类型:'paint' 表示涂抹,'erase' 表示擦除
2865
- */
2866
- setMaskGizmoMode(mode: 'paint' | 'erase'): void;
2867
- /**
2868
- * 撤销蒙版操作
2869
- * @returns 是否成功撤销
2870
- */
2871
- undoMaskGizmo(): boolean;
2872
- /**
2873
- * 重做蒙版操作
2874
- * @returns 是否成功重做
2875
- */
2876
- redoMaskGizmo(): boolean;
2877
- /**
2878
- * 检查蒙版是否可以撤销
2879
- */
2880
- get canUndoMaskGizmo(): boolean;
2881
- /**
2882
- * 检查蒙版是否可以重做
2883
- */
2884
- get canRedoMaskGizmo(): boolean;
2885
- /**
2886
- * 清空蒙版 undoRedo 历史
2887
- */
2888
- clearMaskGizmoUndoRedo(): void;
2889
- /**
2890
- * 撤销图片裁切操作
2891
- * @returns 是否成功撤销
2892
- */
2893
- undoPictureCutGizmo(): boolean;
2894
- /**
2895
- * 重做图片裁切操作
2896
- * @returns 是否成功重做
2897
- */
2898
- redoPictureCutGizmo(): boolean;
2899
- /**
2900
- * 检查图片裁切是否可以撤销
2901
- */
2902
- get canUndoPictureCutGizmo(): boolean;
2903
- /**
2904
- * 检查图片裁切是否可以重做
2905
- */
2906
- get canRedoPictureCutGizmo(): boolean;
2907
- /**
2908
- * 清空图片裁切 undoRedo 历史
2909
- */
2910
- clearPictureCutGizmoUndoRedo(): void;
2911
- openLoadingGizmo(id: string, options?: LoadingGizmoItemOptions): void;
2912
- updateLoadingGizmo(id: string, options: {
2913
- tip?: LoadingGizmoTip;
2914
- }): void;
2915
- closeLoadingGizmo(id: string): void;
2916
- /**
2917
- * @description 元素打组
2918
- * @param children 子元素ID
2919
- */
2920
- groupItems(groupInfo: GroupCreateInfo, scene?: spec.JSONScene): string | undefined;
2921
- setItemParent(id: string, parentId: string): void;
2922
- deleteItemParent(id: string, parentId: string): void;
2923
- addTextItem(textInfo: TextCreateInfo, scene?: spec.JSONScene): Promise<string | undefined>;
2924
- addItemByCreateInfos(createInfos: ItemCreateInfo[], asyncMode?: boolean): Promise<string[]>;
2925
- deleteItems(idInfo: string | string[]): void;
2926
- getItemCreateInfo(id: string): ItemCreateInfo | undefined;
2927
- getItemCreateInfos(ids?: string[]): ItemCreateInfo[];
2928
- createScreenShotSceneByIds(idInfo: string | string[], time?: number): Promise<string | undefined>;
2929
- createScreenShotByFrame(id: string): Promise<string | undefined>;
2930
- createScreenShotByEffects(id: string): Promise<string | undefined>;
2931
- getChildrenIds(id: string): string[];
2932
- /**
2933
- * @description 更新元素在图层中的顺序
2934
- * @param id 元素ID
2935
- * @param action 排序操作:BringToFront(置于顶层)、SendToBack(置于底层)、BringForward(上移一层)、SendBackward(下移一层)
2936
- */
2937
- updateItemOrder(id: string, action: ItemOrderAction): void;
2938
- /**
2939
- * @description 导出JSON
2940
- * @param idInfo 视图序号信息
2941
- * @returns JSON数组
2942
- */
2943
- exportJSON(idInfo?: number | number[]): spec.JSONScene[];
2944
- getViewBoxById(id: string): Box2;
2945
- /**
2946
- * @description 批量设置元素扩展属性
2947
- * @param id 元素ID
2948
- * @param extensions 扩展属性对象(支持同时设置多个)
2949
- * @returns 是否设置成功
2950
- */
2951
- setItemExtension(id: string, extension: Record<string, any>): boolean;
2952
- /**
2953
- * @description 批量获取元素扩展属性
2954
- * @param id 元素ID
2955
- * @param keys 扩展属性名称列表(不传则返回所有扩展属性)
2956
- * @returns 扩展属性对象
2957
- */
2958
- getItemExtension(id: string, keys?: string[]): Record<string, any> | undefined;
2959
- /**
2960
- * @description 删除元素扩展属性(支持批量删除)
2961
- * @param id 元素ID
2962
- * @param keys 扩展属性名称列表
2963
- * @returns 是否删除成功
2964
- */
2965
- deleteItemExtensions(id: string, keys: string[]): boolean;
2966
- /**
2967
- * @description 检查元素是否有指定扩展属性
2968
- * @param id 元素ID
2969
- * @param key 扩展属性名称
2970
- * @returns 是否存在
2971
- */
2972
- hasItemExtension(id: string, key: string): boolean;
2973
- /**
2974
- * @description 获取元素所有扩展属性的键名列表
2975
- * @param id 元素ID
2976
- * @returns 键名数组
2977
- */
2978
- getItemExtensionKeys(id: string): string[] | undefined;
2979
- getViewProperty(id: number): ViewProperty | undefined;
2980
- pageMove(shift: [number, number]): void;
2981
- pageZoom(shift: number, center?: [number, number]): void;
2982
- /**
2983
- * @description 设置视图缩放工具锁定缩放比例开关
2984
- * @param state 缩放比例开关
2985
- */
2986
- setPictureCutGizmoLockScale(state: boolean): void;
2987
- /**
2988
- * @description 设置视图扩展工具锁定缩放比例开关
2989
- * @param state 缩放比例开关
2990
- */
2991
- setPictureExpandGizmoLockScale(state: boolean): void;
2992
- /**
2993
- * @description 视图缩放函数
2994
- * @param shiftParam 视图偏移值
2995
- */
2996
- viewportFit(shiftParam?: ViewportFitShiftParam, box?: Box2): void;
2997
- /**
2998
- * @description 获取元素包围盒
2999
- * @param idInfo 元素Id
3000
- * @returns 元素包围盒
3001
- */
3002
- getItemBoxById(idInfo: string): Box2;
3003
- /**
3004
- * @description 设置元素字体
3005
- * @param id 元素Id
3006
- * @param fontFamilyName 字体名称
3007
- * @param url 字体地址
3008
- */
3009
- setItemFontFamily(id: string, fontFamilyName: string, url: string): Promise<void>;
3010
- createSceneByCreateInfos(createInfos: ItemCreateInfo[], sceneInfo: SceneCreaetInfo): spec.JSONScene;
3011
- setSpriteSize(id: string, size: spec.vec2): void;
3012
- setItemPropertyByCreateInfo(createInfo: ItemCreateInfo | ItemCreateInfo[]): Promise<void>;
3013
- setTransformGizmoLockScale(state: boolean): void;
3014
- getViewBoxByBox(box: Box2): Box2;
3015
- openSpriteTextEditGizmo(initParam: SpriteTextInitParam[]): void;
3016
- closeSpriteTextEditGizmo(): void;
3017
- setSpriteTextSelectedIndex(id: string, index: number): void;
3018
- setSpriteTextSelectedText(id: string, index: number, text: string): void;
3019
- getBoundingBoxByItemCreateInfo(createInfo: ItemCreateInfo): Box2;
3020
- getBoundingBoxByItemCreateInfos(createInfos: ItemCreateInfo[]): Box2;
3021
- setSpriteTextChangedState(id: string, index: number, hasChanged: boolean): void;
3022
- setSpriteTextEditState(id: string, index: number, isEditing: boolean): void;
3023
- getVideoItemPlayTime(id: string): number;
3024
- setVideoItemPlayTime(id: string, time: number): void;
3025
- getEffectsItemPlayTime(id: string): number | undefined;
3026
- setEffectsItemPlayTime(id: string, time: number): void;
3027
- setEffectsResource(id: string, effects: string): void;
3028
- getPixelPositionByViewPosition(viewPosition: Vector2): Vector2;
3029
- hitTest(x: number, y: number): string[] | undefined;
3030
- setInteractType(type: GestureHandlerInteractType): void;
3031
- getInteractType(): GestureHandlerInteractType;
3032
- makeItemAlign(type: AlignType, ids?: string[]): void;
3033
- makeItemDistribute(type: DistributeType, ids?: string[]): void;
3034
- /**
3035
- * @description 创建生成器元素
3036
- * @param createInfo 生成器创建信息
3037
- * @returns 生成器元素ID
3038
- */
3039
- addGeneratorItem(createInfo: GeneratorCreateInfo): string;
3040
- /**
3041
- * @description 创建动效元素
3042
- * @param effectsInfo 动效创建信息
3043
- */
3044
- addEffectsItem(effectsInfo: EffectsCreateInfo): Promise<string | undefined>;
3045
- /**
3046
- * @description 创建画板元素
3047
- * @param createInfo 画板创建信息
3048
- * @returns 画板元素ID
3049
- */
3050
- addFrameItem(createInfo: FrameCreateInfo): Promise<string>;
3051
- /**
3052
- * @description 将元素移动到 Frame 中
3053
- * @param itemIds 要移动的元素ID列表
3054
- * @param frameId 目标 Frame ID
3055
- */
3056
- moveItemsToFrame(itemIds: string[], frameId: string): void;
3057
- /**
3058
- * @description 将元素从 Frame 中移出到主场景
3059
- * @param itemIds 要移动的元素ID列表
3060
- * @param frameId 源 Frame ID(可选,如果不传则从元素的 parentId 推断)
3061
- */
3062
- moveItemsOutOfFrame(itemIds: string[]): void;
3063
- /**
3064
- * @description 设置生成器资源,将生成器转换为对应的元素
3065
- * @param id 生成器元素ID
3066
- * @param resourceUrl 资源地址
3067
- * @returns 新的元素ID
3068
- */
3069
- setGeneratorResource(id: string, resourceUrl: string): Promise<string>;
3070
- /**
3071
- * @description 设置生成器资源(使用 GeneratorResource 对象)
3072
- * @param resource 生成器资源信息
3073
- */
3074
- setGeneratorResourceFromObject(resource: GeneratorResource): void;
3075
- /**
3076
- * @description 设置视频生成器资源
3077
- * @param resource 视频生成器资源信息
3078
- */
3079
- setVideoGeneratorResource(resource: VideoGeneratorResource): Promise<string>;
3080
- /**
3081
- * @description 设置图层生成器资源
3082
- * @param resource 图层生成器资源信息
3083
- */
3084
- setSpriteGeneratorResource(resource: SpriteGeneratorResource): Promise<string>;
3085
- setItemLockState(id: string, state: boolean): void;
3086
- getItemLockState(id: string): boolean;
3087
- openItemCreateGizmo(type: ItemCreateType): void;
3088
- closeItemCreateGizmo(): void;
3089
- openTextGizmo(textItemId?: string, mode?: 'select' | 'focus'): void;
3090
- closeTextGizmo(): void;
3091
- setItemName(id: string, name: string): void;
3092
- setSafeAreaPreviewVisible(id: number, type: 'url' | 'color', visible: boolean): void;
3093
- /**
3094
- * @description 修改画板元素大小
3095
- * @param id 元素id
3096
- * @param size 目标大小 [width, height]
3097
- * @param translation 位置偏移补偿(可选,用于保持拖拽角点固定)
3098
- */
3099
- resizeFrameItem(id: string, size: [number, number], translation?: [number, number]): void;
3100
- /**
3101
- * @description 对 FrameItem 执行自动布局(当 layoutMode 为 AUTO 时使用)
3102
- * @param frameId Frame 元素 ID
3103
- */
3104
- applyFrameAutoLayout(frameId: string): void;
3105
- autoLayoutPage(param?: PageAutoLayoutParam): Promise<void>;
3106
- }
3107
-
3108
- /**
3109
- * @description 创建 Frame 元素的内部合成场景
3110
- * @param frameId Frame 元素ID(用于标识)
3111
- * @param size 场景尺寸 [width, height]
3112
- * @param name 场景名称
3113
- * @returns Frame 内部的合成场景
3114
- */
3115
- declare function createFrameCompositionScene(frameId: string, size: spec.vec2, name: string): spec.JSONScene;
3116
- /**
3117
- * @description 创建基础场景信息
3118
- * @param viewSize 画布大小
3119
- * @returns 场景信息
3120
- */
3121
- declare function getBasicScene(viewSize?: number[], name?: string): spec.JSONScene;
3122
- declare function createSpriteItemJSON(spriteId: string, position: Vector3, rotation: Vector3, size: Vector2, scale: Vector3, name: string, texture?: string): ItemJSONInfo;
3123
- /**
3124
- * @description 创建视频生成器 Item JSON
3125
- * @description 以 SpriteItem 形式渲染,但设置透明颜色
3126
- * @description 在 content 中存储 isVideoGenerator 标记
3127
- */
3128
- declare function createVideoGeneratorItemJSON(id: string, position: Vector3, rotation: Vector3, size: Vector2, scale: Vector3, name: string): ItemJSONInfo;
3129
- declare function createNullItemJSON(nullId: string, name: string, position: Vector3, scale?: Vector2, rotation?: Vector3, worldSize?: Vector2): ItemJSONInfo;
3130
- declare function createTextItemJSON(textId: string, name: string, position: Vector3, rotation: Vector3, size: Vector2, fontInfo: spec.TextContentOptions): ItemJSONInfo;
3131
- declare function createVideoItemJSON(videoId: string, position: Vector3, rotation: Vector3, size: Vector2, scale: Vector3, name: string, isMuted?: boolean, transparent?: boolean, volume?: number, playbackRate?: number, texture?: string, video?: string): ItemJSONInfo;
3132
- /**
3133
- * @description 创建预合成元素
3134
- * @param effectsId 预合成元素ID
3135
- * @param position 位置信息
3136
- * @param rotation 旋转信息
3137
- * @param scale 缩放信息
3138
- * @param name 名称
3139
- */
3140
- declare function createCompositionItemJSON(effectsId: string, position: Vector3, rotation: Vector3, scale: Vector3, name: string): {
3141
- item: spec.VFXItemData;
3142
- components: never[];
3143
- tracks: {
3144
- id: string;
3145
- dataType: spec.DataType;
3146
- children: never[];
3147
- clips: {
3148
- start: number;
3149
- duration: number;
3150
- endBehavior: spec.EndBehavior;
3151
- asset: {
3152
- id: string;
3153
- };
3154
- }[];
3155
- }[];
3156
- playableAssets: {
3157
- id: string;
3158
- dataType: spec.DataType;
3159
- }[];
3160
- };
3161
- /**
3162
- * @description 添加元素信息到JSON
3163
- * @param scene 场景信息
3164
- * @param itemInfo 元素信息
3165
- */
3166
- declare function addItemInfoToScene(scene: spec.JSONScene, itemInfo: ItemJSONInfo): void;
3167
- /**
3168
- * @description 设置元素父节点信息
3169
- * @param scene 场景信息
3170
- * @param itemId 元素Id
3171
- * @param parentId 父节点Id
3172
- */
3173
- declare function setItemJSONParentId(scene: spec.JSONScene, itemId: string, parentId: string): void;
3174
- /**
3175
- * @description 清理元素父节点信息
3176
- * @param scene 场景信息
3177
- * @param itemId 元素Id
3178
- */
3179
- declare function clearItemParentInfo(scene: spec.JSONScene, itemId: string): void;
3180
- /**
3181
- * @description 删除元素信息
3182
- * @param scene 场景信息
3183
- * @param itemId 元素Id
3184
- */
3185
- declare function deleteItemInfoFromScene(scene: spec.JSONScene, itemId: string): spec.JSONScene | undefined;
3186
- /**
3187
- * @description 从场景中移除并获取元素的完整 ItemJSONInfo
3188
- * @param scene 场景信息
3189
- * @param itemId 元素ID
3190
- * @returns ItemJSONInfo 或 undefined(如果元素不存在)
3191
- */
3192
- declare function removeItemInfoFromScene(scene: spec.JSONScene, itemId: string): ItemJSONInfo | undefined;
3193
- declare function getTextureUrlById(scene: spec.JSONScene, itemId: string): string | undefined;
3194
- declare function addCompositionItemByComposition(main: spec.JSONScene, inputChild: spec.JSONScene, compositionItemId: string, parentId?: string): spec.JSONScene;
3195
- /**
3196
- * @description 删除预合成数据
3197
- * @param scene 场景数据
3198
- * @param itemId 预合成ID
3199
- * @returns 场景数据
3200
- */
3201
- declare function deleteCompositionItemFromScene(scene: spec.JSONScene, itemIds: string[]): spec.JSONScene;
3202
- /**
3203
- * @description 删除合成信息
3204
- * @param scene 场景数据
3205
- * @param compositionId 合成ID
3206
- */
3207
- declare function deleteCompositionFromScene(scene: spec.JSONScene, compositionId: string): void;
3208
- /**
3209
- * @description 重置元素ID - 加载时会新建guid,需要保持一致
3210
- * @param scene 场景数据
3211
- * @param idMap id名称列表
3212
- */
3213
- declare function resetSubCompositionItemId(scene: spec.JSONScene, idMap: Map<string, string>): void;
3214
- /**
3215
- * @description 设置场景中元素名称
3216
- * @param scene 场景数据
3217
- * @param itemId 元素ID
3218
- * @param name 名称
3219
- */
3220
- declare function setJSONItemName(scene: spec.JSONScene, itemId: string, name: string): void;
3221
- /**
3222
- * @description 元素变换选项
3223
- */
3224
- type MoveItemTransformOptions = {
3225
- position?: {
3226
- x: number;
3227
- y: number;
3228
- z: number;
3229
- };
3230
- size?: {
3231
- x: number;
3232
- y: number;
3233
- };
3234
- scale?: {
3235
- x: number;
3236
- y: number;
3237
- z: number;
3238
- };
3239
- rotation?: {
3240
- x: number;
3241
- y: number;
3242
- z: number;
3243
- };
3244
- };
3245
- /**
3246
- * @description 将元素从一个合成移动到另一个合成
3247
- * @param scene 场景数据
3248
- * @param itemId 元素ID
3249
- * @param targetCompositionId 目标合成ID,为null时表示移动到主合成
3250
- * @param options 可选的位置、大小、缩放、旋转信息
3251
- * @returns 是否移动成功
3252
- */
3253
- declare function moveItemBetweenCompositions(scene: spec.JSONScene, itemId: string, targetCompositionId: string | null, options?: MoveItemTransformOptions): boolean;
3254
- declare function getCompositionIdByRefCompositionItemId(scene: spec.JSONScene, compositionItemId: string): any;
3255
- /**
3256
- * @description 获取预合成元素所指向的合成数据
3257
- * @param scene 场景数据
3258
- * @param compositionItemId 预合成元素ID
3259
- * @returns 对应的合成数据 (CompositionData),如果未找到则返回 undefined
3260
- */
3261
- declare function getCompositionDataByRefCompositionItemId(scene: spec.JSONScene, compositionItemId: string): spec.CompositionData | undefined;
3262
- /**
3263
- * @description 提取子合成元素及其所有关联资源为独立的 JSONScene
3264
- * @param scene 主场景数据
3265
- * @param compositionItemId 预合成元素ID(子合成元素ID)
3266
- * @returns 独立的子合成场景 JSONScene,如果未找到则返回 undefined
3267
- */
3268
- declare function extractSubCompositionToScene(scene: spec.JSONScene, compositionItemId: string): spec.JSONScene | undefined;
3269
- declare function fixStandardJSON(scene: spec.JSONScene): void;
3270
-
3271
- declare class PageDataUtils {
3272
- private sdk;
3273
- player: Player;
3274
- container: HTMLElement;
3275
- emitter: EventEmitter<SDKEvents>;
3276
- interactionUtils: InteractionUtils;
3277
- constructor(player: Player, container: HTMLElement, emitter: EventEmitter<SDKEvents>, sdk: SDK);
3278
- init(): void;
3279
- getPageData(): PageData | undefined;
3280
- getCurrentComposition(): Composition | undefined;
3281
- isItemSelected(id: string): boolean;
3282
- getItemEditEnable(id: string): boolean;
3283
- getItemShow(id: string): boolean;
3284
- addSelectedItems(ids: string[]): void;
3285
- removeSelectedItems(ids: string[]): void;
3286
- clearSelectedItems(emitChange?: boolean): void;
3287
- getSelectedItems(): SDKItem[];
3288
- addPreSelectedItem(id: string): void;
3289
- clearPreSelectedItem(): void;
3290
- getPreSelectedItem(): SDKItem | undefined;
3291
- addLoadingItems(ids: string[]): void;
3292
- removeLoadingItems(ids: string[]): void;
3293
- clearLoadingItems(): void;
3294
- getLoadingItems(): SDKItem[];
3295
- getSDKItem(id: string): SDKItem | undefined;
3296
- getPlayerSizeByParent(parentSize: [number, number], sceneSize: [number, number]): readonly [number, number];
3297
- loadScene(id: number): Promise<void>;
3298
- refreshPageTime(number: number): void;
3299
- pageZoom(shift: number, center?: Vector2, ignoreClamp?: boolean): void;
3300
- setPageZoom(targetZoom: number, center?: Vector2, ignoreClamp?: boolean): void;
3301
- refreshInteractionParam(): void;
3302
- pageMove(shift: Vector2): void;
3303
- setPageMove(targetTranslation: Vector2): void;
3304
- /**
3305
- * @description 设置当前相机视图矩阵
3306
- * @param matrix 视图矩阵
3307
- */
3308
- setCurrenCameraViewportMatrix(matrix: Matrix4): void;
3309
- rotateItem(id: string, shift: Vector3, ignoreEvent?: boolean): void;
3310
- moveItem(id: string, shift: Vector3, ignoreEvent?: boolean): void;
3311
- scaleItem(id: string, shift: Vector3, ignoreEvent?: boolean): void;
3312
- scaleTextItemWidth(id: string, scalar: number): void;
3313
- scaleTextItem(id: string, scalar: number): void;
3314
- getItemTransformById(id: string): {
3315
- matrix: Matrix4;
3316
- parentMatrix: Matrix4;
3317
- };
3318
- addSDKItemsByItems(result: SDKItem[], playerItems: VFXItem[], id?: string): void;
3319
- getFilterItemIds(): (string | undefined)[];
3320
- createSDKItemByPlayerItem(playerItem: VFXItem, parentId?: string): SDKItem;
3321
- /**
3322
- * @description 根据 spec.ItemType 创建 SDKItem(内部辅助方法)
3323
- * @param itemType spec.ItemType
3324
- * @param baseOptions 基础选项
3325
- * @param property 属性
3326
- * @returns SDKItem 实例
3327
- */
3328
- private createSDKItemBySpecType;
3329
- getViewBoxById(id: string): Box2;
3330
- getItemViewAnchor(id: string): Vector2 | undefined;
3331
- getChildrenPlayerItems(item?: VFXItem): VFXItem[];
3332
- getChildrenSceneItemIds(id: string, scene: spec.JSONScene): string[];
3333
- getViewBoxByPlayerItem(item: VFXItem, childrenItem: VFXItem[]): Box2;
3334
- getViewportLeftTopPosition(): Vector2;
3335
- getViewportByViewPoint(point: Vector2): Vector2;
3336
- /**
3337
- * @description 设置元素属性(支持单个元素的单/多属性设置)
3338
- * @param param 设置参数,支持两种场景:
3339
- * 1. 单个元素单个属性: { itemId, type, propertyName, propertyValue }
3340
- * 2. 单个元素多个属性: { itemId, type, property }
3341
- */
3342
- setItemProperty<T extends SDKItemType>(param: SetItemPropertyParam<T>): Promise<void>;
3343
- /**
3344
- * @description 场景 1: 设置单个元素的单个属性
3345
- */
3346
- private setSingleItemSingleProperty;
3347
- /**
3348
- * @description 场景 2: 设置单个元素的多个属性
3349
- */
3350
- private setSingleItemMultipleProperties;
3351
- /**
3352
- * @description 更新 PlayerItem 的属性
3353
- * @param itemId 元素ID
3354
- * @param propertyName 属性名
3355
- * @param propertyValue 属性值
3356
- */
3357
- private updatePlayerItemProperty;
3358
- /**
3359
- * @description 更新 PlayerItem 的基础属性
3360
- */
3361
- private updatePlayerItemBaseProperty;
3362
- /**
3363
- * @description 更新 PlayerItem 的 Property 属性
3364
- */
3365
- private updatePlayerItemPropertyAttribute;
3366
- /**
3367
- * @description 更新 JSON Scene 中 Item 的属性
3368
- * @param itemId 元素ID
3369
- * @param propertyName 属性名
3370
- * @param propertyValue 属性值
3371
- */
3372
- private updateJSONItemProperty;
3373
- /**
3374
- * @description 更新 Scene 中 Item 的基础属性
3375
- */
3376
- private updateSceneItemBaseProperty;
3377
- /**
3378
- * @description 更新 Scene 中 Item 的 Property 属性
3379
- */
3380
- updateSceneItemPropertyAttribute(scene: spec.JSONScene, itemId: string, propertyName: string, propertyValue: any): void;
3381
- setSpriteSize(id: string, size: [number, number]): void;
3382
- transformSceneItem(id: string, property: 'position' | 'rotation' | 'scale', shift: [number, number, number]): void;
3383
- refreshSDKItem(id: string): void;
3384
- /**
3385
- * @description 更新已有 SDKItem 的属性(而不是替换整个对象)
3386
- * @param sdkItem 需要更新的 SDKItem
3387
- * @param playerItem 对应的 Player VFXItem
3388
- */
3389
- updateSDKItemFromPlayerItem(sdkItem: SDKItem, playerItem: VFXItem): void;
3390
- getPlayerItemById(id?: string): VFXItem | undefined;
3391
- getPixelSizeByWorldSize(worldSize: spec.vec3, item: VFXItem): spec.vec2;
3392
- getWorldSizeByPixelSize(pixelSize: spec.vec2): spec.vec2;
3393
- /**
3394
- * @private
3395
- * @description 获取当前激活的场景
3396
- */
3397
- private getActiveTargetScene;
3398
- /**
3399
- * @description 获取场景主合成的 previewSize
3400
- * @param scene 可选,未传时取当前激活视图场景
3401
- * @returns 主合成的 previewSize;场景/主合成/previewSize 任一不存在时返回 undefined
3402
- */
3403
- getSceneSize(scene?: spec.JSONScene): Vector2 | undefined;
3404
- /**
3405
- * @private
3406
- * @description 刷新场景和页面数据
3407
- */
3408
- private refreshSceneAndPageData;
3409
- addSpriteItem(spriteInfo: AsyncSpriteCreateInfo, asyncMode: true, targetScene?: spec.JSONScene): Promise<string>;
3410
- addSpriteItem(spriteInfo: SpriteCreateInfo, asyncMode: false, targetScene?: spec.JSONScene): Promise<string>;
3411
- addGroupItem(groupInfo: GroupCreateInfo, targetScene?: spec.JSONScene): string | undefined;
3412
- addTextItem(textInfo: TextCreateInfo, targetScene?: spec.JSONScene): Promise<string | undefined>;
3413
- addVideoItem(videoInfo: AsyncVideoCreateInfo, asyncMode: true, targetScene?: spec.JSONScene): Promise<string>;
3414
- addVideoItem(videoInfo: VideoCreateInfo, asyncMode: false, targetScene?: spec.JSONScene): Promise<string>;
3415
- /**
3416
- * @description 添加生成器元素
3417
- * @param createInfo 生成器创建信息
3418
- * @param targetScene 目标场景
3419
- * @returns 元素ID
3420
- */
3421
- addGeneratorItem(createInfo: GeneratorCreateInfo, targetScene?: spec.JSONScene): string;
3422
- /**
3423
- * @description 设置生成器资源,将生成器转换为对应的元素(SpriteItem 或 VideoItem)
3424
- * @param id 生成器元素ID
3425
- * @param resourceUrl 资源地址
3426
- * @returns 新的元素ID
3427
- */
3428
- setGeneratorResource(id: string, resourceUrl: string): Promise<string>;
3429
- /**
3430
- * @description 将视频生成器转换为视频元素
3431
- * @param id 视频生成器元素ID
3432
- * @param videoUrl 视频资源地址
3433
- * @returns 新的视频元素ID
3434
- * @deprecated 使用 setGeneratorResource 替代
3435
- */
3436
- convertVideoGeneratorToVideo(id: string, videoUrl: string): Promise<string>;
3437
- /**
3438
- * @description 删除元素
3439
- * @param id 元素id
3440
- */
3441
- deleteItem(id: string): void;
3442
- /**
3443
- * @description 统一的元素认父函数,根据父节点类型自动选择处理逻辑
3444
- * @param itemId 子元素ID
3445
- * @param parentId 父元素ID
3446
- * @param targetScene 目标场景(可选,默认当前场景)
3447
- * @returns 是否认父成功
3448
- */
3449
- setItemParentUnified(itemId: string, parentId: string, targetScene?: spec.JSONScene): boolean;
3450
- /**
3451
- * @description 将元素设置到空节点/组下
3452
- * @param itemId 子元素ID
3453
- * @param parentId 父节点ID(必须是空节点/组)
3454
- * @param targetScene 目标场景
3455
- * @private
3456
- */
3457
- private setItemParentToGroup;
3458
- /**
3459
- */
3460
- setItemParent(id: string, parentId: string, targetScene?: spec.JSONScene): void;
3461
- deleteItemParent(id: string, parentId: string, targetScene?: spec.JSONScene): void;
3462
- /**
3463
- * @description 将元素移动到 Frame 中
3464
- * @param itemIds 要移动的元素ID列表
3465
- * @param frameId 目标 Frame ID
3466
- */
3467
- moveItemsToFrame(itemIds: string[], frameId: string): void;
3468
- /**
3469
- * @description 移动单个元素到 Frame(仅 JSON 层,Player 层在 reLoad 后重建)
3470
- * @private
3471
- */
3472
- private moveSingleJSONItemToFrame;
3473
- /**
3474
- * @description 移动单个元素到 Frame(保持 parentId)
3475
- * @param itemId 元素ID
3476
- * @param frameItem 目标 Frame
3477
- * @param options 变换选项
3478
- * @param mainScene 主场景
3479
- * @param parentId 要保持的父节点ID
3480
- * @private
3481
- */
3482
- private moveSingleJSONItemToFrameWithParent;
3483
- /**
3484
- * @description 收集元素及其所有子元素(递归处理嵌套组)
3485
- * @param itemIds 初始元素ID列表
3486
- * @returns 包含所有子元素的ID列表
3487
- * @private
3488
- */
3489
- private collectItemsWithChildren;
3490
- private moveSinglePlayerItemToFrame;
3491
- /**
3492
- * @description 将元素从 Frame 中移出到主场景
3493
- * @param itemIds 要移动的元素ID列表
3494
- * @param frameId 源 Frame ID(可选,如果不传则从第一个元素的 parentId 推断)
3495
- */
3496
- moveItemsOutOfFrame(itemIds: string[]): void;
3497
- /**
3498
- * @description 移动单个元素从 Frame 到主场景(仅 JSON 层)
3499
- * @private
3500
- */
3501
- private moveSingleJSONItemOutOfFrame;
3502
- private moveSinglePlayerItemOutOfFrame;
3503
- setItemName(id: string, name: string, targetScene?: spec.JSONScene): void;
3504
- get undoRedo(): UndoRedo;
3505
- saveUndoRedoOldData(): void;
3506
- pushUndoRedoData(): void;
3507
- getItemCreateInfo(id: string, withParent?: boolean): GroupCreateInfo | SpriteCreateInfo | TextCreateInfo | VideoCreateInfo | GeneratorCreateInfo | EffectsCreateInfo | FrameCreateInfo | undefined;
3508
- getChildrenIds(id: string): string[];
3509
- createScreenShotSceneByIds(idInfo: string | string[]): any;
3510
- createSceneByCreateInfos(createInfos: ItemCreateInfo[], sceneSize?: spec.vec2, name?: string, scenePosition?: spec.vec2): spec.JSONScene;
3511
- /**
3512
- * @description 更新元素在图片中的顺序(仅在同级元素之间)
3513
- * @param id 元素ID
3514
- * @param action 排序操作类型
3515
- */
3516
- updateItemOrder(id: string, action: ItemOrderAction): void;
3517
- private isPluginItem;
3518
- private refreshItemRenderOrder;
3519
- /**
3520
- * @description 根据 composition.items 的顺序重新排列 pageData.items
3521
- * @param composition 当前场景
3522
- */
3523
- private syncPageDataItemsOrder;
3524
- getViewProperty(id?: number): ViewProperty | undefined;
3525
- viewportFit(shiftParam?: ViewportFitShiftParam, box?: Box2): void;
3526
- getItemBoxById(idInfo: string): Box2;
3527
- getItemBoxById(idInfo: string[]): Box2[];
3528
- setItemFontFamily(id: string, fontFamilyName: string, url: string): Promise<void>;
3529
- changeItemPropertyByCreateInfo(itemCreateInfo: ItemCreateInfo | ItemCreateInfo[]): Promise<void>;
3530
- getViewBoxByBox(box: Box2): Box2;
3531
- playVideoItem(id?: string): void;
3532
- pauseVideoItem(id?: string): void;
3533
- playEffectsItem(id?: string): void;
3534
- pauseEffectsItem(id?: string): void;
3535
- setEffectsResource(id: string, effects: string): void;
3536
- /**
3537
- * @description 根据元素创建信息获取包围盒
3538
- * @param createInfo 元素创建信息
3539
- * @returns 包围盒
3540
- */
3541
- getBoundingBoxByCreateInfo(createInfo: ItemCreateInfo): Box2;
3542
- /**
3543
- * @description 根据元素创建信息组获取包围盒
3544
- * @param createInfos 元素创建信息组
3545
- * @returns 包围盒
3546
- */
3547
- getBoundingBoxByCreateInfos(createInfos: ItemCreateInfo[]): Box2;
3548
- getVideoItemPlayTime(id: string): number;
3549
- setVideoItemPlayTime(id: string, time: number): void;
3550
- getEffectsItemPlayTime(id: string): number | undefined;
3551
- setEffectsItemPlayTime(id: string, time: number): void;
3552
- getPixelPositionByViewPosition(viewPosition: Vector2): Vector2;
3553
- getItemParentScale(id: string): Vector3;
3554
- getJSONItem(id: string): spec.VFXItemData | undefined;
3555
- getJSONComponent(id: string): spec.ComponentData | undefined;
3556
- getTextOriginSize(id: string): {
3557
- size: spec.vec2;
3558
- isPublishScene: boolean;
3559
- };
3560
- asyncAddItemByCreateInfos(createInfos: ItemCreateInfo[]): Promise<string[]>;
3561
- addItemByCreateInfos(createInfos: ItemCreateInfo[]): Promise<string[]>;
3562
- addEffectsItem(createInfo: EffectsCreateInfo, targetScene?: spec.JSONScene): Promise<string | undefined>;
3563
- /**
3564
- * @description 添加画板元素
3565
- * @param createInfo 画板创建信息
3566
- * @param targetScene 目标场景
3567
- * @returns 元素ID
3568
- */
3569
- addFrameItem(createInfo: FrameCreateInfo, targetScene?: spec.JSONScene): Promise<string>;
3570
- makeItemAlign(type: AlignType, ids?: string[]): void;
3571
- makeItemDistribute(type: DistributeType, ids?: string[]): void;
3572
- setItemLockState(id: string, state: boolean): void;
3573
- getItemLockState(id: string): boolean;
3574
- /**
3575
- * @description 计算元素在新父节点下保持世界绝对 transform 不变时所需的局部 transform
3576
- * @param itemId 要移动的元素 ID
3577
- * @param targetParentVFXItem 目标父 VFXItem(移入 Frame 时为 compositionItem,移出 Frame 时为 composition.rootItem)
3578
- */
3579
- getItemTransformUnderParent(itemId: string, targetParentVFXItem: VFXItem): MoveItemTransformOptions | undefined;
3580
- /**
3581
- * @description 修改画板元素大小
3582
- * @param id 元素id
3583
- * @param size 目标大小 [width, height]
3584
- * @param translation 位置偏移补偿(可选,用于保持拖拽角点固定)
3585
- */
3586
- resizeFrameItem(id: string, size: spec.vec2, translation?: Vector3): void;
3587
- /**
3588
- * @description 对 FrameItem 执行自动布局(Shelf 算法)
3589
- * @param frameId Frame 元素 ID
3590
- */
3591
- applyFrameAutoLayout(frameId: string): void;
3592
- /**
3593
- * @description 将 layout-utils 的 AutoLayoutResult 结果记录到 layoutInfos
3594
- * @param frameId Frame 元素 ID
3595
- * @param layoutResult autoLayout 函数返回的结果
3596
- */
3597
- private recordLayoutInfosFromAutoLayoutResult;
3598
- /**
3599
- * @description 刷新画板子元素
3600
- * @param id 画板元素id
3601
- */
3602
- refreshFrameChildren(id: string): void;
3603
- autoLayoutPage(param?: PageAutoLayoutParam): Promise<void>;
3604
- /**
3605
- * @description 计算选中元素排布的锚点偏移:保持原始包围盒左上角位置不变
3606
- * @param layoutElements 参与排布的元素列表
3607
- * @param layoutBoundingBox 排布算法输出的包围盒
3608
- */
3609
- private getPartialLayoutAnchor;
3610
- /**
3611
- * @description 计算全量排布的锚点偏移:以视口中心为锚点
3612
- * @param layoutBoundingBox 排布算法输出的包围盒
3613
- */
3614
- private getGlobalLayoutAnchor;
3615
- }
3616
-
3617
- declare class InteractionUtils {
3618
- /**
3619
- * @description 交互平面
3620
- */
3621
- plane: Plane;
3622
- /**
3623
- * @description 交互射线
3624
- */
3625
- ray: Ray;
3626
- /**
3627
- * @description 交互状态视图信息
3628
- */
3629
- viewportParam: ViewInteractionParam;
3630
- /**
3631
- * @description 交互状态相机信息
3632
- */
3633
- cameraParam: CameraInteractionParam;
3634
- pageDataUtils: PageDataUtils;
3635
- constructor(utils: PageDataUtils);
3636
- refreshViewParam(): void;
3637
- refreshCameraParam(): void;
3638
- refrehCameraParamByCameraInfo(camera: any): void;
3639
- initInteractionPlane(position?: Vector3, rotation?: Euler): void;
3640
- /**
3641
- * @description 根据视图空间大小获取空间大小
3642
- * @param viewSize 视图空间大小
3643
- * @param isWorld 是否依赖于世界坐标系 - 世界坐标系下,以当前相机锁定平面为基准进行运算;本地坐标系下,以元素坐标系进行运算[用于决定交互平面]
3644
- * @param targetItem 目标元素
3645
- */
3646
- getWorldSizeByViewSize(viewSize: Vector2, isWorld?: boolean, itemId?: string): Vector3;
3647
- /**
3648
- * @description 获取 template 模式下视图与场景的缩放比 (viewportWidth / sceneWidth)
3649
- * 场景未就绪时回退到 1,并打印一次 warning
3650
- */
3651
- getTemplateViewScale(): number;
3652
- getViewSizeByPixelSize(pixelSize: Vector2): Vector2;
3653
- /**
3654
- * @description 对空间坐标进行投影
3655
- * @param point 空间坐标
3656
- * @param isGestureHandlerView 是否投影到辅助视图下 - 辅助试图与实际视图大小可能会有区别
3657
- */
3658
- projectPoint(point: Vector3): Vector2;
3659
- /**
3660
- * @description 通过屏幕坐标获取世界坐标
3661
- * @param point 屏幕坐标
3662
- * @returns 世界坐标
3663
- */
3664
- getWorldPositionByViewPoint(point: Vector2): Vector3 | undefined;
3665
- getNDCPositionByScreenPosition(point: Vector2): Vector2;
3666
- getNDCSizeByPixelSize(pixelSize: Vector2): Vector2;
3667
- getViewPositionWWithOutTransform(point: Vector2): Vector2;
3668
- getViewPositionByPixelPoint(point: Vector2): Vector2;
3669
- getPixelPositionByViewPoint(point: Vector2): Vector2;
3670
- getPixelSizeByWorldSize(worldSize: Vector3): Vector2;
3671
- getPixelSizeByNDCSize(ndcSize: Vector2): Vector2;
3672
- getPixelSizeByViewSize(viewSize: Vector2): Vector2;
3673
- }
3674
-
3675
- /**
3676
- * @description 自动布局指示器数据
3677
- */
3678
- type AutoLayoutIndicator = {
3679
- frameId: string;
3680
- insertIndex: number;
3681
- insertDirection: 'before' | 'after';
3682
- targetSiblingId?: string;
3683
- line: Line2;
3684
- targetRow?: number;
3685
- targetColumn?: number;
3686
- } | null;
3687
- /**
3688
- * @description 布局位置信息
3689
- */
3690
- type LayoutPosition = {
3691
- row: number;
3692
- column: number;
3693
- };
3694
- /**
3695
- * @description 插入位置信息
3696
- */
3697
- type InsertPosition = {
3698
- index: number;
3699
- direction: 'before' | 'after';
3700
- siblingId?: string;
3701
- row: number;
3702
- column: number;
3703
- rowChange?: {
3704
- fromRow: number;
3705
- toRow: number;
3706
- rowBounds?: {
3707
- minY: number;
3708
- maxY: number;
3709
- minX: number;
3710
- maxX: number;
3711
- };
3712
- isRowChange: boolean;
3713
- };
3714
- };
3715
- /**
3716
- * @description 兄弟元素布局信息
3717
- */
3718
- type SiblingWithInfo = {
3719
- item: SDKItem;
3720
- box: Box2;
3721
- row: number;
3722
- column: number;
3723
- centerX: number;
3724
- };
3725
- /**
3726
- * @description 布局元素信息
3727
- */
3728
- type LayoutItem = {
3729
- id: string;
3730
- box: Box2;
3731
- row?: number;
3732
- column?: number;
3733
- };
3734
- /**
3735
- * @description 布局结果项
3736
- */
3737
- type LayoutResultItem = {
3738
- id: string;
3739
- position: [number, number];
3740
- row: number;
3741
- column: number;
3742
- };
3743
- /**
3744
- * @description 自动排布配置
3745
- */
3746
- type AutoLayoutOptions = {
3747
- padding?: number;
3748
- gap?: number;
3749
- config?: AutoLayoutConfig;
3750
- };
3751
- /**
3752
- * @description 自动排布结果
3753
- */
3754
- type AutoLayoutResult = {
3755
- items: LayoutResultItem[];
3756
- size: [number, number];
3757
- };
3758
- /**
3759
- * @description 全局自适应排布元素
3760
- */
3761
- type LayoutElement = {
3762
- id: string;
3763
- box: Box2;
3764
- };
3765
- /**
3766
- * @description 全局自适应排布结果
3767
- */
3768
- type GlobalAutoLayoutResult = {
3769
- items: {
3770
- id: string;
3771
- position: [number, number];
3772
- }[];
3773
- boundingBox: Box2;
3774
- };
3775
- /**
3776
- * @description 全局自适应排布配置
3777
- */
3778
- type GlobalAutoLayoutOptions = {
3779
- /**
3780
- * @description 元素间隔(默认10)
3781
- */
3782
- gap?: number;
3783
- /**
3784
- * @description 目标宽高比(默认1:1正方形)
3785
- */
3786
- targetAspectRatio?: number;
3787
- /**
3788
- * @description 排布模式
3789
- * - 'adaptive': 基于元素包围盒自适应排布(MaxRects算法,更紧凑)
3790
- * - 'ordered': 基于元素顺序的行列排布(保持输入顺序,流式行排布,行优先)
3791
- */
3792
- mode?: GlobalLayoutMode;
3793
- };
3794
- /**
3795
- * @description 全局自适应排布模式
3796
- */
3797
- type GlobalLayoutMode = 'adaptive' | 'ordered';
3798
- /**
3799
- * @description 自动排布函数
3800
- * 根据元素信息中的行列数参数进行排布:
3801
- * - 如果元素有 row/column,则按指定行列排布
3802
- * - 如果元素没有 row/column,则使用 Shelf 算法自动生成行列数,再排布
3803
- *
3804
- * @param canvasBox 画布范围(Box2),min为左上角,max为右下角
3805
- * @param items 元素信息列表(包含 ID、Box2、可选的 row/column)
3806
- * @param options 可选配置(padding, gap)
3807
- * @returns 各元素的位置信息和整体尺寸
3808
- */
3809
- declare function autoLayout(items: LayoutItem[], options?: AutoLayoutOptions): AutoLayoutResult;
3810
- /**
3811
- * @description 计算元素到目标位置的位移
3812
- * @param currentPosition 当前位置 [x, y]
3813
- * @param targetPosition 目标位置 [x, y]
3814
- * @returns 位移向量 [dx, dy]
3815
- */
3816
- declare function calculateDisplacement(currentPosition: [number, number], targetPosition: [number, number]): [number, number];
3817
- /**
3818
- * @description 为 autoLayout 结果计算位移信息
3819
- * @param items 元素列表(包含当前位置)
3820
- * @param layoutResult autoLayout 的返回结果
3821
- * @returns 每个元素的位移信息
3822
- */
3823
- declare function calculateLayoutDisplacements(items: {
3824
- id: string;
3825
- currentPosition: [number, number];
3826
- }[], layoutResult: AutoLayoutResult): {
3827
- id: string;
3828
- displacement: [number, number];
3829
- targetPosition: [number, number];
3830
- }[];
3831
- /**
3832
- * @description 计算自动布局指示线位置
3833
- * @param position 插入位置信息
3834
- * @param getViewBoxById 获取元素包围盒的函数
3835
- * @returns 主指示线
3836
- */
3837
- declare function calculateAutoLayoutIndicatorLine(position: InsertPosition, getViewBoxById: (id: string) => Box2): Line2;
3838
- /**
3839
- * @description 基于鼠标位置计算布局位置(row 和 column)
3840
- * @param mousePoint 鼠标位置
3841
- * @param allItems 所有子元素
3842
- * @param getViewBoxById 获取元素包围盒的函数
3843
- * @param getLayoutInfo 获取元素布局信息的函数
3844
- * @param excludeItemId 需要排除的元素ID(被拖拽的元素)
3845
- * @returns 布局位置信息 { row: number, column: number }
3846
- */
3847
- declare function calculateAutoLayoutPositionByMouse(mousePoint: Vector2, allItems: SDKItem[], getViewBoxById: (id: string) => Box2, getLayoutInfo: (item: SDKItem) => LayoutInfo | undefined, excludeItemId: string): LayoutPosition | null;
3848
- /**
3849
- * @description 基于鼠标位置计算插入位置(用于显示指示器)
3850
- * @param mousePoint 鼠标位置
3851
- * @param allItems 所有子元素
3852
- * @param excludeItemId 需要排除的元素ID(被拖拽的元素)
3853
- * @param parent 父画板
3854
- * @param originalRow 原始行号
3855
- * @param getSelectedItemsBox 获取选中项包围盒的函数
3856
- * @returns 插入位置信息和计算出的行列位置
3857
- */
3858
- declare function calculateInsertPositionFromLayout(mousePoint: Vector2, allItems: SDKItem[], excludeItemId: string, parent: FrameItem, originalRow: number, getViewBoxById: (id: string) => Box2, getSelectedItemsBox: () => Box2): InsertPosition;
3859
- /**
3860
- * @description 更新元素的 layoutInfo
3861
- * @param item 要更新的元素
3862
- * @param parent 父画板
3863
- * @param layoutPosition 新的布局位置
3864
- */
3865
- declare function updateItemLayoutInfo(item: SDKItem, parent: FrameItem, layoutPosition: LayoutPosition): void;
3866
- /**
3867
- * @description 全局自适应排布
3868
- * 支持两种模式:
3869
- * 1. 'adaptive'(默认): 基于元素包围盒自适应排布(MaxRects算法,更紧凑)
3870
- * 2. 'ordered': 基于元素顺序的流式行排布(保持输入顺序,每行尽可能多放元素)
3871
- *
3872
- * @param elements 元素列表(包含ID和包围盒)
3873
- * @param options 配置选项
3874
- * @returns 各元素位置和整体包围盒
3875
- */
3876
- declare function globalAutoLayout(elements: LayoutElement[], options?: GlobalAutoLayoutOptions): GlobalAutoLayoutResult;
3877
- /**
3878
- * @description 调整其他元素的行列信息
3879
- * 当被拖拽元素移动到新位置时,需要调整其他受影响的元素:
3880
- * 1. 同行内移动:原位置到新位置之间的元素需要相应调整列号
3881
- * 2. 跨行移动:原行中后面的元素前移,目标行中后面的元素后移
3882
- * @param parent 父画板
3883
- * @param draggedItemId 被拖拽的元素ID
3884
- * @param fromRow 原始行号
3885
- * @param fromColumn 原始列号
3886
- * @param toRow 目标行号
3887
- * @param toColumn 目标列号
3888
- */
3889
- declare function adjustOtherElementsLayoutInfo(parent: FrameItem, draggedItemId: string, fromRow: number, fromColumn: number, toRow: number, toColumn: number, getSDKItem: (id: string) => SDKItem | undefined): void;
3890
-
3891
- declare class DefaultVFXItems {
3892
- static createEmpty(composition: Composition, parent?: null, name?: string): VFXItem;
3893
- static createSprite(composition: Composition, parent?: null, name?: string): VFXItem;
3894
- static createText(composition: Composition, parent?: null, name?: string): VFXItem;
3895
- static createVideo(composition: Composition, parent?: null, name?: string): VFXItem;
3896
- static createEffects(composition: Composition, effects: string | spec.JSONScene, parent?: null, urlname?: string): Promise<VFXItem>;
3897
- }
3898
- declare class VFXItemFactory {
3899
- static createVFXItem(composition: Composition, parent?: null, name?: string, ...types: Constructor<Component>[]): VFXItem;
3900
- }
3901
-
3902
- type BaseItemProperty = {
3903
- position: [number, number];
3904
- rotation: [number, number, number];
3905
- scale: [number, number];
3906
- width: number;
3907
- height: number;
3908
- };
3909
- type SpriteItemProperty = BaseItemProperty & {
3910
- image: string;
3911
- };
3912
- type GroupItemProperty = BaseItemProperty & {
3913
- children: string[];
3914
- };
3915
- type TextItemProperty = BaseItemProperty & {
3916
- fontFamily: string;
3917
- color: [number, number, number, number];
3918
- fontWeight: spec.TextWeight;
3919
- text: string;
3920
- textAlign: spec.TextAlignment;
3921
- fontSize: number;
3922
- fontStyle: spec.FontStyle;
3923
- lineHeight: number;
3924
- outlineColor?: spec.vec4;
3925
- outlineWidth?: number;
3926
- /**
3927
- * @description 描边开关
3928
- */
3929
- outlineEnabled?: boolean;
3930
- /**
3931
- * @description 文本字间距
3932
- */
3933
- letterSpacing?: number;
3934
- fontUrl?: string;
3935
- };
3936
- type VideoItemProperty = BaseItemProperty & {
3937
- video: string;
3938
- /**
3939
- * @description 是否静音
3940
- */
3941
- muted?: boolean;
3942
- /**
3943
- * @description 是否为透明视频
3944
- */
3945
- transparent?: boolean;
3946
- /**
3947
- * @description 播放速率
3948
- */
3949
- playbackRate?: number;
3950
- /**
3951
- * @description 音量
3952
- */
3953
- volume?: number;
3954
- };
3955
- /**
3956
- * @description Generator 表单属性
3957
- */
3958
- type GeneratorItemProperty = BaseItemProperty & {
3959
- /**
3960
- * @description 生成器类型
3961
- */
3962
- generatorType: 'image' | 'video';
3963
- };
3964
- type EffectsItemProperty = BaseItemProperty & {
3965
- effects: string;
3966
- children?: string[];
3967
- };
3968
- /**
3969
- * @description Frame 画板元素布局模式
3970
- */
3971
- declare enum FrameLayoutMode {
3972
- AUTO = "auto",
3973
- FREE = "free"
3974
- }
3975
- /**
3976
- * @description 自动布局配置
3977
- */
3978
- type AutoLayoutConfig = {
3979
- /**
3980
- * @description 单行最大宽度(像素),超过后自动换行。未设置时不限制
3981
- */
3982
- maxRowWidth?: number;
3983
- /**
3984
- * @description 最大行数限制。未设置时不限制
3985
- */
3986
- maxRowCount?: number;
3987
- };
3988
- /**
3989
- * @description 元素在自动布局中的位置信息
3990
- */
3991
- type LayoutInfo = {
3992
- /**
3993
- * @description 所在行号(可为小数)
3994
- * 整数部分:主行号(0, 1, 2...)
3995
- * 小数部分:分行后的子行号(如 1.5 表示第1行的第5个子行)
3996
- * 仅支持两层(即小数部分为 0-9)
3997
- */
3998
- row: number;
3999
- /**
4000
- * @description 所在列号(必须为整数)
4001
- */
4002
- column: number;
4003
- /**
4004
- * @description 元素在布局中的位置(相对于画板左上角,可选)
4005
- */
4006
- position?: [number, number];
4007
- };
4008
- /**
4009
- * @description Frame 画板元素属性
4010
- */
4011
- type FrameItemProperty = BaseItemProperty & {
4012
- /**
4013
- * @description 布局模式: auto - 自动布局, free - 自由布局
4014
- */
4015
- layoutMode: FrameLayoutMode;
4016
- /**
4017
- * @description 子元素ID数组
4018
- */
4019
- children: string[];
4020
- /**
4021
- * @description 自动布局配置
4022
- */
4023
- autoLayoutConfig?: AutoLayoutConfig;
4024
- /**
4025
- * @description 子元素布局位置信息(用于自动布局)
4026
- * key: 子元素ID, value: 元素的位置信息
4027
- */
4028
- layoutInfos?: Record<string, LayoutInfo>;
4029
- };
4030
- /**
4031
- * @description BaseItem 基础属性键名
4032
- */
4033
- type BaseItemPropertyKey = 'name' | 'duration' | 'delay' | 'endBehavior' | 'visible' | 'isLocked' | 'parentId';
4034
- /**
4035
- * @description BaseItem 基础属性值类型映射
4036
- */
4037
- type BaseItemPropertyValueMap = {
4038
- name: string;
4039
- duration: number;
4040
- delay: number;
4041
- endBehavior: spec.EndBehavior;
4042
- visible: boolean;
4043
- isLocked: boolean;
4044
- parentId?: string;
4045
- };
4046
- /**
4047
- * @description Item 类型与 Property 类型的映射
4048
- */
4049
- type ItemPropertyMap = {
4050
- [SDKItemType.SPRITE]: SpriteItemProperty;
4051
- [SDKItemType.TEXT]: TextItemProperty;
4052
- [SDKItemType.VIDEO]: VideoItemProperty;
4053
- [SDKItemType.GROUP]: GroupItemProperty;
4054
- [SDKItemType.GENERATOR]: GeneratorItemProperty;
4055
- [SDKItemType.EFFECTS]: EffectsItemProperty;
4056
- [SDKItemType.FRAME]: FrameItemProperty;
4057
- };
4058
- /**
4059
- * @description 场景1:单个元素单个属性设置
4060
- * 支持设置 BaseItem 基础属性或具体 Item 类型的 property 属性
4061
- */
4062
- type SetSingleItemSinglePropertyParam<T extends SDKItemType = SDKItemType> = {
4063
- itemId: string;
4064
- type: T;
4065
- propertyName: BaseItemPropertyKey;
4066
- propertyValue: BaseItemPropertyValueMap[BaseItemPropertyKey];
4067
- } | {
4068
- itemId: string;
4069
- type: T;
4070
- propertyName: keyof ItemPropertyMap[T];
4071
- propertyValue: ItemPropertyMap[T][keyof ItemPropertyMap[T]];
4072
- };
4073
- /**
4074
- * @description 场景2:单个元素多个属性设置
4075
- * 同时设置多个 BaseItem 属性或 property 属性
4076
- */
4077
- type SetSingleItemMultiplePropertiesParam<T extends SDKItemType = SDKItemType> = {
4078
- itemId: string;
4079
- type: T;
4080
- property: Partial<Record<BaseItemPropertyKey, BaseItemPropertyValueMap[BaseItemPropertyKey]>> & Partial<Record<keyof ItemPropertyMap[T], ItemPropertyMap[T][keyof ItemPropertyMap[T]]>>;
4081
- };
4082
- /**
4083
- * @description 设置元素属性的统一参数类型
4084
- * 支持两种场景:单元素单属性、单元素多属性
4085
- */
4086
- type SetItemPropertyParam<T extends SDKItemType = SDKItemType> = SetSingleItemSinglePropertyParam<T> | SetSingleItemMultiplePropertiesParam<T>;
4087
- type SDKOptions = {
4088
- /** 导出视频时,是否开启转码日志 */
4089
- loggerInExportVideoTranscoding?: boolean;
4090
- };
4091
- type SDKInputParam = SDKTemplateInputParam | SDKEditorInputParam;
4092
- /**
4093
- * @description SDK入参
4094
- */
4095
- type SDKTemplateInputParam = {
4096
- /**
4097
- * @description JSON地址
4098
- */
4099
- scene: string | spec.JSONScene;
4100
- /**
4101
- * @description SDK模式 - 模板编辑模式
4102
- */
4103
- mode: 'template';
4104
- /**
4105
- * @description 视图参数
4106
- */
4107
- viewParams?: ViewParam[];
4108
- /**
4109
- * @description 页面属性
4110
- */
4111
- options: PageOptions;
4112
- };
4113
- type SDKEditorInputParam = {
4114
- /**
4115
- * @description SDK模式 - 编辑器模式
4116
- */
4117
- mode: 'editor';
4118
- };
4119
- /**
4120
- * @description 页面属性
4121
- */
4122
- type PageOptions = {
4123
- /**
4124
- * @description 同步模式开关
4125
- */
4126
- asyncMode: boolean;
4127
- /**
4128
- * @description 安全区展示开关
4129
- */
4130
- safeAreaPreview: boolean;
4131
- /**
4132
- * @description 吸附开关
4133
- */
4134
- adsorption: boolean;
4135
- };
4136
- /**
4137
- * @description 页面数据
4138
- */
4139
- type PageData = {
4140
- /**
4141
- * @description 基础场景数据
4142
- */
4143
- scene: spec.JSONScene;
4144
- /**
4145
- * @description 页面属性
4146
- */
4147
- property: PageProperty;
4148
- /**
4149
- * @description 视图属性
4150
- */
4151
- viewProperties: ViewProperty[];
4152
- /**
4153
- * @description 活跃数据
4154
- */
4155
- activeData: ActiveData;
4156
- /**
4157
- * @description 元素数据
4158
- */
4159
- items: SDKItem[];
4160
- /**
4161
- * @description 视图当前时间
4162
- */
4163
- time: number;
4164
- /**
4165
- * @description 是否处于播放态
4166
- */
4167
- playing: boolean;
4168
- };
4169
- /**
4170
- * @description 页面自动布局参数
4171
- */
4172
- type PageAutoLayoutParam = {
4173
- /**
4174
- * @description 自动布局模式
4175
- */
4176
- mode?: GlobalLayoutMode;
4177
- /**
4178
- * @description 选中元素【无输入值时,页面内所有元素排布】
4179
- * 如果是选中元素自动排布,则保证包围盒左上角点位置相同
4180
- */
4181
- ids?: string[];
4182
- /**
4183
- * @description 排布后是否聚焦元素,默认开启
4184
- */
4185
- focus?: boolean;
4186
- /**
4187
- * @description 自动布局间隔
4188
- */
4189
- gap?: number;
4190
- };
4191
- /**
4192
- * @description 页面配置
4193
- */
4194
- type PageConfig = {
4195
- /**
4196
- * @description 出血区域展示开关
4197
- */
4198
- safeAreaPreview: boolean;
4199
- /**
4200
- * @description 缩放值
4201
- */
4202
- zoom: number;
4203
- /**
4204
- * @description 吸附开关
4205
- */
4206
- adsorption: boolean;
4207
- /**
4208
- * @description 同步开关
4209
- */
4210
- asyncMode: boolean;
4211
- /**
4212
- * @description 画布移动
4213
- */
4214
- translation: spec.vec2;
4215
- };
4216
- /**
4217
- * @description 页面属性
4218
- */
4219
- type PageProperty = {
4220
- /**
4221
- * @description 出血区域展示开关
4222
- */
4223
- safeAreaPreview: boolean;
4224
- /**
4225
- * @description 缩放值
4226
- */
4227
- zoom: number;
4228
- /**
4229
- * @description 偏移值
4230
- */
4231
- translation: [number, number];
4232
- /**
4233
- * @description 吸附开关
4234
- */
4235
- adsorption: boolean;
4236
- /**
4237
- * @description 同步开关
4238
- */
4239
- asyncMode: boolean;
4240
- };
4241
- /**
4242
- * @description 视图创建参数
4243
- */
4244
- type ViewParam = {
4245
- /**
4246
- * @description 页面尺寸
4247
- */
4248
- size?: [number, number];
4249
- /**
4250
- * @description 出血区参数
4251
- */
4252
- safeArea?: [number, number, number, number];
4253
- /**
4254
- * @description 自适应方向 - 默认根据视图宽高决定
4255
- */
4256
- adaptionDirection?: SizeAdaptDirection;
4257
- /**
4258
- * @description 自定义出血区 - 用于展示
4259
- */
4260
- previewSafeAreas?: PreviewSafeAreaParam[];
4261
- /**
4262
- * @description 导出参数
4263
- */
4264
- export: ExportParam;
4265
- };
4266
- /**
4267
- * @description 导出参数
4268
- */
4269
- type ExportParam = {
4270
- /**
4271
- * @description 视频名称
4272
- */
4273
- name?: string;
4274
- } & Omit<ExportMediaItemOptions, 'scene' | 'size'>;
4275
- /**
4276
- * @description 视图属性
4277
- */
4278
- type ViewProperty = {
4279
- /**
4280
- * @description 视图ID
4281
- */
4282
- id: number;
4283
- /**
4284
- * @description 视图宽高
4285
- */
4286
- size: [number, number];
4287
- /**
4288
- * @description 出血区数据
4289
- */
4290
- safeArea: [number, number, number, number];
4291
- /**
4292
- * @description 自定义出血区数据
4293
- */
4294
- previewSafeAreas: PreviewSafeAreaParam[];
4295
- /**
4296
- * @description 视图场景数据
4297
- */
4298
- scene: spec.JSONScene;
4299
- /**
4300
- * @description 导出参数
4301
- */
4302
- export: ExportParam;
4303
- /**
4304
- * @description 忽略交互 - 仅供展示
4305
- */
4306
- ignoreInteraction: boolean;
4307
- };
4308
- /**
4309
- * @description 自定义出血区数据
4310
- */
4311
- type PreviewSafeAreaParam = {
4312
- /**
4313
- * @description 出血区包围盒 [left top width height]
4314
- */
4315
- box: [number, number, number, number];
4316
- /**
4317
- * @description 出血区色块颜色 默认为 [255, 255, 255, 0.3]
4318
- */
4319
- color?: [number, number, number, number];
4320
- /**
4321
- * @description 出血区图像
4322
- */
4323
- url?: string;
4324
- /**
4325
- * @description 出血区是否可见
4326
- */
4327
- visible?: boolean;
4328
- };
4329
- /**
4330
- * @description 页面活跃数据
4331
- */
4332
- type ActiveData = {
4333
- /**
4334
- * @description 视图ID
4335
- */
4336
- view?: number;
4337
- /**
4338
- * @description 选中元素
4339
- */
4340
- selectedItems: string[];
4341
- /**
4342
- * @description 预选中元素
4343
- */
4344
- preSelectedItem?: string;
4345
- /**
4346
- * @description 执行中元素
4347
- */
4348
- loadingItems?: string[];
4349
- };
4350
- type SDKBackgroundType = 'color' | 'image' | 'chess-board' | 'dot-board';
4351
- /**
4352
- * @description 图层创建信息
4353
- */
4354
- type SpriteCreateInfo = {
4355
- type: SDKItemType.SPRITE;
4356
- /**
4357
- * @description 图层名称
4358
- */
4359
- name?: string;
4360
- /**
4361
- * @description 元素id
4362
- */
4363
- id?: string;
4364
- /**
4365
- * @description 父节点id
4366
- */
4367
- parentId?: string;
4368
- /**
4369
- * @description 扩展属性
4370
- */
4371
- extension?: Record<string, any>;
4372
- /**
4373
- * @description 元素属性
4374
- */
4375
- property: {
4376
- /**
4377
- * @description 图片资源地址 | 数据
4378
- */
4379
- image?: string;
4380
- /**
4381
- * @description 图层像素宽度
4382
- */
4383
- width: number;
4384
- /**
4385
- * @description 图层像素高度
4386
- */
4387
- height: number;
4388
- /**
4389
- * @description 元素位置
4390
- */
4391
- position: [number, number];
4392
- /**
4393
- * @description 元素旋转 z | [x, y, z]
4394
- */
4395
- rotation?: number | [number, number, number];
4396
- /**
4397
- * @description 元素缩放
4398
- */
4399
- scale?: [number, number];
4400
- };
4401
- };
4402
- /**
4403
- * @description 组 元素创建信息
4404
- */
4405
- type GroupCreateInfo = {
4406
- type: SDKItemType.GROUP;
4407
- /**
4408
- * @description 元素id
4409
- */
4410
- id?: string;
4411
- /**
4412
- * @description 父节点id
4413
- */
4414
- parentId?: string;
4415
- /**
4416
- * @description 元素名称
4417
- */
4418
- name?: string;
4419
- /**
4420
- * @description 扩展属性
4421
- */
4422
- extension?: Record<string, any>;
4423
- /**
4424
- * @description 元素属性
4425
- */
4426
- property: {
4427
- /**
4428
- * @description 元素位置
4429
- */
4430
- position?: [number, number];
4431
- /**
4432
- * @description 元素旋转 z | [x, y, z]
4433
- */
4434
- rotation?: number | [number, number, number];
4435
- /**
4436
- * @description 元素缩放
4437
- */
4438
- scale?: [number, number];
4439
- /**
4440
- * @description 子元素id
4441
- */
4442
- children: string[];
4443
- };
4444
- };
4445
- /**
4446
- * @description 文本创建信息
4447
- */
4448
- type TextCreateInfo = {
4449
- type: SDKItemType.TEXT;
4450
- /**
4451
- * @description 元素id
4452
- */
4453
- id?: string;
4454
- /**
4455
- * @description 父节点id
4456
- */
4457
- parentId?: string;
4458
- /**
4459
- * @description 元素名称
4460
- */
4461
- name?: string;
4462
- /**
4463
- * @description 扩展属性
4464
- */
4465
- extension?: Record<string, any>;
4466
- /**
4467
- * @description 元素属性
4468
- */
4469
- property: {
4470
- /**
4471
- * @description 文本宽度
4472
- */
4473
- width: number;
4474
- /**
4475
- * @description 文本高度
4476
- */
4477
- height?: number;
4478
- /**
4479
- * @description 元素位置
4480
- */
4481
- position: [number, number];
4482
- /**
4483
- * @description 元素旋转 z | [x, y, z]
4484
- */
4485
- rotation?: number | [number, number, number];
4486
- /**
4487
- * @description 元素缩放
4488
- */
4489
- scale?: [number, number];
4490
- /**
4491
- * @description 单行高度
4492
- */
4493
- lineHeight: number;
4494
- /**
4495
- * @description 字体名称
4496
- */
4497
- fontFamily: string;
4498
- /**
4499
- * @description 文字大小
4500
- */
4501
- fontSize: number;
4502
- /**
4503
- * @description 字重
4504
- */
4505
- fontWeight?: spec.TextWeight;
4506
- /**
4507
- * @description 字体格式
4508
- */
4509
- fontStyle?: spec.FontStyle;
4510
- /**
4511
- * @description 对齐方式
4512
- */
4513
- textAlign?: spec.TextAlignment;
4514
- /**
4515
- * @description 文本信息
4516
- */
4517
- text: string;
4518
- /**
4519
- * @description 填充色
4520
- */
4521
- color: spec.vec4;
4522
- /**
4523
- * @description 描边色
4524
- */
4525
- outlineColor?: spec.vec4;
4526
- /**
4527
- * @description 描边宽度
4528
- */
4529
- outlineWidth?: number;
4530
- /**
4531
- * @description 描边开关
4532
- */
4533
- outlineEnabled?: boolean;
4534
- /**
4535
- * @description 字体文件地址
4536
- */
4537
- fontUrl?: string;
4538
- /**
4539
- * @description 文本字间距
4540
- */
4541
- letterSpacing?: number;
4542
- };
4543
- };
4544
- /**
4545
- * @description 视频创建信息
4546
- */
4547
- type VideoCreateInfo = {
4548
- type: SDKItemType.VIDEO;
4549
- /**
4550
- * @description 视频名称
4551
- */
4552
- name?: string;
4553
- /**
4554
- * @description 元素id
4555
- */
4556
- id?: string;
4557
- /**
4558
- * @description 父节点id
4559
- */
4560
- parentId?: string;
4561
- /**
4562
- * @description 扩展属性
4563
- */
4564
- extension?: Record<string, any>;
4565
- /**
4566
- * @description 元素属性
4567
- */
4568
- property: {
4569
- /**
4570
- * @description 视频资源地址 | 数据
4571
- */
4572
- video?: string;
4573
- /**
4574
- * @description 视频元素像素宽度
4575
- */
4576
- width: number;
4577
- /**
4578
- * @description 视频元素像素高度
4579
- */
4580
- height: number;
4581
- /**
4582
- * @description 视频元素位置
4583
- */
4584
- position: [number, number];
4585
- /**
4586
- * @description 视频元素旋转 z | [x, y, z]
4587
- */
4588
- rotation?: number | [number, number, number];
4589
- /**
4590
- * @description 视频元素缩放
4591
- */
4592
- scale?: [number, number];
4593
- /**
4594
- * @description 是否静音
4595
- */
4596
- muted?: boolean;
4597
- /**
4598
- * @description 是否为透明视频
4599
- */
4600
- transparent?: boolean;
4601
- /**
4602
- * @description 播放速率
4603
- */
4604
- playbackRate?: number;
4605
- /**
4606
- * @description 音量
4607
- */
4608
- volume?: number;
4609
- };
4610
- };
4611
- /**
4612
- * @description 生成器类型
4613
- */
4614
- type GeneratorType = 'image' | 'video';
4615
- /**
4616
- * @description 生成器创建信息
4617
- */
4618
- type GeneratorCreateInfo = {
4619
- /**
4620
- * @description 元素类型 - 生成器
4621
- */
4622
- type: SDKItemType.GENERATOR;
4623
- /**
4624
- * @description 元素名称
4625
- */
4626
- name?: string;
4627
- /**
4628
- * @description 元素id
4629
- */
4630
- id?: string;
4631
- /**
4632
- * @description 父元素id
4633
- */
4634
- parentId?: string;
4635
- /**
4636
- * @description 扩展属性
4637
- */
4638
- extension?: Record<string, any>;
4639
- /**
4640
- * @description 元素属性
4641
- */
4642
- property: {
4643
- /**
4644
- * @description 生成器类型
4645
- */
4646
- generatorType: GeneratorType;
4647
- /**
4648
- * @description 生成器元素像素宽度
4649
- */
4650
- width: number;
4651
- /**
4652
- * @description 生成器元素像素高度
4653
- */
4654
- height: number;
4655
- /**
4656
- * @description 生成器元素位置
4657
- */
4658
- position: [number, number];
4659
- /**
4660
- * @description 生成器元素旋转 z | [x, y, z]
4661
- */
4662
- rotation?: number | [number, number, number];
4663
- /**
4664
- * @description 生成器元素缩放
4665
- */
4666
- scale?: [number, number];
4667
- };
4668
- };
4669
- /**
4670
- * @description 图片生成器资源信息
4671
- */
4672
- type SpriteGeneratorResource = {
4673
- /**
4674
- * @description 资源地址
4675
- */
4676
- url: string;
4677
- /**
4678
- * @description 资源尺寸
4679
- */
4680
- size?: spec.vec2;
4681
- /**
4682
- * @description 目标生成器元素 ID(必填)
4683
- */
4684
- itemId: string;
4685
- /**
4686
- * @description 扩展属性
4687
- */
4688
- extension?: Record<string, any>;
4689
- };
4690
- /**
4691
- * @description 视频生成器资源信息
4692
- */
4693
- type VideoGeneratorResource = {
4694
- /**
4695
- * @description 资源地址
4696
- */
4697
- url: string;
4698
- /**
4699
- * @description 资源尺寸
4700
- */
4701
- size?: spec.vec2;
4702
- /**
4703
- * @description 是否静音(仅用于视频)
4704
- */
4705
- muted?: boolean;
4706
- /**
4707
- * @description 是否为透明视频(仅用于视频)
4708
- */
4709
- transparent?: boolean;
4710
- /**
4711
- * @description 播放速率(仅用于视频)
4712
- */
4713
- playbackRate?: number;
4714
- /**
4715
- * @description 音量(仅用于视频)
4716
- */
4717
- volume?: number;
4718
- /**
4719
- * @description 目标生成器元素 ID(必填)
4720
- */
4721
- itemId: string;
4722
- /**
4723
- * @description 扩展属性
4724
- */
4725
- extension?: Record<string, any>;
4726
- };
4727
- type GeneratorResource = SpriteGeneratorResource | VideoGeneratorResource;
4728
- type EffectsCreateInfo = {
4729
- /**
4730
- * @description 元素类型 - 特效
4731
- */
4732
- type: SDKItemType.EFFECTS;
4733
- /**
4734
- * @description 元素名称
4735
- */
4736
- name?: string;
4737
- /**
4738
- * @description 元素id
4739
- */
4740
- id?: string;
4741
- /**
4742
- * @description 父元素id
4743
- */
4744
- parentId?: string;
4745
- property: {
4746
- /**
4747
- * @description 动效像素宽度
4748
- */
4749
- width?: number;
4750
- /**
4751
- * @description 动效像素高度
4752
- */
4753
- height?: number;
4754
- /**
4755
- * @description 生成器位置
4756
- */
4757
- position: spec.vec2;
4758
- /**
4759
- * @description 旋转角度
4760
- */
4761
- rotation?: number | [number, number, number];
4762
- /**
4763
- * @description 缩放
4764
- */
4765
- scale?: spec.vec2;
4766
- /**
4767
- * @description 动效资源地址
4768
- */
4769
- effects: string;
4770
- };
4771
- /**
4772
- * @description 扩展属性
4773
- */
4774
- extension?: Record<string, any>;
4775
- };
4776
- type AsyncSpriteCreateInfo = SpriteCreateInfo & {
4777
- textureId: string;
4778
- };
4779
- type AsyncVideoCreateInfo = VideoCreateInfo & {
4780
- textureId: string;
4781
- };
4782
- /**
4783
- * @description Frame 画板元素创建信息
4784
- */
4785
- type FrameCreateInfo = {
4786
- /**
4787
- * @description 元素类型 - 画板
4788
- */
4789
- type: SDKItemType.FRAME;
4790
- /**
4791
- * @description 元素名称
4792
- */
4793
- name?: string;
4794
- /**
4795
- * @description 元素id
4796
- */
4797
- id?: string;
4798
- /**
4799
- * @description 父元素id
4800
- */
4801
- parentId?: string;
4802
- /**
4803
- * @description 元素属性
4804
- */
4805
- property: {
4806
- /**
4807
- * @description 画板像素宽度
4808
- */
4809
- width: number;
4810
- /**
4811
- * @description 画板像素高度
4812
- */
4813
- height: number;
4814
- /**
4815
- * @description 画板位置
4816
- */
4817
- position: [number, number];
4818
- /**
4819
- * @description 画板旋转 z | [x, y, z]
4820
- */
4821
- rotation?: number | [number, number, number];
4822
- /**
4823
- * @description 画板缩放
4824
- */
4825
- scale?: [number, number];
4826
- /**
4827
- * @description 布局模式: 'auto' | 'free'
4828
- */
4829
- layoutMode?: FrameLayoutMode;
4830
- /**
4831
- * @description 子元素序号
4832
- */
4833
- children: string[];
4834
- /**
4835
- * @description 自动布局配置
4836
- */
4837
- autoLayoutConfig?: AutoLayoutConfig;
4838
- /**
4839
- * @description 子元素布局位置信息(用于自动布局)
4840
- * key: 子元素ID, value: 元素的位置信息
4841
- */
4842
- layoutInfos?: Record<string, LayoutInfo>;
4843
- };
4844
- /**
4845
- * @description 扩展属性
4846
- */
4847
- extension?: Record<string, any>;
4848
- };
4849
- type ItemCreateInfo = GroupCreateInfo | SpriteCreateInfo | TextCreateInfo | VideoCreateInfo | GeneratorCreateInfo | EffectsCreateInfo | FrameCreateInfo;
4850
- /**
4851
- * @description 场景创建信息
4852
- */
4853
- type SceneCreaetInfo = {
4854
- /**
4855
- * @description 场景名称
4856
- */
4857
- name: string;
4858
- /**
4859
- * @description 场景大小
4860
- */
4861
- size: spec.vec2;
4862
- };
4863
- declare enum ItemOrderAction {
4864
- BringToFront = 0,
4865
- SendToBack = 1,
4866
- BringForward = 2,
4867
- SendBackward = 3
4868
- }
4869
- /**
4870
- * @description 视图自适应偏移参数
4871
- */
4872
- type ViewportFitShiftParam = {
4873
- /**
4874
- * @description 左偏移
4875
- */
4876
- left?: number;
4877
- /**
4878
- * @description 右偏移
4879
- */
4880
- right?: number;
4881
- /**
4882
- * @description 上偏移
4883
- */
4884
- top?: number;
4885
- /**
4886
- * @description 下偏移
4887
- */
4888
- bottom?: number;
4889
- };
4890
-
4891
- export { type ActiveData, type AlignType, type AutoLayoutIndicator, type AutoLayoutOptions, type AutoLayoutResult, type BackgroundGridConfig, BackgroundManager, type BackgroundPreset, BaseItem, type BaseItemProperty, type BaseItemPropertyKey, type BaseItemPropertyValueMap, Box2, type CameraInteractionParam, type CreateOperation, DefaultVFXItems, type DeleteOperation, type DistributeType, type EffectsCreateInfo, EffectsItem, type EffectsItemOptions, type FrameCreateInfo, FrameItem, type FrameItemOptions, type FrameItemProperty, FrameLayoutMode, type GeneratorCreateInfo, GeneratorItem, type GeneratorItemOptions, type GeneratorItemProperty, type GizmoType, type GlobalAutoLayoutOptions, type GlobalAutoLayoutResult, type GlobalLayoutMode, type GroupCreateInfo, GroupItem, type GroupItemOptions, type InsertPosition, InteractionUtils, type ItemCreateInfo, type ItemJSONInfo, ItemOrderAction, type ItemPropertyMap, type LayoutElement, type LayoutItem, type LayoutPosition, type LayoutResultItem, type MoveItemTransformOptions, type Operation, type PageData, PageDataUtils, type PageProperty, SDK, type SDKEvents, type SDKInputParam, type SDKItem, type SDKItemOptions, SDKItemType, type SDKOptions, SafeConstraint, type SetItemPropertyParam, type SetSingleItemMultiplePropertiesParam, type SetSingleItemSinglePropertyParam, type SiblingWithInfo, type SpriteCreateInfo, SpriteItem, type SpriteItemOptions, type SpriteItemProperty, type TextCreateInfo, TextItem, type TextItemOptions, type TextItemProperty, type UpdateOperation, VFXItemFactory, Vector2, type VideoCreateInfo, VideoItem, type VideoItemOptions, type VideoItemProperty, type ViewInteractionParam, type ViewParam, type ViewProperty, addCompositionItemByComposition, addItemInfoToScene, adjustOtherElementsLayoutInfo, arrAdd, assertExist, asserts, autoLayout, calculateAutoLayoutIndicatorLine, calculateAutoLayoutPositionByMouse, calculateDisplacement, calculateInsertPositionFromLayout, calculateLayoutDisplacements, clearItemParentInfo, createCompositionItemJSON, createFrameCompositionScene, createNullItemJSON, createSDKItem, createSpriteItemJSON, createTextItemJSON, createVideoGeneratorItemJSON, createVideoItemJSON, deepClone, deepEquals, deleteCompositionFromScene, deleteCompositionItemFromScene, deleteItemInfoFromScene, downloadBlob, extractSubCompositionToScene, fixStandardJSON, getBasicScene, getColorByNormalizeColor, getCompositionDataByRefCompositionItemId, getCompositionIdByRefCompositionItemId, getNormalizeColorByColor, getTextureUrlById, getTransformRatioByViewAndCamera, getUniqueName, globalAutoLayout, isBaseItem, isEffectsItem, isEqual, isFrameItem, isGeneratorItem, isGroupItem, isObj, isSpriteItem, isTextItem, isVideoItem, loadScriptAsync, logger, moveItemBetweenCompositions, removeItemInfoFromScene, resetSubCompositionItemId, setItemJSONParentId, setJSONItemName, updateItemLayoutInfo };