@galacean/effects-core 2.3.0-alpha.1 → 2.3.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.
@@ -134,9 +134,9 @@ export declare class ParticleMesh implements ParticleMeshData {
134
134
  };
135
135
  speedOverLifetime?: ValueGetter<number>;
136
136
  time: number;
137
+ maxCount: number;
137
138
  readonly useSprite?: boolean;
138
139
  readonly textureOffsets: number[];
139
- readonly maxCount: number;
140
140
  readonly anchor: Vector2;
141
141
  private cachedRotationVector3;
142
142
  private cachedRotationMatrix;
@@ -157,6 +157,17 @@ export declare class ParticleSystem extends Component {
157
157
  get timePassed(): number;
158
158
  get lifetime(): number;
159
159
  get particleCount(): number;
160
+ /**
161
+ * 获取当前粒子系统的最大粒子数。当系统的粒子数量达到最大值时,发射器会暂时停止发射粒子。
162
+ * @since 2.3.0
163
+ */
164
+ get maxParticles(): number;
165
+ /**
166
+ * 设置当前粒子系统的最大粒子数。当系统的粒子数量达到最大值时,发射器会暂时停止发射粒子。
167
+ * 注意:暂时不支持增加拖尾数量
168
+ * @since 2.3.0
169
+ */
170
+ set maxParticles(count: number);
160
171
  isFrozen(): boolean;
161
172
  isEnded(): boolean;
162
173
  initEmitterTransform(): void;
@@ -1,5 +1,5 @@
1
- export type LineCap = 'butt' | 'round' | 'square';
2
- export type LineJoin = 'round' | 'bevel' | 'miter';
1
+ import type { Color } from '@galacean/effects-math/es/core/color';
2
+ import * as spec from '@galacean/effects-specification';
3
3
  export declare const closePointEps = 0.0001;
4
4
  export declare const curveEps = 0.0001;
5
5
  /**
@@ -11,11 +11,13 @@ export interface StrokeAttributes {
11
11
  /** The alignment of the stroke. */
12
12
  alignment: number;
13
13
  /** The line cap style to use. */
14
- cap: LineCap;
14
+ cap: spec.LineCap;
15
15
  /** The line join style to use. */
16
- join: LineJoin;
16
+ join: spec.LineJoin;
17
17
  /** The miter limit to use. */
18
18
  miterLimit: number;
19
+ /** Stroke color */
20
+ color: Color;
19
21
  }
20
22
  /**
21
23
  * Builds a line to draw using the polygon method.
@@ -31,6 +31,12 @@ export declare class GraphicsPath {
31
31
  * @returns The instance of the current object for chaining.
32
32
  */
33
33
  moveTo(x: number, y: number): GraphicsPath;
34
+ /**
35
+ * Closes the current path by drawing a straight line back to the start.
36
+ * If the shape is already closed or there are no points in the path, this method does nothing.
37
+ * @returns The instance of the current object for chaining.
38
+ */
39
+ closePath(): this;
34
40
  /**
35
41
  * Draws an ellipse at the specified location and with the given x and y radii.
36
42
  * An optional transformation can be applied, allowing for rotation, scaling, and translation.
@@ -51,7 +57,7 @@ export declare class GraphicsPath {
51
57
  * @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
52
58
  * @returns The instance of the current object for chaining.
53
59
  */
54
- rect(x: number, y: number, w: number, h: number, transform?: Matrix4): this;
60
+ rect(x: number, y: number, w: number, h: number, roundness: number, transform?: Matrix4): this;
55
61
  polyStar(pointCount: number, outerRadius: number, innerRadius: number, outerRoundness: number, innerRoundness: number, starType: StarType, transform?: Matrix4): this;
56
62
  clear(): GraphicsPath;
57
63
  }
@@ -60,4 +60,8 @@ export declare class Polygon extends ShapePrimitive {
60
60
  getY(): number;
61
61
  build(points: number[]): void;
62
62
  triangulate(points: number[], vertices: number[], verticesOffset: number, indices: number[], indicesOffset: number): void;
63
+ /**
64
+ * 获取直线上最远的两个端点坐标组成的三角形
65
+ */
66
+ private getLineEndPointsTriangle;
63
67
  }
@@ -1,129 +1,62 @@
1
1
  import { ShapePrimitive } from './shape-primitive';
