@galacean/effects-core 2.1.0-alpha.6 → 2.1.0-alpha.8
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/animation/color-playable.d.ts +26 -0
- package/dist/animation/index.d.ts +1 -0
- package/dist/asset-manager.d.ts +8 -1
- package/dist/asset.d.ts +4 -0
- package/dist/comp-vfx-item.d.ts +2 -5
- package/dist/components/base-render-component.d.ts +99 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/post-process-volume.d.ts +2 -3
- package/dist/components/shape-component.d.ts +40 -6
- package/dist/composition/scene-ticking.d.ts +1 -1
- package/dist/composition-source-manager.d.ts +4 -5
- package/dist/composition.d.ts +7 -8
- package/dist/downloader.d.ts +0 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.js +19192 -18276
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19187 -18275
- package/dist/index.mjs.map +1 -1
- package/dist/math/index.d.ts +1 -1
- package/dist/math/translate.d.ts +1 -1
- package/dist/math/value-getters/color-curve.d.ts +12 -0
- package/dist/math/value-getters/index.d.ts +4 -0
- package/dist/math/value-getters/value-getter-map.d.ts +2 -0
- package/dist/math/{value-getter.d.ts → value-getters/value-getter.d.ts} +3 -4
- package/dist/math/value-getters/vector4-curve.d.ts +12 -0
- package/dist/plugin-system.d.ts +7 -5
- package/dist/plugins/cal/calculate-item.d.ts +5 -3
- package/dist/plugins/cal/calculate-loader.d.ts +1 -1
- package/dist/plugins/cal/calculate-vfx-item.d.ts +1 -1
- package/dist/plugins/cal/playable-graph.d.ts +1 -1
- package/dist/plugins/camera/camera-vfx-item-loader.d.ts +1 -1
- package/dist/plugins/index.d.ts +1 -7
- package/dist/plugins/interact/interact-item.d.ts +11 -0
- package/dist/plugins/interact/interact-loader.d.ts +1 -1
- package/dist/plugins/particle/particle-system.d.ts +1 -2
- package/dist/plugins/plugin.d.ts +14 -3
- package/dist/plugins/shape/ellipse.d.ts +79 -0
- package/dist/plugins/shape/graphics-path.d.ts +28 -0
- package/dist/plugins/shape/point-like.d.ts +31 -0
- package/dist/plugins/shape/point.d.ts +58 -0
- package/dist/plugins/shape/polygon.d.ts +12 -5
- package/dist/plugins/shape/rectangle.d.ts +129 -0
- package/dist/plugins/shape/shape-path.d.ts +25 -3
- package/dist/plugins/shape/shape-primitive.d.ts +18 -0
- package/dist/plugins/shape/triangle.d.ts +89 -0
- package/dist/plugins/sprite/sprite-item.d.ts +17 -111
- package/dist/plugins/sprite/sprite-loader.d.ts +1 -1
- package/dist/plugins/sprite/sprite-mesh.d.ts +3 -4
- package/dist/plugins/text/text-item.d.ts +15 -5
- package/dist/plugins/timeline/index.d.ts +3 -0
- package/dist/plugins/timeline/playable-assets/color-property-playable-asset.d.ts +7 -0
- package/dist/plugins/timeline/playable-assets/float-property-playable-asset.d.ts +7 -0
- package/dist/plugins/timeline/playable-assets/index.d.ts +3 -0
- package/dist/plugins/{cal → timeline/playable-assets}/timeline-asset.d.ts +7 -4
- package/dist/plugins/timeline/playable-assets/vector4-property-playable-asset.d.ts +7 -0
- package/dist/plugins/timeline/playables/color-property-mixer-playable.d.ts +6 -0
- package/dist/plugins/timeline/playables/float-property-mixer-playable.d.ts +6 -0
- package/dist/plugins/timeline/playables/index.d.ts +7 -0
- package/dist/plugins/timeline/playables/property-clip-playable.d.ts +8 -0
- package/dist/plugins/timeline/playables/vector4-property-mixer-playable.d.ts +6 -0
- package/dist/plugins/timeline/track-instance.d.ts +14 -0
- package/dist/plugins/timeline/track.d.ts +4 -2
- package/dist/plugins/timeline/tracks/color-property-track.d.ts +5 -0
- package/dist/plugins/timeline/tracks/float-property-track.d.ts +6 -0
- package/dist/plugins/timeline/tracks/index.d.ts +9 -0
- package/dist/plugins/timeline/tracks/material-track.d.ts +5 -0
- package/dist/plugins/timeline/tracks/property-track.d.ts +8 -0
- package/dist/plugins/timeline/tracks/sub-composition-track.d.ts +1 -1
- package/dist/plugins/timeline/tracks/vector4-property-track.d.ts +5 -0
- package/dist/render/index.d.ts +0 -1
- package/dist/render/mesh.d.ts +1 -1
- package/dist/render/render-frame.d.ts +5 -1
- package/dist/render/renderer.d.ts +1 -1
- package/dist/render/semantic-map.d.ts +1 -1
- package/dist/serialization-helper.d.ts +3 -3
- package/dist/texture/texture.d.ts +9 -0
- package/dist/utils/color.d.ts +4 -5
- package/dist/utils/index.d.ts +1 -1
- package/dist/vfx-item.d.ts +0 -9
- package/package.json +2 -2
- package/dist/image-asset.d.ts +0 -5
- package/dist/render/global-volume.d.ts +0 -17
- /package/dist/plugins/timeline/{playables → playable-assets}/sub-composition-playable-asset.d.ts +0 -0
package/dist/math/index.d.ts
CHANGED
package/dist/math/translate.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Vector3 } from '@galacean/effects-math/es/core/vector3';
|
|
2
2
|
import type { ItemLinearVelOverLifetime } from '../plugins';
|
|
3
|
-
import type { ValueGetter } from './value-
|
|
3
|
+
import type { ValueGetter } from './value-getters';
|
|
4
4
|
export declare function translatePoint(x: number, y: number): number[];
|
|
5
5
|
export interface TranslateTarget {
|
|
6
6
|
speedOverLifetime?: ValueGetter<number>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Color } from '@galacean/effects-math/es/core/color';
|
|
2
|
+
import { ValueGetter } from './value-getter';
|
|
3
|
+
import type * as spec from '@galacean/effects-specification';
|
|
4
|
+
export declare class ColorCurve extends ValueGetter<Color> {
|
|
5
|
+
private value;
|
|
6
|
+
private rCurve;
|
|
7
|
+
private gCurve;
|
|
8
|
+
private bCurve;
|
|
9
|
+
private aCurve;
|
|
10
|
+
onCreate(arg: spec.ColorCurveData): void;
|
|
11
|
+
getValue(t: number): Color;
|
|
12
|
+
}
|
|
@@ -2,9 +2,9 @@ import type { Vector2 } from '@galacean/effects-math/es/core/vector2';
|
|
|
2
2
|
import { Vector3 } from '@galacean/effects-math/es/core/vector3';
|
|
3
3
|
import { Quaternion } from '@galacean/effects-math/es/core/quaternion';
|
|
4
4
|
import * as spec from '@galacean/effects-specification';
|
|
5
|
-
import type { ColorStop } from '
|
|
6
|
-
import type { BezierEasing } from '
|
|
7
|
-
import { BezierPath, BezierQuat } from '
|
|
5
|
+
import type { ColorStop } from '../../utils';
|
|
6
|
+
import type { BezierEasing } from '../bezier';
|
|
7
|
+
import { BezierPath, BezierQuat } from '../bezier';
|
|
8
8
|
interface KeyFrameMeta {
|
|
9
9
|
curves: ValueGetter<any>[];
|
|
10
10
|
index: number;
|
|
@@ -145,7 +145,6 @@ export declare class BezierCurveQuat extends ValueGetter<Quaternion> {
|
|
|
145
145
|
getPercValue(curveKey: string, time: number): number;
|
|
146
146
|
getMaxTime(): number;
|
|
147
147
|
}
|
|
148
|
-
export declare function createValueGetter(args: any): ValueGetter<any>;
|
|
149
148
|
export declare function getKeyFrameMetaByRawValue(meta: KeyFrameMeta, value?: [type: spec.ValueType, value: any]): void;
|
|
150
149
|
export declare function createKeyFrameMeta(): {
|
|
151
150
|
curves: never[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Vector4 } from '@galacean/effects-math/es/core/vector4';
|
|
2
|
+
import { ValueGetter } from './value-getter';
|
|
3
|
+
import type * as spec from '@galacean/effects-specification';
|
|
4
|
+
export declare class Vector4Curve extends ValueGetter<Vector4> {
|
|
5
|
+
private value;
|
|
6
|
+
private xCurve;
|
|
7
|
+
private yCurve;
|
|
8
|
+
private zCurve;
|
|
9
|
+
private wCurve;
|
|
10
|
+
onCreate(arg: spec.Vector4CurveData): void;
|
|
11
|
+
getValue(t: number): Vector4;
|
|
12
|
+
}
|
package/dist/plugin-system.d.ts
CHANGED
|
@@ -3,8 +3,7 @@ import type { Composition } from './composition';
|
|
|
3
3
|
import type { Plugin, PluginConstructor } from './plugins';
|
|
4
4
|
import type { RenderFrame, Renderer } from './render';
|
|
5
5
|
import type { Scene, SceneLoadOptions } from './scene';
|
|
6
|
-
import type { VFXItemConstructor
|
|
7
|
-
import { VFXItem } from './vfx-item';
|
|
6
|
+
import type { VFXItemConstructor } from './vfx-item';
|
|
8
7
|
export declare const pluginLoaderMap: Record<string, PluginConstructor>;
|
|
9
8
|
export declare const defaultPlugins: string[];
|
|
10
9
|
export type PrecompileOptions = {
|
|
@@ -25,9 +24,12 @@ export declare class PluginSystem {
|
|
|
25
24
|
initializeComposition(composition: Composition, scene: Scene): void;
|
|
26
25
|
destroyComposition(comp: Composition): void;
|
|
27
26
|
resetComposition(comp: Composition, renderFrame: RenderFrame): void;
|
|
28
|
-
createPluginItem(name: string, props: VFXItemProps, composition: Composition): VFXItem;
|
|
29
27
|
processRawJSON(json: spec.JSONScene, options: SceneLoadOptions): Promise<void[]>;
|
|
28
|
+
processAssets(json: spec.JSONScene, options?: SceneLoadOptions): Promise<{
|
|
29
|
+
assets: spec.AssetBase[];
|
|
30
|
+
loadedAssets: unknown[];
|
|
31
|
+
}[]>;
|
|
32
|
+
precompile(compositions: spec.CompositionData[], renderer: Renderer, options?: PrecompileOptions): Promise<unknown[]>;
|
|
33
|
+
loadResources(scene: Scene, options: SceneLoadOptions): Promise<unknown[]>;
|
|
30
34
|
private callStatic;
|
|
31
|
-
precompile(compositions: spec.CompositionData[], renderer: Renderer, options?: PrecompileOptions): Promise<void[]>;
|
|
32
|
-
loadResources(scene: Scene, options: SceneLoadOptions): Promise<void[]>;
|
|
33
35
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { Euler
|
|
1
|
+
import type { Euler } from '@galacean/effects-math/es/core/euler';
|
|
2
|
+
import type { Vector3 } from '@galacean/effects-math/es/core/vector3';
|
|
2
3
|
import type { ValueGetter } from '../../math';
|
|
3
|
-
import { TrackAsset } from '../timeline
|
|
4
|
-
import type { TimelineAsset } from '
|
|
4
|
+
import { TrackAsset } from '../timeline';
|
|
5
|
+
import type { TimelineAsset } from '../timeline';
|
|
5
6
|
/**
|
|
6
7
|
* 基础位移属性数据
|
|
7
8
|
*/
|
|
@@ -22,5 +23,6 @@ export type ItemLinearVelOverLifetime = {
|
|
|
22
23
|
* @since 2.0.0
|
|
23
24
|
*/
|
|
24
25
|
export declare class ObjectBindingTrack extends TrackAsset {
|
|
26
|
+
updateAnimatedObject(): void;
|
|
25
27
|
create(timelineAsset: TimelineAsset): void;
|
|
26
28
|
}
|
|
@@ -42,7 +42,7 @@ export declare class TransformAnimationPlayable extends AnimationPlayable {
|
|
|
42
42
|
startSpeed: number;
|
|
43
43
|
data: TransformPlayableAssetData;
|
|
44
44
|
private velocity;
|
|
45
|
-
private
|
|
45
|
+
private boundObject;
|
|
46
46
|
start(): void;
|
|
47
47
|
processFrame(context: FrameContext): void;
|
|
48
48
|
/**
|
|
@@ -81,7 +81,7 @@ export declare class PlayableOutput {
|
|
|
81
81
|
protected time: number;
|
|
82
82
|
private sourceOutputPort;
|
|
83
83
|
constructor();
|
|
84
|
-
|
|
84
|
+
setSourcePlayable(playable: Playable, port?: number): void;
|
|
85
85
|
getSourceOutputPort(): number;
|
|
86
86
|
setUserData(value: object): void;
|
|
87
87
|
getUserData(): object;
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -18,11 +18,5 @@ export * from './particle/particle-system-renderer';
|
|
|
18
18
|
export * from './cal/calculate-loader';
|
|
19
19
|
export * from './cal/calculate-vfx-item';
|
|
20
20
|
export * from './cal/calculate-item';
|
|
21
|
-
export * from './timeline
|
|
22
|
-
export * from './timeline/tracks/transform-track';
|
|
23
|
-
export * from './timeline/tracks/activation-track';
|
|
24
|
-
export * from './timeline/tracks/sprite-color-track';
|
|
25
|
-
export * from './timeline/tracks/sub-composition-track';
|
|
26
|
-
export * from './timeline/playables/sub-composition-playable-asset';
|
|
27
|
-
export * from './cal/timeline-asset';
|
|
21
|
+
export * from './timeline';
|
|
28
22
|
export * from './text';
|
|
@@ -22,11 +22,22 @@ export declare class InteractComponent extends RendererComponent {
|
|
|
22
22
|
* 拖拽的距离映射系数,越大越容易拖动
|
|
23
23
|
*/
|
|
24
24
|
dragRatio: number[];
|
|
25
|
+
/**
|
|
26
|
+
* 拖拽X范围
|
|
27
|
+
*/
|
|
28
|
+
dragRange: {
|
|
29
|
+
dxRange: [min: number, max: number];
|
|
30
|
+
dyRange: [min: number, max: number];
|
|
31
|
+
};
|
|
25
32
|
/** 是否响应点击和拖拽交互事件 */
|
|
26
33
|
private _interactive;
|
|
27
34
|
private hasBeenAddedToComposition;
|
|
28
35
|
set interactive(enable: boolean);
|
|
29
36
|
get interactive(): boolean;
|
|
37
|
+
getDragRangeX(): [min: number, max: number];
|
|
38
|
+
setDragRangeX(min: number, max: number): void;
|
|
39
|
+
getDragRangeY(): [min: number, max: number];
|
|
40
|
+
setDragRangeY(min: number, max: number): void;
|
|
30
41
|
onStart(): void;
|
|
31
42
|
onUpdate(dt: number): void;
|
|
32
43
|
render(renderer: Renderer): void;
|
|
@@ -9,7 +9,6 @@ import type { Mesh } from '../../render';
|
|
|
9
9
|
import type { ShapeGenerator, ShapeParticle } from '../../shape';
|
|
10
10
|
import { Texture } from '../../texture';
|
|
11
11
|
import { Transform } from '../../transform';
|
|
12
|
-
import { type color } from '../../utils';
|
|
13
12
|
import type { BoundingBoxSphere, HitTestCustomParams } from '../interact/click-handler';
|
|
14
13
|
import { Burst } from './burst';
|
|
15
14
|
import type { Point } from './particle-mesh';
|
|
@@ -24,7 +23,7 @@ type ParticleOptions = {
|
|
|
24
23
|
startSpeed: ValueGetter<number>;
|
|
25
24
|
startLifetime: ValueGetter<number>;
|
|
26
25
|
startDelay: ValueGetter<number>;
|
|
27
|
-
startColor: ValueGetter<
|
|
26
|
+
startColor: ValueGetter<spec.RGBAColorValue>;
|
|
28
27
|
start3DRotation?: boolean;
|
|
29
28
|
startRotationX?: ValueGetter<number>;
|
|
30
29
|
startRotationY?: ValueGetter<number>;
|
package/dist/plugins/plugin.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { Composition } from '../composition';
|
|
|
6
6
|
export interface Plugin {
|
|
7
7
|
/**
|
|
8
8
|
* plugin 的数组内排序,按照升序排列
|
|
9
|
-
*
|
|
9
|
+
* @default 100
|
|
10
10
|
*/
|
|
11
11
|
order: number;
|
|
12
12
|
name: string;
|
|
@@ -88,7 +88,7 @@ export declare abstract class AbstractPlugin implements Plugin {
|
|
|
88
88
|
order: number;
|
|
89
89
|
name: string;
|
|
90
90
|
/***
|
|
91
|
-
*
|
|
91
|
+
* loadScene 函数调用的时候会触发此函数,
|
|
92
92
|
* 此阶段可以对资源 JSON 进行处理,替换调 JSON 中的数据,或者直接终止加载流程
|
|
93
93
|
* 一旦被 reject,加载过程将失败
|
|
94
94
|
* @param json 动画资源
|
|
@@ -96,7 +96,18 @@ export declare abstract class AbstractPlugin implements Plugin {
|
|
|
96
96
|
*/
|
|
97
97
|
static processRawJSON: (json: spec.JSONScene, options: SceneLoadOptions) => Promise<void>;
|
|
98
98
|
/**
|
|
99
|
-
*
|
|
99
|
+
* loadScene 函数调用的时候会触发此函数,
|
|
100
|
+
* 此阶段可以加载插件所需类型资源,并返回原始资源和加载后的资源。
|
|
101
|
+
* @param json
|
|
102
|
+
* @param options
|
|
103
|
+
* @returns
|
|
104
|
+
*/
|
|
105
|
+
static processAssets: (json: spec.JSONScene, options?: SceneLoadOptions) => Promise<{
|
|
106
|
+
assets: spec.AssetBase[];
|
|
107
|
+
loadedAssets: unknown[];
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* loadScene 函数调用的时候会触发此函数,
|
|
100
111
|
* 此阶段时,json 中的图片和二进制已经被加载完成,可以对加载好的资源做进一步处理,
|
|
101
112
|
* 如果 promise 被 reject, loadScene 函数同样会被 reject,表示场景加载失败。
|
|
102
113
|
* 请记住,整个 load 阶段都不要创建 GL 相关的对象,只创建 JS 对象
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ShapePrimitive } from './shape-primitive';
|
|
2
|
+
/**
|
|
3
|
+
* The Ellipse object is used to help draw graphics and can also be used to specify a hit area for containers.
|
|
4
|
+
*/
|
|
5
|
+
export declare class Ellipse extends ShapePrimitive {
|
|
6
|
+
/**
|
|
7
|
+
* The X coordinate of the center of this ellipse
|
|
8
|
+
* @default 0
|
|
9
|
+
*/
|
|
10
|
+
x: number;
|
|
11
|
+
/**
|
|
12
|
+
* The Y coordinate of the center of this ellipse
|
|
13
|
+
* @default 0
|
|
14
|
+
*/
|
|
15
|
+
y: number;
|
|
16
|
+
/**
|
|
17
|
+
* The half width of this ellipse
|
|
18
|
+
* @default 0
|
|
19
|
+
*/
|
|
20
|
+
halfWidth: number;
|
|
21
|
+
/**
|
|
22
|
+
* The half height of this ellipse
|
|
23
|
+
* @default 0
|
|
24
|
+
*/
|
|
25
|
+
halfHeight: number;
|
|
26
|
+
/**
|
|
27
|
+
* The type of the object, mainly used to avoid `instanceof` checks
|
|
28
|
+
* @default 'ellipse'
|
|
29
|
+
*/
|
|
30
|
+
readonly type = "ellipse";
|
|
31
|
+
/**
|
|
32
|
+
* @param x - The X coordinate of the center of this ellipse
|
|
33
|
+
* @param y - The Y coordinate of the center of this ellipse
|
|
34
|
+
* @param halfWidth - The half width of this ellipse
|
|
35
|
+
* @param halfHeight - The half height of this ellipse
|
|
36
|
+
*/
|
|
37
|
+
constructor(x?: number, y?: number, halfWidth?: number, halfHeight?: number);
|
|
38
|
+
/**
|
|
39
|
+
* Creates a clone of this Ellipse instance
|
|
40
|
+
* @returns {Ellipse} A copy of the ellipse
|
|
41
|
+
*/
|
|
42
|
+
clone(): Ellipse;
|
|
43
|
+
/**
|
|
44
|
+
* Checks whether the x and y coordinates given are contained within this ellipse
|
|
45
|
+
* @param x - The X coordinate of the point to test
|
|
46
|
+
* @param y - The Y coordinate of the point to test
|
|
47
|
+
* @returns Whether the x/y coords are within this ellipse
|
|
48
|
+
*/
|
|
49
|
+
contains(x: number, y: number): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Checks whether the x and y coordinates given are contained within this ellipse including stroke
|
|
52
|
+
* @param x - The X coordinate of the point to test
|
|
53
|
+
* @param y - The Y coordinate of the point to test
|
|
54
|
+
* @param width
|
|
55
|
+
* @returns Whether the x/y coords are within this ellipse
|
|
56
|
+
*/
|
|
57
|
+
strokeContains(x: number, y: number, width: number): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Returns the framing rectangle of the ellipse as a Rectangle object
|
|
60
|
+
* @param out
|
|
61
|
+
* @returns The framing rectangle
|
|
62
|
+
*/
|
|
63
|
+
/**
|
|
64
|
+
* Copies another ellipse to this one.
|
|
65
|
+
* @param ellipse - The ellipse to copy from.
|
|
66
|
+
* @returns Returns itself.
|
|
67
|
+
*/
|
|
68
|
+
copyFrom(ellipse: Ellipse): this;
|
|
69
|
+
/**
|
|
70
|
+
* Copies this ellipse to another one.
|
|
71
|
+
* @param ellipse - The ellipse to copy to.
|
|
72
|
+
* @returns Returns given parameter.
|
|
73
|
+
*/
|
|
74
|
+
copyTo(ellipse: Ellipse): Ellipse;
|
|
75
|
+
getX(): number;
|
|
76
|
+
getY(): number;
|
|
77
|
+
build(points: number[]): number[];
|
|
78
|
+
triangulate(points: number[], vertices: number[], verticesOffset: number, indices: number[], indicesOffset: number): void;
|
|
79
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Based on:
|
|
3
3
|
* https://github.com/pixijs/pixijs/blob/dev/src/scene/graphics/shared/path/GraphicsPath.ts
|
|
4
4
|
*/
|
|
5
|
+
import type { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
|
|
5
6
|
import { ShapePath } from './shape-path';
|
|
6
7
|
export declare class GraphicsPath {
|
|
7
8
|
instructions: PathInstruction[];
|
|
@@ -26,7 +27,34 @@ export declare class GraphicsPath {
|
|
|
26
27
|
* @returns The instance of the current object for chaining.
|
|
27
28
|
*/
|
|
28
29
|
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number, smoothness?: number): GraphicsPath;
|
|
30
|
+
/**
|
|
31
|
+
* Sets the starting point for a new sub-path. Any subsequent drawing commands are considered part of this path.
|
|
32
|
+
* @param x - The x-coordinate for the starting point.
|
|
33
|
+
* @param y - The y-coordinate for the starting point.
|
|
34
|
+
* @returns The instance of the current object for chaining.
|
|
35
|
+
*/
|
|
29
36
|
moveTo(x: number, y: number): GraphicsPath;
|
|
37
|
+
/**
|
|
38
|
+
* Draws an ellipse at the specified location and with the given x and y radii.
|
|
39
|
+
* An optional transformation can be applied, allowing for rotation, scaling, and translation.
|
|
40
|
+
* @param x - The x-coordinate of the center of the ellipse.
|
|
41
|
+
* @param y - The y-coordinate of the center of the ellipse.
|
|
42
|
+
* @param radiusX - The horizontal radius of the ellipse.
|
|
43
|
+
* @param radiusY - The vertical radius of the ellipse.
|
|
44
|
+
* @param transform - An optional `Matrix` object to apply a transformation to the ellipse. This can include rotations.
|
|
45
|
+
* @returns The instance of the current object for chaining.
|
|
46
|
+
*/
|
|
47
|
+
ellipse(x: number, y: number, radiusX: number, radiusY: number, transform?: Matrix4): this;
|
|
48
|
+
/**
|
|
49
|
+
* Draws a rectangle shape. This method adds a new rectangle path to the current drawing.
|
|
50
|
+
* @param x - The x-coordinate of the top-left corner of the rectangle.
|
|
51
|
+
* @param y - The y-coordinate of the top-left corner of the rectangle.
|
|
52
|
+
* @param w - The width of the rectangle.
|
|
53
|
+
* @param h - The height of the rectangle.
|
|
54
|
+
* @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
|
|
55
|
+
* @returns The instance of the current object for chaining.
|
|
56
|
+
*/
|
|
57
|
+
rect(x: number, y: number, w: number, h: number, transform?: Matrix4): this;
|
|
30
58
|
clear(): GraphicsPath;
|
|
31
59
|
}
|
|
32
60
|
export interface PathInstruction {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { PointData } from './point-data';
|
|
2
|
+
/**
|
|
3
|
+
* Common interface for points. Both Point and ObservablePoint implement it
|
|
4
|
+
*/
|
|
5
|
+
export interface PointLike extends PointData {
|
|
6
|
+
/**
|
|
7
|
+
* Copies x and y from the given point
|
|
8
|
+
* @param p - The point to copy from
|
|
9
|
+
* @returns Returns itself.
|
|
10
|
+
*/
|
|
11
|
+
copyFrom: (p: PointData) => this;
|
|
12
|
+
/**
|
|
13
|
+
* Copies x and y into the given point
|
|
14
|
+
* @param p - The point to copy.fds
|
|
15
|
+
* @returns Given point with values updated
|
|
16
|
+
*/
|
|
17
|
+
copyTo: <T extends PointLike>(p: T) => T;
|
|
18
|
+
/**
|
|
19
|
+
* Returns true if the given point is equal to this point
|
|
20
|
+
* @param p - The point to check
|
|
21
|
+
* @returns Whether the given point equal to this point
|
|
22
|
+
*/
|
|
23
|
+
equals: (p: PointData) => boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Sets the point to a new x and y position.
|
|
26
|
+
* If y is omitted, both x and y will be set to x.
|
|
27
|
+
* @param {number} [x=0] - position of the point on the x axis
|
|
28
|
+
* @param {number} [y=x] - position of the point on the y axis
|
|
29
|
+
*/
|
|
30
|
+
set: (x?: number, y?: number) => void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { PointData } from './point-data';
|
|
2
|
+
import type { PointLike } from './point-like';
|
|
3
|
+
/**
|
|
4
|
+
* The Point object represents a location in a two-dimensional coordinate system, where `x` represents
|
|
5
|
+
* the position on the horizontal axis and `y` represents the position on the vertical axis.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Point implements PointLike {
|
|
8
|
+
/**
|
|
9
|
+
* Position of the point on the x axis
|
|
10
|
+
*/
|
|
11
|
+
x: number;
|
|
12
|
+
/**
|
|
13
|
+
* Position of the point on the y axis
|
|
14
|
+
*/
|
|
15
|
+
y: number;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new `Point`
|
|
18
|
+
* @param {number} [x=0] - position of the point on the x axis
|
|
19
|
+
* @param {number} [y=0] - position of the point on the y axis
|
|
20
|
+
*/
|
|
21
|
+
constructor(x?: number, y?: number);
|
|
22
|
+
/**
|
|
23
|
+
* Creates a clone of this point
|
|
24
|
+
* @returns A clone of this point
|
|
25
|
+
*/
|
|
26
|
+
clone(): Point;
|
|
27
|
+
/**
|
|
28
|
+
* Copies `x` and `y` from the given point into this point
|
|
29
|
+
* @param p - The point to copy from
|
|
30
|
+
* @returns The point instance itself
|
|
31
|
+
*/
|
|
32
|
+
copyFrom(p: PointData): this;
|
|
33
|
+
/**
|
|
34
|
+
* Copies this point's x and y into the given point (`p`).
|
|
35
|
+
* @param p - The point to copy to. Can be any of type that is or extends `PointData`
|
|
36
|
+
* @returns The point (`p`) with values updated
|
|
37
|
+
*/
|
|
38
|
+
copyTo<T extends PointLike>(p: T): T;
|
|
39
|
+
/**
|
|
40
|
+
* Accepts another point (`p`) and returns `true` if the given point is equal to this point
|
|
41
|
+
* @param p - The point to check
|
|
42
|
+
* @returns Returns `true` if both `x` and `y` are equal
|
|
43
|
+
*/
|
|
44
|
+
equals(p: PointData): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Sets the point to a new `x` and `y` position.
|
|
47
|
+
* If `y` is omitted, both `x` and `y` will be set to `x`.
|
|
48
|
+
* @param {number} [x=0] - position of the point on the `x` axis
|
|
49
|
+
* @param {number} [y=x] - position of the point on the `y` axis
|
|
50
|
+
* @returns The point instance itself
|
|
51
|
+
*/
|
|
52
|
+
set(x?: number, y?: number): this;
|
|
53
|
+
/**
|
|
54
|
+
* A static Point object with `x` and `y` values of `0`. Can be used to avoid creating new objects multiple times.
|
|
55
|
+
* @readonly
|
|
56
|
+
*/
|
|
57
|
+
static get shared(): Point;
|
|
58
|
+
}
|
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
* Based on:
|
|
3
3
|
* https://github.com/pixijs/pixijs/blob/dev/src/maths/shapes/Polygon.ts
|
|
4
4
|
*/
|
|
5
|
+
import { ShapePrimitive } from './shape-primitive';
|
|
5
6
|
import type { PointData } from './point-data';
|
|
6
7
|
/**
|
|
7
8
|
* A class to define a shape via user defined coordinates.
|
|
8
9
|
*/
|
|
9
|
-
export declare class Polygon {
|
|
10
|
-
/**
|
|
10
|
+
export declare class Polygon extends ShapePrimitive {
|
|
11
|
+
/**
|
|
12
|
+
* An array of the points of this polygon.
|
|
13
|
+
*/
|
|
11
14
|
points: number[];
|
|
12
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* `false` after moveTo, `true` after `closePath`. In all other cases it is `true`.
|
|
17
|
+
*/
|
|
13
18
|
closePath: boolean;
|
|
14
19
|
constructor(points: PointData[] | number[]);
|
|
15
20
|
constructor(...points: PointData[] | number[]);
|
|
@@ -51,10 +56,12 @@ export declare class Polygon {
|
|
|
51
56
|
* Get the first X coordinate of the polygon
|
|
52
57
|
* @readonly
|
|
53
58
|
*/
|
|
54
|
-
|
|
59
|
+
getX(): number;
|
|
55
60
|
/**
|
|
56
61
|
* Get the first Y coordinate of the polygon
|
|
57
62
|
* @readonly
|
|
58
63
|
*/
|
|
59
|
-
|
|
64
|
+
getY(): number;
|
|
65
|
+
build(points: number[]): void;
|
|
66
|
+
triangulate(points: number[], vertices: number[], verticesOffset: number, indices: number[], indicesOffset: number): void;
|
|
60
67
|
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { ShapePrimitive } from './shape-primitive';
|
|
2
|
+
/**
|
|
3
|
+
* The `Rectangle` object is an area defined by its position, as indicated by its top-left corner
|
|
4
|
+
* point (`x`, `y`) and by its `width` and its `height`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Rectangle extends ShapePrimitive {
|
|
7
|
+
/**
|
|
8
|
+
* The X coordinate of the upper-left corner of the rectangle
|
|
9
|
+
* @default 0
|
|
10
|
+
*/
|
|
11
|
+
x: number;
|
|
12
|
+
/**
|
|
13
|
+
* The Y coordinate of the upper-left corner of the rectangle
|
|
14
|
+
* @default 0
|
|
15
|
+
*/
|
|
16
|
+
y: number;
|
|
17
|
+
/**
|
|
18
|
+
* The overall width of this rectangle
|
|
19
|
+
* @default 0
|
|
20
|
+
*/
|
|
21
|
+
width: number;
|
|
22
|
+
/**
|
|
23
|
+
* The overall height of this rectangle
|
|
24
|
+
* @default 0
|
|
25
|
+
*/
|
|
26
|
+
height: number;
|
|
27
|
+
/**
|
|
28
|
+
* @param x - The X coordinate of the upper-left corner of the rectangle
|
|
29
|
+
* @param y - The Y coordinate of the upper-left corner of the rectangle
|
|
30
|
+
* @param width - The overall width of the rectangle
|
|
31
|
+
* @param height - The overall height of the rectangle
|
|
32
|
+
*/
|
|
33
|
+
constructor(x?: string | number, y?: string | number, width?: string | number, height?: string | number);
|
|
34
|
+
/** Returns the left edge of the rectangle. */
|
|
35
|
+
get left(): number;
|
|
36
|
+
/** Returns the right edge of the rectangle. */
|
|
37
|
+
get right(): number;
|
|
38
|
+
/** Returns the top edge of the rectangle. */
|
|
39
|
+
get top(): number;
|
|
40
|
+
/** Returns the bottom edge of the rectangle. */
|
|
41
|
+
get bottom(): number;
|
|
42
|
+
/** Determines whether the Rectangle is empty. */
|
|
43
|
+
isEmpty(): boolean;
|
|
44
|
+
/** A constant empty rectangle. This is a new object every time the property is accessed */
|
|
45
|
+
static get EMPTY(): Rectangle;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a clone of this Rectangle
|
|
48
|
+
* @returns a copy of the rectangle
|
|
49
|
+
*/
|
|
50
|
+
clone(): Rectangle;
|
|
51
|
+
/**
|
|
52
|
+
* Converts a Bounds object to a Rectangle object.
|
|
53
|
+
* @param bounds - The bounds to copy and convert to a rectangle.
|
|
54
|
+
* @returns Returns itself.
|
|
55
|
+
*/
|
|
56
|
+
/**
|
|
57
|
+
* Copies another rectangle to this one.
|
|
58
|
+
* @param rectangle - The rectangle to copy from.
|
|
59
|
+
* @returns Returns itself.
|
|
60
|
+
*/
|
|
61
|
+
copyFrom(rectangle: Rectangle): Rectangle;
|
|
62
|
+
/**
|
|
63
|
+
* Copies this rectangle to another one.
|
|
64
|
+
* @param rectangle - The rectangle to copy to.
|
|
65
|
+
* @returns Returns given parameter.
|
|
66
|
+
*/
|
|
67
|
+
copyTo(rectangle: Rectangle): Rectangle;
|
|
68
|
+
/**
|
|
69
|
+
* Checks whether the x and y coordinates given are contained within this Rectangle
|
|
70
|
+
* @param x - The X coordinate of the point to test
|
|
71
|
+
* @param y - The Y coordinate of the point to test
|
|
72
|
+
* @returns Whether the x/y coordinates are within this Rectangle
|
|
73
|
+
*/
|
|
74
|
+
contains(x: number, y: number): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Checks whether the x and y coordinates given are contained within this rectangle including the stroke.
|
|
77
|
+
* @param x - The X coordinate of the point to test
|
|
78
|
+
* @param y - The Y coordinate of the point to test
|
|
79
|
+
* @param strokeWidth - The width of the line to check
|
|
80
|
+
* @returns Whether the x/y coordinates are within this rectangle
|
|
81
|
+
*/
|
|
82
|
+
strokeContains(x: number, y: number, strokeWidth: number): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object.
|
|
85
|
+
* Returns true only if the area of the intersection is >0, this means that Rectangles
|
|
86
|
+
* sharing a side are not overlapping. Another side effect is that an arealess rectangle
|
|
87
|
+
* (width or height equal to zero) can't intersect any other rectangle.
|
|
88
|
+
* @param {Rectangle} other - The Rectangle to intersect with `this`.
|
|
89
|
+
* @param {Matrix} transform - The transformation matrix of `other`.
|
|
90
|
+
* @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`.
|
|
91
|
+
*/
|
|
92
|
+
/**
|
|
93
|
+
* Pads the rectangle making it grow in all directions.
|
|
94
|
+
* If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
|
|
95
|
+
* @param paddingX - The horizontal padding amount.
|
|
96
|
+
* @param paddingY - The vertical padding amount.
|
|
97
|
+
* @returns Returns itself.
|
|
98
|
+
*/
|
|
99
|
+
pad(paddingX?: number, paddingY?: number): this;
|
|
100
|
+
/**
|
|
101
|
+
* Fits this rectangle around the passed one.
|
|
102
|
+
* @param rectangle - The rectangle to fit.
|
|
103
|
+
* @returns Returns itself.
|
|
104
|
+
*/
|
|
105
|
+
fit(rectangle: Rectangle): this;
|
|
106
|
+
/**
|
|
107
|
+
* Enlarges rectangle that way its corners lie on grid
|
|
108
|
+
* @param resolution - resolution
|
|
109
|
+
* @param eps - precision
|
|
110
|
+
* @returns Returns itself.
|
|
111
|
+
*/
|
|
112
|
+
ceil(resolution?: number, eps?: number): this;
|
|
113
|
+
/**
|
|
114
|
+
* Enlarges this rectangle to include the passed rectangle.
|
|
115
|
+
* @param rectangle - The rectangle to include.
|
|
116
|
+
* @returns Returns itself.
|
|
117
|
+
*/
|
|
118
|
+
enlarge(rectangle: Rectangle): this;
|
|
119
|
+
/**
|
|
120
|
+
* Returns the framing rectangle of the rectangle as a Rectangle object
|
|
121
|
+
* @param out - optional rectangle to store the result
|
|
122
|
+
* @returns The framing rectangle
|
|
123
|
+
*/
|
|
124
|
+
getBounds(out?: Rectangle): Rectangle;
|
|
125
|
+
getX(): number;
|
|
126
|
+
getY(): number;
|
|
127
|
+
build(points: number[]): number[];
|
|
128
|
+
triangulate(points: number[], vertices: number[], verticesOffset: number, indices: number[], indicesOffset: number): void;
|
|
129
|
+
}
|