@vvfx/sdk 0.1.14-alpha.3 → 0.1.14-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _galacean_effects from '@galacean/effects';
2
- import { spec, VFXItem, math, Player } from '@galacean/effects';
2
+ import { spec, math, Player } from '@galacean/effects';
3
3
  export { generateGUID, spec } from '@galacean/effects';
4
4
  import { Point } from '@pixi/constants';
5
5
 
@@ -32,6 +32,10 @@ type SDKItemOptions = {
32
32
  * @description 元素生命周期延时
33
33
  */
34
34
  delay?: number;
35
+ /**
36
+ * @description 可视状态
37
+ */
38
+ visible?: boolean;
35
39
  /**
36
40
  * @description 元素结束行为
37
41
  */
@@ -56,7 +60,7 @@ type SpriteItemOptions = SDKItemOptions & {
56
60
  /**
57
61
  * @description 元素属性
58
62
  */
59
- property?: Partial<SpriteFormProperty>;
63
+ property?: Partial<SpriteItemProperty>;
60
64
  };
61
65
  /**
62
66
  * @description Text SDKItem 选项
@@ -65,7 +69,7 @@ type TextItemOptions = SDKItemOptions & {
65
69
  /**
66
70
  * @description 元素属性
67
71
  */
68
- property?: Partial<TextFormProperty>;
72
+ property?: Partial<TextItemProperty>;
69
73
  };
70
74
  /**
71
75
  * @description Video SDKItem 选项
@@ -74,40 +78,44 @@ type VideoItemOptions = SDKItemOptions & {
74
78
  /**
75
79
  * @description 元素属性
76
80
  */
77
- property?: Partial<VideoFormProperty>;
81
+ property?: Partial<VideoItemProperty>;
78
82
  };
79
83
  /**
80
- * @description Null SDKItem 选项(空节点/组)
84
+ * @description Group SDKItem 选项(空节点/组)
81
85
  */
