@galacean/effects-core 2.1.0-alpha.5 → 2.1.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/animation/color-playable.d.ts +26 -0
  2. package/dist/animation/index.d.ts +1 -0
  3. package/dist/asset-manager.d.ts +15 -7
  4. package/dist/asset.d.ts +4 -0
  5. package/dist/binary-asset.d.ts +2 -2
  6. package/dist/comp-vfx-item.d.ts +1 -4
  7. package/dist/components/base-render-component.d.ts +99 -0
  8. package/dist/components/index.d.ts +2 -0
  9. package/dist/components/shape-component.d.ts +206 -0
  10. package/dist/composition/scene-ticking.d.ts +1 -1
  11. package/dist/composition-source-manager.d.ts +5 -6
  12. package/dist/composition.d.ts +12 -9
  13. package/dist/downloader.d.ts +0 -3
  14. package/dist/index.d.ts +3 -1
  15. package/dist/index.js +20120 -17902
  16. package/dist/index.js.map +1 -1
  17. package/dist/index.mjs +20118 -17899
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/plugin-system.d.ts +7 -5
  20. package/dist/plugins/cal/calculate-item.d.ts +4 -3
  21. package/dist/plugins/cal/calculate-loader.d.ts +1 -1
  22. package/dist/plugins/cal/calculate-vfx-item.d.ts +1 -1
  23. package/dist/plugins/camera/camera-vfx-item-loader.d.ts +1 -1
  24. package/dist/plugins/index.d.ts +1 -7
  25. package/dist/plugins/interact/interact-loader.d.ts +1 -1
  26. package/dist/plugins/particle/particle-system.d.ts +1 -2
  27. package/dist/plugins/plugin.d.ts +14 -3
  28. package/dist/plugins/shape/build-adaptive-bezier.d.ts +1 -0
  29. package/dist/plugins/shape/ellipse.d.ts +79 -0
  30. package/dist/plugins/shape/graphics-path.d.ts +37 -0
  31. package/dist/plugins/shape/point-data.d.ts +6 -0
  32. package/dist/plugins/shape/point-like.d.ts +31 -0
  33. package/dist/plugins/shape/point.d.ts +58 -0
  34. package/dist/plugins/shape/polygon.d.ts +67 -0
  35. package/dist/plugins/shape/shape-path.d.ts +73 -0
  36. package/dist/plugins/shape/shape-primitive.d.ts +18 -0
  37. package/dist/plugins/shape/triangulate.d.ts +1 -0
  38. package/dist/plugins/sprite/sprite-item.d.ts +17 -111
  39. package/dist/plugins/sprite/sprite-loader.d.ts +1 -1
  40. package/dist/plugins/sprite/sprite-mesh.d.ts +3 -4
  41. package/dist/plugins/text/text-item.d.ts +15 -5
  42. package/dist/plugins/timeline/index.d.ts +3 -0
  43. package/dist/plugins/timeline/playable-assets/float-property-playable-asset.d.ts +7 -0
  44. package/dist/plugins/timeline/playable-assets/index.d.ts +3 -0
  45. package/dist/plugins/{cal → timeline/playable-assets}/timeline-asset.d.ts +5 -5
  46. package/dist/plugins/timeline/playables/float-property-clip-playable.d.ts +8 -0
  47. package/dist/plugins/timeline/playables/float-property-mixer-playable.d.ts +6 -0
  48. package/dist/plugins/timeline/playables/index.d.ts +5 -0
  49. package/dist/plugins/timeline/track.d.ts +6 -4
  50. package/dist/plugins/timeline/tracks/float-property-track.d.ts +8 -0
  51. package/dist/plugins/timeline/tracks/index.d.ts +5 -0
  52. package/dist/plugins/timeline/tracks/sub-composition-track.d.ts +1 -1
  53. package/dist/render/gpu-capability.d.ts +1 -1
  54. package/dist/render/mesh.d.ts +1 -1
  55. package/dist/render/renderer.d.ts +1 -1
  56. package/dist/render/semantic-map.d.ts +1 -1
  57. package/dist/render/shader.d.ts +1 -1
  58. package/dist/scene.d.ts +17 -18
  59. package/dist/serialization-helper.d.ts +3 -3
  60. package/dist/shape/geometry.d.ts +3 -3
  61. package/dist/texture/texture.d.ts +9 -0
  62. package/dist/texture/utils.d.ts +1 -2
  63. package/dist/utils/color.d.ts +4 -5
  64. package/dist/utils/index.d.ts +1 -1
  65. package/dist/vfx-item.d.ts +0 -1
  66. package/package.json +4 -3
  67. package/dist/image-asset.d.ts +0 -5
  68. /package/dist/plugins/timeline/{playables → playable-assets}/sub-composition-playable-asset.d.ts +0 -0
