@galacean/effects-core 2.1.0-alpha.13 → 2.1.0-alpha.14

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.
@@ -1,4 +1,4 @@
1
- import type * as spec from '@galacean/effects-specification';
1
+ import * as spec from '@galacean/effects-specification';
2
2
  import type { Engine } from '../engine';
3
3
  import { MeshComponent } from './mesh-component';
4
4
  /**
@@ -22,264 +22,5 @@ export declare class ShapeComponent extends MeshComponent {
22
22
  private buildGeometryFromPath;
23
23
  private buildPath;
24
24
  private setFillColor;
25
- fromData(data: ShapeComponentData): void;
26
- }
27
- /************************** Test Interface **********************************/
28
- /**
29
- * 矢量图形组件
30
- */
31
- export interface ShapeComponentData extends spec.ComponentData {
32
- /**
33
- * 矢量类型
34
- */
35
- type: ShapePrimitiveType;
36
- }
37
- /**
38
- * 矢量图形类型
39
- */
40
- export declare enum ShapePrimitiveType {
41
- /**
42
- * 自定义图形
43
- */
44
- Custom = 0,
45
- /**
46
- * 矩形
47
- */
48
- Rectangle = 1,
49
- /**
50
- * 椭圆
51
- */
52
- Ellipse = 2,
53
- /**
54
- * 多边形
55
- */
56
- Polygon = 3,
57
- /**
58
- * 星形
59
- */
60
- Star = 4
61
- }
62
- /**
63
- * 自定义图形组件
64
- */
65
- export interface CustomShapeData extends ShapeComponentData {
66
- /**
67
- * 矢量类型 - 形状
68
- */
69
- type: ShapePrimitiveType.Custom;
70
- /**
71
- * 路径点
72
- */
73
- points: spec.Vector2Data[];
74
- /**
75
- * 入射控制点
76
- */
77
- easingIns: spec.Vector2Data[];
78
- /**
79
- * 入射控制点
80
- */
81
- easingOuts: spec.Vector2Data[];
82
- /**
83
- * 自定义形状
84
- */
85
- shapes: CustomShape[];
86
- }
87
- /**
88
- * 自定义形状参数
89
- */
90
- export interface CustomShape {
91
- /**
92
- * 点索引 - 用于构成闭合图形
93
- */
94
- indexes: CustomShapePoint[];
95
- /**
96
- * 是否为闭合图形 - 用于Stroke
97
- */
98
- close: boolean;
99
- /**
100
- * 填充属性
101
- */
102
- fill?: ShapeFillParam;
103
- /**
104
- * 描边属性
105
- */
106
- stroke?: ShapeStrokeParam;
107
- /**
108
- * 空间变换
109
- */
110
- transform?: spec.TransformData;
111
- }
112
- /**
113
- * 自定义形状点
114
- */
115
- export interface CustomShapePoint {
116
- /**
117
- * 顶点索引
118
- */
119
- point: number;
120
- /**
121
- * 入射点索引
122
- */
123
- easingIn: number;
124
- /**
125
- * 出射点索引
126
- */
127
- easingOut: number;
128
- }
129
- /**
130
- * 矢量填充参数
131
- */
132
- export interface ShapeFillParam {
133
- /**
134
- * 填充颜色
135
- */
136
- color: spec.ColorData;
137
- }
138
- /**
139
- * 矢量描边参数
140
- */
141
- export interface ShapeStrokeParam {
142
- /**
143
- * 线宽
144
- */
145
- width: number;
146
- /**
147
- * 线颜色
148
- */
149
- color: spec.ColorData;
150
- /**
151
- * 连接类型
152
- */
153
- connectType: ShapeConnectType;
154
- /**
155
- * 点类型
156
- */
157
- pointType: ShapePointType;
158
- }
159
- export declare enum ShapeConnectType {
160
- }
161
- export declare enum ShapePointType {
162
- }
163
- /**
164
- * 椭圆组件参数
165
- */
166
- export interface EllipseData extends ShapeComponentData {
167
- type: ShapePrimitiveType.Ellipse;
168
- /**
169
- * x 轴半径
170
- * -- TODO 后续完善类型
171
- * -- TODO 可以看一下用xRadius/yRadius 还是 width/height
172
- */
173
- xRadius: number;
174
- /**
175
- * y 轴半径
176
- */
177
- yRadius: number;
178
- /**
179
- * 填充属性
180
- */
181
- fill?: ShapeFillParam;
182
- /**
183
- * 描边属性
184
- */
185
- stroke?: ShapeStrokeParam;
186
- /**
187
- * 空间变换
188
- */
189
- transform?: spec.TransformData;
190
- }
191
- /**
192
- * 星形参数
193
- */
194
- export interface StarData extends ShapeComponentData {
195
- /**
196
- * 顶点数 - 内外顶点同数
197
- */
198
- pointCount: number;
199
- /**
200
- * 内径
201
- */
202
- innerRadius: number;
203
- /**
204
- * 外径
205
- */
206
- outerRadius: number;
207
- /**
208
- * 内径点圆度
209
- */
210
- innerRoundness: number;
211
- /**
212
- * 外径点圆度
213
- */
214
- outerRoundness: number;
215
- /**
216
- * 填充属性
217
- */
218
- fill?: ShapeFillParam;
219
- /**
220
- * 描边属性
221
- */
222
- stroke?: ShapeStrokeParam;
223
- /**
224
- * 空间变换
225
- */
226
- transform?: spec.TransformData;
227
- }
228
- /**
229
- * 多边形参数
230
- */
231
- export interface PolygonData extends ShapeComponentData {
232
- /**
233
- * 顶点数
234
- */
235
- pointCount: number;
236
- /**
237
- * 外切圆半径
238
- */
239
- radius: number;
240
- /**
241
- * 角点圆度
242
- */
243
- roundness: number;
244
- /**
245
- * 填充属性
246
- */
247
- fill?: ShapeFillParam;
248
- /**
249
- * 描边属性
250
- */
251
- stroke?: ShapeStrokeParam;
252
- /**
253
- * 空间变换
254
- */
255
- transform?: spec.TransformData;
256
- }
257
- /**
258
- * 矩形参数
259
- */
260
- export interface RectangleData extends ShapeComponentData {
261
- /**
262
- * 宽度
263
- */
264
- width: number;
265
- /**
266
- * 高度
267
- */
268
- height: number;
269
- /**
270
- * 角点元素
271
- */
272
- roundness: number;
273
- /**
274
- * 填充属性
275
- */
276
- fill?: ShapeFillParam;
277
- /**
278
- * 描边属性
279
- */
280
- stroke?: ShapeStrokeParam;
281
- /**
282
- * 空间变换
283
- */
284
- transform?: spec.TransformData;
25
+ fromData(data: spec.ShapeComponentData): void;
285
26
  }