82
- type NullItemOptions = SDKItemOptions & {
86
+ type GroupItemOptions = SDKItemOptions & {
83
87
  /**
84
88
  * @description 元素属性
85
89
  */
86
- property?: Partial<BaseFormProperty>;
90
+ property?: Partial<GroupItemProperty>;
87
91
  };
88
92
  /**
89
93
  * @description Generator SDKItem 选项(资源生成器)
90
94
  * @description 支持 image 和 video 两种生成器类型
91
- * @description 复用 SpriteFormProperty 作为底层渲染
95
+ * @description 使用 GeneratorItemProperty 包含 generatorType
92
96
  */
93
97
  type GeneratorItemOptions = SDKItemOptions & {
94
98
  /**
95
- * @description 生成器类型
96
- */
97
- generatorType: GeneratorType;
98
- /**
99
- * @description 元素属性
99
+ * @description 元素属性(包含 generatorType)
100
100
  */
101
- property?: Partial<SpriteFormProperty>;
101
+ property?: Partial<GeneratorItemProperty>;
102
102
  };
103
103
  type EffectsItemOptions = SDKItemOptions & {
104
- property?: Partial<EffectsFormProperty>;
104
+ property?: Partial<EffectsItemProperty>;
105
105
  };
106
106
  /**
107
107
  * @description SDKItem 类型(独立于 spec.ItemType)
108
108
  * @description 包含所有 SDK 层级的元素类型,包括虚拟类型如 generator
109
109
  */
110
- type SDKItemType = 'sprite' | 'text' | 'video' | 'null' | 'generator' | 'effects' | 'frame';
110
+ declare enum SDKItemType {
111
+ Sprite = "sprite",
112
+ Text = "text",
113
+ Video = "video",
114
+ Group = "group",
115
+ Generator = "generator",
116
+ Effects = "effects",
117
+ Frame = "frame"
118
+ }
111
119
 
112
120
  /**
113
121
  * @description SDKItem 抽象基类
@@ -126,10 +134,6 @@ declare abstract class BaseItem {
126
134
  * @description 父节点ID
127
135
  */
128
136
  parentId?: string;
129
- /**
130
- * @description 子元素ID列表
131
- */
132
- children: string[];
133
137
  /**
134
138
  * @description 元素生命周期
135
139
  */
@@ -142,23 +146,27 @@ declare abstract class BaseItem {
142
146
  * @description 元素结束行为
143
147
  */
144
148
  endBehavior: spec.EndBehavior;
149
+ /**
150
+ * @description 是否可见
151
+ */
152
+ visible: boolean;
145
153
  /**
146
154
  * @description 是否处于锁定状态
147
155
  */
148
156
  isLocked: boolean;
149
157
  /**
150
- * @description 扩展属性存储(私有)
158
+ * @description 扩展属性存储(与 property 同级)
151
159
  */
152
160
  private _extensions;
153
161
  /**
154
162
  * @description 元素类型(由子类实现)
155
- * @description 支持 spec.ItemType 或扩展的 SDKItemType(如 'video-generator')
163
+ * @description 支持 spec.ItemType 或扩展的 SDKItemType
156
164
  */
157
- abstract readonly type: spec.ItemType | SDKItemType;
165
+ abstract readonly type: SDKItemType;
158
166
  /**
159
167
  * @description 元素属性(由子类实现)
160
168
  */
161
- abstract readonly property: BaseFormProperty;
169
+ abstract readonly property: BaseItemProperty;
162
170
  constructor(options: SDKItemOptions);
163
171
  /**
164
172
  * @description 设置扩展属性
@@ -193,7 +201,7 @@ declare abstract class BaseItem {
193
201
  * @description 获取所有扩展属性
194
202
  * @returns 扩展属性对象
195
203
  */
196
- getAllExtensions(): Record<string, any>;
204
+ getExtensions(): Record<string, any>;
197
205
  /**
198
206
  * @description 批量设置扩展属性
199
207
  * @param extensions 扩展属性对象
@@ -235,11 +243,11 @@ declare class SpriteItem extends BaseItem {
235
243
  /**
236
244
  * @description 元素类型
237
245
  */
238
- readonly type = spec.ItemType.sprite;
246
+ readonly type = SDKItemType.Sprite;
239
247
  /**
240
248
  * @description 元素属性
241
249
  */
242
- property: SpriteFormProperty;
250
+ property: SpriteItemProperty;
243
251
  constructor(options: SpriteItemOptions);
244
252
  /**
245
253
  * @description 图片地址
@@ -266,11 +274,6 @@ declare class SpriteItem extends BaseItem {
266
274
  */
267
275
  get fullRotation(): [number, number, number];
268
276
  set fullRotation(value: [number, number, number]);
269
- /**
270
- * @description 可见性
271
- */
272
- get visible(): boolean;
273
- set visible(value: boolean);
274
277
  /**
275
278
  * @description 是否正在编辑关键属性
276
279
  */
@@ -305,11 +308,11 @@ declare class TextItem extends BaseItem {
305
308
  /**
306
309
  * @description 元素类型
307
310
  */
308
- readonly type = spec.ItemType.text;
311
+ readonly type = SDKItemType.Text;
309
312
  /**
310
313
  * @description 元素属性
311
314
  */
312
- property: TextFormProperty;
315
+ property: TextItemProperty;
313
316
  constructor(options: TextItemOptions);
314
317
  /**
315
318
  * @description 文本内容
@@ -344,8 +347,8 @@ declare class TextItem extends BaseItem {
344
347
  /**
345
348
  * @description 文本颜色 [r, g, b, a]
346
349
  */
347
- get textColor(): [number, number, number, number];
348
- set textColor(value: [number, number, number, number]);
350
+ get color(): [number, number, number, number];
351
+ set color(value: [number, number, number, number]);
349
352
  /**
350
353
  * @description 文本宽度
351
354
  */
@@ -386,11 +389,6 @@ declare class TextItem extends BaseItem {
386
389
  */
387
390
  get rotation(): number;
388
391
  set rotation(value: number);
389
- /**
390
- * @description 可见性
391
- */
392
- get visible(): boolean;
393
- set visible(value: boolean);
394
392
  /**
395
393
  * @description 转换为 CreateInfo
396
394
  * @param withParent 是否包含父节点ID
@@ -414,11 +412,11 @@ declare class VideoItem extends BaseItem {
414
412
  /**
415
413
  * @description 元素类型
416
414
  */
417
- readonly type = spec.ItemType.video;
415
+ readonly type = SDKItemType.Video;
418
416
  /**
419
417
  * @description 元素属性
420
418
  */
421
- property: VideoFormProperty;
419
+ property: VideoItemProperty;
422
420
  constructor(options: VideoItemOptions);
423
421
  /**
424
422
  * @description 视频地址
@@ -445,16 +443,31 @@ declare class VideoItem extends BaseItem {
445
443
  */
446
444
  get fullRotation(): [number, number, number];
447
445
  set fullRotation(value: [number, number, number]);
448
- /**
449
- * @description 可见性
450
- */
451
- get visible(): boolean;
452
- set visible(value: boolean);
453
446
  /**
454
447
  * @description 是否正在编辑关键属性
455
448
  */
456
449
  get keyPropertyEditing(): boolean;
457
450
  set keyPropertyEditing(value: boolean);
451
+ /**
452
+ * @description 是否静音
453
+ */
454
+ get muted(): boolean;
455
+ set muted(state: boolean);
456
+ /**
457
+ * @description 是否为透明视频
458
+ */
459
+ get transparent(): boolean;
460
+ set transparent(state: boolean);
461
+ /**
462
+ * @description 播放音量
463
+ */
464
+ get volume(): number;
465
+ set volume(value: number);
466
+ /**
467
+ * @description 播放速率
468
+ */
469
+ get playbackRate(): number;
470
+ set playbackRate(value: number);
458
471
  /**
459
472
  * @description 转换为 CreateInfo
460
473
  * @param withParent 是否包含父节点ID
@@ -474,16 +487,16 @@ declare function isVideoItem(obj: any): obj is VideoItem;
474
487
  * @description 空节点/组 SDKItem 类
475
488
  * @description 支持属性扩展
476
489
  */
477
- declare class NullItem extends BaseItem {
490
+ declare class GroupItem extends BaseItem {
478
491
  /**
479
492
  * @description 元素类型
480
493
  */
481
- readonly type = spec.ItemType.null;
494
+ readonly type = SDKItemType.Group;
482
495
  /**
483
496
  * @description 元素属性
484
497
  */
485
- property: BaseFormProperty;
486
- constructor(options: NullItemOptions);
498
+ property: GroupItemProperty;
499
+ constructor(options: GroupItemOptions);
487
500
  /**
488
501
  * @description 位置
489
502
  */
@@ -494,6 +507,11 @@ declare class NullItem extends BaseItem {
494
507
  */
495
508
  get size(): [number, number];
496
509
  set size(value: [number, number]);
510
+ /**
511
+ * @description 大小
512
+ */
513
+ get scale(): [number, number];
514
+ set scale(value: [number, number]);
497
515
  /**
498
516
  * @description 旋转(二维旋转角度)
499
517
  */
@@ -504,38 +522,25 @@ declare class NullItem extends BaseItem {
504
522
  */
505
523
  get fullRotation(): [number, number, number];
506
524
  set fullRotation(value: [number, number, number]);
507
- /**
508
- * @description 可见性
509
- */
510
- get visible(): boolean;
511
- set visible(value: boolean);
512
525
  /**
513
526
  * @description 是否正在编辑关键属性
514
527
  */
515
528
  get keyPropertyEditing(): boolean;
516
529
  set keyPropertyEditing(value: boolean);
517
- /**
518
- * @description 计算缩放(基于子元素)
519
- */
520
- get scaleForCreateInfo(): [number, number];
521
- /**
522
- * @description 设置缩放(存储在扩展属性中)
523
- */
524
- set scaleForCreateInfo(value: [number, number]);
525
530
  /**
526
531
  * @description 转换为 CreateInfo
527
532
  * @param withParent 是否包含父节点ID
528
533
  */
529
- toCreateInfo(withParent?: boolean): NullCreateInfo;
534
+ toCreateInfo(withParent?: boolean): GroupCreateInfo;
530
535
  /**
531
536
  * @description 克隆 SDKItem
532
537
  */
533
- clone(): NullItem;
538
+ clone(): GroupItem;
534
539
  }
535
540
  /**
536
- * @description 类型守卫:检查是否是 NullItem
541
+ * @description 类型守卫:检查是否是 GroupItem
537
542
  */
538
- declare function isNullItem(obj: any): obj is NullItem;
543
+ declare function isGroupItem(obj: any): obj is GroupItem;
539
544
 
540
545
  /**
541
546
  * @description 资源生成器元素 SDKItem 类
@@ -547,16 +552,17 @@ declare class GeneratorItem extends BaseItem {
547
552
  /**
548
553
  * @description 元素类型(独立类型,不属于 spec.ItemType)
549
554
  */
550
- readonly type: SDKItemType;
555
+ readonly type = SDKItemType.Generator;
551
556
  /**
552
- * @description 生成器类型
557
+ * @description 元素属性(包含 generatorType)
553
558
  */
554
- generatorType: GeneratorType;
559
+ property: GeneratorItemProperty;
560
+ constructor(options: GeneratorItemOptions);
555
561
  /**
556
- * @description 元素属性
562
+ * @description 生成器类型
557
563
  */
558
- property: SpriteFormProperty;
559
- constructor(options: GeneratorItemOptions);
564
+ get generatorType(): 'image' | 'video';
565
+ set generatorType(value: 'image' | 'video');
560
566
  /**
561
567
  * @description 图片地址(生成器返回空)
562
568
  */
@@ -582,11 +588,6 @@ declare class GeneratorItem extends BaseItem {
582
588
  */
583
589
  get fullRotation(): [number, number, number];
584
590
  set fullRotation(value: [number, number, number]);
585
- /**
586
- * @description 可见性
587
- */
588
- get visible(): boolean;
589
- set visible(value: boolean);
590
591
  /**
591
592
  * @description 是否正在编辑关键属性
592
593
  */
@@ -626,11 +627,11 @@ declare class EffectsItem extends BaseItem {
626
627
  /**
627
628
  * @description 元素类型(独立类型,不属于 spec.ItemType)
628
629
  */
629
- readonly type: SDKItemType;
630
+ readonly type = SDKItemType.Effects;
630
631
  /**
631
632
  * @description 元素属性
632
633
  */
633
- property: EffectsFormProperty;
634
+ property: EffectsItemProperty;
634
635
  constructor(options: EffectsItemOptions);
635
636
  /**
636
637
  * @description 特效资源地址
@@ -657,11 +658,6 @@ declare class EffectsItem extends BaseItem {
657
658
  */
658
659
  get fullRotation(): [number, number, number];
659
660
  set fullRotation(value: [number, number, number]);
660
- /**
661
- * @description 可见性
662
- */
663
- get visible(): boolean;
664
- set visible(value: boolean);
665
661
  /**
666
662
  * @description 是否正在编辑关键属性
667
663
  */
@@ -689,20 +685,11 @@ declare function isEffectsItem(obj: any): obj is EffectsItem;
689
685
  * @returns SDKItem 实例
690
686
  */
691
687
  declare function createSDKItem(type: spec.ItemType, options: SDKItemOptions): BaseItem;
692
- /**
693
- * @description 从 Player Item 创建 SDKItem
694
- * @param playerItem VFXItem
695
- * @param parentId 父节点ID
696
- * @param property 属性对象
697
- * @param generatorType 生成器类型(如果是生成器元素)
698
- * @returns SDKItem 实例
699
- */
700
- declare function createSDKItemFromPlayerItem(playerItem: VFXItem, parentId: string | undefined, property: Record<string, any>, generatorType?: GeneratorType): BaseItem;
701
688
  /**
702
689
  * @description SDKItem 类型联合
703
690
  * @description 用于替换原来的 SDKItem type
704
691
  */
705
- type SDKItem$1 = SpriteItem | TextItem | VideoItem | NullItem | GeneratorItem;
692
+ type SDKItem$1 = SpriteItem | TextItem | VideoItem | GroupItem | GeneratorItem;
706
693
 
707
694
  type ViewItemTypedProperty = {
708
695
  [K in keyof PageFormTypeAndPropertyReference]: {
@@ -748,7 +735,7 @@ type SetItemPropertyValueParam = {
748
735
  }[keyof PageFormTypeAndPropertyReference[T]];
749
736
  }[keyof PageFormTypeAndPropertyReference] | {
750
737
  itemId: string;
751
- type: spec.ItemType;
738
+ type: SDKItemType | spec.ItemType;
752
739
  propertyName: 'position' | 'size';
753
740
  propertyValue: spec.vec2 | spec.vec3;
754
741
  };
@@ -1510,7 +1497,7 @@ type TransformGizmoConfig = {
1510
1497
  /**
1511
1498
  * @description 空节点Logo地址
1512
1499
  */
1513
- nullLogoUrl: string;
1500
+ groupLogoUrl: string;
1514
1501
  /**
1515
1502
  * @description 文本Logo地址
1516
1503
  */
@@ -2247,11 +2234,12 @@ declare class SDK {
2247
2234
  * @description 元素打组
2248
2235
  * @param children 子元素ID
2249
2236
  */
2250
- groupItems(nullInfo: NullCreateInfo, scene?: spec.JSONScene): string | undefined;
2237
+ groupItems(groupInfo: GroupCreateInfo, scene?: spec.JSONScene): string | undefined;
2251
2238
  addTextItem(textInfo: TextCreateInfo, scene?: spec.JSONScene): Promise<string | undefined>;
2252
2239
  addItemByCreateInfos(createInfos: ItemCreateInfo[], asyncMode?: boolean): Promise<(string | undefined)[]>;
2253
2240
  deleteItems(idInfo: string | string[]): void;
2254
- getItemCreateInfo(idInfo: string | string[]): ItemCreateInfo[];
2241
+ getItemCreateInfo(idInfo: string): ItemCreateInfo | undefined;
2242
+ getItemCreateInfo(idInfo: string[]): ItemCreateInfo[];
2255
2243
  createScreenShotSceneByIds(idInfo: string | string[], time?: number): Promise<string | undefined>;
2256
2244
  getChildrenIds(id: string): string[];
2257
2245
  /**
@@ -2401,21 +2389,23 @@ declare class SDK {
2401
2389
 
2402
2390
  type SizeAdaptDirection = 'x' | 'y';
2403
2391
 
2404
- type BaseFormProperty = {
2392
+ type BaseItemProperty = {
2405
2393
  position: [number, number];
2406
2394
  rotation: [number, number, number];
2407
2395
  size: [number, number];
2408
2396
  scale: [number, number];
2409
- visible: boolean;
2410
- isLocked?: boolean;
2397
+ visible?: boolean;
2411
2398
  keyPropertyEditing: boolean;
2412
2399
  };
2413
- type SpriteFormProperty = BaseFormProperty & {
2400
+ type SpriteItemProperty = BaseItemProperty & {
2414
2401
  image: string;
2415
2402
  };
2416
- type TextFormProperty = BaseFormProperty & {
2403
+ type GroupItemProperty = BaseItemProperty & {
2404
+ children: string[];
2405
+ };
2406
+ type TextItemProperty = BaseItemProperty & {
2417
2407
  fontFamily: string;
2418
- textColor: [number, number, number, number];
2408
+ color: [number, number, number, number];
2419
2409
  fontWeight: spec.TextWeight;
2420
2410
  text: string;
2421
2411
  textAlign: spec.TextAlignment;
@@ -2430,38 +2420,70 @@ type TextFormProperty = BaseFormProperty & {
2430
2420
  * @description 描边开关
2431
2421
  */
2432
2422
  outlineEnabled?: boolean;
2423
+ fontUrl?: string;
2433
2424
  };
2434
- type VideoFormProperty = BaseFormProperty & {
2425
+ type VideoItemProperty = BaseItemProperty & {
2435
2426
  video: string;
2427
+ /**
2428
+ * @description 是否静音
2429
+ */
2430
+ muted?: boolean;
2431
+ /**
2432
+ * @description 是否为透明视频
2433
+ */
2434
+ transparent?: boolean;
2435
+ /**
2436
+ * @description 播放速率
2437
+ */
2438
+ playbackRate?: number;
2439
+ /**
2440
+ * @description 音量
2441
+ */
2442
+ volume?: number;
2443
+ };
2444
+ /**
2445
+ * @description Generator 表单属性
2446
+ */
2447
+ type GeneratorItemProperty = BaseItemProperty & {
2448
+ /**
2449
+ * @description 生成器类型
2450
+ */
2451
+ generatorType: 'image' | 'video';
2436
2452
  };
2437
- type EffectsFormProperty = BaseFormProperty & {
2453
+ type EffectsItemProperty = BaseItemProperty & {
2438
2454
  effects: string;
2439
2455
  };
2440
2456
  /**
2441
2457
  * @description 页面表单类型和属性引用
2442
2458
  */
2443
2459
  type PageFormTypeAndPropertyReference = {
2444
- [spec.ItemType.base]: BaseFormProperty;
2445
- [spec.ItemType.sprite]: SpriteFormProperty;
2446
- [spec.ItemType.particle]: BaseFormProperty;
2447
- [spec.ItemType.null]: BaseFormProperty;
2448
- [spec.ItemType.interact]: BaseFormProperty;
2449
- [spec.ItemType.plugin]: BaseFormProperty;
2450
- [spec.ItemType.camera]: BaseFormProperty;
2451
- [spec.ItemType.composition]: BaseFormProperty;
2452
- [spec.ItemType.spine]: BaseFormProperty;
2453
- [spec.ItemType.mesh]: BaseFormProperty;
2454
- [spec.ItemType.tree]: BaseFormProperty;
2455
- [spec.ItemType.text]: TextFormProperty;
2456
- [spec.ItemType.light]: BaseFormProperty;
2457
- [spec.ItemType.skybox]: BaseFormProperty;
2458
- [spec.ItemType.effect]: BaseFormProperty;
2459
- [spec.ItemType.shape]: BaseFormProperty;
2460
- [spec.ItemType.postProcessVolume]: BaseFormProperty;
2461
- [spec.ItemType.node]: BaseFormProperty;
2462
- [spec.ItemType.video]: VideoFormProperty;
2463
- [spec.ItemType.audio]: BaseFormProperty;
2464
- [spec.ItemType.richtext]: TextFormProperty;
2460
+ [spec.ItemType.base]: BaseItemProperty;
2461
+ [spec.ItemType.sprite]: SpriteItemProperty;
2462
+ [spec.ItemType.null]: BaseItemProperty;
2463
+ [SDKItemType.Sprite]: SpriteItemProperty;
2464
+ [SDKItemType.Text]: TextItemProperty;
2465
+ [SDKItemType.Video]: VideoItemProperty;
2466
+ [SDKItemType.Group]: GroupItemProperty;
2467
+ [SDKItemType.Generator]: GeneratorItemProperty;
2468
+ [SDKItemType.Effects]: EffectsItemProperty;
2469
+ [SDKItemType.Frame]: BaseItemProperty;
2470
+ [spec.ItemType.interact]: BaseItemProperty;
2471
+ [spec.ItemType.plugin]: BaseItemProperty;
2472
+ [spec.ItemType.camera]: BaseItemProperty;
2473
+ [spec.ItemType.composition]: BaseItemProperty;
2474
+ [spec.ItemType.spine]: BaseItemProperty;
2475
+ [spec.ItemType.mesh]: BaseItemProperty;
2476
+ [spec.ItemType.tree]: BaseItemProperty;
2477
+ [spec.ItemType.text]: TextItemProperty;
2478
+ [spec.ItemType.light]: BaseItemProperty;
2479
+ [spec.ItemType.skybox]: BaseItemProperty;
2480
+ [spec.ItemType.effect]: BaseItemProperty;
2481
+ [spec.ItemType.shape]: BaseItemProperty;
2482
+ [spec.ItemType.postProcessVolume]: BaseItemProperty;
2483
+ [spec.ItemType.node]: BaseItemProperty;
2484
+ [spec.ItemType.video]: VideoItemProperty;
2485
+ [spec.ItemType.audio]: BaseItemProperty;
2486
+ [spec.ItemType.richtext]: TextItemProperty;
2465
2487
  };
2466
2488
  type SpecificPageFormProps<T extends keyof PageFormTypeAndPropertyReference> = {
2467
2489
  type: T;
@@ -2721,7 +2743,7 @@ type SDKBackgroundType = 'color' | 'image' | 'chess-board' | 'dot-board';
2721
2743
  * @description 图层创建信息
2722
2744
  */
2723
2745
  type SpriteCreateInfo = {
2724
- type: 'sprite';
2746
+ type: SDKItemType.Sprite;
2725
2747
  /**
2726
2748
  * @description 图层名称
2727
2749
  */
@@ -2734,36 +2756,41 @@ type SpriteCreateInfo = {
2734
2756
  * @description 父节点id
2735
2757
  */
2736
2758
  parentId?: string;
2737
- /**
2738
- * @description 图片资源地址
2739
- */
2740
- url: string;
2741
- /**
2742
- * @description 图层元素像素大小
2743
- */
2744
- size: spec.vec2;
2745
- /**
2746
- * @description 图层元素缩放
2747
- */
2748
- scale?: spec.vec2;
2749
- /**
2750
- * @description 图层元素旋转
2751
- */
2752
- rotation?: number;
2753
- /**
2754
- * @description 图层元素二维位置
2755
- */
2756
- position: spec.vec2;
2757
2759
  /**
2758
2760
  * @description 扩展属性
2759
2761
  */
2760
2762
  extensions?: Record<string, any>;
2763
+ /**
2764
+ * @description 元素属性
2765
+ */
2766
+ property: {
2767
+ /**
2768
+ * @description 图片资源地址 | 数据
2769
+ */
2770
+ image: string;
2771
+ /**
2772
+ * @description 元素像素大小
2773
+ */
2774
+ size: [number, number];
2775
+ /**
2776
+ * @description 元素位置
2777
+ */
2778
+ position: [number, number];
2779
+ /**
2780
+ * @description 元素旋转 z | [x, y, z]
2781
+ */
2782
+ rotation?: number | [number, number, number];
2783
+ /**
2784
+ * @description 元素缩放
2785
+ */
2786
+ scale?: [number, number];
2787
+ };
2761
2788
  };
2762
2789
  /**
2763
2790
  * @description 空节点创建信息
2764
2791
  */
2765
- type NullCreateInfo = {
2766
- type: 'null';
2792
+ type GroupCreateInfo = {
2793
+ type: SDKItemType.Group;
2767
2794
  /**
2768
2795
  * @description 元素id
2769
2796
  */
@@ -2776,32 +2803,37 @@ type NullCreateInfo = {
2776
2803
  * @description 元素名称
2777
2804
  */
2778
2805
  name?: string;
2779
- /**
2780
- * @description 空节点缩放
2781
- */
2782
- scale?: spec.vec2;
2783
- /**
2784
- * @description 子元素id
2785
- */
2786
- children: string[];
2787
- /**
2788
- * @description 空节点旋转
2789
- */
2790
- rotation?: number;
2791
- /**
2792
- * @description 空节点位移
2793
- */
2794
- position?: spec.vec2;
2795
2806
  /**
2796
2807
  * @description 扩展属性
2797
2808
  */
2798
2809
  extensions?: Record<string, any>;
2810
+ /**
2811
+ * @description 元素属性
2812
+ */
2813
+ property: {
2814
+ /**
2815
+ * @description 元素位置
2816
+ */
2817
+ position: [number, number];
2818
+ /**
2819
+ * @description 元素旋转 z | [x, y, z]
2820
+ */
2821
+ rotation?: number | [number, number, number];
2822
+ /**
2823
+ * @description 元素缩放
2824
+ */
2825
+ scale?: [number, number];
2826
+ /**
2827
+ * @description 子元素id
2828
+ */
2829
+ children: string[];
2830
+ };
2799
2831
  };
2800
2832
  /**
2801
2833
  * @description 文本创建信息
2802
2834
  */
2803
2835
  type TextCreateInfo = {
2804
- type: 'text';
2836
+ type: SDKItemType.Text;
2805
2837
  /**
2806
2838
  * @description 元素id
2807
2839
  */
@@ -2815,79 +2847,84 @@ type TextCreateInfo = {
2815
2847
  */
2816
2848
  name?: string;
2817
2849
  /**
2818
- * @description 单行高度
2819
- */
2820
- lineHeight: number;
2821
- /**
2822
- * @description 文本高度
2823
- */
2824
- textHeight?: number;
2825
- /**
2826
- * @description 宽度
2827
- */
2828
- textWidth: number;
2829
- /**
2830
- * @description 字体名称
2831
- */
2832
- fontFamily: string;
2833
- /**
2834
- * @description 文本位置
2835
- */
2836
- position?: spec.vec2;
2837
- /**
2838
- * @description 文本旋转
2839
- */
2840
- rotation?: number;
2841
- /**
2842
- * @description 文字大小
2843
- */
2844
- fontSize: number;
2845
- /**
2846
- * @description 字重
2847
- */
2848
- fontWeight?: spec.TextWeight;
2849
- /**
2850
- * @description 字体格式
2851
- */
2852
- fontStyle?: spec.FontStyle;
2853
- /**
2854
- * @description 对齐方式
2855
- */
2856
- textAlign?: spec.TextAlignment;
2857
- /**
2858
- * @description 文本信息
2859
- */
2860
- text: string;
2861
- /**
2862
- * @description 填充色
2863
- */
2864
- textColor: spec.vec4;
2865
- /**
2866
- * @description 描边色
2867
- */
2868
- outlineColor?: spec.vec4;
2869
- /**
2870
- * @description 描边宽度
2871
- */
2872
- outlineWidth?: number;
2873
- /**
2874
- * @description 描边开关
2850
+ * @description 扩展属性
2875
2851
  */
2876
- outlineEnabled?: boolean;
2852
+ extensions?: Record<string, any>;
2877
2853
  /**
2878
- * @description 字体文件地址
2854
+ * @description 元素属性
2879
2855
  */
2880
- url?: string;
2881
- /**
2882
- * @description 扩展属性
2856
+ property: {
2857
+ /**
2858
+ * @description 文本宽高
2883
2859
  */
2884
- extensions?: Record<string, any>;
2860
+ size: [number, number];
2861
+ /**
2862
+ * @description 元素位置
2863
+ */
2864
+ position: [number, number];
2865
+ /**
2866
+ * @description 元素旋转 z | [x, y, z]
2867
+ */
2868
+ rotation?: number | [number, number, number];
2869
+ /**
2870
+ * @description 元素缩放
2871
+ */
2872
+ scale?: [number, number];
2873
+ /**
2874
+ * @description 单行高度
2875
+ */
2876
+ lineHeight: number;
2877
+ /**
2878
+ * @description 字体名称
2879
+ */
2880
+ fontFamily: string;
2881
+ /**
2882
+ * @description 文字大小
2883
+ */
2884
+ fontSize: number;
2885
+ /**
2886
+ * @description 字重
2887
+ */
2888
+ fontWeight?: spec.TextWeight;
2889
+ /**
2890
+ * @description 字体格式
2891
+ */
2892
+ fontStyle?: spec.FontStyle;
2893
+ /**
2894
+ * @description 对齐方式
2895
+ */
2896
+ textAlign?: spec.TextAlignment;
2897
+ /**
2898
+ * @description 文本信息
2899
+ */
2900
+ text: string;
2901
+ /**
2902
+ * @description 填充色
2903
+ */
2904
+ color: spec.vec4;
2905
+ /**
2906
+ * @description 描边色
2907
+ */
2908
+ outlineColor?: spec.vec4;
2909
+ /**
2910
+ * @description 描边宽度
2911
+ */
2912
+ outlineWidth?: number;
2913
+ /**
2914
+ * @description 描边开关
2915
+ */
2916
+ outlineEnabled?: boolean;
2917
+ /**
2918
+ * @description 字体文件地址
2919
+ */
2920
+ fontUrl?: string;
2921
+ };
2885
2922
  };
2886
2923
  /**
2887
2924
  * @description 视频创建信息
2888
2925
  */
2889
2926
  type VideoCreateInfo = {
2890
- type: 'video';
2927
+ type: SDKItemType.Video;
2891
2928
  /**
2892
2929
  * @description 视频名称
2893
2930
  */
@@ -2900,46 +2937,51 @@ type VideoCreateInfo = {
2900
2937
  * @description 父节点id
2901
2938
  */
2902
2939
  parentId?: string;
2903
- /**
2904
- * @description 视频资源地址
2905
- */
2906
- url: string;
2907
- /**
2908
- * @description 视频元素像素大小
2909
- */
2910
- size: spec.vec2;
2911
- /**
2912
- * @description 视频元素缩放
2913
- */
2914
- scale?: spec.vec2;
2915
- /**
2916
- * @description 视频元素旋转
2917
- */
2918
- rotation?: number;
2919
- /**
2920
- * @description 视频元素二维位置
2921
- */
2922
- position: spec.vec2;
2923
- /**
2924
- * @description 是否静音
2925
- */
2926
- muted?: boolean;
2927
- /**
2928
- * @description 是否为透明视频
2929
- */
2930
- transparent?: boolean;
2931
- /**
2932
- * @description 播放速率
2933
- */
2934
- playbackRate?: number;
2935
- /**
2936
- * @description 音量
2937
- */
2938
- volume?: number;
2939
2940
  /**
2940
2941
  * @description 扩展属性
2941
2942
  */
2942
2943
  extensions?: Record<string, any>;
2944
+ /**
2945
+ * @description 元素属性
2946
+ */
2947
+ property: {
2948
+ /**
2949
+ * @description 视频资源地址 | 数据
2950
+ */
2951
+ video: string;
2952
+ /**
2953
+ * @description 视频元素像素大小
2954
+ */
2955
+ size: [number, number];
2956
+ /**
2957
+ * @description 视频元素位置
2958
+ */
2959
+ position: [number, number];
2960
+ /**
2961
+ * @description 视频元素旋转 z | [x, y, z]
2962
+ */
2963
+ rotation?: number | [number, number, number];
2964
+ /**
2965
+ * @description 视频元素缩放
2966
+ */
2967
+ scale?: [number, number];
2968
+ /**
2969
+ * @description 是否静音
2970
+ */
2971
+ muted?: boolean;
2972
+ /**
2973
+ * @description 是否为透明视频
2974
+ */
2975
+ transparent?: boolean;
2976
+ /**
2977
+ * @description 播放速率
2978
+ */
2979
+ playbackRate?: number;
2980
+ /**
2981
+ * @description 音量
2982
+ */
2983
+ volume?: number;
2984
+ };
2943
2985
  };
2944
2986
  /**
2945
2987
  * @description 生成器类型
@@ -2952,11 +2994,7 @@ type GeneratorCreateInfo = {
2952
2994
  /**
2953
2995
  * @description 元素类型 - 生成器
2954
2996
  */
2955
- type: 'generator';
2956
- /**
2957
- * @description 生成器类型
2958
- */
2959
- generatorType: GeneratorType;
2997
+ type: SDKItemType.Generator;
2960
2998
  /**
2961
2999
  * @description 元素名称
2962
3000
  */
@@ -2969,29 +3007,38 @@ type GeneratorCreateInfo = {
2969
3007
  * @description 父元素id
2970
3008
  */
2971
3009
  parentId?: string;
2972
- /**
2973
- * @description 生成器大小
2974
- */
2975
- size: spec.vec2;
2976
- /**
2977
- * @description 生成器位置
2978
- */
2979
- position: spec.vec2;
2980
- /**
2981
- * @description 旋转角度
2982
- */
2983
- rotation?: number;
2984
- /**
2985
- * @description 缩放
2986
- */
2987
- scale?: spec.vec2;
2988
3010
  /**
2989
3011
  * @description 扩展属性
2990
3012
  */
2991
3013
  extensions?: Record<string, any>;
3014
+ /**
3015
+ * @description 元素属性
3016
+ */
3017
+ property: {
3018
+ /**
3019
+ * @description 生成器类型
3020
+ */
3021
+ generatorType: GeneratorType;
3022
+ /**
3023
+ * @description 生成器元素像素大小
3024
+ */
3025
+ size: [number, number];
3026
+ /**
3027
+ * @description 生成器元素位置
3028
+ */
3029
+ position: [number, number];
3030
+ /**
3031
+ * @description 生成器元素旋转 z | [x, y, z]
3032
+ */
3033
+ rotation?: number | [number, number, number];
3034
+ /**
3035
+ * @description 生成器元素缩放
3036
+ */
3037
+ scale?: [number, number];
3038
+ };
2992
3039
  };
2993
3040
  /**
2994
- * @description 生成器资源信息
3041
+ * @description 图片生成器资源信息
2995
3042
  */
2996
3043
  type SpriteGeneratorResource = {
2997
3044
  /**
@@ -3011,10 +3058,13 @@ type SpriteGeneratorResource = {
3011
3058
  */
3012
3059
  extensions?: Record<string, any>;
3013
3060
  };
3061
+ /**
3062
+ * @description 视频生成器资源信息
3063
+ */
3014
3064
  type VideoGeneratorResource = {
3015
3065
  /**
3016
- * @description 资源地址
3017
- */
3066
+ * @description 资源地址
3067
+ */
3018
3068
  url: string;
3019
3069
  /**
3020
3070
  * @description 资源尺寸
@@ -3050,7 +3100,7 @@ type EffectsCreateInfo = {
3050
3100
  /**
3051
3101
  * @description 元素类型 - 特效
3052
3102
  */
3053
- type: 'effects';
3103
+ type: SDKItemType.Effects;
3054
3104
  /**
3055
3105
  * @description 元素名称
3056
3106
  */
@@ -3063,32 +3113,34 @@ type EffectsCreateInfo = {
3063
3113
  * @description 父元素id
3064
3114
  */
3065
3115
  parentId?: string;
3066
- /**
3067
- * @description 生成器大小
3068
- */
3069
- size?: spec.vec2;
3070
- /**
3071
- * @description 生成器位置
3072
- */
3073
- position: spec.vec2;
3074
- /**
3075
- * @description 旋转角度
3076
- */
3077
- rotation?: number;
3078
- /**
3079
- * @description 缩放
3080
- */
3081
- scale?: spec.vec2;
3082
- /**
3083
- * @description 动效资源地址
3084
- */
3085
- url: string;
3116
+ property: {
3117
+ /**
3118
+ * @description 生成器大小
3119
+ */
3120
+ size?: spec.vec2;
3121
+ /**
3122
+ * @description 生成器位置
3123
+ */
3124
+ position: spec.vec2;
3125
+ /**
3126
+ * @description 旋转角度
3127
+ */
3128
+ rotation?: number | [number, number, number];
3129
+ /**
3130
+ * @description 缩放
3131
+ */
3132
+ scale?: spec.vec2;
3133
+ /**
3134
+ * @description 动效资源地址
3135
+ */
3136
+ effects: string | spec.JSONScene;
3137
+ };
3086
3138
  /**
3087
3139
  * @description 扩展属性
3088
3140
  */
3089
3141
  extensions?: Record<string, any>;
3090
3142
  };
3091
- type ItemCreateInfo = NullCreateInfo | SpriteCreateInfo | TextCreateInfo | VideoCreateInfo | GeneratorCreateInfo | EffectsCreateInfo;
3143
+ type ItemCreateInfo = GroupCreateInfo | SpriteCreateInfo | TextCreateInfo | VideoCreateInfo | GeneratorCreateInfo | EffectsCreateInfo;
3092
3144
  /**
3093
3145
  * @description 场景创建信息
3094
3146
  */
@@ -3130,4 +3182,4 @@ type ViewportFitShiftParam = {
3130
3182
  bottom?: number;
3131
3183
  };
3132
3184
 
3133
- export { type ActiveData, type BaseFormProperty, BaseItem, Box2, type CreateOperation, type DeleteOperation, type EffectsCreateInfo, EffectsItem, type EffectsItemOptions, type GeneratorCreateInfo, GeneratorItem, type GeneratorItemOptions, type GizmoType, type ItemCreateInfo, ItemOrderAction, type NullCreateInfo, NullItem, type NullItemOptions, type Operation, type PageData, type PageFormTypedProperty, type PageProperty, SDK, type SDKEvents, type SDKInputParam, type SDKItem$1 as SDKItem, type SDKItemOptions, type SDKOptions, type SetItemPropertyValueParam, type SpecificPageFormProps, type SpriteCreateInfo, type SpriteFormProperty, SpriteItem, type SpriteItemOptions, type TextCreateInfo, type TextFormProperty, TextItem, type TextItemOptions, type UpdateOperation, Vector2, type VideoCreateInfo, type VideoFormProperty, VideoItem, type VideoItemOptions, type ViewItemTypedProperty, type ViewParam, type ViewProperty, createSDKItem, createSDKItemFromPlayerItem, isBaseItem, isEffectsItem, isGeneratorItem, isNullItem, isSpriteItem, isTextItem, isVideoItem };
3185
+ export { type ActiveData, BaseItem, type BaseItemProperty, Box2, type CreateOperation, type DeleteOperation, type EffectsCreateInfo, EffectsItem, type EffectsItemOptions, type GeneratorCreateInfo, GeneratorItem, type GeneratorItemOptions, type GeneratorItemProperty, type GizmoType, type GroupCreateInfo, GroupItem, type GroupItemOptions, type ItemCreateInfo, ItemOrderAction, type Operation, type PageData, type PageFormTypedProperty, type PageProperty, SDK, type SDKEvents, type SDKInputParam, type SDKItem$1 as SDKItem, type SDKItemOptions, type SDKOptions, type SetItemPropertyValueParam, type SpecificPageFormProps, type SpriteCreateInfo, SpriteItem, type SpriteItemOptions, type SpriteItemProperty, type TextCreateInfo, TextItem, type TextItemOptions, type TextItemProperty, type UpdateOperation, Vector2, type VideoCreateInfo, VideoItem, type VideoItemOptions, type VideoItemProperty, type ViewItemTypedProperty, type ViewParam, type ViewProperty, createSDKItem, isBaseItem, isEffectsItem, isGeneratorItem, isGroupItem, isSpriteItem, isTextItem, isVideoItem };