@galacean/effects 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.
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime player 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
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -14945,7 +14945,6 @@ var VFXItem = /** @class */ (function () {
14945
14945
  shouldUpdate = true;
14946
14946
  if (this.endBehavior === END_BEHAVIOR_RESTART$1) {
14947
14947
  this.ended = true;
14948
- lifetime = lifetime % 1;
14949
14948
  }
14950
14949
  }
14951
14950
  }
@@ -14953,7 +14952,7 @@ var VFXItem = /** @class */ (function () {
14953
14952
  this.setVisible(true);
14954
14953
  this.callEnd = false;
14955
14954
  }
14956
- this.lifetime = lifetime;
14955
+ this.lifetime = lifetime % 1;
14957
14956
  shouldUpdate && this.onItemUpdate(dt, lifetime);
14958
14957
  }
14959
14958
  }
@@ -19276,19 +19275,28 @@ var SpriteMesh = /** @class */ (function () {
19276
19275
  var aPointLen = 0;
19277
19276
  var indexLen = 0;
19278
19277
  var pointCount = 0;
19278
+ var renderInfo;
19279
19279
  if (!items.length) {
19280
19280
  this.mesh.setVisible(false);
19281
19281
  return true;
19282
19282
  }
19283
+ for (var i = 0; i < items.length; i++) {
19284
+ if (items[i].renderInfo) {
19285
+ renderInfo = items[i].renderInfo;
19286
+ break;
19287
+ }
19288
+ }
19289
+ if (!renderInfo) {
19290
+ return true;
19291
+ }
19283
19292
  this.items = items.slice();
19284
19293
  if (items.length > 2) {
19285
19294
  itemSlot = maxSpriteMeshItemCount;
19286
19295
  }
19287
- var renderInfo = items[0].renderInfo;
19288
19296
  if (this.mtlSlotCount !== itemSlot) {
19289
19297
  this.mesh.setMaterial(this.createMaterial(renderInfo, itemSlot), { textures: DestroyOptions.keep });
19290
19298
  }
19291
- 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;
19299
+ 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;
19292
19300
  this.splitLayer = attachmentLength > 0;
19293
19301
  for (var i = 0; i < items.length; i++) {
19294
19302
  var item = items[i];
@@ -23887,9 +23895,7 @@ var ParticleSystem = /** @class */ (function () {
23887
23895
  if (options.removeParticle) {
23888
23896
  mesh.removePoint(pointIndex);
23889
23897
  this.clearPointTrail(pointIndex);
23890
- link.removeNode(node);
23891
- node.content = [0];
23892
- // link.shiftNode(node.content); // 删了又加回去 没明白什么意思
23898
+ node.content[0] = 0;
23893
23899
  }
23894
23900
  hitPositions.push(pos);
23895
23901
  if (!options.multiple) {
@@ -24143,7 +24149,9 @@ function randomArrItem(arr, keepArr) {
24143
24149
  var ParticleVFXItem = /** @class */ (function (_super) {
24144
24150
  __extends(ParticleVFXItem, _super);
24145
24151
  function ParticleVFXItem() {
24146
- return _super !== null && _super.apply(this, arguments) || this;
24152
+ var _this = _super !== null && _super.apply(this, arguments) || this;
24153
+ _this.destroyed = false;
24154
+ return _this;
24147
24155
  }
24148
24156
  Object.defineProperty(ParticleVFXItem.prototype, "type", {
24149
24157
  get: function () {
@@ -30466,7 +30474,7 @@ var Composition = /** @class */ (function () {
30466
30474
  });
30467
30475
  Object.defineProperty(Composition.prototype, "startTime", {
30468
30476
  /**
30469
- * 获取合成开始时间
30477
+ * 获取合成开始渲染的时间
30470
30478
  */
30471
30479
  get: function () {
30472
30480
  var _a;
@@ -30546,7 +30554,12 @@ var Composition = /** @class */ (function () {
30546
30554
  if (this.content.ended && this.reusable) {
30547
30555
  this.restart();
30548
30556
  }
30549
- this.gotoAndPlay(this.time);
30557
+ if (this.content.started) {
30558
+ this.gotoAndPlay(this.time - this.startTime);
30559
+ }
30560
+ else {
30561
+ this.gotoAndPlay(0);
30562
+ }
30550
30563
  };
30551
30564
  /**
30552
30565
  * 暂停合成的播放
@@ -30560,14 +30573,21 @@ var Composition = /** @class */ (function () {
30560
30573
  Composition.prototype.resume = function () {
30561
30574
  this.paused = false;
30562
30575
  };
30576
+ /**
30577
+ * 跳转合成到指定时间播放
30578
+ * @param time - 相对 startTime 的时间
30579
+ */
30563
30580
  Composition.prototype.gotoAndPlay = function (time) {
30564
30581
  this.resume();
30565
30582
  if (!this.content.started) {
30566
30583
  this.content.start();
30567
- this.forwardTime(this.startTime);
30568
30584
  }
30569
- this.forwardTime(time);
30585
+ this.forwardTime(time + this.startTime);
30570
30586
  };
30587
+ /**
30588
+ * 跳转合成到指定时间并暂停
30589
+ * @param time - 相对 startTime 的时间
30590
+ */
30571
30591
  Composition.prototype.gotoAndStop = function (time) {
30572
30592
  this.gotoAndPlay(time);
30573
30593
  this.pause();
@@ -30587,21 +30607,29 @@ var Composition = /** @class */ (function () {
30587
30607
  };
30588
30608
  /**
30589
30609
  * 跳到指定时间点(不做任何播放行为)
30590
- * @param time - 指定的时间
30610
+ * @param time - 相对 startTime 的时间
30591
30611
  */
30592
30612
  Composition.prototype.setTime = function (time) {
30593
30613
  var pause = this.paused;
30594
30614
  if (pause) {
30595
30615
  this.resume();
30596
30616
  }
30597
- this.forwardTime(time, true);
30617
+ if (!this.content.started) {
30618
+ this.content.start();
30619
+ }
30620
+ this.forwardTime(time + this.startTime, true);
30598
30621
  if (pause) {
30599
30622
  this.pause();
30600
30623
  }
30601
30624
  };
30625
+ /**
30626
+ * 前进合成到指定时间
30627
+ * @param time - 相对0时刻的时间
30628
+ * @param skipRender - 是否跳过渲染
30629
+ */
30602
30630
  Composition.prototype.forwardTime = function (time, skipRender) {
30603
30631
  if (skipRender === void 0) { skipRender = false; }
30604
- var deltaTime = (this.startTime + Math.max(0, time)) * 1000 - this.content.timeInms;
30632
+ var deltaTime = time * 1000 - this.content.timeInms;
30605
30633
  var reverse = deltaTime < 0;
30606
30634
  var step = 15;
30607
30635
  var t = Math.abs(deltaTime);
@@ -33001,6 +33029,13 @@ var GLMaterial = /** @class */ (function (_super) {
33001
33029
  try {
33002
33030
  for (var _b = __values$1(Object.values(this.textures)), _c = _b.next(); !_c.done; _c = _b.next()) {
33003
33031
  var texture = _c.value;
33032
+ if (!isFunction(texture.initialize)) {
33033
+ console.error({
33034
+ content: "".concat(JSON.stringify(texture), " is not valid Texture to initialize"),
33035
+ type: LOG_TYPE,
33036
+ });
33037
+ return;
33038
+ }
33004
33039
  texture.initialize();
33005
33040
  }
33006
33041
  }
@@ -35896,7 +35931,7 @@ var Player = /** @class */ (function () {
35896
35931
  }
35897
35932
  };
35898
35933
  /**
35899
- * 跳转全部合成带指定时间并停留
35934
+ * 跳转全部合成到指定时间并停留
35900
35935
  * @param time - 指定时间, 单位秒
35901
35936
  */
35902
35937
  Player.prototype.gotoAndStop = function (time) {
@@ -36375,9 +36410,9 @@ Renderer.create = function (canvas, framework, renderOptions) {
36375
36410
  Engine.create = function (gl) {
36376
36411
  return new GLEngine(gl);
36377
36412
  };
36378
- var version = "1.1.4";
36413
+ var version = "1.1.6";
36379
36414
  console.info({
36380
- content: '[Galacean Effects Player] version: ' + "1.1.4",
36415
+ content: '[Galacean Effects Player] version: ' + "1.1.6",
36381
36416
  type: LOG_TYPE,
36382
36417
  });
36383
36418