@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.
- package/dist/asset-loader.d.ts +8 -90
- package/dist/asset-manager.d.ts +1 -80
- package/dist/asset-migrations.d.ts +1 -3
- package/dist/binary-asset.d.ts +6 -0
- package/dist/canvas-pool.d.ts +10 -0
- package/dist/comp-vfx-item.d.ts +24 -10
- package/dist/components/component.d.ts +5 -5
- package/dist/components/effect-component.d.ts +1 -1
- package/dist/components/renderer-component.d.ts +1 -1
- package/dist/composition-source-manager.d.ts +7 -4
- package/dist/composition.d.ts +40 -35
- package/dist/constants.d.ts +1 -2
- package/dist/decorators.d.ts +5 -4
- package/dist/downloader.d.ts +2 -8
- package/dist/effects-object.d.ts +3 -2
- package/dist/engine.d.ts +11 -7
- 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 +7 -4
- package/dist/index.js +19952 -20233
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19602 -19878
- package/dist/index.mjs.map +1 -1
- package/dist/material/material.d.ts +18 -5
- package/dist/material/types.d.ts +0 -5
- package/dist/material/utils.d.ts +4 -4
- 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 +6 -2
- package/dist/math/value-getter.d.ts +52 -26
- package/dist/pass-render-level.d.ts +3 -1
- package/dist/plugin-system.d.ts +3 -4
- package/dist/plugins/cal/animation-mixer-playable.d.ts +1 -1
- package/dist/plugins/cal/animation-playable-output.d.ts +1 -1
- 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 +58 -12
- package/dist/plugins/cal/playable-graph.d.ts +73 -18
- package/dist/plugins/cal/timeline-asset.d.ts +27 -0
- package/dist/plugins/camera/camera-controller-node.d.ts +1 -12
- package/dist/plugins/index.d.ts +8 -3
- package/dist/plugins/interact/click-handler.d.ts +2 -2
- package/dist/plugins/interact/event-system.d.ts +0 -2
- package/dist/plugins/interact/interact-item.d.ts +1 -1
- package/dist/plugins/interact/interact-mesh.d.ts +1 -1
- package/dist/plugins/particle/particle-loader.d.ts +1 -1
- package/dist/plugins/particle/particle-mesh.d.ts +7 -7
- package/dist/plugins/particle/particle-system-renderer.d.ts +1 -1
- package/dist/plugins/particle/particle-system.d.ts +3 -3
- package/dist/plugins/particle/particle-vfx-item.d.ts +9 -3
- package/dist/plugins/particle/trail-mesh.d.ts +7 -7
- package/dist/plugins/plugin.d.ts +7 -8
- package/dist/plugins/sprite/sprite-item.d.ts +29 -15
- 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 +19 -5
- 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 +73 -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 +1 -1
- 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 +3 -0
- package/dist/render/gpu-capability.d.ts +6 -6
- package/dist/render/index.d.ts +3 -2
- package/dist/render/render-frame.d.ts +6 -6
- package/dist/render/render-pass.d.ts +10 -10
- package/dist/render/{render-buffer.d.ts → renderbuffer.d.ts} +4 -4
- package/dist/render/renderer.d.ts +7 -6
- package/dist/render/semantic-map.d.ts +14 -0
- package/dist/render/shader.d.ts +12 -5
- package/dist/scene.d.ts +82 -4
- package/dist/serialization-helper.d.ts +6 -4
- package/dist/shader/index.d.ts +0 -11
- package/dist/shape/shape.d.ts +1 -1
- package/dist/shape/sphere.d.ts +0 -3
- package/dist/template-image.d.ts +10 -0
- package/dist/texture/texture.d.ts +8 -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 +1 -0
- package/dist/utils/index.d.ts +28 -14
- package/dist/utils/text.d.ts +8 -0
- package/dist/vfx-item.d.ts +36 -54
- package/package.json +5 -5
- package/dist/plugins/cal/track.d.ts +0 -35
- package/dist/semantic-map.d.ts +0 -14
- package/dist/template-image/index.d.ts +0 -67
- package/dist/template-image/qcanvas-viewer.d.ts +0 -21
- package/dist/template-image/qtext.d.ts +0 -96
- package/dist/template-image/template-v1.d.ts +0 -27
- package/dist/template-image/text-metrics.d.ts +0 -18
- package/dist/utils/timeline-component.d.ts +0 -6
|
@@ -31,6 +31,12 @@ export declare abstract class Texture extends EffectsObject {
|
|
|
31
31
|
* 创建一个新的 Texture 对象。
|
|
32
32
|
*/
|
|
33
33
|
static create: (engine: Engine, options?: TextureSourceOptions) => Texture;
|
|
34
|
+
/**
|
|
35
|
+
* 通过 URL 创建 Texture 对象。
|
|
36
|
+
* @param url - 要创建的 Texture URL
|
|
37
|
+
* @since 2.0.0
|
|
38
|
+
*/
|
|
39
|
+
static fromImage(url: string, engine: Engine): Promise<Texture>;
|
|
34
40
|
/**
|
|
35
41
|
* 通过数据创建 Texture 对象。
|
|
36
42
|
* @param data - 要创建的 Texture 数据
|
|
@@ -76,3 +82,5 @@ export declare abstract class Texture extends EffectsObject {
|
|
|
76
82
|
protected assembleOptions(options: TextureSourceOptions): TextureSourceOptions;
|
|
77
83
|
}
|
|
78
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
package/dist/utils/index.d.ts
CHANGED
|
@@ -4,11 +4,17 @@ 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
|
+
}
|
|
12
18
|
export declare enum DestroyOptions {
|
|
13
19
|
destroy = 0,
|
|
14
20
|
keep = 1,
|
|
@@ -32,17 +38,17 @@ export declare function noop(): void;
|
|
|
32
38
|
*
|
|
33
39
|
* @static
|
|
34
40
|
* @function isString
|
|
35
|
-
* @param
|
|
36
|
-
* @return
|
|
41
|
+
* @param obj - 要判断的对象
|
|
42
|
+
* @return
|
|
37
43
|
*/
|
|
38
|
-
export declare function isString(obj:
|
|
44
|
+
export declare function isString(obj: unknown): obj is string;
|
|
39
45
|
/**
|
|
40
46
|
* 判断对象是否是`Array`类型
|
|
41
47
|
*
|
|
42
48
|
* @static
|
|
43
49
|
* @function isArray
|
|
44
|
-
* @param
|
|
45
|
-
* @return
|
|
50
|
+
* @param obj - 要判断的对象
|
|
51
|
+
* @return
|
|
46
52
|
*/
|
|
47
53
|
export declare const isArray: (arg: any) => arg is any[];
|
|
48
54
|
/**
|
|
@@ -50,20 +56,28 @@ export declare const isArray: (arg: any) => arg is any[];
|
|
|
50
56
|
*
|
|
51
57
|
* @static
|
|
52
58
|
* @function isFunction
|
|
53
|
-
* @param
|
|
54
|
-
* @return
|
|
59
|
+
* @param obj - 要判断的对象
|
|
60
|
+
* @return
|
|
55
61
|
*/
|
|
56
|
-
export declare function isFunction(obj:
|
|
62
|
+
export declare function isFunction(obj: unknown): boolean;
|
|
57
63
|
/**
|
|
58
64
|
* 判断对象是否是`Object`类型
|
|
59
65
|
*
|
|
60
66
|
* @static
|
|
61
67
|
* @function isObject
|
|
62
|
-
* @param
|
|
63
|
-
* @return
|
|
68
|
+
* @param obj - 要判断的对象
|
|
69
|
+
* @return
|
|
70
|
+
*/
|
|
71
|
+
export declare function isObject(obj: unknown): obj is Record<string | symbol, unknown>;
|
|
72
|
+
export declare function isCanvas(canvas: HTMLCanvasElement): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* 生成一个位于 min 和 max 之间的随机数
|
|
75
|
+
* @param min
|
|
76
|
+
* @param max
|
|
77
|
+
* @returns
|
|
64
78
|
*/
|
|
65
|
-
export declare function
|
|
66
|
-
export declare function deepClone(obj: any): any;
|
|
67
|
-
export declare function random(min: number, max: number): number;
|
|
79
|
+
export declare function randomInRange(min: number, max: number): number;
|
|
68
80
|
export declare function throwDestroyedError(): void;
|
|
69
81
|
export declare function generateGUID(): string;
|
|
82
|
+
export declare function base64ToFile(base64: string, filename?: string, contentType?: string): File;
|
|
83
|
+
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
|
-
import {
|
|
4
|
-
import type { Component } from './components
|
|
5
|
-
import { ItemBehaviour } from './components/component';
|
|
3
|
+
import type { VFXItemData } from './asset-loader';
|
|
4
|
+
import type { Component, RendererComponent, ItemBehaviour } from './components';
|
|
6
5
|
import type { Composition } from './composition';
|
|
7
|
-
import { type VFXItemData } from './asset-loader';
|
|
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
|
*/
|
|
@@ -65,10 +58,6 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
|
|
|
65
58
|
* 元素是否可用
|
|
66
59
|
*/
|
|
67
60
|
ended: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* 元素在合成中的索引
|
|
70
|
-
*/
|
|
71
|
-
listIndex: number;
|
|
72
61
|
/**
|
|
73
62
|
* 元素名称
|
|
74
63
|
*/
|
|
@@ -81,16 +70,9 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
|
|
|
81
70
|
/**
|
|
82
71
|
* 元素创建的数据图层/粒子/模型等
|
|
83
72
|
*/
|
|
84
|
-
_content?:
|
|
85
|
-
|
|
86
|
-
* 元素动画是否延迟播放
|
|
87
|
-
*/
|
|
88
|
-
delaying: boolean;
|
|
89
|
-
/**
|
|
90
|
-
* 元素动画的速度
|
|
91
|
-
*/
|
|
73
|
+
_content?: VFXItemContent;
|
|
74
|
+
reusable: boolean;
|
|
92
75
|
type: spec.ItemType;
|
|
93
|
-
stopped: boolean;
|
|
94
76
|
props: VFXItemProps;
|
|
95
77
|
components: Component[];
|
|
96
78
|
itemBehaviours: ItemBehaviour[];
|
|
@@ -101,31 +83,31 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
|
|
|
101
83
|
*/
|
|
102
84
|
protected visible: boolean;
|
|
103
85
|
/**
|
|
104
|
-
*
|
|
105
|
-
* @protected
|
|
86
|
+
* 元素动画的速度
|
|
106
87
|
*/
|
|
107
|
-
protected _contentVisible: boolean;
|
|
108
88
|
private speed;
|
|
109
|
-
|
|
110
|
-
static
|
|
111
|
-
static
|
|
112
|
-
static
|
|
113
|
-
static
|
|
114
|
-
static
|
|
115
|
-
static
|
|
89
|
+
private listIndex;
|
|
90
|
+
static isComposition(item: VFXItem): boolean;
|
|
91
|
+
static isSprite(item: VFXItem): boolean;
|
|
92
|
+
static isParticle(item: VFXItem): boolean;
|
|
93
|
+
static isNull(item: VFXItem): boolean;
|
|
94
|
+
static isTree(item: VFXItem): boolean;
|
|
95
|
+
static isCamera(item: VFXItem): boolean;
|
|
96
|
+
static isExtraCamera(item: VFXItem): boolean;
|
|
116
97
|
constructor(engine: Engine, props?: VFXItemProps);
|
|
117
98
|
/**
|
|
118
99
|
* 返回元素创建的数据
|
|
119
100
|
*/
|
|
120
|
-
get content():
|
|
101
|
+
get content(): VFXItemContent;
|
|
121
102
|
/**
|
|
122
103
|
* 播放完成后是否需要再使用,是的话生命周期结束后不会 dispose
|
|
123
104
|
*/
|
|
124
|
-
get
|
|
105
|
+
get compositionReusable(): boolean;
|
|
125
106
|
/**
|
|
126
|
-
*
|
|
107
|
+
* 元素在合成中的索引
|
|
127
108
|
*/
|
|
128
|
-
get
|
|
109
|
+
get renderOrder(): number;
|
|
110
|
+
set renderOrder(value: number);
|
|
129
111
|
/**
|
|
130
112
|
* 设置元素的动画速度
|
|
131
113
|
* @param speed - 速度
|
|
@@ -140,24 +122,20 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
|
|
|
140
122
|
* 添加组件
|
|
141
123
|
* @param classConstructor - 要添加的组件类型
|
|
142
124
|
*/
|
|
143
|
-
addComponent<T extends Component>(classConstructor:
|
|
125
|
+
addComponent<T extends Component>(classConstructor: Constructor<T>): T;
|
|
144
126
|
/**
|
|
145
127
|
* 获取某一类型的组件。如果当前元素绑定了多个同类型的组件只返回第一个
|
|
146
128
|
* @param classConstructor - 要获取的组件类型
|
|
147
129
|
* @returns 查询结果中符合类型的第一个组件
|
|
148
130
|
*/
|
|
149
|
-
getComponent<T extends Component>(classConstructor:
|
|
131
|
+
getComponent<T extends Component>(classConstructor: Constructor<T>): T;
|
|
150
132
|
/**
|
|
151
133
|
* 获取某一类型的所有组件
|
|
152
134
|
* @param classConstructor - 要获取的组件
|
|
153
135
|
* @returns 一个组件列表,包含所有符合类型的组件
|
|
154
136
|
*/
|
|
155
|
-
getComponents<T extends Component>(classConstructor:
|
|
156
|
-
setParent(vfxItem: VFXItem
|
|
157
|
-
/**
|
|
158
|
-
* 停止播放元素动画
|
|
159
|
-
*/
|
|
160
|
-
stop(): void;
|
|
137
|
+
getComponents<T extends Component>(classConstructor: Constructor<T>): T[];
|
|
138
|
+
setParent(vfxItem: VFXItem): void;
|
|
161
139
|
/**
|
|
162
140
|
* 元素动画结束播放时回调函数
|
|
163
141
|
* @override
|
|
@@ -210,7 +188,12 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
|
|
|
210
188
|
*/
|
|
211
189
|
scale(x: number, y: number, z: number): void;
|
|
212
190
|
/**
|
|
213
|
-
*
|
|
191
|
+
* 设置元素在画布上的像素位置
|
|
192
|
+
* Tips:
|
|
193
|
+
* - 坐标原点在 canvas 左上角,x 正方向水平向右, y 正方向垂直向下
|
|
194
|
+
* - 设置后会覆盖原有的位置信息
|
|
195
|
+
* @param x - x 坐标
|
|
196
|
+
* @param y - y 坐标
|
|
214
197
|
*/
|
|
215
198
|
setPositionByPixel(x: number, y: number): void;
|
|
216
199
|
/**
|
|
@@ -246,7 +229,7 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
|
|
|
246
229
|
* @returns
|
|
247
230
|
*/
|
|
248
231
|
isEnded(now: number): boolean;
|
|
249
|
-
find(name: string): VFXItem
|
|
232
|
+
find(name: string): VFXItem | undefined;
|
|
250
233
|
fromData(data: VFXItemData): void;
|
|
251
234
|
toData(): void;
|
|
252
235
|
translateByPixel(x: number, y: number): void;
|
|
@@ -258,7 +241,6 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
|
|
|
258
241
|
}
|
|
259
242
|
export declare namespace Item {
|
|
260
243
|
function is<T extends spec.Item>(item: spec.Item, type: spec.ItemType): item is T;
|
|
261
|
-
function isFilter(item: spec.Item): item is spec.FilterItem;
|
|
262
244
|
function isComposition(item: spec.Item): item is spec.CompositionItem;
|
|
263
245
|
function isParticle(item: spec.Item): item is spec.ParticleItem;
|
|
264
246
|
function isNull(item: spec.Item): item is spec.NullItem;
|
|
@@ -268,4 +250,4 @@ export declare namespace Item {
|
|
|
268
250
|
* @param props
|
|
269
251
|
* @param composition
|
|
270
252
|
*/
|
|
271
|
-
export declare function createVFXItem(props: VFXItemProps, composition: Composition): VFXItem
|
|
253
|
+
export declare function createVFXItem(props: VFXItemProps, composition: Composition): VFXItem;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/effects-core",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.20",
|
|
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,15 @@
|
|
|
42
42
|
"registry": "https://registry.npmjs.org"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@galacean/effects-specification": "
|
|
46
|
-
"@galacean/effects-math": "1.0
|
|
45
|
+
"@galacean/effects-specification": "2.0.0-alpha.19",
|
|
46
|
+
"@galacean/effects-math": "1.1.0",
|
|
47
47
|
"uuid": "9.0.1"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"prebuild": "pnpm clean",
|
|
51
51
|
"build": "pnpm build:declaration && pnpm build:module",
|
|
52
52
|
"build:module": "rollup -c",
|
|
53
|
-
"build:declaration": "tsc -d --
|
|
54
|
-
"clean": "rimraf dist && rimraf
|
|
53
|
+
"build:declaration": "tsc -d --emitDeclarationOnly",
|
|
54
|
+
"clean": "rimraf dist && rimraf \"*+(.tsbuildinfo)\""
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { VFXItem, VFXItemContent } from '../../vfx-item';
|
|
2
|
-
import { Playable, PlayableOutput } from './playable-graph';
|
|
3
|
-
/**
|
|
4
|
-
* @since 2.0.0
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export declare class Track {
|
|
8
|
-
id: string;
|
|
9
|
-
name: string;
|
|
10
|
-
bindingItem: VFXItem<VFXItemContent>;
|
|
11
|
-
private clips;
|
|
12
|
-
private clipSeed;
|
|
13
|
-
constructor();
|
|
14
|
-
createOutput(): PlayableOutput;
|
|
15
|
-
/**
|
|
16
|
-
* 重写该方法以创建自定义混合器
|
|
17
|
-
*/
|
|
18
|
-
createMixerPlayable(): Playable;
|
|
19
|
-
createPlayebleTree(): Playable;
|
|
20
|
-
createClip<T extends Playable>(classConstructor: new () => T, name?: string): TimelineClip;
|
|
21
|
-
getClips(): TimelineClip[];
|
|
22
|
-
findClip(name: string): TimelineClip | undefined;
|
|
23
|
-
private addClip;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @since 2.0.0
|
|
27
|
-
* @internal
|
|
28
|
-
*/
|
|
29
|
-
export declare class TimelineClip {
|
|
30
|
-
id: string;
|
|
31
|
-
name: string;
|
|
32
|
-
start: number;
|
|
33
|
-
duration: number;
|
|
34
|
-
playable: Playable;
|
|
35
|
-
}
|
package/dist/semantic-map.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { UniformValue } from './material';
|
|
2
|
-
import type { RenderingData } from './render';
|
|
3
|
-
import type { Disposable } from './utils';
|
|
4
|
-
export type SemanticFunc = (state: RenderingData) => UniformValue | undefined;
|
|
5
|
-
export type SemanticGetter = UniformValue | SemanticFunc;
|
|
6
|
-
export declare class SemanticMap implements Disposable {
|
|
7
|
-
readonly semantics: Record<string, SemanticGetter>;
|
|
8
|
-
constructor(semantics?: Record<string, SemanticGetter>);
|
|
9
|
-
toObject(): Record<string, SemanticGetter>;
|
|
10
|
-
setSemantic(name: string, value?: SemanticGetter): void;
|
|
11
|
-
getSemanticValue(name: string, state: RenderingData): number | Float32Array | Int32Array | Float64Array | Uint8Array | Uint32Array | Uint16Array | Int8Array | Int16Array | number[] | number[][] | import("@galacean/effects-math/es/core").Vector3 | import("./texture").Texture | import("@galacean/effects-math/es/core").Vector2 | import("@galacean/effects-math/es/core").Vector4 | import("@galacean/effects-math/es/core").Matrix3 | import("@galacean/effects-math/es/core").Matrix4 | import("./texture").Texture[] | import("./material").UniformStruct | import("./material").UniformStruct[] | SemanticFunc | undefined;
|
|
12
|
-
hasSemanticValue(name: string): boolean;
|
|
13
|
-
dispose(): void;
|
|
14
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { TemplateContentV1, TemplateContentV2 } from '@galacean/effects-specification';
|
|
2
|
-
export * from './qcanvas-viewer';
|
|
3
|
-
export * from './qtext';
|
|
4
|
-
export * from './template-v1';
|
|
5
|
-
export declare const DEFAULT_FONTS: string[];
|
|
6
|
-
export interface TextLayout {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
}
|
|
12
|
-
export interface TemplateOptions {
|
|
13
|
-
templateScale?: number;
|
|
14
|
-
canvas?: HTMLCanvasElement;
|
|
15
|
-
textLayouts?: TextLayout[];
|
|
16
|
-
debug?: boolean;
|
|
17
|
-
borderColor?: string;
|
|
18
|
-
borderWidth?: number;
|
|
19
|
-
flipY?: boolean;
|
|
20
|
-
scaleX?: number;
|
|
21
|
-
scaleY?: number;
|
|
22
|
-
toData?: boolean;
|
|
23
|
-
}
|
|
24
|
-
declare class CanvasPool {
|
|
25
|
-
readonly elements: HTMLCanvasElement[];
|
|
26
|
-
constructor();
|
|
27
|
-
dispose(): void;
|
|
28
|
-
getCanvas(): HTMLCanvasElement;
|
|
29
|
-
saveCanvas(cvs: HTMLCanvasElement): void;
|
|
30
|
-
}
|
|
31
|
-
export declare const canvasPool: CanvasPool;
|
|
32
|
-
export declare function getDefaultTemplateCanvasPool(): CanvasPool;
|
|
33
|
-
export declare function getBackgroundImage(template: TemplateContentV2, variables?: Record<string, number | string | string[]>): string | number | string[] | undefined;
|
|
34
|
-
/**
|
|
35
|
-
* @param {string|HTMLImageElement} url
|
|
36
|
-
* @param {TemplateContentV2} [template]
|
|
37
|
-
* @param {Record<string, number | string>} [variables]
|
|
38
|
-
* @param {TemplateOptions} [opts]
|
|
39
|
-
* @param {boolean} [flipY]
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
|
-
export declare function combineImageTemplate2(url: string | HTMLImageElement, template?: TemplateContentV2, variables?: Record<string, number | string>, opts?: TemplateOptions, flipY?: boolean): Promise<HTMLCanvasElement>;
|
|
43
|
-
/**
|
|
44
|
-
* @internal
|
|
45
|
-
* @deprecated since 2.0.0 - use `combineImageTemplate2` instead
|
|
46
|
-
*/
|
|
47
|
-
export declare function combineImageTemplate2Async(url: string | HTMLImageElement, template?: TemplateContentV2, variables?: Record<string, number | string>, opts?: TemplateOptions, flipY?: boolean): Promise<HTMLCanvasElement | ImageData>;
|
|
48
|
-
/**
|
|
49
|
-
* @param url
|
|
50
|
-
* @param template
|
|
51
|
-
* @param variables
|
|
52
|
-
* @param opts
|
|
53
|
-
* @param flipY
|
|
54
|
-
* @returns
|
|
55
|
-
*/
|
|
56
|
-
export declare function combineImageTemplate(url: string | HTMLImageElement, template: TemplateContentV1 | TemplateContentV2, variables: Record<string, number | string>, opts?: {
|
|
57
|
-
templateScale?: number;
|
|
58
|
-
canvas?: HTMLCanvasElement;
|
|
59
|
-
}, flipY?: boolean): Promise<HTMLCanvasElement>;
|
|
60
|
-
/**
|
|
61
|
-
* @internal
|
|
62
|
-
* @deprecated since 2.0.0 - use `combineImageTemplate` instead
|
|
63
|
-
*/
|
|
64
|
-
export declare function combineImageTemplateAsync(url: string | HTMLImageElement, template: TemplateContentV1 | TemplateContentV2, variables: Record<string, number | string>, opts?: {
|
|
65
|
-
templateScale?: number;
|
|
66
|
-
canvas?: HTMLCanvasElement;
|
|
67
|
-
}, flipY?: boolean): Promise<HTMLCanvasElement | HTMLImageElement | ImageData>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { QText } from './qtext';
|
|
2
|
-
declare class QCanvasViewer {
|
|
3
|
-
width: number;
|
|
4
|
-
height: number;
|
|
5
|
-
background: HTMLImageElement;
|
|
6
|
-
scaleX: number;
|
|
7
|
-
scaleY: number;
|
|
8
|
-
renderCanvas: HTMLCanvasElement;
|
|
9
|
-
renderContext: CanvasRenderingContext2D;
|
|
10
|
-
textList: QText[];
|
|
11
|
-
devicePixelRatio: number;
|
|
12
|
-
flipY: boolean;
|
|
13
|
-
constructor(canvas: string | HTMLCanvasElement, width: number, height: number, scaleX?: number, scaleY?: number, flipY?: boolean);
|
|
14
|
-
initDimension(width: number, height: number, scaleX?: number, scaleY?: number): void;
|
|
15
|
-
clearText(): void;
|
|
16
|
-
clearCanvasWithContext(ctx: CanvasRenderingContext2D): void;
|
|
17
|
-
clearCanvas(): void;
|
|
18
|
-
addObject(text: QText): void;
|
|
19
|
-
render(): void;
|
|
20
|
-
}
|
|
21
|
-
export { QCanvasViewer };
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type { QCanvasViewer } from './qcanvas-viewer';
|
|
2
|
-
import type { IFontMetrics } from './text-metrics';
|
|
3
|
-
declare enum QTextWrapMode {
|
|
4
|
-
Default = 0,
|
|
5
|
-
Clip = 1,
|
|
6
|
-
Ellipsis = 2
|
|
7
|
-
}
|
|
8
|
-
interface QTextOptions {
|
|
9
|
-
left?: number;
|
|
10
|
-
top?: number;
|
|
11
|
-
maxWidth?: number;
|
|
12
|
-
fontFamily?: string;
|
|
13
|
-
fontSize?: number;
|
|
14
|
-
fontWeight?: string;
|
|
15
|
-
align?: string;
|
|
16
|
-
verticalAlign?: string;
|
|
17
|
-
padding?: number;
|
|
18
|
-
letterSpacing?: number;
|
|
19
|
-
wrap?: QTextWrapMode;
|
|
20
|
-
color?: string;
|
|
21
|
-
fontStyle?: string;
|
|
22
|
-
angle?: number;
|
|
23
|
-
name?: string;
|
|
24
|
-
}
|
|
25
|
-
interface QChar {
|
|
26
|
-
left: number;
|
|
27
|
-
top: number;
|
|
28
|
-
char: string;
|
|
29
|
-
width: number;
|
|
30
|
-
heigh: number;
|
|
31
|
-
font: string;
|
|
32
|
-
fontSize: number;
|
|
33
|
-
isEllipsis: boolean;
|
|
34
|
-
scale: number;
|
|
35
|
-
index: number;
|
|
36
|
-
}
|
|
37
|
-
declare class QText {
|
|
38
|
-
left: number;
|
|
39
|
-
top: number;
|
|
40
|
-
width?: number;
|
|
41
|
-
height?: number;
|
|
42
|
-
text: string;
|
|
43
|
-
name: string;
|
|
44
|
-
fontSize: number;
|
|
45
|
-
fontFamily: string;
|
|
46
|
-
color: string;
|
|
47
|
-
letterSpacing: number;
|
|
48
|
-
maxLineWidth: number;
|
|
49
|
-
wrap: QTextWrapMode;
|
|
50
|
-
fontStyle: 'normal' | 'italic' | 'oblique' | 'initial' | 'inherit';
|
|
51
|
-
textAlign: 'center' | 'end' | 'left' | 'right' | 'start';
|
|
52
|
-
textBaseline: 'alphabetic' | 'bottom' | 'hanging' | 'ideographic' | 'middle' | 'top';
|
|
53
|
-
scaleX: number;
|
|
54
|
-
scaleY: number;
|
|
55
|
-
angle: number;
|
|
56
|
-
active: boolean;
|
|
57
|
-
padding: number;
|
|
58
|
-
fontWeight: string;
|
|
59
|
-
chars: QChar[];
|
|
60
|
-
borderColor: string;
|
|
61
|
-
borderWidth: number;
|
|
62
|
-
fontProperties: IFontMetrics;
|
|
63
|
-
fontVariant: string;
|
|
64
|
-
private viewer;
|
|
65
|
-
private originX;
|
|
66
|
-
private originY;
|
|
67
|
-
private ellipsis;
|
|
68
|
-
constructor(text: string, options: QTextOptions);
|
|
69
|
-
update(): void;
|
|
70
|
-
render(): void;
|
|
71
|
-
init(viewer: QCanvasViewer): void;
|
|
72
|
-
getLayout(): {
|
|
73
|
-
x: number;
|
|
74
|
-
y: number;
|
|
75
|
-
width: number;
|
|
76
|
-
height: number;
|
|
77
|
-
};
|
|
78
|
-
private updateDimension;
|
|
79
|
-
private configTextStyle;
|
|
80
|
-
private getFontDesc;
|
|
81
|
-
private configTextLayout;
|
|
82
|
-
private setRenderTransform;
|
|
83
|
-
private renderText;
|
|
84
|
-
private drawCharsInTextBox;
|
|
85
|
-
private addEllipsisToChars;
|
|
86
|
-
private createCharsFromText;
|
|
87
|
-
private addOffsetToChars;
|
|
88
|
-
private clipCharsWithTextBox;
|
|
89
|
-
private cloneChars;
|
|
90
|
-
private replaceCharWithEllipsis;
|
|
91
|
-
private findEllipsisPositionAndReplaceCharsFromLeft;
|
|
92
|
-
private findEllipsisPositionAndReplaceCharsFromRight;
|
|
93
|
-
private drawCharsFromLeft;
|
|
94
|
-
private drawBorders;
|
|
95
|
-
}
|
|
96
|
-
export { QText, QTextOptions, QTextWrapMode };
|