@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/weapp.mjs CHANGED
@@ -14939,7 +14939,6 @@ var VFXItem = /** @class */ (function () {
14939
14939
  shouldUpdate = true;
14940
14940
  if (this.endBehavior === END_BEHAVIOR_RESTART$1) {
14941
14941
  this.ended = true;
14942
- lifetime = lifetime % 1;
14943
14942
  }
14944
14943
  }
14945
14944
  }
@@ -14947,7 +14946,7 @@ var VFXItem = /** @class */ (function () {
14947
14946
  this.setVisible(true);
14948
14947
  this.callEnd = false;
14949
14948
  }
14950
- this.lifetime = lifetime;
14949
+ this.lifetime = lifetime % 1;
14951
14950
  shouldUpdate && this.onItemUpdate(dt, lifetime);
14952
14951
  }
14953
14952
  }
@@ -19270,19 +19269,28 @@ var SpriteMesh = /** @class */ (function () {
19270
19269
  var aPointLen = 0;
19271
19270
  var indexLen = 0;
19272
19271
  var pointCount = 0;
19272
+ var renderInfo;
19273
19273
  if (!items.length) {
19274
19274
  this.mesh.setVisible(false);
19275
19275
  return true;
19276
19276
  }
19277
+ for (var i = 0; i < items.length; i++) {
19278
+ if (items[i].renderInfo) {
19279
+ renderInfo = items[i].renderInfo;
19280
+ break;
19281
+ }
19282
+ }
19283
+ if (!renderInfo) {
19284
+ return true;
19285
+ }
19277
19286
  this.items = items.slice();
19278
19287
  if (items.length > 2) {
19279
19288
  itemSlot = maxSpriteMeshItemCount;
19280
19289
  }
19281
- var renderInfo = items[0].renderInfo;
19282
19290
  if (this.mtlSlotCount !== itemSlot) {
19283
19291
  this.mesh.setMaterial(this.createMaterial(renderInfo, itemSlot), { textures: DestroyOptions.keep });
19284
19292
  }
19285
- 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;
19293
+ 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;
19286
19294
  this.splitLayer = attachmentLength > 0;
19287
19295
  for (var i = 0; i < items.length; i++) {
19288
19296
  var item = items[i];
@@ -23881,9 +23889,7 @@ var ParticleSystem = /** @class */ (function () {
23881
23889
  if (options.removeParticle) {
23882
23890
  mesh.removePoint(pointIndex);
23883
23891
  this.clearPointTrail(pointIndex);
23884
- link.removeNode(node);
23885
- node.content = [0];
23886
- // link.shiftNode(node.content); // 删了又加回去 没明白什么意思
23892
+ node.content[0] = 0;
23887
23893
  }
23888
23894
  hitPositions.push(pos);
23889
23895
  if (!options.multiple) {
@@ -24137,7 +24143,9 @@ function randomArrItem(arr, keepArr) {
24137
24143
  var ParticleVFXItem = /** @class */ (function (_super) {
24138
24144
  __extends(ParticleVFXItem, _super);
24139
24145
  function ParticleVFXItem() {
24140
- return _super !== null && _super.apply(this, arguments) || this;
24146
+ var _this = _super !== null && _super.apply(this, arguments) || this;
24147
+ _this.destroyed = false;
24148
+ return _this;
24141
24149
  }
24142
24150
  Object.defineProperty(ParticleVFXItem.prototype, "type", {
24143
24151
  get: function () {
@@ -30460,7 +30468,7 @@ var Composition = /** @class */ (function () {
30460
30468
  });
30461
30469
  Object.defineProperty(Composition.prototype, "startTime", {
30462
30470
  /**
30463
- * 获取合成开始时间
30471
+ * 获取合成开始渲染的时间
30464
30472
  */
30465
30473
  get: function () {
30466
30474
  var _a;
@@ -30540,7 +30548,12 @@ var Composition = /** @class */ (function () {
30540
30548
  if (this.content.ended && this.reusable) {
30541
30549
  this.restart();
30542
30550
  }
30543
- this.gotoAndPlay(this.time);
30551
+ if (this.content.started) {
30552
+ this.gotoAndPlay(this.time - this.startTime);
30553
+ }
30554
+ else {
30555
+ this.gotoAndPlay(0);
30556
+ }
30544
30557
  };
30545
30558
  /**
30546
30559
  * 暂停合成的播放
@@ -30554,14 +30567,21 @@ var Composition = /** @class */ (function () {
30554
30567
  Composition.prototype.resume = function () {
30555
30568
  this.paused = false;
30556
30569
  };
30570
+ /**
30571
+ * 跳转合成到指定时间播放
30572
+ * @param time - 相对 startTime 的时间
30573
+ */
30557
30574
  Composition.prototype.gotoAndPlay = function (time) {
30558
30575
  this.resume();
30559
30576
  if (!this.content.started) {
30560
30577
  this.content.start();
30561
- this.forwardTime(this.startTime);
30562
30578
  }
30563
- this.forwardTime(time);
30579
+ this.forwardTime(time + this.startTime);
30564
30580
  };
30581
+ /**
30582
+ * 跳转合成到指定时间并暂停
30583
+ * @param time - 相对 startTime 的时间
30584
+ */
30565
30585
  Composition.prototype.gotoAndStop = function (time) {
30566
30586
  this.gotoAndPlay(time);
30567
30587
  this.pause();
@@ -30581,21 +30601,29 @@ var Composition = /** @class */ (function () {
30581
30601
  };
30582
30602
  /**
30583
30603
  * 跳到指定时间点(不做任何播放行为)
30584
- * @param time - 指定的时间
30604
+ * @param time - 相对 startTime 的时间
30585
30605
  */
30586
30606
  Composition.prototype.setTime = function (time) {
30587
30607
  var pause = this.paused;
30588
30608
  if (pause) {
30589
30609
  this.resume();
30590
30610
  }
30591
- this.forwardTime(time, true);
30611
+ if (!this.content.started) {
30612
+ this.content.start();
30613
+ }
30614
+ this.forwardTime(time + this.startTime, true);
30592
30615
  if (pause) {
30593
30616
  this.pause();
30594
30617
  }
30595
30618
  };
30619
+ /**
30620
+ * 前进合成到指定时间
30621
+ * @param time - 相对0时刻的时间
30622
+ * @param skipRender - 是否跳过渲染
30623
+ */
30596
30624
  Composition.prototype.forwardTime = function (time, skipRender) {
30597
30625
  if (skipRender === void 0) { skipRender = false; }
30598
- var deltaTime = (this.startTime + Math.max(0, time)) * 1000 - this.content.timeInms;
30626
+ var deltaTime = time * 1000 - this.content.timeInms;
30599
30627
  var reverse = deltaTime < 0;
30600
30628
  var step = 15;
30601
30629
  var t = Math.abs(deltaTime);
@@ -32995,6 +33023,13 @@ var GLMaterial = /** @class */ (function (_super) {
32995
33023
  try {
32996
33024
  for (var _b = __values$1(Object.values(this.textures)), _c = _b.next(); !_c.done; _c = _b.next()) {
32997
33025
  var texture = _c.value;
33026
+ if (!isFunction(texture.initialize)) {
33027
+ console.error({
33028
+ content: "".concat(JSON.stringify(texture), " is not valid Texture to initialize"),
33029
+ type: LOG_TYPE,
33030
+ });
33031
+ return;
33032
+ }
32998
33033
  texture.initialize();
32999
33034
  }
33000
33035
  }
@@ -35890,7 +35925,7 @@ var Player = /** @class */ (function () {
35890
35925
  }
35891
35926
  };
35892
35927
  /**
35893
- * 跳转全部合成带指定时间并停留
35928
+ * 跳转全部合成到指定时间并停留
35894
35929
  * @param time - 指定时间, 单位秒
35895
35930
  */
35896
35931
  Player.prototype.gotoAndStop = function (time) {
@@ -36369,9 +36404,9 @@ Renderer.create = function (canvas, framework, renderOptions) {
36369
36404
  Engine.create = function (gl) {
36370
36405
  return new GLEngine(gl);
36371
36406
  };
36372
- var version = "1.1.4";
36407
+ var version = "1.1.6";
36373
36408
  console.info({
36374
- content: '[Galacean Effects Player] version: ' + "1.1.4",
36409
+ content: '[Galacean Effects Player] version: ' + "1.1.6",
36375
36410
  type: LOG_TYPE,
36376
36411
  });
36377
36412