@galacean/effects-threejs 2.7.3 → 2.7.4

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: v2.7.3
6
+ * Version: v2.7.4
7
7
  */
8
8
 
9
9
  'use strict';
@@ -20341,7 +20341,7 @@ function calculateDirection(prePoint, point, nextPoint) {
20341
20341
  if (this.time >= 0 && this.time < particleSystem.item.duration && particleSystem.isEnded()) {
20342
20342
  particleSystem.reset();
20343
20343
  }
20344
- particleSystem.update(this.time - particleSystem.time);
20344
+ particleSystem.simulate(this.time - particleSystem.time);
20345
20345
  }
20346
20346
  this.lastTime = this.time;
20347
20347
  };
@@ -21793,126 +21793,133 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
21793
21793
  this.initEmitterTransform();
21794
21794
  };
21795
21795
  _proto.onUpdate = function onUpdate(dt) {
21796
- this.update(dt);
21796
+ if (!this.frozen) {
21797
+ this.update(dt);
21798
+ }
21799
+ };
21800
+ _proto.simulate = function simulate(time) {
21801
+ this.update(time * 1000);
21802
+ this.frozen = true;
21797
21803
  };
21798
21804
  _proto.update = function update(delta) {
21799
21805
  var _this = this;
21800
- if (this.started && !this.frozen) {
21801
- var now = this.time + delta / 1000;
21802
- var options = this.options;
21803
- var loopStartTime = this.loopStartTime;
21804
- var emission = this.emission;
21805
- this.time = now;
21806
- this.upDirectionWorld = null;
21807
- this.renderer.updateTime(now, delta);
21808
- var link = this.particleLink;
21809
- var emitterLifetime = (now - loopStartTime) / this.item.duration;
21810
- var timePassed = this.timePassed;
21811
- var trailUpdated = false;
21812
- var updateTrail = function() {
21813
- if (_this.trails && !trailUpdated) {
21814
- trailUpdated = true;
21815
- link.forEach(function(param) {
21816
- var time = param[0], pointIndex = param[1], delay = param[2], point = param[3];
21817
- if (time < timePassed) {
21818
- _this.clearPointTrail(pointIndex);
21819
- } else if (timePassed > delay) {
21820
- _this.updatePointTrail(pointIndex, emitterLifetime, point, delay);
21821
- }
21822
- });
21806
+ if (!this.started) {
21807
+ return;
21808
+ }
21809
+ var now = this.time + delta / 1000;
21810
+ var options = this.options;
21811
+ var loopStartTime = this.loopStartTime;
21812
+ var emission = this.emission;
21813
+ this.time = now;
21814
+ this.upDirectionWorld = null;
21815
+ this.renderer.updateTime(now, delta);
21816
+ var link = this.particleLink;
21817
+ var emitterLifetime = (now - loopStartTime) / this.item.duration;
21818
+ var timePassed = this.timePassed;
21819
+ var trailUpdated = false;
21820
+ var updateTrail = function() {
21821
+ if (_this.trails && !trailUpdated) {
21822
+ trailUpdated = true;
21823
+ link.forEach(function(param) {
21824
+ var time = param[0], pointIndex = param[1], delay = param[2], point = param[3];
21825
+ if (time < timePassed) {
21826
+ _this.clearPointTrail(pointIndex);
21827
+ } else if (timePassed > delay) {
21828
+ _this.updatePointTrail(pointIndex, emitterLifetime, point, delay);
21829
+ }
21830
+ });
21831
+ }
21832
+ };
21833
+ if (!this.ended) {
21834
+ var duration = this.item.duration;
21835
+ var lifetime = this.lifetime;
21836
+ if (timePassed < duration) {
21837
+ var interval = 1 / emission.rateOverTime.getValue(lifetime);
21838
+ var pointCount = Math.floor((timePassed - this.lastEmitTime) / interval);
21839
+ var maxEmissionCount = pointCount;
21840
+ var timeDelta = interval / pointCount;
21841
+ var meshTime = now;
21842
+ var maxCount = options.maxCount;
21843
+ this.updateEmitterTransform(timePassed);
21844
+ var shouldSkipGenerate = function() {
21845
+ var first = link.first;
21846
+ return _this.emissionStopped || link.length === maxCount && first && first.content[0] - loopStartTime > timePassed;
21847
+ };
21848
+ for(var i = 0; i < maxEmissionCount && i < maxCount; i++){
21849
+ if (shouldSkipGenerate()) {
21850
+ break;
21851
+ }
21852
+ var p = this.createPoint(lifetime);
21853
+ p.delay += meshTime + i * timeDelta;
21854
+ this.addParticle(p, maxCount);
21855
+ this.lastEmitTime = timePassed;
21823
21856
  }
21824
- };
21825
- if (!this.ended) {
21826
- var duration = this.item.duration;
21827
- var lifetime = this.lifetime;
21828
- if (timePassed < duration) {
21829
- var interval = 1 / emission.rateOverTime.getValue(lifetime);
21830
- var pointCount = Math.floor((timePassed - this.lastEmitTime) / interval);
21831
- var maxEmissionCount = pointCount;
21832
- var timeDelta = interval / pointCount;
21833
- var meshTime = now;
21834
- var maxCount = options.maxCount;
21835
- this.updateEmitterTransform(timePassed);
21836
- var shouldSkipGenerate = function() {
21837
- var first = link.first;
21838
- return _this.emissionStopped || link.length === maxCount && first && first.content[0] - loopStartTime > timePassed;
21839
- };
21840
- for(var i = 0; i < maxEmissionCount && i < maxCount; i++){
21841
- if (shouldSkipGenerate()) {
21842
- break;
21843
- }
21844
- var p = this.createPoint(lifetime);
21845
- p.delay += meshTime + i * timeDelta;
21846
- this.addParticle(p, maxCount);
21847
- this.lastEmitTime = timePassed;
21857
+ var bursts = emission.bursts;
21858
+ for(var j = (bursts == null ? void 0 : bursts.length) - 1, cursor = 0; j >= 0 && cursor < maxCount; j--){
21859
+ if (shouldSkipGenerate()) {
21860
+ break;
21848
21861
  }
21849
- var bursts = emission.bursts;
21850
- for(var j = (bursts == null ? void 0 : bursts.length) - 1, cursor = 0; j >= 0 && cursor < maxCount; j--){
21851
- if (shouldSkipGenerate()) {
21852
- break;
21862
+ var burst = bursts[j];
21863
+ var opts = !burst.disabled && burst.getGeneratorOptions(timePassed, lifetime);
21864
+ if (opts) {
21865
+ var originVec = [
21866
+ 0,
21867
+ 0,
21868
+ 0
21869
+ ];
21870
+ var offsets = emission.burstOffsets[j];
21871
+ var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
21872
+ if (burst.once) {
21873
+ this.removeBurst(j);
21853
21874
  }
21854
- var burst = bursts[j];
21855
- var opts = !burst.disabled && burst.getGeneratorOptions(timePassed, lifetime);
21856
- if (opts) {
21857
- var originVec = [
21858
- 0,
21859
- 0,
21860
- 0
21861
- ];
21862
- var offsets = emission.burstOffsets[j];
21863
- var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
21864
- if (burst.once) {
21865
- this.removeBurst(j);
21866
- }
21867
- for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
21868
- var _p_transform;
21869
- if (shouldSkipGenerate()) {
21870
- break;
21871
- }
21872
- var p1 = this.initPoint(this.shape.generate({
21873
- total: opts.total,
21874
- index: opts.index,
21875
- burstIndex: i1,
21876
- burstCount: opts.count
21877
- }));
21878
- p1.delay += meshTime;
21879
- cursor++;
21880
- (_p_transform = p1.transform).translate.apply(_p_transform, [].concat(burstOffset));
21881
- this.addParticle(p1, maxCount);
21875
+ for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
21876
+ var _p_transform;
21877
+ if (shouldSkipGenerate()) {
21878
+ break;
21882
21879
  }
21880
+ var p1 = this.initPoint(this.shape.generate({
21881
+ total: opts.total,
21882
+ index: opts.index,
21883
+ burstIndex: i1,
21884
+ burstCount: opts.count
21885
+ }));
21886
+ p1.delay += meshTime;
21887
+ cursor++;
21888
+ (_p_transform = p1.transform).translate.apply(_p_transform, [].concat(burstOffset));
21889
+ this.addParticle(p1, maxCount);
21883
21890
  }
21884
21891
  }
21885
- } else if (this.item.endBehavior === EndBehavior.restart) {
21886
- updateTrail();
21887
- this.loopStartTime = now - duration;
21888
- this.lastEmitTime -= duration;
21889
- this.time -= duration;
21890
- emission.bursts.forEach(function(b) {
21891
- return b.reset();
21892
- });
21893
- this.particleLink.forEach(function(content) {
21894
- content[0] -= duration;
21895
- content[2] -= duration;
21896
- content[3].delay -= duration;
21897
- });
21898
- this.renderer.minusTimeForLoop(duration);
21899
- } else {
21900
- this.ended = true;
21901
- var endBehavior = this.item.endBehavior;
21902
- if (endBehavior === EndBehavior.freeze) {
21903
- this.frozen = true;
21904
- }
21905
21892
  }
21906
- } else if (this.item.endBehavior !== EndBehavior.restart) {
21907
- if (EndBehavior.destroy === this.item.endBehavior) {
21908
- var node = link.last;
21909
- if (node && node.content[0] < this.time) {
21910
- this.destroyed = true;
21911
- }
21893
+ } else if (this.item.endBehavior === EndBehavior.restart) {
21894
+ updateTrail();
21895
+ this.loopStartTime = now - duration;
21896
+ this.lastEmitTime -= duration;
21897
+ this.time -= duration;
21898
+ emission.bursts.forEach(function(b) {
21899
+ return b.reset();
21900
+ });
21901
+ this.particleLink.forEach(function(content) {
21902
+ content[0] -= duration;
21903
+ content[2] -= duration;
21904
+ content[3].delay -= duration;
21905
+ });
21906
+ this.renderer.minusTimeForLoop(duration);
21907
+ } else {
21908
+ this.ended = true;
21909
+ var endBehavior = this.item.endBehavior;
21910
+ if (endBehavior === EndBehavior.freeze) {
21911
+ this.frozen = true;
21912
+ }
21913
+ }
21914
+ } else if (this.item.endBehavior !== EndBehavior.restart) {
21915
+ if (EndBehavior.destroy === this.item.endBehavior) {
21916
+ var node = link.last;
21917
+ if (node && node.content[0] < this.time) {
21918
+ this.destroyed = true;
21912
21919
  }
21913
21920
  }
21914
- updateTrail();
21915
21921
  }
21922
+ updateTrail();
21916
21923
  };
21917
21924
  _proto.drawStencilMask = function drawStencilMask(renderer) {
21918
21925
  if (!this.isActiveAndEnabled) {
@@ -31635,7 +31642,7 @@ function getStandardSpriteContent(sprite, transform) {
31635
31642
  return ret;
31636
31643
  }
31637
31644
 
31638
- var version$2 = "2.7.3";
31645
+ var version$2 = "2.7.4";
31639
31646
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
31640
31647
  var standardVersion = /^(\d+)\.(\d+)$/;
31641
31648
  var reverseParticle = false;
@@ -34911,7 +34918,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
34911
34918
  registerPlugin("particle", ParticleLoader, exports.VFXItem);
34912
34919
  registerPlugin("cal", CalculateLoader, exports.VFXItem);
34913
34920
  registerPlugin("interact", InteractLoader, exports.VFXItem);
34914
- var version$1 = "2.7.3";
34921
+ var version$1 = "2.7.4";
34915
34922
  logger.info("Core version: " + version$1 + ".");
34916
34923
 
34917
34924
  var _obj;
@@ -36492,7 +36499,7 @@ setMaxSpriteMeshItemCount(8);
36492
36499
  */ Mesh.create = function(engine, props) {
36493
36500
  return new ThreeMesh(engine, props);
36494
36501
  };
36495
- var version = "2.7.3";
36502
+ var version = "2.7.4";
36496
36503
  logger.info("THREEJS plugin version: " + version + ".");
36497
36504
 
36498
36505
  exports.AbstractPlugin = AbstractPlugin;