@galacean/effects-core 1.1.4 → 1.1.6

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.
@@ -186,7 +186,7 @@ export declare class Composition implements Disposable, LostHandler {
186
186
  */
187
187
  get items(): VFXItem<VFXItemContent>[];
188
188
  /**
189
- * 获取合成开始时间
189
+ * 获取合成开始渲染的时间
190
190
  */
191
191
  get startTime(): number;
192
192
  /**
@@ -234,7 +234,15 @@ export declare class Composition implements Disposable, LostHandler {
234
234
  * 恢复合成的播放
235
235
  */
236
236
  resume(): void;
237
+ /**
238
+ * 跳转合成到指定时间播放
239
+ * @param time - 相对 startTime 的时间
240
+ */
237
241
  gotoAndPlay(time: number): void;
242
+ /**
243
+ * 跳转合成到指定时间并暂停
244
+ * @param time - 相对 startTime 的时间
245
+ */
238
246
  gotoAndStop(time: number): void;
239
247
  /**
240
248
  *
@@ -242,9 +250,14 @@ export declare class Composition implements Disposable, LostHandler {
242
250
  createRenderFrame(): void;
243
251
  /**
244
252
  * 跳到指定时间点(不做任何播放行为)
245
- * @param time - 指定的时间
253
+ * @param time - 相对 startTime 的时间
246
254
  */
247
255
  setTime(time: number): void;
256
+ /**
257
+ * 前进合成到指定时间
258
+ * @param time - 相对0时刻的时间
259
+ * @param skipRender - 是否跳过渲染
260
+ */
248
261
  private forwardTime;
249
262
  /**
250
263
  * 重置状态函数
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: v1.1.4
6
+ * Version: v1.1.6
7
7
  */
8
8
 
9
9
  'use strict';
@@ -14949,7 +14949,6 @@ var VFXItem = /** @class */ (function () {
14949
14949
  shouldUpdate = true;
14950
14950
  if (this.endBehavior === END_BEHAVIOR_RESTART$1) {
14951
14951
  this.ended = true;
14952
- lifetime = lifetime % 1;
14953
14952
  }
14954
14953
  }
14955
14954
  }
@@ -14957,7 +14956,7 @@ var VFXItem = /** @class */ (function () {
14957
14956
  this.setVisible(true);
14958
14957
  this.callEnd = false;
14959
14958
  }
14960
- this.lifetime = lifetime;
14959
+ this.lifetime = lifetime % 1;
14961
14960
  shouldUpdate && this.onItemUpdate(dt, lifetime);
14962
14961
  }
14963
14962
  }
