@galacean/effects-core 2.0.0-alpha.2 → 2.0.0-alpha.20

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 (110) hide show
  1. package/dist/asset-loader.d.ts +8 -90
  2. package/dist/asset-manager.d.ts +1 -80
  3. package/dist/asset-migrations.d.ts +1 -3
  4. package/dist/binary-asset.d.ts +6 -0
  5. package/dist/canvas-pool.d.ts +10 -0
  6. package/dist/comp-vfx-item.d.ts +24 -10
  7. package/dist/components/component.d.ts +5 -5
  8. package/dist/components/effect-component.d.ts +1 -1
  9. package/dist/components/renderer-component.d.ts +1 -1
  10. package/dist/composition-source-manager.d.ts +7 -4
  11. package/dist/composition.d.ts +40 -35
  12. package/dist/constants.d.ts +1 -2
  13. package/dist/decorators.d.ts +5 -4
  14. package/dist/downloader.d.ts +2 -8
  15. package/dist/effects-object.d.ts +3 -2
  16. package/dist/engine.d.ts +11 -7
  17. package/dist/fallback/camera.d.ts +2 -0
  18. package/dist/fallback/index.d.ts +12 -0
  19. package/dist/fallback/interact.d.ts +2 -0
  20. package/dist/fallback/migration.d.ts +20 -0
  21. package/dist/fallback/particle.d.ts +2 -0
  22. package/dist/fallback/sprite.d.ts +3 -0
  23. package/dist/fallback/utils.d.ts +25 -0
  24. package/dist/gl/create-gl-context.d.ts +2 -1
  25. package/dist/gl/index.d.ts +3 -0
  26. package/dist/image-asset.d.ts +5 -0
  27. package/dist/index.d.ts +7 -4
  28. package/dist/index.js +19952 -20233
  29. package/dist/index.js.map +1 -1
  30. package/dist/index.mjs +19602 -19878
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/material/material.d.ts +18 -5
  33. package/dist/material/types.d.ts +0 -5
  34. package/dist/material/utils.d.ts +4 -4
  35. package/dist/math/bezier.d.ts +99 -0
  36. package/dist/math/keyframe-info.d.ts +39 -0
  37. package/dist/math/translate.d.ts +3 -2
  38. package/dist/math/utils.d.ts +6 -2
  39. package/dist/math/value-getter.d.ts +52 -26
  40. package/dist/pass-render-level.d.ts +3 -1
  41. package/dist/plugin-system.d.ts +3 -4
  42. package/dist/plugins/cal/animation-mixer-playable.d.ts +1 -1
  43. package/dist/plugins/cal/animation-playable-output.d.ts +1 -1
  44. package/dist/plugins/cal/animation-playable.d.ts +2 -1
  45. package/dist/plugins/cal/calculate-item.d.ts +5 -39
  46. package/dist/plugins/cal/calculate-vfx-item.d.ts +58 -12
  47. package/dist/plugins/cal/playable-graph.d.ts +73 -18
  48. package/dist/plugins/cal/timeline-asset.d.ts +27 -0
  49. package/dist/plugins/camera/camera-controller-node.d.ts +1 -12
  50. package/dist/plugins/index.d.ts +8 -3
  51. package/dist/plugins/interact/click-handler.d.ts +2 -2
  52. package/dist/plugins/interact/event-system.d.ts +0 -2
  53. package/dist/plugins/interact/interact-item.d.ts +1 -1
  54. package/dist/plugins/interact/interact-mesh.d.ts +1 -1
  55. package/dist/plugins/particle/particle-loader.d.ts +1 -1
  56. package/dist/plugins/particle/particle-mesh.d.ts +7 -7
  57. package/dist/plugins/particle/particle-system-renderer.d.ts +1 -1
  58. package/dist/plugins/particle/particle-system.d.ts +3 -3
  59. package/dist/plugins/particle/particle-vfx-item.d.ts +9 -3
  60. package/dist/plugins/particle/trail-mesh.d.ts +7 -7
  61. package/dist/plugins/plugin.d.ts +7 -8
  62. package/dist/plugins/sprite/sprite-item.d.ts +29 -15
  63. package/dist/plugins/sprite/sprite-mesh.d.ts +0 -4
  64. package/dist/plugins/text/index.d.ts +4 -0
  65. package/dist/plugins/text/text-item.d.ts +19 -5
  66. package/dist/plugins/timeline/playables/activation-mixer-playable.d.ts +7 -0
  67. package/dist/plugins/timeline/playables/sub-composition-clip-playable.d.ts +5 -0
  68. package/dist/plugins/timeline/playables/sub-composition-playable-asset.d.ts +5 -0
  69. package/dist/plugins/timeline/track.d.ts +73 -0
  70. package/dist/plugins/timeline/tracks/activation-track.d.ts +5 -0
  71. package/dist/plugins/timeline/tracks/sprite-color-track.d.ts +3 -0
  72. package/dist/plugins/timeline/tracks/sub-composition-track.d.ts +4 -0
  73. package/dist/plugins/timeline/tracks/transform-track.d.ts +3 -0
  74. package/dist/render/create-copy-shader.d.ts +1 -1
  75. package/dist/render/{frame-buffer.d.ts → framebuffer.d.ts} +7 -7
  76. package/dist/render/geometry.d.ts +14 -1
  77. package/dist/render/global-volume.d.ts +3 -0
  78. package/dist/render/gpu-capability.d.ts +6 -6
  79. package/dist/render/index.d.ts +3 -2
  80. package/dist/render/render-frame.d.ts +6 -6
  81. package/dist/render/render-pass.d.ts +10 -10
  82. package/dist/render/{render-buffer.d.ts → renderbuffer.d.ts} +4 -4
  83. package/dist/render/renderer.d.ts +7 -6
  84. package/dist/render/semantic-map.d.ts +14 -0
  85. package/dist/render/shader.d.ts +12 -5
  86. package/dist/scene.d.ts +82 -4
  87. package/dist/serialization-helper.d.ts +6 -4
  88. package/dist/shader/index.d.ts +0 -11
  89. package/dist/shape/shape.d.ts +1 -1
  90. package/dist/shape/sphere.d.ts +0 -3
  91. package/dist/template-image.d.ts +10 -0
  92. package/dist/texture/texture.d.ts +8 -0
  93. package/dist/texture/types.d.ts +2 -2
  94. package/dist/texture/utils.d.ts +2 -1
  95. package/dist/ticker.d.ts +2 -2
  96. package/dist/transform.d.ts +3 -3
  97. package/dist/utils/array.d.ts +1 -1
  98. package/dist/utils/device.d.ts +1 -0
  99. package/dist/utils/index.d.ts +28 -14
  100. package/dist/utils/text.d.ts +8 -0
  101. package/dist/vfx-item.d.ts +36 -54
  102. package/package.json +5 -5
  103. package/dist/plugins/cal/track.d.ts +0 -35
  104. package/dist/semantic-map.d.ts +0 -14
  105. package/dist/template-image/index.d.ts +0 -67
  106. package/dist/template-image/qcanvas-viewer.d.ts +0 -21
  107. package/dist/template-image/qtext.d.ts +0 -96
  108. package/dist/template-image/template-v1.d.ts +0 -27
  109. package/dist/template-image/text-metrics.d.ts +0 -18
  110. package/dist/utils/timeline-component.d.ts +0 -6