@@ -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, VFXItemProps } from './vfx-item';
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, Vector3 } from '@galacean/effects-math/es/core/index';
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/track';
4
- import type { TimelineAsset } from './timeline-asset';
4
+ import { TrackAsset } from '../timeline';
5
+ import type { TimelineAsset } from '../timeline';
5
6
  /**
6
7
  * 基础位移属性数据
7
8
  */
@@ -1,3 +1,3 @@
1
- import { AbstractPlugin } from '../index';
1
+ import { AbstractPlugin } from '../plugin';
2
2
  export declare class CalculateLoader extends AbstractPlugin {
3
3
  }
@@ -42,7 +42,7 @@ export declare class TransformAnimationPlayable extends AnimationPlayable {
42
42
  startSpeed: number;
43
43
  data: TransformPlayableAssetData;
44
44
  private velocity;
45
- private binding;
45
+ private boundObject;
46
46
  start(): void;
47
47
  processFrame(context: FrameContext): void;
48
48
  /**
@@ -1,3 +1,3 @@
1
- import { AbstractPlugin } from '../index';
1
+ import { AbstractPlugin } from '../plugin';
2
2
  export declare class CameraVFXItemLoader extends AbstractPlugin {
3
3
  }
@@ -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/track';
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';
@@ -1,3 +1,3 @@
1
- import { AbstractPlugin } from '../index';
1
+ import { AbstractPlugin } from '../plugin';
2
2
  export declare class InteractLoader extends AbstractPlugin {
3
3
  }
@@ -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<color>;
26
+ startColor: ValueGetter<spec.RGBAColorValue>;
28
27
  start3DRotation?: boolean;
29
28
  startRotationX?: ValueGetter<number>;
30
29
  startRotationY?: ValueGetter<number>;
@@ -6,7 +6,7 @@ import type { Composition } from '../composition';
6
6
  export interface Plugin {
7
7
  /**
8
8
  * plugin 的数组内排序,按照升序排列
9
- * 默认为100
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
- * player.loadScene 函数调用的时候会触发此函数,
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
- * player.loadScene 函数调用的时候会触发此函数,
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 @@
1
+ export declare function buildAdaptiveBezier(points: number[], sX: number, sY: number, cp1x: number, cp1y: number, cp2x: number, cp2y: number, eX: number, eY: number, smoothness?: number): number[];
@@ -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
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Based on:
3
+ * https://github.com/pixijs/pixijs/blob/dev/src/scene/graphics/shared/path/GraphicsPath.ts
4
+ */
5
+ import type { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
6
+ import { ShapePath } from './shape-path';
7
+ export declare class GraphicsPath {
8
+ instructions: PathInstruction[];
9
+ private dirty;
10
+ private _shapePath;
11
+ /**
12
+ * Provides access to the internal shape path, ensuring it is up-to-date with the current instructions.
13
+ * @returns The `ShapePath` instance associated with this `GraphicsPath`.
14
+ */
15
+ get shapePath(): ShapePath;
16
+ /**
17
+ * Adds a cubic Bezier curve to the path.
18
+ * It requires three points: the first two are control points and the third one is the end point.
19
+ * The starting point is the last point in the current path.
20
+ * @param cp1x - The x-coordinate of the first control point.
21
+ * @param cp1y - The y-coordinate of the first control point.
22
+ * @param cp2x - The x-coordinate of the second control point.
23
+ * @param cp2y - The y-coordinate of the second control point.
24
+ * @param x - The x-coordinate of the end point.
25
+ * @param y - The y-coordinate of the end point.
26
+ * @param smoothness - Optional parameter to adjust the smoothness of the curve.
27
+ * @returns The instance of the current object for chaining.
28
+ */
29
+ bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number, smoothness?: number): GraphicsPath;
30
+ moveTo(x: number, y: number): GraphicsPath;
31
+ ellipse(x: number, y: number, radiusX: number, radiusY: number, matrix?: Matrix4): this;
32
+ clear(): GraphicsPath;
33
+ }
34
+ export interface PathInstruction {
35
+ action: 'moveTo' | 'lineTo' | 'quadraticCurveTo' | 'bezierCurveTo' | 'arc' | 'closePath' | 'addPath' | 'arcTo' | 'ellipse' | 'rect' | 'roundRect' | 'arcToSvg' | 'poly' | 'circle' | 'regularPoly' | 'roundPoly' | 'roundShape' | 'filletRect' | 'chamferRect';
36
+ data: any[];
37
+ }
@@ -0,0 +1,6 @@
1
+ export interface PointData {
2
+ /** X coord */
3
+ x: number;
4
+ /** Y coord */
5
+ y: number;
6
+ }
@@ -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
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Based on:
3
+ * https://github.com/pixijs/pixijs/blob/dev/src/maths/shapes/Polygon.ts
4
+ */
5
+ import { ShapePrimitive } from './shape-primitive';
6
+ import type { PointData } from './point-data';
7
+ /**
8
+ * A class to define a shape via user defined coordinates.
9
+ */
10
+ export declare class Polygon extends ShapePrimitive {
11
+ /**
12
+ * An array of the points of this polygon.
13
+ */
14
+ points: number[];
15
+ /**
16
+ * `false` after moveTo, `true` after `closePath`. In all other cases it is `true`.
17
+ */
18
+ closePath: boolean;
19
+ constructor(points: PointData[] | number[]);
20
+ constructor(...points: PointData[] | number[]);
21
+ /**
22
+ * Creates a clone of this polygon.
23
+ * @returns - A copy of the polygon.
24
+ */
25
+ clone(): Polygon;
26
+ /**
27
+ * Checks whether the x and y coordinates passed to this function are contained within this polygon.
28
+ * @param x - The X coordinate of the point to test.
29
+ * @param y - The Y coordinate of the point to test.
30
+ * @returns - Whether the x/y coordinates are within this polygon.
31
+ */
32
+ contains(x: number, y: number): boolean;
33
+ /**
34
+ * Copies another polygon to this one.
35
+ * @param polygon - The polygon to copy from.
36
+ * @returns Returns itself.
37
+ */
38
+ copyFrom(polygon: Polygon): this;
39
+ /**
40
+ * Copies this polygon to another one.
41
+ * @param polygon - The polygon to copy to.
42
+ * @returns Returns given parameter.
43
+ */
44
+ copyTo(polygon: Polygon): Polygon;
45
+ /**
46
+ * Get the last X coordinate of the polygon
47
+ * @readonly
48
+ */
49
+ get lastX(): number;
50
+ /**
51
+ * Get the last Y coordinate of the polygon
52
+ * @readonly
53
+ */
54
+ get lastY(): number;
55
+ /**
56
+ * Get the first X coordinate of the polygon
57
+ * @readonly
58
+ */
59
+ getX(): number;
60
+ /**
61
+ * Get the first Y coordinate of the polygon
62
+ * @readonly
63
+ */
64
+ getY(): number;
65
+ build(points: number[]): void;
66
+ triangulate(points: number[], vertices: number[], verticesOffset: number, indices: number[], indicesOffset: number): void;
67
+ }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Based on:
3
+ * https://github.com/pixijs/pixijs/blob/dev/src/scene/graphics/shared/path/ShapePath.ts
4
+ */
5
+ import type { Matrix4 } from '@galacean/effects-math/es/core/matrix4';
6
+ import { Polygon } from './polygon';
7
+ import type { GraphicsPath } from './graphics-path';
8
+ import type { ShapePrimitive } from './shape-primitive';
9
+ export declare class ShapePath {
10
+ private graphicsPath;
11
+ currentPoly: Polygon | null;
12
+ shapePrimitives: {
13
+ shape: ShapePrimitive;
14
+ transform?: Matrix4;
15
+ }[];
16
+ constructor(graphicsPath: GraphicsPath);
17
+ /** Builds the path. */
18
+ buildPath(): void;
19
+ /**
20
+ * Adds a cubic Bezier curve to the path.
21
+ * It requires three points: the first two are control points and the third one is the end point.
22
+ * The starting point is the last point in the current path.
23
+ * @param cp1x - The x-coordinate of the first control point.
24
+ * @param cp1y - The y-coordinate of the first control point.
25
+ * @param cp2x - The x-coordinate of the second control point.
26
+ * @param cp2y - The y-coordinate of the second control point.
27
+ * @param x - The x-coordinate of the end point.
28
+ * @param y - The y-coordinate of the end point.
29
+ * @param smoothness - Optional parameter to adjust the smoothness of the curve.
30
+ * @returns The instance of the current object for chaining.
31
+ */
32
+ bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number, smoothness?: number): ShapePath;
33
+ moveTo(x: number, y: number): ShapePath;
34
+ /**
35
+ * Draws an ellipse at the specified location and with the given x and y radii.
36
+ * An optional transformation can be applied, allowing for rotation, scaling, and translation.
37
+ * @param x - The x-coordinate of the center of the ellipse.
38
+ * @param y - The y-coordinate of the center of the ellipse.
39
+ * @param radiusX - The horizontal radius of the ellipse.
40
+ * @param radiusY - The vertical radius of the ellipse.
41
+ * @param transform - An optional `Matrix` object to apply a transformation to the ellipse. This can include rotations.
42
+ * @returns The instance of the current object for chaining.
43
+ */
44
+ ellipse(x: number, y: number, radiusX: number, radiusY: number, transform?: Matrix4): this;
45
+ /**
46
+ * Draws a given shape on the canvas.
47
+ * This is a generic method that can draw any type of shape specified by the `ShapePrimitive` parameter.
48
+ * An optional transformation matrix can be applied to the shape, allowing for complex transformations.
49
+ * @param shape - The shape to draw, defined as a `ShapePrimitive` object.
50
+ * @param matrix - An optional `Matrix` for transforming the shape. This can include rotations,
51
+ * scaling, and translations.
52
+ * @returns The instance of the current object for chaining.
53
+ */
54
+ drawShape(shape: ShapePrimitive, matrix?: Matrix4): this;
55
+ /**
56
+ * Starts a new polygon path from the specified starting point.
57
+ * This method initializes a new polygon or ends the current one if it exists.
58
+ * @param x - The x-coordinate of the starting point of the new polygon.
59
+ * @param y - The y-coordinate of the starting point of the new polygon.
60
+ * @returns The instance of the current object for chaining.
61
+ */
62
+ private startPoly;
63
+ /**
64
+ * Ends the current polygon path. If `closePath` is set to true,
65
+ * the path is closed by connecting the last point to the first one.
66
+ * This method finalizes the current polygon and prepares it for drawing or adding to the shape primitives.
67
+ * @param closePath - A boolean indicating whether to close the polygon by connecting the last point
68
+ * back to the starting point. False by default.
69
+ * @returns The instance of the current object for chaining.
70
+ */
71
+ private endPoly;
72
+ private ensurePoly;
73
+ }
@@ -0,0 +1,18 @@
1
+ export declare abstract class ShapePrimitive {
2
+ /** Checks whether the x and y coordinates passed to this function are contained within this ShapePrimitive. */
3
+ abstract contains(x: number, y: number): boolean;
4
+ /** Checks whether the x and y coordinates passed to this function are contained within the stroke of this shape */
5
+ /** Creates a clone of this ShapePrimitive instance. */
6
+ abstract clone(): ShapePrimitive;
7
+ /** Copies the properties from another ShapePrimitive to this ShapePrimitive. */
8
+ abstract copyFrom(source: ShapePrimitive): void;
9
+ /** Copies the properties from this ShapePrimitive to another ShapePrimitive. */
10
+ abstract copyTo(destination: ShapePrimitive): void;
11
+ /** Returns the framing rectangle of the ShapePrimitive as a Rectangle object. */
12
+ /** The X coordinate of the shape */
13
+ abstract getX(): number;
14
+ /** The Y coordinate of the shape */
15
+ abstract getY(): number;
16
+ abstract build(points: number[]): void;
17
+ abstract triangulate(points: number[], vertices: number[], verticesOffset: number, indices: number[], indicesOffset: number): void;
18
+ }
@@ -0,0 +1 @@
1
+ export declare function triangulate(contours: number[][]): number[];