@@ -19280,19 +19279,28 @@ var SpriteMesh = /** @class */ (function () {
19280
19279
  var aPointLen = 0;
19281
19280
  var indexLen = 0;
19282
19281
  var pointCount = 0;
19282
+ var renderInfo;
19283
19283
  if (!items.length) {
19284
19284
  this.mesh.setVisible(false);
19285
19285
  return true;
19286
19286
  }
19287
+ for (var i = 0; i < items.length; i++) {
19288
+ if (items[i].renderInfo) {
19289
+ renderInfo = items[i].renderInfo;
19290
+ break;
19291
+ }
19292
+ }
19293
+ if (!renderInfo) {
19294
+ return true;
19295
+ }
19287
19296
  this.items = items.slice();
19288
19297
  if (items.length > 2) {
19289
19298
  itemSlot = exports.maxSpriteMeshItemCount;
19290
19299
  }
19291
- var renderInfo = items[0].renderInfo;
19292
19300
  if (this.mtlSlotCount !== itemSlot) {
19293
19301
  this.mesh.setMaterial(this.createMaterial(renderInfo, itemSlot), { textures: exports.DestroyOptions.keep });
19294
19302
  }
19295
- var attachmentLength = (_d = (_c = (_b = (_a = renderInfo === null || renderInfo === void 0 ? void 0 : renderInfo.filter) === null || _a === void 0 ? void 0 : _a.passSplitOptions) === null || _b === void 0 ? void 0 : _b.attachments) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0;
19303
+ var attachmentLength = (_d = (_c = (_b = (_a = renderInfo.filter) === null || _a === void 0 ? void 0 : _a.passSplitOptions) === null || _b === void 0 ? void 0 : _b.attachments) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0;
19296
19304
  this.splitLayer = attachmentLength > 0;
19297
19305
  for (var i = 0; i < items.length; i++) {
19298
19306
  var item = items[i];
@@ -23891,9 +23899,7 @@ var ParticleSystem = /** @class */ (function () {
23891
23899
  if (options.removeParticle) {
23892
23900
  mesh.removePoint(pointIndex);
23893
23901
  this.clearPointTrail(pointIndex);
23894
- link.removeNode(node);
23895
- node.content = [0];
23896
- // link.shiftNode(node.content); // 删了又加回去 没明白什么意思
23902
+ node.content[0] = 0;
23897
23903
  }
23898
23904
  hitPositions.push(pos);
23899
23905
  if (!options.multiple) {
@@ -24147,7 +24153,9 @@ function randomArrItem(arr, keepArr) {
24147
24153
  var ParticleVFXItem = /** @class */ (function (_super) {
24148
24154
  __extends(ParticleVFXItem, _super);
24149
24155
  function ParticleVFXItem() {
24150
- return _super !== null && _super.apply(this, arguments) || this;
24156
+ var _this = _super !== null && _super.apply(this, arguments) || this;
24157
+ _this.destroyed = false;
24158
+ return _this;
24151
24159
  }
24152
24160
  Object.defineProperty(ParticleVFXItem.prototype, "type", {
24153
24161
  get: function () {
@@ -30470,7 +30478,7 @@ var Composition = /** @class */ (function () {
30470
30478
  });
30471
30479
  Object.defineProperty(Composition.prototype, "startTime", {
30472
30480
  /**
30473
- * 获取合成开始时间
30481
+ * 获取合成开始渲染的时间
30474
30482
  */
30475
30483
  get: function () {
30476
30484
  var _a;
@@ -30550,7 +30558,12 @@ var Composition = /** @class */ (function () {
30550
30558
  if (this.content.ended && this.reusable) {
30551
30559
  this.restart();
30552
30560
  }
30553
- this.gotoAndPlay(this.time);
30561
+ if (this.content.started) {
30562
+ this.gotoAndPlay(this.time - this.startTime);
30563
+ }
30564
+ else {
30565
+ this.gotoAndPlay(0);
30566
+ }
30554
30567
  };
30555
30568
  /**
30556
30569
  * 暂停合成的播放
@@ -30564,14 +30577,21 @@ var Composition = /** @class */ (function () {
30564
30577
  Composition.prototype.resume = function () {
30565
30578
  this.paused = false;
30566
30579
  };
30580
+ /**
30581
+ * 跳转合成到指定时间播放
30582
+ * @param time - 相对 startTime 的时间
30583
+ */
30567
30584
  Composition.prototype.gotoAndPlay = function (time) {
30568
30585
  this.resume();
30569
30586
  if (!this.content.started) {
30570
30587
  this.content.start();
30571
- this.forwardTime(this.startTime);
30572
30588
  }
30573
- this.forwardTime(time);
30589
+ this.forwardTime(time + this.startTime);
30574
30590
  };
30591
+ /**
30592
+ * 跳转合成到指定时间并暂停
30593
+ * @param time - 相对 startTime 的时间
30594
+ */
30575
30595
  Composition.prototype.gotoAndStop = function (time) {
30576
30596
  this.gotoAndPlay(time);
30577
30597
  this.pause();
@@ -30591,21 +30611,29 @@ var Composition = /** @class */ (function () {
30591
30611
  };
30592
30612
  /**
30593
30613
  * 跳到指定时间点(不做任何播放行为)
30594
- * @param time - 指定的时间
30614
+ * @param time - 相对 startTime 的时间
30595
30615
  */
30596
30616
  Composition.prototype.setTime = function (time) {
30597
30617
  var pause = this.paused;
30598
30618
  if (pause) {
30599
30619
  this.resume();
30600
30620
  }
30601
- this.forwardTime(time, true);
30621
+ if (!this.content.started) {
30622
+ this.content.start();
30623
+ }
30624
+ this.forwardTime(time + this.startTime, true);
30602
30625
  if (pause) {
30603
30626
  this.pause();
30604
30627
  }
30605
30628
  };
30629
+ /**
30630
+ * 前进合成到指定时间
30631
+ * @param time - 相对0时刻的时间
30632
+ * @param skipRender - 是否跳过渲染
30633
+ */
30606
30634
  Composition.prototype.forwardTime = function (time, skipRender) {
30607
30635
  if (skipRender === void 0) { skipRender = false; }
30608
- var deltaTime = (this.startTime + Math.max(0, time)) * 1000 - this.content.timeInms;
30636
+ var deltaTime = time * 1000 - this.content.timeInms;
30609
30637
  var reverse = deltaTime < 0;
30610
30638
  var step = 15;
30611
30639
  var t = Math.abs(deltaTime);