@galacean/effects-core 2.0.0-alpha.9 → 2.0.0-beta.0

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 (120) hide show
  1. package/README.md +25 -21
  2. package/dist/__definations__/fbeffects-object-data.d.ts +28 -0
  3. package/dist/__definations__/fbeffects-package-data.d.ts +26 -0
  4. package/dist/__definations__/fbgeometry-data.d.ts +77 -0
  5. package/dist/__definations__/fbsub-mesh.d.ts +26 -0
  6. package/dist/__definations__/fbvertex-channel.d.ts +33 -0
  7. package/dist/__definations__/fbvertex-data.d.ts +27 -0
  8. package/dist/__definations__/index.d.ts +6 -0
  9. package/dist/asset-loader.d.ts +0 -13
  10. package/dist/binary-asset.d.ts +6 -0
  11. package/dist/camera.d.ts +10 -1
  12. package/dist/canvas-pool.d.ts +0 -1
  13. package/dist/comp-vfx-item.d.ts +26 -12
  14. package/dist/components/component.d.ts +4 -14
  15. package/dist/components/effect-component.d.ts +3 -23
  16. package/dist/components/index.d.ts +1 -0
  17. package/dist/components/post-process-volume.d.ts +15 -0
  18. package/dist/components/renderer-component.d.ts +2 -2
  19. package/dist/composition-source-manager.d.ts +8 -7
  20. package/dist/composition.d.ts +64 -62
  21. package/dist/constants.d.ts +1 -1
  22. package/dist/decorators.d.ts +4 -3
  23. package/dist/downloader.d.ts +9 -0
  24. package/dist/effects-object.d.ts +4 -1
  25. package/dist/effects-package.d.ts +19 -0
  26. package/dist/engine.d.ts +7 -4
  27. package/dist/events/event-emitter.d.ts +46 -0
  28. package/dist/events/index.d.ts +2 -0
  29. package/dist/events/types.d.ts +37 -0
  30. package/dist/fallback/camera.d.ts +2 -0
  31. package/dist/fallback/index.d.ts +12 -0
  32. package/dist/fallback/interact.d.ts +2 -0
  33. package/dist/fallback/migration.d.ts +20 -0
  34. package/dist/fallback/particle.d.ts +2 -0
  35. package/dist/fallback/sprite.d.ts +3 -0
  36. package/dist/fallback/utils.d.ts +25 -0
  37. package/dist/gl/create-gl-context.d.ts +2 -1
  38. package/dist/gl/index.d.ts +3 -0
  39. package/dist/image-asset.d.ts +5 -0
  40. package/dist/index.d.ts +9 -4
  41. package/dist/index.js +18752 -13963
  42. package/dist/index.js.map +1 -1
  43. package/dist/index.mjs +20450 -15668
  44. package/dist/index.mjs.map +1 -1
  45. package/dist/material/material.d.ts +5 -6
  46. package/dist/material/utils.d.ts +0 -10
  47. package/dist/math/bezier.d.ts +99 -0
  48. package/dist/math/keyframe-info.d.ts +39 -0
  49. package/dist/math/translate.d.ts +3 -2
  50. package/dist/math/utils.d.ts +5 -4
  51. package/dist/math/value-getter.d.ts +52 -26
  52. package/dist/pass-render-level.d.ts +3 -1
  53. package/dist/plugin-system.d.ts +2 -2
  54. package/dist/plugins/cal/animation-playable.d.ts +2 -1
  55. package/dist/plugins/cal/calculate-item.d.ts +5 -39
  56. package/dist/plugins/cal/calculate-vfx-item.d.ts +54 -13
  57. package/dist/plugins/cal/playable-graph.d.ts +72 -21
  58. package/dist/plugins/cal/timeline-asset.d.ts +27 -0
  59. package/dist/plugins/camera/camera-controller-node.d.ts +2 -13
  60. package/dist/plugins/index.d.ts +8 -3
  61. package/dist/plugins/interact/click-handler.d.ts +3 -3
  62. package/dist/plugins/interact/event-system.d.ts +0 -2
  63. package/dist/plugins/interact/interact-item.d.ts +15 -1
  64. package/dist/plugins/particle/burst.d.ts +10 -3
  65. package/dist/plugins/particle/link.d.ts +1 -0
  66. package/dist/plugins/particle/particle-loader.d.ts +2 -2
  67. package/dist/plugins/particle/particle-mesh.d.ts +5 -9
  68. package/dist/plugins/particle/particle-system-renderer.d.ts +1 -1
  69. package/dist/plugins/particle/particle-system.d.ts +14 -6
  70. package/dist/plugins/particle/particle-vfx-item.d.ts +9 -3
  71. package/dist/plugins/particle/trail-mesh.d.ts +2 -2
  72. package/dist/plugins/plugin.d.ts +6 -6
  73. package/dist/plugins/sprite/sprite-item.d.ts +16 -12
  74. package/dist/plugins/sprite/sprite-mesh.d.ts +0 -4
  75. package/dist/plugins/text/index.d.ts +4 -0
  76. package/dist/plugins/text/text-item.d.ts +32 -5
  77. package/dist/plugins/text/text-layout.d.ts +9 -1
  78. package/dist/plugins/timeline/playables/activation-mixer-playable.d.ts +7 -0
  79. package/dist/plugins/timeline/playables/sub-composition-clip-playable.d.ts +5 -0
  80. package/dist/plugins/timeline/playables/sub-composition-playable-asset.d.ts +5 -0
  81. package/dist/plugins/timeline/track.d.ts +72 -0
  82. package/dist/plugins/timeline/tracks/activation-track.d.ts +5 -0
  83. package/dist/plugins/timeline/tracks/sprite-color-track.d.ts +3 -0
  84. package/dist/plugins/timeline/tracks/sub-composition-track.d.ts +4 -0
  85. package/dist/plugins/timeline/tracks/transform-track.d.ts +3 -0
  86. package/dist/render/create-copy-shader.d.ts +2 -2
  87. package/dist/render/{frame-buffer.d.ts → framebuffer.d.ts} +7 -7
  88. package/dist/render/geometry.d.ts +14 -1
  89. package/dist/render/global-volume.d.ts +4 -5
  90. package/dist/render/gpu-capability.d.ts +6 -6
  91. package/dist/render/index.d.ts +2 -2
  92. package/dist/render/mesh.d.ts +1 -1
  93. package/dist/render/render-frame.d.ts +11 -10
  94. package/dist/render/render-pass.d.ts +8 -8
  95. package/dist/render/{render-buffer.d.ts → renderbuffer.d.ts} +4 -4
  96. package/dist/render/renderer.d.ts +9 -7
  97. package/dist/render/semantic-map.d.ts +1 -1
  98. package/dist/render/shader.d.ts +4 -4
  99. package/dist/scene.d.ts +10 -4
  100. package/dist/serialization-helper.d.ts +6 -4
  101. package/dist/shader/index.d.ts +1 -3
  102. package/dist/shader/shader-factory.d.ts +35 -0
  103. package/dist/shape/shape.d.ts +1 -1
  104. package/dist/template-image.d.ts +3 -3
  105. package/dist/texture/texture.d.ts +2 -0
  106. package/dist/texture/types.d.ts +2 -2
  107. package/dist/texture/utils.d.ts +2 -1
  108. package/dist/ticker.d.ts +2 -2
  109. package/dist/transform.d.ts +3 -3
  110. package/dist/utils/array.d.ts +1 -1
  111. package/dist/utils/device.d.ts +4 -0
  112. package/dist/utils/index.d.ts +29 -14
  113. package/dist/utils/text.d.ts +8 -0
  114. package/dist/vfx-item.d.ts +37 -61
  115. package/package.json +7 -5
  116. package/dist/asset-migrations.d.ts +0 -5
  117. package/dist/plugins/cal/animation-mixer-playable.d.ts +0 -4
  118. package/dist/plugins/cal/animation-playable-output.d.ts +0 -4
  119. package/dist/plugins/cal/track.d.ts +0 -34
  120. package/dist/utils/timeline-component.d.ts +0 -6