@@ -34,4 +34,11 @@ export type CompositionEvent<C> = {
34
34
  ['end']: [endInfo: {
35
35
  composition: C;
36
36
  }];
37
+ /**
38
+ * 时间跳转事件
39
+ * 用于在合成中跳转到指定时间
40
+ */
41
+ ['goto']: [gotoInfo: {
42
+ time: number;
43
+ }];
37
44
  };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime core for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.1.0-alpha.13
6
+ * Version: v2.1.0-alpha.14
7
7
  */
8
8
 
9
9
  'use strict';
@@ -1622,6 +1622,34 @@ var BuiltinObjectGUID = {
1622
1622
  UnlitShader: "unlit000000000000000000000000000"
1623
1623
  };
1624
1624
 
1625
+ /**
1626
+ * 矢量图形类型
1627
+ */ var ShapePrimitiveType;
1628
+ (function(ShapePrimitiveType) {
1629
+ /**
1630
+ * 自定义图形
1631
+ */ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
1632
+ /**
1633
+ * 矩形
1634
+ */ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
1635
+ /**
1636
+ * 椭圆
1637
+ */ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
1638
+ /**
1639
+ * 多边形
1640
+ */ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
1641
+ /**
1642
+ * 星形
1643
+ */ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
1644
+ })(ShapePrimitiveType || (ShapePrimitiveType = {}));
1645
+
1646
+ // 本期无该功能 待补充
1647
+ var ShapeConnectType;
1648
+ (function(ShapeConnectType) {})(ShapeConnectType || (ShapeConnectType = {}));
1649
+ // @待补充
1650
+ var ShapePointType;
1651
+ (function(ShapePointType) {})(ShapePointType || (ShapePointType = {}));
1652
+
1625
1653
  /**
1626
1654
  * 动态换图类型
1627
1655
  * @since 1.1.0
@@ -1816,6 +1844,9 @@ var index$1 = /*#__PURE__*/Object.freeze({
1816
1844
  get TextWeight () { return TextWeight; },
1817
1845
  get FontStyle () { return FontStyle; },
1818
1846
  BuiltinObjectGUID: BuiltinObjectGUID,
1847
+ get ShapePrimitiveType () { return ShapePrimitiveType; },
1848
+ get ShapeConnectType () { return ShapeConnectType; },
1849
+ get ShapePointType () { return ShapePointType; },
1819
1850
  get BackgroundType () { return BackgroundType; },
1820
1851
  get MultimediaType () { return MultimediaType; },
1821
1852
  get DataType () { return DataType; },
@@ -16143,7 +16174,7 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16143
16174
  this.path.clear();
16144
16175
  var shapeData = data;
16145
16176
  switch(shapeData.type){
16146
- case 0:
16177
+ case ShapePrimitiveType.Custom:
16147
16178
  {
16148
16179
  var customData = shapeData;
16149
16180
  var points = customData.points;
@@ -16180,28 +16211,28 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16180
16211
  }
16181
16212
  break;
16182
16213
  }
16183
- case 2:
16214
+ case ShapePrimitiveType.Ellipse:
16184
16215
  {
16185
16216
  var ellipseData = shapeData;
16186
16217
  this.path.ellipse(0, 0, ellipseData.xRadius, ellipseData.yRadius);
16187
16218
  this.setFillColor(ellipseData.fill);
16188
16219
  break;
16189
16220
  }
16190
- case 1:
16221
+ case ShapePrimitiveType.Rectangle:
16191
16222
  {
16192
16223
  var rectangleData = shapeData;
16193
16224
  this.path.rect(-rectangleData.width / 2, -rectangleData.height / 2, rectangleData.width, rectangleData.height);
16194
16225
  this.setFillColor(rectangleData.fill);
16195
16226
  break;
16196
16227
  }
16197
- case 4:
16228
+ case ShapePrimitiveType.Star:
16198
16229
  {
16199
16230
  var starData = shapeData;
16200
16231
  this.path.polyStar(starData.pointCount, starData.outerRadius, starData.innerRadius, starData.outerRoundness, starData.innerRoundness, StarType.Star);
16201
16232
  this.setFillColor(starData.fill);
16202
16233
  break;
16203
16234
  }
16204
- case 3:
16235
+ case ShapePrimitiveType.Polygon:
16205
16236
  {
16206
16237
  var polygonData = shapeData;
16207
16238
  this.path.polyStar(polygonData.pointCount, polygonData.radius, polygonData.radius, polygonData.roundness, polygonData.roundness, StarType.Polygon);
@@ -16233,28 +16264,6 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16233
16264
  exports.ShapeComponent = __decorate([
16234
16265
  effectsClass("ShapeComponent")
16235
16266
  ], exports.ShapeComponent);
16236
- exports.ShapePrimitiveType = void 0;
16237
- (function(ShapePrimitiveType) {
16238
- /**
16239
- * 自定义图形
16240
- */ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
16241
- /**
16242
- * 矩形
16243
- */ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
16244
- /**
16245
- * 椭圆
16246
- */ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
16247
- /**
16248
- * 多边形
16249
- */ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
16250
- /**
16251
- * 星形
16252
- */ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
16253
- })(exports.ShapePrimitiveType || (exports.ShapePrimitiveType = {}));
16254
- exports.ShapeConnectType = void 0;
16255
- (function(ShapeConnectType) {})(exports.ShapeConnectType || (exports.ShapeConnectType = {}));
16256
- exports.ShapePointType = void 0;
16257
- (function(ShapePointType) {})(exports.ShapePointType || (exports.ShapePointType = {}));
16258
16267
 
16259
16268
  exports.Fake3DComponent = /*#__PURE__*/ function(Component) {
16260
16269
  _inherits(Fake3DComponent, Component);
@@ -18867,9 +18876,18 @@ exports.SpriteComponent = /*#__PURE__*/ function(BaseRenderComponent) {
18867
18876
  }
18868
18877
  };
18869
18878
  _proto.onDestroy = function onDestroy() {
18879
+ var textures = this.getTextures();
18870
18880
  if (this.item && this.item.composition) {
18871
- this.item.composition.destroyTextures(this.getTextures());
18881
+ this.item.composition.destroyTextures(textures);
18872
18882
  }
18883
+ textures.forEach(function(texture) {
18884
+ var source = texture.source;
18885
+ if (source.sourceType === exports.TextureSourceType.video && (source == null ? void 0 : source.video)) {
18886
+ source.video.pause();
18887
+ source.video.src = "";
18888
+ source.video.load();
18889
+ }
18890
+ });
18873
18891
  };
18874
18892
  _proto.createGeometry = function createGeometry(mode) {
18875
18893
  var maxVertex = 12 * this.splits.length;
@@ -24862,7 +24880,7 @@ var TextLayout = /*#__PURE__*/ function() {
24862
24880
  function TextLayout(options) {
24863
24881
  this.width = 0;
24864
24882
  this.height = 0;
24865
- var _options_textHeight = options.textHeight, textHeight = _options_textHeight === void 0 ? 100 : _options_textHeight, _options_textWidth = options.textWidth, textWidth = _options_textWidth === void 0 ? 100 : _options_textWidth, _options_textOverflow = options.textOverflow, textOverflow = _options_textOverflow === void 0 ? TextOverflow.display : _options_textOverflow, _options_textBaseline = options.textBaseline, textBaseline = _options_textBaseline === void 0 ? TextBaseline.top : _options_textBaseline, _options_textAlign = options.textAlign, textAlign = _options_textAlign === void 0 ? TextAlignment.left : _options_textAlign, text = options.text, _options_letterSpace = options.letterSpace, letterSpace = _options_letterSpace === void 0 ? 0 : _options_letterSpace, _options_autoWidth = options.autoWidth, autoWidth = _options_autoWidth === void 0 ? false : _options_autoWidth, fontSize = options.fontSize, _options_lineHeight = options.lineHeight, lineHeight = _options_lineHeight === void 0 ? fontSize : _options_lineHeight;
24883
+ var _options_textHeight = options.textHeight, textHeight = _options_textHeight === void 0 ? 100 : _options_textHeight, _options_textWidth = options.textWidth, textWidth = _options_textWidth === void 0 ? 100 : _options_textWidth, _options_textOverflow = options.textOverflow, textOverflow = _options_textOverflow === void 0 ? TextOverflow.display : _options_textOverflow, _options_textBaseline = options.textBaseline, textBaseline = _options_textBaseline === void 0 ? TextBaseline.top : _options_textBaseline, _options_textAlign = options.textAlign, textAlign = _options_textAlign === void 0 ? TextAlignment.left : _options_textAlign, _options_text = options.text, text = _options_text === void 0 ? " " : _options_text, _options_letterSpace = options.letterSpace, letterSpace = _options_letterSpace === void 0 ? 0 : _options_letterSpace, _options_autoWidth = options.autoWidth, autoWidth = _options_autoWidth === void 0 ? false : _options_autoWidth, fontSize = options.fontSize, _options_lineHeight = options.lineHeight, lineHeight = _options_lineHeight === void 0 ? fontSize : _options_lineHeight;
24866
24884
  var tempWidth = fontSize + letterSpace;
24867
24885
  this.autoWidth = autoWidth;
24868
24886
  this.maxTextWidth = text.length * tempWidth;
@@ -29038,16 +29056,15 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
29038
29056
  if (pause) {
29039
29057
  this.resume();
29040
29058
  }
29041
- if (!this.rootComposition.isStartCalled) {
29042
- this.rootComposition.onStart();
29043
- this.rootComposition.isStartCalled = true;
29044
- }
29045
29059
  this.setSpeed(1);
29046
29060
  this.forwardTime(time + this.startTime);
29047
29061
  this.setSpeed(speed);
29048
29062
  if (pause) {
29049
29063
  this.pause();
29050
29064
  }
29065
+ this.emit("goto", {
29066
+ time: time
29067
+ });
29051
29068
  };
29052
29069
  _proto.addItem = function addItem(item) {
29053
29070
  this.items.push(item);
@@ -31587,7 +31604,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
31587
31604
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
31588
31605
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
31589
31606
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
31590
- var version = "2.1.0-alpha.13";
31607
+ var version = "2.1.0-alpha.14";
31591
31608
  logger.info("Core version: " + version + ".");
31592
31609
 
31593
31610
  exports.AbstractPlugin = AbstractPlugin;