@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.
- 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 +10 -1
- package/dist/canvas-pool.d.ts +0 -1
- package/dist/comp-vfx-item.d.ts +26 -12
- package/dist/components/component.d.ts +4 -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 +64 -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 +4 -1
- 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 +18752 -13963
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20450 -15668
- 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 +14 -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 +37 -61
- 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,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 {
|
|
14
|
-
export type VFXItemContent = ParticleSystem | SpriteComponent |
|
|
15
|
-
export type VFXItemConstructor = new (
|
|
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
|
|
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
|
|
35
|
-
children: VFXItem
|
|
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.
|
|
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?:
|
|
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:
|
|
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
|
-
*
|
|
105
|
-
* @protected
|
|
85
|
+
* 元素动画的速度
|
|
106
86
|
*/
|
|
107
|
-
protected _contentVisible: boolean;
|
|
108
87
|
private speed;
|
|
109
|
-
|
|
110
|
-
static
|
|
111
|
-
static
|
|
112
|
-
static
|
|
113
|
-
static
|
|
114
|
-
static
|
|
115
|
-
static
|
|
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():
|
|
100
|
+
get content(): VFXItemContent;
|
|
121
101
|
/**
|
|
122
102
|
* 播放完成后是否需要再使用,是的话生命周期结束后不会 dispose
|
|
123
103
|
*/
|
|
124
|
-
get
|
|
104
|
+
get compositionReusable(): boolean;
|
|
125
105
|
/**
|
|
126
|
-
*
|
|
106
|
+
* 元素在合成中的索引
|
|
127
107
|
*/
|
|
128
|
-
get
|
|
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:
|
|
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:
|
|
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:
|
|
156
|
-
setParent(vfxItem: VFXItem
|
|
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
|
-
*
|
|
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
|
|
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-
|
|
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-
|
|
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
|
-
}
|