@@ -0,0 +1,35 @@
1
+ import type { ShaderMacros } from '../render';
2
+ import { ShaderType } from '../material';
3
+ export interface ShaderCodeOptions {
4
+ level: number;
5
+ shaderType: ShaderType;
6
+ shader: string;
7
+ macros?: ShaderMacros;
8
+ removeVersion?: boolean;
9
+ }
10
+ export declare class ShaderFactory {
11
+ static registerInclude(includeName: string, includeSource: string): void;
12
+ static unRegisterInclude(includeName: string): void;
13
+ static unRegisterAllIncludes(): void;
14
+ /**
15
+ * 生成 shader,检测到 WebGL1 上下文会降级
16
+ * @param macros - 宏定义数组
17
+ * @param shader - 原始 shader 文本
18
+ * @param shaderType - shader 类型
19
+ * @return 去除版本号的 shader 文本
20
+ */
21
+ static genFinalShaderCode(options: ShaderCodeOptions): string;
22
+ /**
23
+ * Convert lower GLSL version to GLSL 300 es.
24
+ * @param source - code
25
+ * @param isFragment - Whether it is a fragment shader.
26
+ * */
27
+ private static convertTo300;
28
+ private static parseIncludes;
29
+ private static genMacroString;
30
+ private static genShaderVersion;
31
+ private static isVersion300;
32
+ private static removeWebGLVersion;
33
+ private static has300Output;
34
+ private static replaceMRTShader;
35
+ }
@@ -18,4 +18,4 @@ export type ShapeGenerator = Shape & {
18
18
  alignSpeedDirection?: boolean;
19
19
  upDirection?: Vector3;
20
20
  };