2
2
  /**
3
- * The `Rectangle` object is an area defined by its position, as indicated by its upper-left corner
4
- * point (`x`, `y`) and by its `width` and its `height`.
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`, including a `roundness` property that
5
+ * defines the roundness of the rounded corners.
6
+ * @memberof maths
5
7
  */
6
8
  export declare class Rectangle extends ShapePrimitive {
7
9
  /**
8
10
  * The X coordinate of the upper-left corner of the rectangle
9
- * @default 0
10
11
  */
11
12
  x: number;
12
13
  /**
13
14
  * The Y coordinate of the upper-left corner of the rectangle
14
- * @default 0
15
15
  */
16
16
  y: number;
17
17
  /**
18
18
  * The overall width of this rectangle
19
- * @default 0
20
19
  */
21
20
  width: number;
22
21
  /**
23
22
  * The overall height of this rectangle
24
- * @default 0
25
23
  */
26
24
  height: number;
25
+ /**
26
+ * Controls the roundness of the rounded corners
27
+ */
28
+ roundness: number;
27
29
  /**
28
30
  * @param x - The X coordinate of the upper-left corner of the rectangle
29
31
  * @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
+ * @param width - The overall width of this rectangle
33
+ * @param height - The overall height of this rectangle
34
+ * @param roundness - Controls the roundness of the rounded corners
32
35
  */
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;
36
+ constructor(x?: number, y?: number, width?: number, height?: number, roundness?: number);
46
37
  /**
47
- * Creates a clone of this Rectangle
48
- * @returns a copy of the rectangle
38
+ * Returns the framing rectangle of the rectangle as a Rectangle object
39
+ * @param out - optional rectangle to store the result
40
+ * @returns The framing rectangle
49
41
  */
50
- clone(): Rectangle;
42
+ getBounds(out?: Rectangle): Rectangle;
51
43
  /**
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.
44
+ * Creates a clone of this rectangle.
45
+ * @returns - A copy of the rectangle.
55
46
  */
47
+ clone(): Rectangle;
56
48
  /**
57
49
  * Copies another rectangle to this one.
58
50
  * @param rectangle - The rectangle to copy from.
59
51
  * @returns Returns itself.
60
52
  */
61
- copyFrom(rectangle: Rectangle): Rectangle;
53
+ copyFrom(rectangle: Rectangle): this;
62
54
  /**
63
55
  * Copies this rectangle to another one.
64
56
  * @param rectangle - The rectangle to copy to.
65
57
  * @returns Returns given parameter.
66
58
  */
67
59
  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[];
60
+ build(points: number[]): void;
128
61
  triangulate(points: number[], vertices: number[], verticesOffset: number, indices: number[], indicesOffset: number): void;
129
62
  }
@@ -28,6 +28,12 @@ export declare class ShapePath {
28
28
  */
29
29
  bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number, smoothness?: number): ShapePath;
30
30
  moveTo(x: number, y: number): ShapePath;
31
+ /**
32
+ * Closes the current path by drawing a straight line back to the start.
33
+ * If the shape is already closed or there are no points in the path, this method does nothing.
34
+ * @returns The instance of the current object for chaining.
35
+ */
36
+ closePath(): this;
31
37
  /**
32
38
  * Draws an ellipse at the specified location and with the given x and y radii.
33
39
  * An optional transformation can be applied, allowing for rotation, scaling, and translation.
@@ -49,7 +55,7 @@ export declare class ShapePath {
49
55
  * @param transform - An optional `Matrix` object to apply a transformation to the rectangle.
50
56
  * @returns The instance of the current object for chaining.
51
57
  */
52
- rect(x: number, y: number, w: number, h: number, transform?: Matrix4): this;
58
+ rect(x: number, y: number, w: number, h: number, roundness: number, transform?: Matrix4): this;
53
59
  /**
54
60
  * Draws a given shape on the canvas.
55
61
  * This is a generic method that can draw any type of shape specified by the `ShapePrimitive` parameter.
@@ -29,6 +29,10 @@ export declare class TextComponent extends BaseRenderComponent {
29
29
  * 文本行数
30
30
  */
31
31
  lineCount: number;
32
+ /**
33
+ * 每一行文本的最大宽度
34
+ */
35
+ protected maxLineWidth: number;
32
36
  protected readonly SCALE_FACTOR = 0.1;
33
37
  protected readonly ALPHA_FIX_VALUE: number;
34
38
  constructor(engine: Engine, props?: TextItemProps);