@@ -1,4 +1,4 @@
1
- import type * as spec from '@galacean/effects-specification';
1
+ import * as spec from '@galacean/effects-specification';
2
2
  import type { EffectsObject } from './effects-object';
3
3
  import type { Engine } from './engine';
4
4
  import type { VFXItemProps } from './vfx-item';
@@ -17,96 +17,14 @@ export declare class AssetLoader {
17
17
  export declare class Database {
18
18
  loadGUID(guid: string): Promise<EffectsObject | undefined>;
19
19
  }
20
- export declare enum DataType {
21
- VFXItemData = 0,
22
- EffectComponent = 1,
23
- Material = 2,
24
- Shader = 3,
25
- SpriteComponent = 4,
26
- ParticleSystem = 5,
27
- InteractComponent = 6,
28
- CameraController = 7,
29
- Geometry = 8,
30
- Texture = 9,
31
- TextComponent = 10,
32
- MeshComponent = 10000,
33
- SkyboxComponent = 10001,
34
- LightComponent = 10002,
35
- CameraComponent = 10003,
36
- ModelPluginComponent = 10004,
37
- TreeComponent = 10005
38
- }
39
- export interface DataPath {
40
- id: string;
41
- }
42
- export interface EffectsObjectData {
43
- id: string;
44
- name?: string;
45
- dataType: number;
46
- }
47
- export interface MaterialData extends EffectsObjectData {
48
- shader: DataPath;
49
- blending?: boolean;
50
- zWrite?: boolean;
51
- zTest?: boolean;
52
- floats: Record<string, number>;
53
- ints: Record<string, number>;
54
- vector2s?: Record<string, spec.vec2>;
55
- vector3s?: Record<string, spec.vec3>;
56
- vector4s: Record<string, {
57
- x: number;
58
- y: number;
59
- z: number;
60
- w: number;
61
- }>;
62
- colors: Record<string, {
63
- r: number;
64
- g: number;
65
- b: number;
66
- a: number;
67
- }>;
68
- matrices?: Record<string, spec.mat4>;
69
- matrice3s?: Record<string, spec.mat3>;
70
- textures?: Record<string, DataPath>;
71
- floatArrays?: Record<string, number[]>;
72
- vector4Arrays?: Record<string, number[]>;
73
- matrixArrays?: Record<string, number[]>;
74
- }
75
- export interface GeometryData extends EffectsObjectData {
76
- vertexData: VertexData;
77
- indexFormat: number;
78
- indexOffset: number;
79
- buffer: string;
80
- }
81
- export interface VertexData {
82
- vertexCount: number;
83
- channels: VertexChannel[];
84
- }
85
- export interface VertexChannel {
86
- offset: number;
87
- format: number;
88
- dimension: number;
89
- }
90
- export interface ShaderData extends EffectsObjectData {
91
- vertex: string;
92
- fragment: string;
93
- properties?: string;
94
- }
95
- export interface EffectComponentData extends EffectsObjectData {
20
+ export interface EffectComponentData extends spec.EffectsObjectData {
96
21
  _priority: number;
97
- item: DataPath;
98
- materials: DataPath[];
99
- geometry: DataPath;
22
+ item: spec.DataPath;
23
+ materials: spec.DataPath[];
24
+ geometry: spec.DataPath;
100
25
  }
101
26
  export type VFXItemData = VFXItemProps & {
102
- dataType: DataType;
103
- components: DataPath[];
27
+ dataType: spec.DataType;
28
+ components: spec.DataPath[];
104
29
  };
105
- export type SceneData = Record<string, EffectsObjectData>;
106
- export interface EffectsPackageData {
107
- fileSummary: {
108
- guid: string;
109
- assetType: string;
110
- };
111
- exportObjects: EffectsObjectData[];
112
- }
30
+ export type SceneData = Record<string, spec.EffectsObjectData>;
@@ -1,86 +1,7 @@
1
- import * as spec from '@galacean/effects-specification';
2
1
  import { Downloader } from './downloader';
3
- import type { Scene } from './scene';
2
+ import type { Scene, SceneLoadOptions, SceneType } from './scene';
4
3
  import type { Disposable } from './utils';
5
4
  import type { Renderer } from './render';
6
- /**
7
- * 场景加载参数
8
- */
9
- export interface SceneLoadOptions {
10
- /**
11
- * 动态数据的参数
12
- * key 是 JSON 中配置的字段名
13
- * value 是要使用的值,图片使用 url 链接
14
- * 图片链接可以使用数组传递,如果第一个加载失败,将尝试使用第二个地址
15
- *
16
- * @example
17
- * ``` ts
18
- * {
19
- * variables: {
20
- * bg: ['url','fallback_url'], // 如果两个图片都失败,将会触发加载失败
21
- * fg: 'url' // 如果图片加载失败,将会触发加载失败,
22
- * amount: 88.8,
23
- * name: 'abc'
24
- * }
25
- * }
26
- * ```
27
- */
28
- variables?: Record<string, number | string | string[]>;
29
- /**
30
- * 模板图片缩放倍数
31
- * @default 1 如果图片比较糊,可以用 2(但会增大图片内存)
32
- */
33
- templateScale?: number;
34
- /**
35
- * 是否使用压缩纹理
36
- */
37
- useCompressedTexture?: boolean;
38
- /**
39
- * 渲染分级。
40
- * 分级之后,只会加载当前渲染等级的资源。
41
- * 当渲染等级被设置为 B 后,player 的 fps 会降到 30 帧
42
- * @default 's'
43
- */
44
- renderLevel?: spec.RenderLevel;
45
- /**
46
- * 资源加载超时,时间单位秒
47
- * @default 10s
48
- */
49
- timeout?: number;
50
- /***
51
- * 用于给 plugin 的加载数据
52
- * key/value 的内容由 plugin 自己实现
53
- */
54
- pluginData?: Record<string, any>;
55
- /**
56
- * 场景加载时的环境(加载后把 env 结果写入 scene)
57
- * @default '' - 编辑器中为 'editor'
58
- */
59
- env?: string;
60
- /**
61
- * 加载后是否自动播放
62
- * @default true
63
- */
64
- autoplay?: boolean;
65
- /**
66
- * 合成播放完成后是否需要再使用,是的话生命周期结束后不会 `dispose`
67
- * @default false
68
- */
69
- reusable?: boolean;
70
- /**
71
- * 播放速度,当速度为负数时,合成倒播
72
- */
73
- speed?: number;
74
- }
75
- /**
76
- * 接受用于加载的数据类型
77
- */
78
- export type SceneType = string | Scene | Record<string, unknown>;
79
- export type SceneWithOptionsType = {
80
- scene: SceneType;
81
- options: SceneLoadOptions;
82
- };
83
- export type SceneLoadType = SceneType | SceneWithOptionsType;
84
5
  /**
85
6
  * 资源管理器
86
7
  * 用于加载和动效中所有的资源文件,包括图片、插件、图层粒子数据等
@@ -1,6 +1,4 @@
1
- import * as spec from '@galacean/effects-specification';
2
- import type { Scene } from './scene';
3
- export declare function version3Migration(scene: Record<string, any>): Scene;
1
+ import type * as spec from '@galacean/effects-specification';
4
2
  /**
5
3
  * 提取并转换 JSON 数据中的 anchor 值
6
4
  */
@@ -0,0 +1,6 @@
1
+ import type { EffectsObjectData } from '@galacean/effects-specification';
2
+ import { EffectsObject } from './effects-object';
3
+ export declare class BinaryAsset extends EffectsObject {
4
+ buffer: ArrayBuffer;
5
+ fromData(data: EffectsObjectData): void;
6
+ }
@@ -0,0 +1,10 @@
1
+ declare class CanvasPool {
2
+ readonly elements: HTMLCanvasElement[];
3
+ constructor();
4
+ dispose(): void;
5
+ getCanvas(): HTMLCanvasElement;
6
+ saveCanvas(canvas: HTMLCanvasElement): void;
7
+ }
8
+ export declare const canvasPool: CanvasPool;
9
+ export declare function getDefaultTemplateCanvasPool(): CanvasPool;
10
+ export {};
@@ -1,27 +1,41 @@
1
1
  import type { Ray } from '@galacean/effects-math/es/core/ray';
2
+ import * as spec from '@galacean/effects-specification';
2
3
  import { ItemBehaviour } from './components';
3
4
  import type { CompositionHitTestOptions } from './composition';
4
- import type { Region } from './plugins';
5
- import { TimelineComponent } from './plugins';
6
- import type { VFXItemContent } from './vfx-item';
5
+ import type { ContentOptions } from './composition-source-manager';
6
+ import type { Region, TrackAsset } from './plugins';
7
7
  import { VFXItem } from './vfx-item';
8
+ export interface SceneBinding {
9
+ key: TrackAsset;
10
+ value: VFXItem;
11
+ }
12
+ export interface SceneBindingData {
13
+ key: spec.DataPath;
14
+ value: spec.DataPath;
15
+ }
8
16
  /**
9
17
  * @since 2.0.0
10
18
  * @internal
11
19
  */
12
20
  export declare class CompositionComponent extends ItemBehaviour {
21
+ time: number;
13
22
  startTime: number;
14
23
  refId: string;
15
- items: VFXItem<VFXItemContent>[];
16
- timelineComponents: TimelineComponent[];
17
- timelineComponent: TimelineComponent;
24
+ items: VFXItem[];
25
+ data: ContentOptions;
26
+ private reusable;
27
+ private sceneBindings;
28
+ private timelineAsset;
29
+ private timelinePlayable;
30
+ private graph;
18
31
  start(): void;
32
+ setReusable(value: boolean): void;
33
+ getReusable(): boolean;
19
34
  update(dt: number): void;
20
- /**
21
- * 重置元素状态属性
22
- */
23
- resetStatus(): void;
24
35
  createContent(): void;
25
36
  onDestroy(): void;
26
37
  hitTest(ray: Ray, x: number, y: number, regions: Region[], force?: boolean, options?: CompositionHitTestOptions): Region[];
38
+ fromData(data: unknown): void;
39
+ private resolveBindings;
40
+ private resolveTrackBindingsWithRoot;
27
41
  }
@@ -1,5 +1,5 @@
1
1
  import { EffectsObject } from '../effects-object';
2
- import type { VFXItem, VFXItemContent } from '../vfx-item';
2
+ import type { VFXItem } from '../vfx-item';
3
3
  /**
4
4
  * @since 2.0.0
5
5
  * @internal
@@ -9,11 +9,11 @@ export declare abstract class Component extends EffectsObject {
9
9
  /**
10
10
  * 附加到的 VFXItem 对象
11
11
  */
12
- item: VFXItem<VFXItemContent>;
12
+ item: VFXItem;
13
13
  /**
14
14
  * 附加到的 VFXItem 对象 Transform 组件
15
15
  */
16
- get transform(): import("..").Transform;
16
+ get transform(): import("@galacean/effects-core").Transform;
17
17
  onAttached(): void;
18
18
  onDestroy(): void;
19
19
  fromData(data: any): void;
@@ -24,7 +24,7 @@ export declare abstract class Component extends EffectsObject {
24
24
  * @internal
25
25
  */
26
26
  export declare abstract class Behaviour extends Component {
27
- _enabled: boolean;
27
+ private _enabled;
28
28
  /**
29
29
  * 组件是否可以更新,true 更新,false 不更新
30
30
  */
@@ -32,7 +32,7 @@ export declare abstract class Behaviour extends Component {
32
32
  get enabled(): boolean;
33
33
  set enabled(value: boolean);
34
34
  protected onBehaviourEnable(): void;
35
- fromData(data: any): void;
35
+ fromData(data: unknown): void;
36
36
  toData(): void;
37
37
  }
38
38
  /**
@@ -53,7 +53,7 @@ export declare class EffectComponent extends RendererComponent {
53
53
  setMaterial(material: Material, destroy?: MaterialDestroyOptions | DestroyOptions.keep): void;
54
54
  getHitTestParams: (force?: boolean) => HitTestTriangleParams | void;
55
55
  getBoundingBox(): BoundingBoxTriangle | void;
56
- fromData(data: any): void;
56
+ fromData(data: unknown): void;
57
57
  toData(): void;
58
58
  /**
59
59
  * 销毁当前资源
@@ -26,7 +26,7 @@ export declare class RendererComponent extends Component {
26
26
  lateUpdate(dt: number): void;
27
27
  render(renderer: Renderer): void;
28
28
  onAttached(): void;
29
- fromData(data: any): void;
29
+ fromData(data: unknown): void;
30
30
  toData(): void;
31
31
  dispose(): void;
32
32
  }
@@ -1,8 +1,9 @@
1
1
  import * as spec from '@galacean/effects-specification';
2
+ import type { SceneBindingData } from './comp-vfx-item';
2
3
  import type { Engine } from './engine';
3
4
  import type { PluginSystem } from './plugin-system';
4
5
  import type { GlobalVolume } from './render';
5
- import type { Scene } from './scene';
6
+ import type { Scene, SceneRenderLevel } from './scene';
6
7
  import type { Texture } from './texture';
7
8
  import type { Disposable } from './utils';
8
9
  import type { VFXItemProps } from './vfx-item';
@@ -15,16 +16,18 @@ export interface ContentOptions {
15
16
  camera: spec.CameraOptions;
16
17
  startTime: number;
17
18
  globalVolume: GlobalVolume;
19
+ timelineAsset: spec.DataPath;
20
+ sceneBindings: SceneBindingData[];
18
21
  }
19
22
  /**
20
23
  * 合成资源管理
21
24
  */
22
25
  export declare class CompositionSourceManager implements Disposable {
23
- composition?: spec.Composition;
24
- refCompositions: Map<string, spec.Composition>;
26
+ composition?: spec.CompositionData;
27
+ refCompositions: Map<string, spec.CompositionData>;
25
28
  sourceContent?: ContentOptions;
26
29
  refCompositionProps: Map<string, VFXItemProps>;
27
- renderLevel?: spec.RenderLevel;
30
+ renderLevel?: SceneRenderLevel;
28
31
  pluginSystem?: PluginSystem;
29
32
  totalTime: number;
30
33
  imgUsage: Record<string, number[]>;
@@ -2,18 +2,16 @@ import type { Ray } from '@galacean/effects-math/es/core/index';
2
2
  import * as spec from '@galacean/effects-specification';
3
3
  import { Camera } from './camera';
4
4
  import { CompositionComponent } from './comp-vfx-item';
5
- import type { CompositionSourceManager } from './composition-source-manager';
5
+ import { CompositionSourceManager } from './composition-source-manager';
6
6
  import type { PluginSystem } from './plugin-system';
7
- import type { EventSystem, Region } from './plugins';
7
+ import type { EventSystem, Plugin, Region } from './plugins';
8
8
  import type { MeshRendererOptions, Renderer } from './render';
9
9
  import { RenderFrame } from './render';
10
- import type { Scene } from './scene';
10
+ import type { Scene, SceneType } from './scene';
11
11
  import type { Texture } from './texture';
12
- import { Transform } from './transform';
13
12
  import type { Disposable, LostHandler } from './utils';
14
- import type { VFXItemContent, VFXItemProps } from './vfx-item';
13
+ import type { VFXItemProps } from './vfx-item';
15
14
  import { VFXItem } from './vfx-item';
16
- import type { SceneType } from './asset-manager';
17
15
  export interface CompositionStatistic {
18
16
  loadTime: number;
19
17
  loadStart: number;
@@ -31,13 +29,13 @@ export interface MessageItem {
31
29
  export interface CompositionHitTestOptions {
32
30
  maxCount?: number;
33
31
  stop?: (region: Region) => boolean;
34
- skip?: (item: VFXItem<VFXItemContent>) => boolean;
32
+ skip?: (item: VFXItem) => boolean;
35
33
  }
36
34
  export interface CompositionProps {
37
35
  reusable?: boolean;
38
36
  baseRenderOrder?: number;
39
37
  renderer: Renderer;
40
- onPlayerPause?: (item: VFXItem<any>) => void;
38
+ onPlayerPause?: (item: VFXItem) => void;
41
39
  onMessageItem?: (item: MessageItem) => void;
42
40
  onEnd?: (composition: Composition) => void;
43
41
  event?: EventSystem;
@@ -51,7 +49,6 @@ export interface CompositionProps {
51
49
  * 也负责 Item 相关的动画播放控制,和持有渲染帧数据。
52
50
  */
53
51
  export declare class Composition implements Disposable, LostHandler {
54
- compositionSourceManager: CompositionSourceManager;
55
52
  renderer: Renderer;
56
53
  /**
57
54
  * 当前帧的渲染数据对象
@@ -70,10 +67,6 @@ export declare class Composition implements Disposable, LostHandler {
70
67
  * 合成渲染顺序,默认按升序渲染
71
68
  */
72
69
  renderOrder: number;
73
- /**
74
- * 所有合成 Item 的根变换
75
- */
76
- transform: Transform;
77
70
  /**
78
71
  * 播放完成后是否需要再使用,是的话生命周期结束后不会自动 dispose
79
72
  */
@@ -82,12 +75,12 @@ export declare class Composition implements Disposable, LostHandler {
82
75
  * 是否播放完成后销毁 texture 对象
83
76
  */
84
77
  keepResource: boolean;
85
- extraCamera: VFXItem<VFXItemContent>;
78
+ extraCamera: VFXItem;
86
79
  /**
87
80
  * 合成结束行为是 spec.END_BEHAVIOR_PAUSE 或 spec.END_BEHAVIOR_PAUSE_AND_DESTROY 时执行的回调
88
81
  * @internal
89
82
  */
90
- onPlayerPause?: (item: VFXItem<any>) => void;
83
+ onPlayerPause?: (item: VFXItem) => void;
91
84
  /**
92
85
  * 单个合成结束时的回调
93
86
  */
@@ -128,10 +121,6 @@ export declare class Composition implements Disposable, LostHandler {
128
121
  * 用于保存与当前合成相关的插件数据
129
122
  */
130
123
  readonly loaderData: Record<string, any>;
131
- /**
132
- * 渲染等级:S,A+,A,B+,B
133
- */
134
- readonly renderLevel?: spec.RenderLevel;
135
124
  /**
136
125
  * 场景加载和首帧渲染时间
137
126
  */
@@ -143,11 +132,11 @@ export declare class Composition implements Disposable, LostHandler {
143
132
  /**
144
133
  * 合成根元素
145
134
  */
146
- rootItem: VFXItem<VFXItemContent>;
135
+ readonly rootItem: VFXItem;
147
136
  /**
148
137
  * 预合成数组
149
138
  */
150
- readonly refContent: VFXItem<VFXItemContent>[];
139
+ readonly refContent: VFXItem[];
151
140
  /**
152
141
  * 预合成的合成属性,在 content 中会被其元素属性覆盖
153
142
  */
@@ -160,6 +149,7 @@ export declare class Composition implements Disposable, LostHandler {
160
149
  * 合成全局时间
161
150
  */
162
151
  globalTime: number;
152
+ editorScaleRatio: number;
163
153
  protected rendererOptions: MeshRendererOptions | null;
164
154
  protected assigned: boolean;
165
155
  /**
@@ -171,6 +161,8 @@ export declare class Composition implements Disposable, LostHandler {
171
161
  */
172
162
  protected readonly keepColorBuffer: boolean;
173
163
  protected rootComposition: CompositionComponent;
164
+ protected readonly postLoaders: Plugin[];
165
+ protected compositionSourceManager: CompositionSourceManager;
174
166
  /**
175
167
  * 合成暂停/播放 标识
176
168
  */
@@ -181,21 +173,17 @@ export declare class Composition implements Disposable, LostHandler {
181
173
  */
182
174
  private readonly globalVolume;
183
175
  private readonly texInfo;
184
- private readonly postLoaders;
185
- private rootTimeline;
186
176
  /**
187
177
  * Composition 构造函数
188
178
  * @param props - composition 的创建参数
189
179
  * @param scene
190
180
  * @param compositionSourceManager
191
181
  */
192
- constructor(props: CompositionProps, scene: Scene, compositionSourceManager: CompositionSourceManager);
182
+ constructor(props: CompositionProps, scene: Scene);
193
183
  /**
194
- * 合成结束回调
195
- * @param {(composition: Composition) => void} func
196
- * @deprecated since 2.0 - use `onEnd` instead
184
+ * 所有合成 Item 的根变换
197
185
  */
198
- set handleEnd(func: (composition: Composition) => void);
186
+ get transform(): import("@galacean/effects-core").Transform;
199
187
  /**
200
188
  * 获取场景中的纹理数组
201
189
  */
@@ -203,7 +191,7 @@ export declare class Composition implements Disposable, LostHandler {
203
191
  /**
204
192
  * 获取合成中所有元素
205
193
  */
206
- get items(): VFXItem<VFXItemContent>[];
194
+ get items(): VFXItem[];
207
195
  /**
208
196
  * 获取合成开始渲染的时间
209
197
  */
@@ -239,6 +227,12 @@ export declare class Composition implements Disposable, LostHandler {
239
227
  * @param speed - 速度
240
228
  */
241
229
  setSpeed(speed: number): void;
230
+ /**
231
+ * 设置合成的可见性
232
+ * @since 2.0.0
233
+ * @param visible - 是否可见
234
+ */
235
+ setVisible(visible: boolean): void;
242
236
  /**
243
237
  * 获取合成的动画速度
244
238
  * @returns
@@ -273,7 +267,7 @@ export declare class Composition implements Disposable, LostHandler {
273
267
  * @param time - 相对 startTime 的时间
274
268
  */
275
269
  setTime(time: number): void;
276
- addItem(item: VFXItem<VFXItemContent>): void;
270
+ addItem(item: VFXItem): void;
277
271
  /**
278
272
  * 前进合成到指定时间
279
273
  * @param time - 相对0时刻的时间
@@ -285,6 +279,7 @@ export declare class Composition implements Disposable, LostHandler {
285
279
  */
286
280
  protected reset(): void;
287
281
  prepareRender(): void;
282
+ protected gatherRendererComponent(vfxItem: VFXItem, renderFrame: RenderFrame): void;
288
283
  /**
289
284
  * 是否合成需要重新播放
290
285
  * @returns 重新播放合成标志位
@@ -301,6 +296,7 @@ export declare class Composition implements Disposable, LostHandler {
301
296
  * @param skipRender - 是否需要渲染
302
297
  */
303
298
  update(deltaTime: number, skipRender?: boolean): void;
299
+ private toLocalTime;
304
300
  private getUpdateTime;
305
301
  private callStart;
306
302
  private callUpdate;
@@ -330,7 +326,7 @@ export declare class Composition implements Disposable, LostHandler {
330
326
  * @param name - 元素名称
331
327
  * @returns 元素对象
332
328
  */
333
- getItemByName(name: string): VFXItem<VFXItemContent> | undefined;
329
+ getItemByName(name: string): VFXItem | undefined;
334
330
  /**
335
331
  * 获取指定位置和相机连成的射线
336
332
  * @param x
@@ -342,7 +338,7 @@ export declare class Composition implements Disposable, LostHandler {
342
338
  * 获取 engine 对象
343
339
  * @returns
344
340
  */
345
- getEngine(): import("./engine").Engine;
341
+ getEngine(): import("@galacean/effects-core").Engine;
346
342
  /**
347
343
  * Item 求交测试,返回求交结果列表,x 和 y 是归一化到[-1, 1]区间的值,原点在左上角
348
344
  * @param x - 鼠标或触点的 x,已经归一化到[-1, 1]
@@ -356,13 +352,13 @@ export declare class Composition implements Disposable, LostHandler {
356
352
  * @param item - 交互元素
357
353
  * @param type - 交互类型
358
354
  */
359
- addInteractiveItem(item: VFXItem<VFXItemContent>, type: spec.InteractType): string | undefined;
355
+ addInteractiveItem(item: VFXItem, type: spec.InteractType): string | undefined;
360
356
  /**
361
357
  * InteractItem 生命周期结束时的调用
362
358
  * @param item - 交互元素
363
359
  * @param type - 交互类型
364
360
  */
365
- removeInteractiveItem(item: VFXItem<VFXItemContent>, type: spec.InteractType): void;
361
+ removeInteractiveItem(item: VFXItem, type: spec.InteractType): void;
366
362
  /**
367
363
  * 销毁插件 Item 中保存的纹理数组
368
364
  * @internal
@@ -374,7 +370,7 @@ export declare class Composition implements Disposable, LostHandler {
374
370
  * @internal
375
371
  * @param item - 需要销毁的 item
376
372
  */
377
- destroyItem(item: VFXItem<VFXItemContent>): void;
373
+ destroyItem(item: VFXItem): void;
378
374
  lost(e: Event): void;
379
375
  /**
380
376
  * 合成对象销毁
@@ -392,6 +388,15 @@ export declare class Composition implements Disposable, LostHandler {
392
388
  * 合成整体在水平方向移动 x 像素,垂直方向移动 y 像素
393
389
  */
394
390
  translateByPixel(x: number, y: number): void;
391
+ /**
392
+ * 设置合成在画布上的像素位置
393
+ * Tips:
394
+ * - 坐标原点在 canvas 左上角,x 正方向水平向右, y 正方向垂直向下
395
+ * - 设置后会覆盖原有的位置信息
396
+ * @param x - x 坐标
397
+ * @param y - y 坐标
398
+ */
399
+ setPositionByPixel(x: number, y: number): void;
395
400
  /**
396
401
  * 设置合成在 3D 坐标轴上相对当前的位移
397
402
  */
@@ -4,8 +4,7 @@ export declare const SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0 = "PRE_COLOR_SIZE_0";
4
4
  export declare const SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0 = "PRE_MAIN_COLOR_0";
5
5
  export declare const SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0 = "PRE_MAIN_COLOR_SIZE_0";
6
6
  export declare const PLAYER_OPTIONS_ENV_EDITOR = "editor";
7
- export declare const FILTER_NAME_NONE = "none";
8
7
  export declare const HELP_LINK: {
9
- 'Filter not imported': string;
10
8
  'Item duration can\'t be less than 0': string;
9
+ 'ValueType: 21/22 is not supported': string;
11
10
  };
@@ -1,4 +1,5 @@
1
- export declare const effectsClassStore: Record<number, any>;
2
- export declare function getMergedStore(target: any): any;
3
- export declare function serialize(sourceName?: string): (target: any, propertyKey: any) => void;
4
- export declare function effectsClass(className: any): (target: any, context?: any) => void;
1
+ import type { Constructor } from './utils';
2
+ export declare const effectsClassStore: Record<string, any>;
3
+ export declare function effectsClass(className: string): (target: Object, context?: unknown) => void;
4
+ export declare function serialize(type?: Constructor, sourceName?: string): (target: Object, propertyKey: string | symbol) => void;
5
+ export declare function getMergedStore(target: Object): Record<string, any>;
@@ -3,12 +3,6 @@ type ErrorHandler = (status: number, responseText: string) => void;
3
3
  /**
4
4
  *
5
5
  */
6
- type VideoLoadOptions = {
7
- /**
8
- * 视频是否循环播放
9
- */
10
- loop?: boolean;
11
- };
12
6
  /**
13
7
  * JSON 值,它可以是字符串、数字、布尔值、对象或者 JSON 值的数组。
14
8
  *
@@ -77,7 +71,7 @@ export declare function loadBlob(url: string): Promise<Blob>;
77
71
  /**
78
72
  * 异步加载一个视频文件
79
73
  * @param url - 视频文件的 URL 或 MediaProvider 对象
80
- * @param options - 加载参数
81
74
  */
82
- export declare function loadVideo(url: string | MediaProvider, options?: VideoLoadOptions): Promise<HTMLVideoElement>;
75
+ export declare function loadVideo(url: string | MediaProvider): Promise<HTMLVideoElement>;
76
+ export declare function loadMedia(url: string | string[], loadFn: (url: string) => Promise<HTMLImageElement | HTMLVideoElement>): Promise<HTMLImageElement | HTMLVideoElement>;
83
77
  export {};
@@ -1,4 +1,4 @@
1
- import type { EffectsObjectData } from './asset-loader';
1
+ import type * as spec from '@galacean/effects-specification';
2
2
  import type { Engine } from './engine';
3
3
  /**
4
4
  * @since 2.0.0
@@ -6,6 +6,7 @@ import type { Engine } from './engine';
6
6
  */
7
7
  export declare abstract class EffectsObject {
8
8
  engine: Engine;
9
+ static is(obj: unknown): obj is EffectsObject;
9
10
  protected guid: string;
10
11
  /**
11
12
  * 存储需要序列化的数据
@@ -20,6 +21,6 @@ export declare abstract class EffectsObject {
20
21
  *
21
22
  * @param data - 对象的序列化的数据
22
23
  */
23
- fromData(data: EffectsObjectData): void;
24
+ fromData(data: spec.EffectsObjectData): void;
24
25
  dispose(): void;
25
26
  }