21
- export declare function createShape(shapeOptions: spec.ParticleShape): Shape;
21
+ export declare function createShape(shapeOptions?: spec.ParticleShape): Shape;
@@ -1,5 +1,5 @@
1
- import type { TemplateContent } from '@galacean/effects-specification';
2
- export declare function getBackgroundImage(template: TemplateContent, variables?: Record<string, number | string | string[]>): string | number | string[] | undefined;
1
+ import type * as spec from '@galacean/effects-specification';
2
+ export declare function getBackgroundImage(template: spec.TemplateContent, variables?: spec.TemplateVariables): string | string[] | HTMLImageElement | HTMLImageElement[] | undefined;
3
3
  /**
4
4
  * @param url
5
5
  * @param template
@@ -7,4 +7,4 @@ export declare function getBackgroundImage(template: TemplateContent, variables?
7
7
  * @param options
8
8
  * @returns
9
9
  */
10
- export declare function combineImageTemplate(url: string | HTMLImageElement, template?: TemplateContent, variables?: Record<string, number | string>): Promise<HTMLImageElement>;
10
+ export declare function combineImageTemplate(url: string | HTMLImageElement, template?: spec.TemplateContent, variables?: spec.TemplateVariables): Promise<HTMLImageElement>;
@@ -82,3 +82,5 @@ export declare abstract class Texture extends EffectsObject {
82
82
  protected assembleOptions(options: TextureSourceOptions): TextureSourceOptions;
83
83
  }
84
84
  export declare function generateHalfFloatTexture(engine: Engine, data: Uint16Array, width: number, height: number): Texture;
85
+ export declare function generateWhiteTexture(engine: Engine): Texture;
86
+ export declare function generateTransparentTexture(engine: Engine): Texture;
@@ -148,7 +148,7 @@ export interface Texture2DSourceOptionsCompressed extends TextureOptionsBase {
148
148
  mipmaps: TextureDataType[];
149
149
  target?: WebGLRenderingContext['TEXTURE_2D'] | WebGLRenderingContext['TEXTURE_CUBE_MAP'];
150
150
  }