@@ -51,7 +55,9 @@ export declare class TextComponentBase {
51
55
  item: VFXItem;
52
56
  renderer: ItemRenderer;
53
57
  /***** mix 类型兼容用 *****/
58
+ protected maxLineWidth: number;
54
59
  private char;
60
+ protected renderText(options: spec.TextContentOptions): void;
55
61
  updateWithOptions(options: spec.TextContentOptions): void;
56
62
  private getLineCount;
57
63
  /**
@@ -120,6 +126,16 @@ export declare class TextComponentBase {
120
126
  * @returns
121
127
  */
122
128
  setShadowBlur(value: number): void;
129
+ /**
130
+ * 设置文本溢出模式
131
+ *
132
+ * - clip: 当文本内容超出边界框时,多余的会被截断。
133
+ * - display: 该模式下会显示所有文本,会自动调整文本字号以保证显示完整。
134
+ * > 当存在多行时,部分行内文本可能存在文本字号变小的情况,其他行为正常情况
135
+ *
136
+ * @param overflow - 文本溢出模式
137
+ */
138
+ setOverflow(overflow: spec.TextOverflow): void;
123
139
  /**
124
140
  * 设置阴影颜色
125
141
  * @param value - 阴影颜色
package/dist/scene.d.ts CHANGED
@@ -2,6 +2,7 @@ import type * as spec from '@galacean/effects-specification';
2
2
  import type { Texture } from './texture';
3
3
  import type { PluginSystem } from './plugin-system';
4
4
  import type { PickEnum } from './utils';
5
+ import type { AssetManager } from './asset-manager';
5
6
  export type ImageLike = spec.HTMLImageLike | ArrayBuffer | Texture;
6
7
  export type SceneRenderLevel = PickEnum<spec.RenderLevel, spec.RenderLevel.A | spec.RenderLevel.B | spec.RenderLevel.S>;
7
8
  /**
@@ -36,6 +37,11 @@ export declare namespace Scene {
36
37
  url: string;
37
38
  options?: SceneLoadOptions;
38
39
  };
40
+ export interface LoadResult {
41
+ scene: Scene;
42
+ assetManager: AssetManager;
43
+ options: SceneLoadOptions;
44
+ }
39
45
  /**
40
46
  * 接受用于加载的数据类型
41
47
  */
@@ -27,10 +27,6 @@ export declare class VFXItem extends EffectsObject implements Disposable {
27
27
  * 元素的变换包含位置、旋转、缩放。
28
28
  */
29
29
  transform: Transform;
30
- /**
31
- * 合成属性
32
- */
33
- composition: Composition | null;
34
30
  /**
35
31
  * 元素动画的当前时间
36
32
  */
@@ -83,6 +79,10 @@ export declare class VFXItem extends EffectsObject implements Disposable {
83
79
  private listIndex;
84
80
  private isEnabled;
85
81
  private eventProcessor;
82
+ /**
83
+ * 合成属性
84
+ */
85
+ private _composition;
86
86
  /**
87
87
  *
88
88
  * @param item
@@ -136,6 +136,14 @@ export declare class VFXItem extends EffectsObject implements Disposable {
136
136
  * 返回元素创建的数据
137
137
  */
138
138
  get content(): VFXItemContent;
139
+ /**
140
+ * 获取元素的合成
141
+ */
142
+ get composition(): Composition | null;
143
+ /**
144
+ * 设置元素的合成
145
+ */
146
+ set composition(value: Composition);
139
147
  /**
140
148
  * 播放完成后是否需要再使用,是的话生命周期结束后不会 dispose
141
149
  */
@@ -295,6 +303,7 @@ export declare class VFXItem extends EffectsObject implements Disposable {
295
303
  */
296
304
  dispose(): void;
297
305
  private resetChildrenParent;
306
+ private instantiatePreComposition;
298
307
  }
299
308
  export declare namespace Item {
300
309
  function is<T extends spec.Item>(item: spec.Item, type: spec.ItemType): item is T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-core",
3
- "version": "2.3.0-alpha.1",
3
+ "version": "2.3.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,7 +42,7 @@
42
42
  "registry": "https://registry.npmjs.org"
43
43
  },
44
44
  "dependencies": {
45
- "@galacean/effects-specification": "2.2.0-alpha.3",
45
+ "@galacean/effects-specification": "2.2.0-alpha.4",
46
46
  "@galacean/effects-math": "1.1.0",
47
47
  "flatbuffers": "24.3.25",
48
48
  "uuid": "9.0.1",