@galacean/effects-threejs 1.1.4 → 1.1.5

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/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v1.1.4
6
+ * Version: v1.1.5
7
7
  */
8
8
 
9
9
  'use strict';
@@ -14971,7 +14971,6 @@ var VFXItem = /** @class */ (function () {
14971
14971
  shouldUpdate = true;
14972
14972
  if (this.endBehavior === END_BEHAVIOR_RESTART$1) {
14973
14973
  this.ended = true;
14974
- lifetime = lifetime % 1;
14975
14974
  }
14976
14975
  }
14977
14976
  }
@@ -14979,7 +14978,7 @@ var VFXItem = /** @class */ (function () {
14979
14978
  this.setVisible(true);
14980
14979
  this.callEnd = false;
14981
14980
  }
14982
- this.lifetime = lifetime;
14981
+ this.lifetime = lifetime % 1;
14983
14982
  shouldUpdate && this.onItemUpdate(dt, lifetime);
14984
14983
  }
14985
14984
  }
@@ -19302,19 +19301,28 @@ var SpriteMesh = /** @class */ (function () {
19302
19301
  var aPointLen = 0;
19303
19302
  var indexLen = 0;
19304
19303
  var pointCount = 0;
19304
+ var renderInfo;
19305
19305
  if (!items.length) {
19306
19306
  this.mesh.setVisible(false);
19307
19307
  return true;
19308
19308
  }
19309
+ for (var i = 0; i < items.length; i++) {
19310
+ if (items[i].renderInfo) {
19311
+ renderInfo = items[i].renderInfo;
19312
+ break;
19313
+ }
19314
+ }
19315
+ if (!renderInfo) {
19316
+ return true;
19317
+ }
19309
19318
  this.items = items.slice();
19310
19319
  if (items.length > 2) {
19311
19320
  itemSlot = exports.maxSpriteMeshItemCount;
19312
19321
  }
19313
- var renderInfo = items[0].renderInfo;
19314
19322
  if (this.mtlSlotCount !== itemSlot) {
19315
19323
  this.mesh.setMaterial(this.createMaterial(renderInfo, itemSlot), { textures: exports.DestroyOptions.keep });
19316
19324
  }
19317
- 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;
19325
+ 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;
19318
19326
  this.splitLayer = attachmentLength > 0;
19319
19327
  for (var i = 0; i < items.length; i++) {
19320
19328
  var item = items[i];
@@ -23913,9 +23921,7 @@ var ParticleSystem = /** @class */ (function () {
23913
23921
  if (options.removeParticle) {
23914
23922
  mesh.removePoint(pointIndex);
23915
23923
  this.clearPointTrail(pointIndex);
23916
- link.removeNode(node);
23917
- node.content = [0];
23918
- // link.shiftNode(node.content); // 删了又加回去 没明白什么意思
23924
+ node.content[0] = 0;
23919
23925
  }
23920
23926
  hitPositions.push(pos);
23921
23927
  if (!options.multiple) {
@@ -24169,7 +24175,9 @@ function randomArrItem(arr, keepArr) {
24169
24175
  var ParticleVFXItem = /** @class */ (function (_super) {
24170
24176
  __extends(ParticleVFXItem, _super);
24171
24177
  function ParticleVFXItem() {
24172
- return _super !== null && _super.apply(this, arguments) || this;
24178
+ var _this = _super !== null && _super.apply(this, arguments) || this;
24179
+ _this.destroyed = false;
24180
+ return _this;
24173
24181
  }
24174
24182
  Object.defineProperty(ParticleVFXItem.prototype, "type", {
24175
24183
  get: function () {
@@ -30492,7 +30500,7 @@ var Composition = /** @class */ (function () {
30492
30500
  });
30493
30501
  Object.defineProperty(Composition.prototype, "startTime", {
30494
30502
  /**
30495
- * 获取合成开始时间
30503
+ * 获取合成开始渲染的时间
30496
30504
  */
30497
30505
  get: function () {
30498
30506
  var _a;
@@ -30572,7 +30580,12 @@ var Composition = /** @class */ (function () {
30572
30580
  if (this.content.ended && this.reusable) {
30573
30581
  this.restart();
30574
30582
  }
30575
- this.gotoAndPlay(this.time);
30583
+ if (this.content.started) {
30584
+ this.gotoAndPlay(this.time - this.startTime);
30585
+ }
30586
+ else {
30587
+ this.gotoAndPlay(0);
30588
+ }
30576
30589
  };
30577
30590
  /**
30578
30591
  * 暂停合成的播放
@@ -30586,14 +30599,21 @@ var Composition = /** @class */ (function () {
30586
30599
  Composition.prototype.resume = function () {
30587
30600
  this.paused = false;
30588
30601
  };
30602
+ /**
30603
+ * 跳转合成到指定时间播放
30604
+ * @param time - 相对 startTime 的时间
30605
+ */
30589
30606
  Composition.prototype.gotoAndPlay = function (time) {
30590
30607
  this.resume();
30591
30608
  if (!this.content.started) {
30592
30609
  this.content.start();
30593
- this.forwardTime(this.startTime);
30594
30610
  }
30595
- this.forwardTime(time);
30611
+ this.forwardTime(time + this.startTime);
30596
30612
  };
30613
+ /**
30614
+ * 跳转合成到指定时间并暂停
30615
+ * @param time - 相对 startTime 的时间
30616
+ */
30597
30617
  Composition.prototype.gotoAndStop = function (time) {
30598
30618
  this.gotoAndPlay(time);
30599
30619
  this.pause();
@@ -30613,21 +30633,29 @@ var Composition = /** @class */ (function () {
30613
30633
  };
30614
30634
  /**
30615
30635
  * 跳到指定时间点(不做任何播放行为)
30616
- * @param time - 指定的时间
30636
+ * @param time - 相对 startTime 的时间
30617
30637
  */
30618
30638
  Composition.prototype.setTime = function (time) {
30619
30639
  var pause = this.paused;
30620
30640
  if (pause) {
30621
30641
  this.resume();
30622
30642
  }
30623
- this.forwardTime(time, true);
30643
+ if (!this.content.started) {
30644
+ this.content.start();
30645
+ }
30646
+ this.forwardTime(time + this.startTime, true);
30624
30647
  if (pause) {
30625
30648
  this.pause();
30626
30649
  }
30627
30650
  };
30651
+ /**
30652
+ * 前进合成到指定时间
30653
+ * @param time - 相对0时刻的时间
30654
+ * @param skipRender - 是否跳过渲染
30655
+ */
30628
30656
  Composition.prototype.forwardTime = function (time, skipRender) {
30629
30657
  if (skipRender === void 0) { skipRender = false; }
30630
- var deltaTime = (this.startTime + Math.max(0, time)) * 1000 - this.content.timeInms;
30658
+ var deltaTime = time * 1000 - this.content.timeInms;
30631
30659
  var reverse = deltaTime < 0;
30632
30660
  var step = 15;
30633
30661
  var t = Math.abs(deltaTime);
@@ -32810,9 +32838,9 @@ Geometry.create = function (engine, options) {
32810
32838
  Mesh.create = function (engine, props) {
32811
32839
  return new ThreeMesh(engine, props);
32812
32840
  };
32813
- var version = "1.1.4";
32841
+ var version = "1.1.5";
32814
32842
  console.info({
32815
- content: '[Galacean Effects THREEJS] version: ' + "1.1.4",
32843
+ content: '[Galacean Effects THREEJS] version: ' + "1.1.5",
32816
32844
  type: LOG_TYPE,
32817
32845
  });
32818
32846