151
- export interface Texture2DSourceOptionsFrameBuffer extends TextureOptionsBase {
151
+ export interface Texture2DSourceOptionsFramebuffer extends TextureOptionsBase {
152
152
  sourceType: TextureSourceType.framebuffer;
153
153
  data?: {
154
154
  width: number;
@@ -160,6 +160,6 @@ export interface Texture2DSourceOptionsNone extends TextureOptionsBase {
160
160
  sourceType?: TextureSourceType.none;
161
161
  target?: GLenum;
162
162
  }
163
- export type Texture2DSourceOptions = Texture2DSourceOptionsImage | Texture2DSourceOptionsData | Texture2DSourceOptionsVideo | Texture2DSourceOptionsImageMipmaps | Texture2DSourceOptionsCompressed | Texture2DSourceOptionsFrameBuffer | Texture2DSourceOptionsNone;
163
+ export type Texture2DSourceOptions = Texture2DSourceOptionsImage | Texture2DSourceOptionsData | Texture2DSourceOptionsVideo | Texture2DSourceOptionsImageMipmaps | Texture2DSourceOptionsCompressed | Texture2DSourceOptionsFramebuffer | Texture2DSourceOptionsNone;
164
164
  export type TextureSourceOptions = Texture2DSourceOptions | TextureCubeSourceOptions;
165
165
  export {};
@@ -1,5 +1,6 @@
1
1
  import type * as spec from '@galacean/effects-specification';
2
2
  import type { Texture2DSourceOptions, TextureCubeSourceOptions } from './types';
3
+ import type { Engine } from '../engine';
3
4
  type TextureJSONOptions = spec.SerializedTextureSource & spec.TextureConfigOptionsBase & spec.TextureFormatOptions;
4
- export declare function deserializeMipmapTexture(texOpts: TextureJSONOptions, bins: ArrayBuffer[], files?: spec.BinaryFile[]): Promise<Texture2DSourceOptions | TextureCubeSourceOptions>;
5
+ export declare function deserializeMipmapTexture(textureOptions: TextureJSONOptions, bins: ArrayBuffer[], engine: Engine, files?: spec.BinaryFile[]): Promise<Texture2DSourceOptions | TextureCubeSourceOptions>;
5
6
  export {};
package/dist/ticker.d.ts CHANGED
@@ -9,7 +9,7 @@ export declare class Ticker {
9
9
  private interval;
10
10
  private intervalId;
11
11
  private resetTickers;
12
- private _deltaTime;
12
+ private dt;
13
13
  constructor(fps?: number);
14
14
  /**
15
15
  * 获取定时器当前帧更新的时间
@@ -22,7 +22,7 @@ export declare class Ticker {
22
22
  setFPS(fps: number): void;
23
23
  /**
24
24
  * 获取定时器暂停标志位
25
- * @returns 暂停标志位
25
+ * @returns
26
26
  */
27
27
  getPaused(): boolean;
28
28
  /**
@@ -22,7 +22,7 @@ export declare class Transform implements Disposable {
22
22
  static getRotation(quat: Quaternion, out: Euler): Euler;
23
23
  engine: Engine;
24
24
  name: string;
25
- taggedProperties: Record<string, any>;
25
+ taggedProperties: spec.TransformData;
26
26
  /**
27
27
  * 自身位移
28
28
  */
@@ -223,8 +223,8 @@ export declare class Transform implements Disposable {
223
223
  * 获取 Transform 是否生效
224
224
  */
225
225
  getValid(): boolean;
226
- toData(): Record<string, any>;
227
- fromData(data: any): void;
226
+ toData(): spec.TransformData;
227
+ fromData(data: spec.TransformData): void;
228
228
  dispose(): void;
229
229
  private updateTRSCache;
230
230
  private dispatchValueChange;
@@ -16,4 +16,4 @@ export declare function removeItem<T>(arr: T[], value: T): T[];
16
16
  * @returns
17
17
  */
18
18
  export declare function addItemWithOrder<T extends Record<string, any>>(arr: T[], item: T, property: string, descending?: boolean): void;
19
- export declare function enlargeBuffer<T extends TypedArray>(typeArray: T, length: number, increase: number | undefined, maxSize: number): T;
19
+ export declare function enlargeBuffer<T extends TypedArray>(typeArray: T, length: number, maxSize: number, increase?: number): T;
@@ -1,4 +1,8 @@
1
1
  export declare function getPixelRatio(): number;
2
2
  export declare function isIOS(): boolean;
3
+ export declare function isIOSByUA(): number;
3
4
  export declare function isAndroid(): boolean;
4
5
  export declare function isSimulatorCellPhone(): boolean;
6
+ export declare function isMiniProgram(): boolean;
7
+ export declare function isAlipayMiniApp(): boolean;
8
+ export declare function isWechatMiniApp(): boolean;
@@ -4,11 +4,18 @@ export * from './device';
4
4
  export * from './image-data';
5
5
  export * from './sortable';
6
6
  export * from './asserts';
7
- export * from './timeline-component';
7
+ export * from './text';
8
8
  export * from './logger';
9
9
  export type Immutable<O> = O extends Record<any, any> ? {
10
10
  readonly [key in keyof O]: Immutable<O[key]>;
11
11
  } : O extends Array<infer X> ? ReadonlyArray<X> : O;
12
+ export type PickEnum<T, K extends T> = {
13
+ [P in keyof K]: P extends K ? P : never;
14
+ };
15
+ export interface Constructor<T = unknown> {
16
+ new (...args: any[]): T;
17
+ }
18
+ export type Nullable<T> = T | null;
12
19
  export declare enum DestroyOptions {
13
20
  destroy = 0,
14
21
  keep = 1,
@@ -32,17 +39,17 @@ export declare function noop(): void;
32
39
  *
33
40
  * @static
34
41
  * @function isString
35
- * @param {object} obj - 要判断的对象
36
- * @return {boolean}
42
+ * @param obj - 要判断的对象
43
+ * @return
37
44
  */
38
- export declare function isString(obj: any): obj is string;
45
+ export declare function isString(obj: unknown): obj is string;
39
46
  /**
40
47
  * 判断对象是否是`Array`类型
41
48
  *
42
49
  * @static
43
50
  * @function isArray
44
- * @param {object} obj - 要判断的对象
45
- * @return {boolean}
51
+ * @param obj - 要判断的对象
52
+ * @return
46
53
  */
47
54
  export declare const isArray: (arg: any) => arg is any[];
48
55
  /**
@@ -50,20 +57,28 @@ export declare const isArray: (arg: any) => arg is any[];
50
57
  *
51
58
  * @static
52
59
  * @function isFunction
53
- * @param {object} obj - 要判断的对象
54
- * @return {boolean}
60
+ * @param obj - 要判断的对象
61
+ * @return
55
62
  */
56
- export declare function isFunction(obj: any): boolean;
63
+ export declare function isFunction(obj: unknown): boolean;
57
64
  /**
58
65
  * 判断对象是否是`Object`类型
59
66
  *
60
67
  * @static
61
68
  * @function isObject
62
- * @param {object} obj - 要判断的对象
63
- * @return {boolean}
69
+ * @param obj - 要判断的对象
70
+ * @return
71
+ */
72
+ export declare function isObject(obj: unknown): obj is Record<string | symbol, unknown>;
73
+ export declare function isCanvas(canvas: HTMLCanvasElement): boolean;
74
+ /**
75
+ * 生成一个位于 min 和 max 之间的随机数
76
+ * @param min
77
+ * @param max
78
+ * @returns
64
79
  */
65
- export declare function isObject(obj: any): boolean;
66
- export declare function deepClone(obj: any): any;
67
- export declare function random(min: number, max: number): number;
80
+ export declare function randomInRange(min: number, max: number): number;
68
81
  export declare function throwDestroyedError(): void;
69
82
  export declare function generateGUID(): string;
83
+ export declare function base64ToFile(base64: string, filename?: string, contentType?: string): File;
84
+ export declare function applyMixins<T extends Constructor, K extends Constructor>(derivedCtrl: T, baseCtrls: K[]): void;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 判断是否为可解析的字体
3
+ * - 首字母不能为数字或 `.`
4
+ * - 不能包含特殊字符,`_-` 是被允许的
5
+ * @param fontFamily - 字体名称
6
+ * @returns
7
+ */
8
+ export declare function isValidFontFamily(fontFamily: string): boolean;
@@ -1,18 +1,15 @@
1
1
  import { Vector3 } from '@galacean/effects-math/es/core/vector3';
2
2
  import * as spec from '@galacean/effects-specification';
3
3
  import type { VFXItemData } from './asset-loader';
4
- import { RendererComponent } from './components';
5
- import type { Component } from './components/component';
6
- import { ItemBehaviour } from './components/component';
4
+ import type { Component, RendererComponent, Behaviour } from './components';
7
5
  import type { Composition } from './composition';
8
6
  import { EffectsObject } from './effects-object';
9
7
  import type { Engine } from './engine';
10
8
  import type { BoundingBoxData, CameraController, HitTestBoxParams, HitTestCustomParams, HitTestSphereParams, HitTestTriangleParams, InteractComponent, ParticleSystem, SpriteComponent } from './plugins';
11
- import { TimelineComponent } from './plugins';
12
9
  import { Transform } from './transform';
13
- import { type Disposable } from './utils';
14
- export type VFXItemContent = ParticleSystem | SpriteComponent | TimelineComponent | CameraController | InteractComponent | void | {};
15
- export type VFXItemConstructor = new (enigne: Engine, props: VFXItemProps, composition: Composition) => VFXItem<VFXItemContent>;
10
+ import type { Constructor, Disposable } from './utils';
11
+ export type VFXItemContent = ParticleSystem | SpriteComponent | CameraController | InteractComponent | undefined | {};
12
+ export type VFXItemConstructor = new (engine: Engine, props: VFXItemProps, composition: Composition) => VFXItem;
16
13
  export type VFXItemProps = spec.Item & {
17
14
  items: VFXItemProps[];
18
15
  startTime: number;
@@ -23,7 +20,7 @@ export type VFXItemProps = spec.Item & {
23
20
  /**
24
21
  * 所有元素的继承的抽象类
25
22
  */
26
- export declare class VFXItem<T extends VFXItemContent> extends EffectsObject implements Disposable {
23
+ export declare class VFXItem extends EffectsObject implements Disposable {
27
24
  /**
28
25
  * 元素绑定的父元素,
29
26
  * 1. 当元素没有绑定任何父元素时,parent为空,transform.parentTransform 为 composition.transform
@@ -31,8 +28,8 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
31
28
  * 3. 当元素绑定 TreeItem 的node时,parent为treeItem, transform.parentTransform 为 tree.nodes[i].transform(绑定的node节点上的transform)
32
29
  * 4. 当元素绑定 TreeItem 本身时,行为表现和绑定 nullItem 相同
33
30
  */
34
- parent?: VFXItem<VFXItemContent>;
35
- children: VFXItem<VFXItemContent>[];
31
+ parent?: VFXItem;
32
+ children: VFXItem[];
36
33
  /**
37
34
  * 元素的变换包含位置、旋转、缩放。
38
35
  */
@@ -45,10 +42,6 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
45
42
  * 元素动画的持续时间
46
43
  */
47
44
  duration: number;
48
- /**
49
- * 元素当前更新归一化时间,开始时为 0,结束时为 1
50
- */
51
- lifetime: number;
52
45
  /**
53
46
  * 父元素的 id
54
47
  */
@@ -60,15 +53,11 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
60
53
  /**
61
54
  * 元素动画结束时行为(如何处理元素)
62
55
  */
63
- endBehavior: spec.ItemEndBehavior | spec.ParentItemEndBehavior;
56
+ endBehavior: spec.EndBehavior;
64
57
  /**
65
58
  * 元素是否可用
66
59
  */
67
60
  ended: boolean;
68
- /**
69
- * 元素在合成中的索引
70
- */
71
- listIndex: number;
72
61
  /**
73
62
  * 元素名称
74
63
  */
@@ -77,23 +66,15 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
77
66
  * 元素 id 唯一
78
67
  */
79
68
  id: string;
80
- oldId: string;
81
69
  /**
82
70
  * 元素创建的数据图层/粒子/模型等
83
71
  */
84
- _content?: T;
85
- /**
86
- * 元素动画是否延迟播放
87
- */
88
- delaying: boolean;
89
- /**
90
- * 元素动画的速度
91
- */
72
+ _content?: VFXItemContent;
73
+ reusable: boolean;
92
74
  type: spec.ItemType;
93
- stopped: boolean;
94
75
  props: VFXItemProps;
95
76
  components: Component[];
96
- itemBehaviours: ItemBehaviour[];
77
+ itemBehaviours: Behaviour[];
97
78
  rendererComponents: RendererComponent[];
98
79
  /**
99
80
  * 元素可见性,该值的改变会触发 `handleVisibleChanged` 回调
@@ -101,31 +82,31 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
101
82
  */
102
83
  protected visible: boolean;
103
84
  /**
104
- * 是否允许渲染,元素生命周期开始后为 true,结束时为 false
105
- * @protected
85
+ * 元素动画的速度
106
86
  */
107
- protected _contentVisible: boolean;
108
87
  private speed;
109
- static isComposition(item: VFXItem<VFXItemContent>): item is VFXItem<void>;
110
- static isSprite(item: VFXItem<VFXItemContent>): item is VFXItem<SpriteComponent>;
111
- static isParticle(item: VFXItem<VFXItemContent>): item is VFXItem<ParticleSystem>;
112
- static isNull(item: VFXItem<VFXItemContent>): item is VFXItem<void>;
113
- static isTree(item: VFXItem<VFXItemContent>): item is VFXItem<void>;
114
- static isCamera(item: VFXItem<VFXItemContent>): item is VFXItem<void>;
115
- static isExtraCamera(item: VFXItem<VFXItemContent>): item is VFXItem<CameraController>;
88
+ private listIndex;
89
+ static isComposition(item: VFXItem): boolean;
90
+ static isSprite(item: VFXItem): boolean;
91
+ static isParticle(item: VFXItem): boolean;
92
+ static isNull(item: VFXItem): boolean;
93
+ static isTree(item: VFXItem): boolean;
94
+ static isCamera(item: VFXItem): boolean;
95
+ static isExtraCamera(item: VFXItem): boolean;
116
96
  constructor(engine: Engine, props?: VFXItemProps);
117
97
  /**
118
98
  * 返回元素创建的数据
119
99
  */
120
- get content(): T;
100
+ get content(): VFXItemContent;
121
101
  /**
122
102
  * 播放完成后是否需要再使用,是的话生命周期结束后不会 dispose
123
103
  */
124
- get reusable(): boolean;
104
+ get compositionReusable(): boolean;
125
105
  /**
126
- * 获取元素生命周期是否开始
106
+ * 元素在合成中的索引
127
107
  */
128
- get lifetimeStarted(): boolean;
108
+ get renderOrder(): number;
109
+ set renderOrder(value: number);
129
110
  /**
130
111
  * 设置元素的动画速度
131
112
  * @param speed - 速度
@@ -140,24 +121,20 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
140
121
  * 添加组件
141
122
  * @param classConstructor - 要添加的组件类型
142
123
  */
143
- addComponent<T extends Component>(classConstructor: new (engine: Engine) => T): T;
124
+ addComponent<T extends Component>(classConstructor: Constructor<T>): T;
144
125
  /**
145
126
  * 获取某一类型的组件。如果当前元素绑定了多个同类型的组件只返回第一个
146
127
  * @param classConstructor - 要获取的组件类型
147
128
  * @returns 查询结果中符合类型的第一个组件
148
129
  */
149
- getComponent<T extends Component>(classConstructor: new (engine: Engine) => T): T | undefined;
130
+ getComponent<T extends Component>(classConstructor: Constructor<T>): T;
150
131
  /**
151
132
  * 获取某一类型的所有组件
152
133
  * @param classConstructor - 要获取的组件
153
134
  * @returns 一个组件列表,包含所有符合类型的组件
154
135
  */
155
- getComponents<T extends Component>(classConstructor: new (engine: Engine) => T): T[];
156
- setParent(vfxItem: VFXItem<VFXItemContent>): void;
157
- /**
158
- * 停止播放元素动画
159
- */
160
- stop(): void;
136
+ getComponents<T extends Component>(classConstructor: Constructor<T>): T[];
137
+ setParent(vfxItem: VFXItem): void;
161
138
  /**
162
139
  * 元素动画结束播放时回调函数
163
140
  * @override
@@ -210,7 +187,12 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
210
187
  */
211
188
  scale(x: number, y: number, z: number): void;
212
189
  /**
213
- * 设置元素的在画布上的像素位置, 坐标原点在 canvas 中心,x 正方向水平向右, y 正方向垂直向下
190
+ * 设置元素在画布上的像素位置
191
+ * Tips:
192
+ * - 坐标原点在 canvas 左上角,x 正方向水平向右, y 正方向垂直向下
193
+ * - 设置后会覆盖原有的位置信息
194
+ * @param x - x 坐标
195
+ * @param y - y 坐标
214
196
  */
215
197
  setPositionByPixel(x: number, y: number): void;
216
198
  /**
@@ -233,7 +215,7 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
233
215
  /**
234
216
  * 获取元素用于计算光线投射的面片类型和参数
235
217
  * @override
236
- * @param force 元素没有开启交互也返回参数
218
+ * @param force - 元素没有开启交互也返回参数
237
219
  */
238
220
  getHitTestParams(force?: boolean): void | HitTestBoxParams | HitTestTriangleParams | HitTestSphereParams | HitTestCustomParams;
239
221
  /**
@@ -246,7 +228,7 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
246
228
  * @returns
247
229
  */
248
230
  isEnded(now: number): boolean;
249
- find(name: string): VFXItem<VFXItemContent> | undefined;
231
+ find(name: string): VFXItem | undefined;
250
232
  fromData(data: VFXItemData): void;
251
233
  toData(): void;
252
234
  translateByPixel(x: number, y: number): void;
@@ -262,9 +244,3 @@ export declare namespace Item {
262
244
  function isParticle(item: spec.Item): item is spec.ParticleItem;
263
245
  function isNull(item: spec.Item): item is spec.NullItem;
264
246
  }
265
- /**
266
- * (待废弃) 根据元素的类型创建对应的 `VFXItem` 实例
267
- * @param props
268
- * @param composition
269
- */
270
- export declare function createVFXItem(props: VFXItemProps, composition: Composition): VFXItem<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-core",
3
- "version": "2.0.0-alpha.9",
3
+ "version": "2.0.0-beta.0",
4
4
  "description": "Galacean Effects runtime core for the web",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
@@ -42,15 +42,17 @@
42
42
  "registry": "https://registry.npmjs.org"
43
43
  },
44
44
  "dependencies": {
45
- "@galacean/effects-specification": "2.0.0-alpha.8",
46
- "@galacean/effects-math": "1.1.0-alpha.0",
45
+ "@galacean/effects-specification": "2.0.0-beta.0",
46
+ "@galacean/effects-math": "1.1.0",
47
+ "flatbuffers": "24.3.25",
47
48
  "uuid": "9.0.1"
48
49
  },
49
50
  "scripts": {
50
51
  "prebuild": "pnpm clean",
51
- "build": "pnpm build:declaration && pnpm build:module",
52
+ "build": "pnpm build:fbs && pnpm build:declaration && pnpm build:module",
53
+ "build:fbs": "node ../../scripts/flatc ./src/__definations__/index.fbs",
52
54
  "build:module": "rollup -c",
53
55
  "build:declaration": "tsc -d --emitDeclarationOnly",
54
- "clean": "rimraf dist && rimraf '*+(.tsbuildinfo)'"
56
+ "clean": "rimraf dist && rimraf \"*+(.tsbuildinfo)\""
55
57
  }
56
58
  }
@@ -1,5 +0,0 @@
1
- import type * as spec from '@galacean/effects-specification';
2
- /**
3
- * 提取并转换 JSON 数据中的 anchor 值
4
- */
5
- export declare function convertAnchor(anchor?: spec.vec2, particleOrigin?: spec.ParticleOrigin): spec.vec2;
@@ -1,4 +0,0 @@
1
- import { AnimationPlayable } from './animation-playable';
2
- export declare class AnimationMixerPlayable extends AnimationPlayable {
3
- processFrame(dt: number): void;
4
- }
@@ -1,4 +0,0 @@
1
- import { PlayableOutput } from './playable-graph';
2
- export declare class AnimationPlayableOutput extends PlayableOutput {
3
- processFrame(dt: number): void;
4
- }
@@ -1,34 +0,0 @@
1
- import type { VFXItem, VFXItemContent } from '../../vfx-item';
2
- import { Playable, PlayableAsset, PlayableOutput } from './playable-graph';
3
- /**
4
- * @since 2.0.0
5
- * @internal
6
- */
7
- export declare class Track extends PlayableAsset {
8
- id: string;
9
- name: string;
10
- bindingItem: VFXItem<VFXItemContent>;
11
- private clips;
12
- private clipSeed;
13
- createOutput(): PlayableOutput;
14
- /**
15
- * 重写该方法以创建自定义混合器
16
- */
17
- createMixerPlayable(): Playable;
18
- createPlayable(): Playable;
19
- createClip<T extends Playable>(classConstructor: new () => T, name?: string): TimelineClip;
20
- getClips(): TimelineClip[];
21
- findClip(name: string): TimelineClip | undefined;
22
- private addClip;
23
- }
24
- /**
25
- * @since 2.0.0
26
- * @internal
27
- */
28
- export declare class TimelineClip {
29
- id: string;
30
- name: string;
31
- start: number;
32
- duration: number;
33
- playable: Playable;
34
- }
@@ -1,6 +0,0 @@
1
- import type * as spec from '@galacean/effects-specification';
2
- export interface TimelineComponentOptions {
3
- sizeOverLifetime?: spec.SizeOverLifetime;
4
- rotationOverLifetime?: spec.RotationOverLifetime;
5
- positionOverLifetime?: spec.PositionOverLifetime;
6
- }