@galacean/effects-core 2.0.0-alpha.9 → 2.0.0-beta.1
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/README.md +25 -21
- package/dist/__definations__/fbeffects-object-data.d.ts +28 -0
- package/dist/__definations__/fbeffects-package-data.d.ts +26 -0
- package/dist/__definations__/fbgeometry-data.d.ts +77 -0
- package/dist/__definations__/fbsub-mesh.d.ts +26 -0
- package/dist/__definations__/fbvertex-channel.d.ts +33 -0
- package/dist/__definations__/fbvertex-data.d.ts +27 -0
- package/dist/__definations__/index.d.ts +6 -0
- package/dist/asset-loader.d.ts +0 -13
- package/dist/binary-asset.d.ts +6 -0
- package/dist/camera.d.ts +11 -2
- package/dist/canvas-pool.d.ts +0 -1
- package/dist/comp-vfx-item.d.ts +26 -12
- package/dist/components/component.d.ts +9 -14
- package/dist/components/effect-component.d.ts +3 -23
- package/dist/components/index.d.ts +1 -0
- package/dist/components/post-process-volume.d.ts +15 -0
- package/dist/components/renderer-component.d.ts +2 -2
- package/dist/composition-source-manager.d.ts +8 -7
- package/dist/composition.d.ts +65 -62
- package/dist/constants.d.ts +1 -1
- package/dist/decorators.d.ts +4 -3
- package/dist/downloader.d.ts +9 -0
- package/dist/effects-object.d.ts +1 -0
- package/dist/effects-package.d.ts +19 -0
- package/dist/engine.d.ts +7 -4
- package/dist/events/event-emitter.d.ts +46 -0
- package/dist/events/index.d.ts +2 -0
- package/dist/events/types.d.ts +37 -0
- package/dist/fallback/camera.d.ts +2 -0
- package/dist/fallback/index.d.ts +12 -0
- package/dist/fallback/interact.d.ts +2 -0
- package/dist/fallback/migration.d.ts +20 -0
- package/dist/fallback/particle.d.ts +2 -0
- package/dist/fallback/sprite.d.ts +3 -0
- package/dist/fallback/utils.d.ts +25 -0
- package/dist/gl/create-gl-context.d.ts +2 -1
- package/dist/gl/index.d.ts +3 -0
- package/dist/image-asset.d.ts +5 -0
- package/dist/index.d.ts +9 -4
- package/dist/index.js +19373 -14510
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19333 -14477
- package/dist/index.mjs.map +1 -1
- package/dist/material/material.d.ts +5 -6
- package/dist/material/utils.d.ts +0 -10
- package/dist/math/bezier.d.ts +99 -0
- package/dist/math/keyframe-info.d.ts +39 -0
- package/dist/math/translate.d.ts +3 -2
- package/dist/math/utils.d.ts +5 -4
- package/dist/math/value-getter.d.ts +52 -26
- package/dist/pass-render-level.d.ts +3 -1
- package/dist/plugin-system.d.ts +2 -2
- package/dist/plugins/cal/animation-playable.d.ts +2 -1
- package/dist/plugins/cal/calculate-item.d.ts +5 -39
- package/dist/plugins/cal/calculate-vfx-item.d.ts +54 -13
- package/dist/plugins/cal/playable-graph.d.ts +72 -21
- package/dist/plugins/cal/timeline-asset.d.ts +27 -0
- package/dist/plugins/camera/camera-controller-node.d.ts +2 -13
- package/dist/plugins/index.d.ts +8 -3
- package/dist/plugins/interact/click-handler.d.ts +3 -3
- package/dist/plugins/interact/event-system.d.ts +0 -2
- package/dist/plugins/interact/interact-item.d.ts +15 -1
- package/dist/plugins/particle/burst.d.ts +10 -3
- package/dist/plugins/particle/link.d.ts +1 -0
- package/dist/plugins/particle/particle-loader.d.ts +2 -2
- package/dist/plugins/particle/particle-mesh.d.ts +5 -9
- package/dist/plugins/particle/particle-system-renderer.d.ts +1 -1
- package/dist/plugins/particle/particle-system.d.ts +13 -6
- package/dist/plugins/particle/particle-vfx-item.d.ts +9 -3
- package/dist/plugins/particle/trail-mesh.d.ts +2 -2
- package/dist/plugins/plugin.d.ts +6 -6
- package/dist/plugins/sprite/sprite-item.d.ts +16 -12
- package/dist/plugins/sprite/sprite-mesh.d.ts +0 -4
- package/dist/plugins/text/index.d.ts +4 -0
- package/dist/plugins/text/text-item.d.ts +32 -5
- package/dist/plugins/text/text-layout.d.ts +9 -1
- package/dist/plugins/timeline/playables/activation-mixer-playable.d.ts +7 -0
- package/dist/plugins/timeline/playables/sub-composition-clip-playable.d.ts +5 -0
- package/dist/plugins/timeline/playables/sub-composition-playable-asset.d.ts +5 -0
- package/dist/plugins/timeline/track.d.ts +72 -0
- package/dist/plugins/timeline/tracks/activation-track.d.ts +5 -0
- package/dist/plugins/timeline/tracks/sprite-color-track.d.ts +3 -0
- package/dist/plugins/timeline/tracks/sub-composition-track.d.ts +4 -0
- package/dist/plugins/timeline/tracks/transform-track.d.ts +3 -0
- package/dist/render/create-copy-shader.d.ts +2 -2
- package/dist/render/{frame-buffer.d.ts → framebuffer.d.ts} +7 -7
- package/dist/render/geometry.d.ts +14 -1
- package/dist/render/global-volume.d.ts +4 -5
- package/dist/render/gpu-capability.d.ts +6 -6
- package/dist/render/index.d.ts +2 -2
- package/dist/render/mesh.d.ts +1 -1
- package/dist/render/render-frame.d.ts +11 -10
- package/dist/render/render-pass.d.ts +8 -8
- package/dist/render/{render-buffer.d.ts → renderbuffer.d.ts} +4 -4
- package/dist/render/renderer.d.ts +9 -7
- package/dist/render/semantic-map.d.ts +1 -1
- package/dist/render/shader.d.ts +4 -4
- package/dist/scene.d.ts +10 -4
- package/dist/serialization-helper.d.ts +6 -4
- package/dist/shader/index.d.ts +1 -3
- package/dist/shader/shader-factory.d.ts +35 -0
- package/dist/shape/shape.d.ts +1 -1
- package/dist/template-image.d.ts +3 -3
- package/dist/texture/texture.d.ts +2 -0
- package/dist/texture/types.d.ts +2 -2
- package/dist/texture/utils.d.ts +2 -1
- package/dist/ticker.d.ts +2 -2
- package/dist/transform.d.ts +3 -3
- package/dist/utils/array.d.ts +1 -1
- package/dist/utils/device.d.ts +4 -0
- package/dist/utils/index.d.ts +29 -14
- package/dist/utils/text.d.ts +8 -0
- package/dist/vfx-item.d.ts +75 -62
- package/package.json +7 -5
- package/dist/asset-migrations.d.ts +0 -5
- package/dist/plugins/cal/animation-mixer-playable.d.ts +0 -4
- package/dist/plugins/cal/animation-playable-output.d.ts +0 -4
- package/dist/plugins/cal/track.d.ts +0 -34
- 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
|
+
}
|
package/dist/shape/shape.d.ts
CHANGED
package/dist/template-image.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export declare function getBackgroundImage(template: TemplateContent, variables?:
|
|
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?:
|
|
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;
|
package/dist/texture/types.d.ts
CHANGED
|
@@ -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
|
|
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 |
|
|
163
|
+
export type Texture2DSourceOptions = Texture2DSourceOptionsImage | Texture2DSourceOptionsData | Texture2DSourceOptionsVideo | Texture2DSourceOptionsImageMipmaps | Texture2DSourceOptionsCompressed | Texture2DSourceOptionsFramebuffer | Texture2DSourceOptionsNone;
|
|
164
164
|
export type TextureSourceOptions = Texture2DSourceOptions | TextureCubeSourceOptions;
|
|
165
165
|
export {};
|
package/dist/texture/utils.d.ts
CHANGED
|
@@ -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(
|
|
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
|
|
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
|
/**
|
package/dist/transform.d.ts
CHANGED
|
@@ -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:
|
|
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():
|
|
227
|
-
fromData(data:
|
|
226
|
+
toData(): spec.TransformData;
|
|
227
|
+
fromData(data: spec.TransformData): void;
|
|
228
228
|
dispose(): void;
|
|
229
229
|
private updateTRSCache;
|
|
230
230
|
private dispatchValueChange;
|
package/dist/utils/array.d.ts
CHANGED
|
@@ -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,
|
|
19
|
+
export declare function enlargeBuffer<T extends TypedArray>(typeArray: T, length: number, maxSize: number, increase?: number): T;
|
package/dist/utils/device.d.ts
CHANGED
|
@@ -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;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -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 './
|
|
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
|
|
36
|
-
* @return
|
|
42
|
+
* @param obj - 要判断的对象
|
|
43
|
+
* @return
|
|
37
44
|
*/
|
|
38
|
-
export declare function isString(obj:
|
|
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
|
|
45
|
-
* @return
|
|
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
|
|
54
|
-
* @return
|
|
60
|
+
* @param obj - 要判断的对象
|
|
61
|
+
* @return
|
|
55
62
|
*/
|
|
56
|
-
export declare function isFunction(obj:
|
|
63
|
+
export declare function isFunction(obj: unknown): boolean;
|
|
57
64
|
/**
|
|
58
65
|
* 判断对象是否是`Object`类型
|
|
59
66
|
*
|
|
60
67
|
* @static
|
|
61
68
|
* @function isObject
|
|
62
|
-
* @param
|
|
63
|
-
* @return
|
|
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
|
|
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;
|
package/dist/vfx-item.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
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 {
|
|
5
|
-
import
|
|
6
|
-
import { ItemBehaviour } from './components/component';
|
|
4
|
+
import type { Component } from './components';
|
|
5
|
+
import { RendererComponent, Behaviour } from './components';
|
|
7
6
|
import type { Composition } from './composition';
|
|
8
7
|
import { EffectsObject } from './effects-object';
|
|
9
8
|
import type { Engine } from './engine';
|
|
10
|
-
import type { BoundingBoxData, CameraController, HitTestBoxParams, HitTestCustomParams, HitTestSphereParams, HitTestTriangleParams, InteractComponent,
|
|
11
|
-
import {
|
|
9
|
+
import type { BoundingBoxData, CameraController, HitTestBoxParams, HitTestCustomParams, HitTestSphereParams, HitTestTriangleParams, InteractComponent, SpriteComponent } from './plugins';
|
|
10
|
+
import { ParticleSystem } from './plugins';
|
|
12
11
|
import { Transform } from './transform';
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
export type
|
|
12
|
+
import type { Constructor, Disposable } from './utils';
|
|
13
|
+
import type { EventEmitterListener, EventEmitterOptions, ItemEvent } from './events';
|
|
14
|
+
export type VFXItemContent = ParticleSystem | SpriteComponent | CameraController | InteractComponent | undefined | {};
|
|
15
|
+
export type VFXItemConstructor = new (engine: Engine, props: VFXItemProps, composition: Composition) => VFXItem;
|
|
16
16
|
export type VFXItemProps = spec.Item & {
|
|
17
17
|
items: VFXItemProps[];
|
|
18
18
|
startTime: number;
|
|
@@ -23,7 +23,7 @@ export type VFXItemProps = spec.Item & {
|
|
|
23
23
|
/**
|
|
24
24
|
* 所有元素的继承的抽象类
|
|
25
25
|
*/
|
|
26
|
-
export declare class VFXItem
|
|
26
|
+
export declare class VFXItem extends EffectsObject implements Disposable {
|
|
27
27
|
/**
|
|
28
28
|
* 元素绑定的父元素,
|
|
29
29
|
* 1. 当元素没有绑定任何父元素时,parent为空,transform.parentTransform 为 composition.transform
|
|
@@ -31,8 +31,8 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
|
|
|
31
31
|
* 3. 当元素绑定 TreeItem 的node时,parent为treeItem, transform.parentTransform 为 tree.nodes[i].transform(绑定的node节点上的transform)
|
|
32
32
|
* 4. 当元素绑定 TreeItem 本身时,行为表现和绑定 nullItem 相同
|
|
33
33
|
*/
|
|
34
|
-
parent?: VFXItem
|
|
35
|
-
children: VFXItem
|
|
34
|
+
parent?: VFXItem;
|
|
35
|
+
children: VFXItem[];
|
|
36
36
|
/**
|
|
37
37
|
* 元素的变换包含位置、旋转、缩放。
|
|
38
38
|
*/
|
|
@@ -45,10 +45,6 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
|
|
|
45
45
|
* 元素动画的持续时间
|
|
46
46
|
*/
|
|
47
47
|
duration: number;
|
|
48
|
-
/**
|
|
49
|
-
* 元素当前更新归一化时间,开始时为 0,结束时为 1
|
|
50
|
-
*/
|
|
51
|
-
lifetime: number;
|
|
52
48
|
/**
|
|
53
49
|
* 父元素的 id
|
|
54
50
|
*/
|
|
@@ -60,15 +56,11 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
|
|
|
60
56
|
/**
|
|
61
57
|
* 元素动画结束时行为(如何处理元素)
|
|
62
58
|
*/
|
|
63
|
-
endBehavior: spec.
|
|
59
|
+
endBehavior: spec.EndBehavior;
|
|
64
60
|
/**
|
|
65
61
|
* 元素是否可用
|
|
66
62
|
*/
|
|
67
63
|
ended: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* 元素在合成中的索引
|
|
70
|
-
*/
|
|
71
|
-
listIndex: number;
|
|
72
64
|
/**
|
|
73
65
|
* 元素名称
|
|
74
66
|
*/
|
|
@@ -77,23 +69,15 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
|
|
|
77
69
|
* 元素 id 唯一
|
|
78
70
|
*/
|
|
79
71
|
id: string;
|
|
80
|
-
oldId: string;
|
|
81
72
|
/**
|
|
82
73
|
* 元素创建的数据图层/粒子/模型等
|
|
83
74
|
*/
|
|
84
|
-
_content?:
|
|
85
|
-
|
|
86
|
-
* 元素动画是否延迟播放
|
|
87
|
-
*/
|
|
88
|
-
delaying: boolean;
|
|
89
|
-
/**
|
|
90
|
-
* 元素动画的速度
|
|
91
|
-
*/
|
|
75
|
+
_content?: VFXItemContent;
|
|
76
|
+
reusable: boolean;
|
|
92
77
|
type: spec.ItemType;
|
|
93
|
-
stopped: boolean;
|
|
94
78
|
props: VFXItemProps;
|
|
95
79
|
components: Component[];
|
|
96
|
-
itemBehaviours:
|
|
80
|
+
itemBehaviours: Behaviour[];
|
|
97
81
|
rendererComponents: RendererComponent[];
|
|
98
82
|
/**
|
|
99
83
|
* 元素可见性,该值的改变会触发 `handleVisibleChanged` 回调
|
|
@@ -101,31 +85,65 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
|
|
|
101
85
|
*/
|
|
102
86
|
protected visible: boolean;
|
|
103
87
|
/**
|
|
104
|
-
*
|
|
105
|
-
* @protected
|
|
88
|
+
* 元素动画的速度
|
|
106
89
|
*/
|
|
107
|
-
protected _contentVisible: boolean;
|
|
108
90
|
private speed;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
static
|
|
112
|
-
static
|
|
113
|
-
static
|
|
114
|
-
static
|
|
115
|
-
static
|
|
91
|
+
private listIndex;
|
|
92
|
+
private eventProcessor;
|
|
93
|
+
static isComposition(item: VFXItem): boolean;
|
|
94
|
+
static isSprite(item: VFXItem): boolean;
|
|
95
|
+
static isParticle(item: VFXItem): boolean;
|
|
96
|
+
static isNull(item: VFXItem): boolean;
|
|
97
|
+
static isTree(item: VFXItem): boolean;
|
|
98
|
+
static isCamera(item: VFXItem): boolean;
|
|
99
|
+
static isExtraCamera(item: VFXItem): boolean;
|
|
116
100
|
constructor(engine: Engine, props?: VFXItemProps);
|
|
117
101
|
/**
|
|
118
102
|
* 返回元素创建的数据
|
|
119
103
|
*/
|
|
120
|
-
get content():
|
|
104
|
+
get content(): VFXItemContent;
|
|
121
105
|
/**
|
|
122
106
|
* 播放完成后是否需要再使用,是的话生命周期结束后不会 dispose
|
|
123
107
|
*/
|
|
124
|
-
get
|
|
108
|
+
get compositionReusable(): boolean;
|
|
125
109
|
/**
|
|
126
|
-
*
|
|
110
|
+
* 元素在合成中的索引
|
|
127
111
|
*/
|
|
128
|
-
get
|
|
112
|
+
get renderOrder(): number;
|
|
113
|
+
set renderOrder(value: number);
|
|
114
|
+
/**
|
|
115
|
+
* 元素监听事件
|
|
116
|
+
* @param eventName - 事件名称
|
|
117
|
+
* @param listener - 事件监听器
|
|
118
|
+
* @param options - 事件监听器选项
|
|
119
|
+
* @returns
|
|
120
|
+
*/
|
|
121
|
+
on<E extends keyof ItemEvent>(eventName: E, listener: EventEmitterListener<ItemEvent[E]>, options?: EventEmitterOptions): void;
|
|
122
|
+
/**
|
|
123
|
+
* 移除事件监听器
|
|
124
|
+
* @param eventName - 事件名称
|
|
125
|
+
* @param listener - 事件监听器
|
|
126
|
+
* @returns
|
|
127
|
+
*/
|
|
128
|
+
off<E extends keyof ItemEvent>(eventName: E, listener: EventEmitterListener<ItemEvent[E]>): void;
|
|
129
|
+
/**
|
|
130
|
+
* 一次性监听事件
|
|
131
|
+
* @param eventName - 事件名称
|
|
132
|
+
* @param listener - 事件监听器
|
|
133
|
+
*/
|
|
134
|
+
once<E extends keyof ItemEvent>(eventName: E, listener: EventEmitterListener<ItemEvent[E]>): void;
|
|
135
|
+
/**
|
|
136
|
+
* 触发事件
|
|
137
|
+
* @param eventName - 事件名称
|
|
138
|
+
* @param args - 事件参数
|
|
139
|
+
*/
|
|
140
|
+
emit<E extends keyof ItemEvent>(eventName: E, ...args: ItemEvent[E]): void;
|
|
141
|
+
/**
|
|
142
|
+
* 获取事件名称对应的所有监听器
|
|
143
|
+
* @param eventName - 事件名称
|
|
144
|
+
* @returns - 返回事件名称对应的所有监听器
|
|
145
|
+
*/
|
|
146
|
+
getListeners<E extends keyof ItemEvent>(eventName: E): EventEmitterListener<ItemEvent[E]>[];
|
|
129
147
|
/**
|
|
130
148
|
* 设置元素的动画速度
|
|
131
149
|
* @param speed - 速度
|
|
@@ -140,24 +158,20 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
|
|
|
140
158
|
* 添加组件
|
|
141
159
|
* @param classConstructor - 要添加的组件类型
|
|
142
160
|
*/
|
|
143
|
-
addComponent<T extends Component>(classConstructor:
|
|
161
|
+
addComponent<T extends Component>(classConstructor: Constructor<T>): T;
|
|
144
162
|
/**
|
|
145
163
|
* 获取某一类型的组件。如果当前元素绑定了多个同类型的组件只返回第一个
|
|
146
164
|
* @param classConstructor - 要获取的组件类型
|
|
147
165
|
* @returns 查询结果中符合类型的第一个组件
|
|
148
166
|
*/
|
|
149
|
-
getComponent<T extends Component>(classConstructor:
|
|
167
|
+
getComponent<T extends Component>(classConstructor: Constructor<T>): T;
|
|
150
168
|
/**
|
|
151
169
|
* 获取某一类型的所有组件
|
|
152
170
|
* @param classConstructor - 要获取的组件
|
|
153
171
|
* @returns 一个组件列表,包含所有符合类型的组件
|
|
154
172
|
*/
|
|
155
|
-
getComponents<T extends Component>(classConstructor:
|
|
156
|
-
setParent(vfxItem: VFXItem
|
|
157
|
-
/**
|
|
158
|
-
* 停止播放元素动画
|
|
159
|
-
*/
|
|
160
|
-
stop(): void;
|
|
173
|
+
getComponents<T extends Component>(classConstructor: Constructor<T>): T[];
|
|
174
|
+
setParent(vfxItem: VFXItem): void;
|
|
161
175
|
/**
|
|
162
176
|
* 元素动画结束播放时回调函数
|
|
163
177
|
* @override
|
|
@@ -210,7 +224,12 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
|
|
|
210
224
|
*/
|
|
211
225
|
scale(x: number, y: number, z: number): void;
|
|
212
226
|
/**
|
|
213
|
-
*
|
|
227
|
+
* 设置元素在画布上的像素位置
|
|
228
|
+
* Tips:
|
|
229
|
+
* - 坐标原点在 canvas 左上角,x 正方向水平向右, y 正方向垂直向下
|
|
230
|
+
* - 设置后会覆盖原有的位置信息
|
|
231
|
+
* @param x - x 坐标
|
|
232
|
+
* @param y - y 坐标
|
|
214
233
|
*/
|
|
215
234
|
setPositionByPixel(x: number, y: number): void;
|
|
216
235
|
/**
|
|
@@ -233,7 +252,7 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
|
|
|
233
252
|
/**
|
|
234
253
|
* 获取元素用于计算光线投射的面片类型和参数
|
|
235
254
|
* @override
|
|
236
|
-
* @param force 元素没有开启交互也返回参数
|
|
255
|
+
* @param force - 元素没有开启交互也返回参数
|
|
237
256
|
*/
|
|
238
257
|
getHitTestParams(force?: boolean): void | HitTestBoxParams | HitTestTriangleParams | HitTestSphereParams | HitTestCustomParams;
|
|
239
258
|
/**
|
|
@@ -246,7 +265,7 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
|
|
|
246
265
|
* @returns
|
|
247
266
|
*/
|
|
248
267
|
isEnded(now: number): boolean;
|
|
249
|
-
find(name: string): VFXItem
|
|
268
|
+
find(name: string): VFXItem | undefined;
|
|
250
269
|
fromData(data: VFXItemData): void;
|
|
251
270
|
toData(): void;
|
|
252
271
|
translateByPixel(x: number, y: number): void;
|
|
@@ -262,9 +281,3 @@ export declare namespace Item {
|
|
|
262
281
|
function isParticle(item: spec.Item): item is spec.ParticleItem;
|
|
263
282
|
function isNull(item: spec.Item): item is spec.NullItem;
|
|
264
283
|
}
|
|
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-
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
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-
|
|
46
|
-
"@galacean/effects-math": "1.1.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
|
|
56
|
+
"clean": "rimraf dist && rimraf \"*+(.tsbuildinfo)\""
|
|
55
57
|
}
|
|
56
58
|
}
|
|
@@ -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
|
-
}
|