@galacean/effects-core 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 +118 -111
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +118 -111
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/particle/particle-system.d.ts +2 -1
- package/package.json +1 -1
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: v2.7.
|
|
6
|
+
* Version: v2.7.4
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -20319,7 +20319,7 @@ function calculateDirection(prePoint, point, nextPoint) {
|
|
|
20319
20319
|
if (this.time >= 0 && this.time < particleSystem.item.duration && particleSystem.isEnded()) {
|
|
20320
20320
|
particleSystem.reset();
|
|
20321
20321
|
}
|
|
20322
|
-
particleSystem.
|
|
20322
|
+
particleSystem.simulate(this.time - particleSystem.time);
|
|
20323
20323
|
}
|
|
20324
20324
|
this.lastTime = this.time;
|
|
20325
20325
|
};
|
|
@@ -21771,126 +21771,133 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
21771
21771
|
this.initEmitterTransform();
|
|
21772
21772
|
};
|
|
21773
21773
|
_proto.onUpdate = function onUpdate(dt) {
|
|
21774
|
-
this.
|
|
21774
|
+
if (!this.frozen) {
|
|
21775
|
+
this.update(dt);
|
|
21776
|
+
}
|
|
21777
|
+
};
|
|
21778
|
+
_proto.simulate = function simulate(time) {
|
|
21779
|
+
this.update(time * 1000);
|
|
21780
|
+
this.frozen = true;
|
|
21775
21781
|
};
|
|
21776
21782
|
_proto.update = function update(delta) {
|
|
21777
21783
|
var _this = this;
|
|
21778
|
-
if (this.started
|
|
21779
|
-
|
|
21780
|
-
|
|
21781
|
-
|
|
21782
|
-
|
|
21783
|
-
|
|
21784
|
-
|
|
21785
|
-
|
|
21786
|
-
|
|
21787
|
-
|
|
21788
|
-
|
|
21789
|
-
|
|
21790
|
-
|
|
21791
|
-
|
|
21792
|
-
|
|
21793
|
-
|
|
21794
|
-
|
|
21795
|
-
|
|
21796
|
-
|
|
21797
|
-
|
|
21798
|
-
|
|
21799
|
-
|
|
21800
|
-
|
|
21784
|
+
if (!this.started) {
|
|
21785
|
+
return;
|
|
21786
|
+
}
|
|
21787
|
+
var now = this.time + delta / 1000;
|
|
21788
|
+
var options = this.options;
|
|
21789
|
+
var loopStartTime = this.loopStartTime;
|
|
21790
|
+
var emission = this.emission;
|
|
21791
|
+
this.time = now;
|
|
21792
|
+
this.upDirectionWorld = null;
|
|
21793
|
+
this.renderer.updateTime(now, delta);
|
|
21794
|
+
var link = this.particleLink;
|
|
21795
|
+
var emitterLifetime = (now - loopStartTime) / this.item.duration;
|
|
21796
|
+
var timePassed = this.timePassed;
|
|
21797
|
+
var trailUpdated = false;
|
|
21798
|
+
var updateTrail = function() {
|
|
21799
|
+
if (_this.trails && !trailUpdated) {
|
|
21800
|
+
trailUpdated = true;
|
|
21801
|
+
link.forEach(function(param) {
|
|
21802
|
+
var time = param[0], pointIndex = param[1], delay = param[2], point = param[3];
|
|
21803
|
+
if (time < timePassed) {
|
|
21804
|
+
_this.clearPointTrail(pointIndex);
|
|
21805
|
+
} else if (timePassed > delay) {
|
|
21806
|
+
_this.updatePointTrail(pointIndex, emitterLifetime, point, delay);
|
|
21807
|
+
}
|
|
21808
|
+
});
|
|
21809
|
+
}
|
|
21810
|
+
};
|
|
21811
|
+
if (!this.ended) {
|
|
21812
|
+
var duration = this.item.duration;
|
|
21813
|
+
var lifetime = this.lifetime;
|
|
21814
|
+
if (timePassed < duration) {
|
|
21815
|
+
var interval = 1 / emission.rateOverTime.getValue(lifetime);
|
|
21816
|
+
var pointCount = Math.floor((timePassed - this.lastEmitTime) / interval);
|
|
21817
|
+
var maxEmissionCount = pointCount;
|
|
21818
|
+
var timeDelta = interval / pointCount;
|
|
21819
|
+
var meshTime = now;
|
|
21820
|
+
var maxCount = options.maxCount;
|
|
21821
|
+
this.updateEmitterTransform(timePassed);
|
|
21822
|
+
var shouldSkipGenerate = function() {
|
|
21823
|
+
var first = link.first;
|
|
21824
|
+
return _this.emissionStopped || link.length === maxCount && first && first.content[0] - loopStartTime > timePassed;
|
|
21825
|
+
};
|
|
21826
|
+
for(var i = 0; i < maxEmissionCount && i < maxCount; i++){
|
|
21827
|
+
if (shouldSkipGenerate()) {
|
|
21828
|
+
break;
|
|
21829
|
+
}
|
|
21830
|
+
var p = this.createPoint(lifetime);
|
|
21831
|
+
p.delay += meshTime + i * timeDelta;
|
|
21832
|
+
this.addParticle(p, maxCount);
|
|
21833
|
+
this.lastEmitTime = timePassed;
|
|
21801
21834
|
}
|
|
21802
|
-
|
|
21803
|
-
|
|
21804
|
-
|
|
21805
|
-
|
|
21806
|
-
if (timePassed < duration) {
|
|
21807
|
-
var interval = 1 / emission.rateOverTime.getValue(lifetime);
|
|
21808
|
-
var pointCount = Math.floor((timePassed - this.lastEmitTime) / interval);
|
|
21809
|
-
var maxEmissionCount = pointCount;
|
|
21810
|
-
var timeDelta = interval / pointCount;
|
|
21811
|
-
var meshTime = now;
|
|
21812
|
-
var maxCount = options.maxCount;
|
|
21813
|
-
this.updateEmitterTransform(timePassed);
|
|
21814
|
-
var shouldSkipGenerate = function() {
|
|
21815
|
-
var first = link.first;
|
|
21816
|
-
return _this.emissionStopped || link.length === maxCount && first && first.content[0] - loopStartTime > timePassed;
|
|
21817
|
-
};
|
|
21818
|
-
for(var i = 0; i < maxEmissionCount && i < maxCount; i++){
|
|
21819
|
-
if (shouldSkipGenerate()) {
|
|
21820
|
-
break;
|
|
21821
|
-
}
|
|
21822
|
-
var p = this.createPoint(lifetime);
|
|
21823
|
-
p.delay += meshTime + i * timeDelta;
|
|
21824
|
-
this.addParticle(p, maxCount);
|
|
21825
|
-
this.lastEmitTime = timePassed;
|
|
21835
|
+
var bursts = emission.bursts;
|
|
21836
|
+
for(var j = (bursts == null ? void 0 : bursts.length) - 1, cursor = 0; j >= 0 && cursor < maxCount; j--){
|
|
21837
|
+
if (shouldSkipGenerate()) {
|
|
21838
|
+
break;
|
|
21826
21839
|
}
|
|
21827
|
-
var
|
|
21828
|
-
|
|
21829
|
-
|
|
21830
|
-
|
|
21840
|
+
var burst = bursts[j];
|
|
21841
|
+
var opts = !burst.disabled && burst.getGeneratorOptions(timePassed, lifetime);
|
|
21842
|
+
if (opts) {
|
|
21843
|
+
var originVec = [
|
|
21844
|
+
0,
|
|
21845
|
+
0,
|
|
21846
|
+
0
|
|
21847
|
+
];
|
|
21848
|
+
var offsets = emission.burstOffsets[j];
|
|
21849
|
+
var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
|
|
21850
|
+
if (burst.once) {
|
|
21851
|
+
this.removeBurst(j);
|
|
21831
21852
|
}
|
|
21832
|
-
var
|
|
21833
|
-
|
|
21834
|
-
|
|
21835
|
-
|
|
21836
|
-
0,
|
|
21837
|
-
0,
|
|
21838
|
-
0
|
|
21839
|
-
];
|
|
21840
|
-
var offsets = emission.burstOffsets[j];
|
|
21841
|
-
var burstOffset = offsets && offsets[opts.cycleIndex] || originVec;
|
|
21842
|
-
if (burst.once) {
|
|
21843
|
-
this.removeBurst(j);
|
|
21844
|
-
}
|
|
21845
|
-
for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
|
|
21846
|
-
var _p_transform;
|
|
21847
|
-
if (shouldSkipGenerate()) {
|
|
21848
|
-
break;
|
|
21849
|
-
}
|
|
21850
|
-
var p1 = this.initPoint(this.shape.generate({
|
|
21851
|
-
total: opts.total,
|
|
21852
|
-
index: opts.index,
|
|
21853
|
-
burstIndex: i1,
|
|
21854
|
-
burstCount: opts.count
|
|
21855
|
-
}));
|
|
21856
|
-
p1.delay += meshTime;
|
|
21857
|
-
cursor++;
|
|
21858
|
-
(_p_transform = p1.transform).translate.apply(_p_transform, [].concat(burstOffset));
|
|
21859
|
-
this.addParticle(p1, maxCount);
|
|
21853
|
+
for(var i1 = 0; i1 < opts.count && cursor < maxCount; i1++){
|
|
21854
|
+
var _p_transform;
|
|
21855
|
+
if (shouldSkipGenerate()) {
|
|
21856
|
+
break;
|
|
21860
21857
|
}
|
|
21858
|
+
var p1 = this.initPoint(this.shape.generate({
|
|
21859
|
+
total: opts.total,
|
|
21860
|
+
index: opts.index,
|
|
21861
|
+
burstIndex: i1,
|
|
21862
|
+
burstCount: opts.count
|
|
21863
|
+
}));
|
|
21864
|
+
p1.delay += meshTime;
|
|
21865
|
+
cursor++;
|
|
21866
|
+
(_p_transform = p1.transform).translate.apply(_p_transform, [].concat(burstOffset));
|
|
21867
|
+
this.addParticle(p1, maxCount);
|
|
21861
21868
|
}
|
|
21862
21869
|
}
|
|
21863
|
-
} else if (this.item.endBehavior === EndBehavior.restart) {
|
|
21864
|
-
updateTrail();
|
|
21865
|
-
this.loopStartTime = now - duration;
|
|
21866
|
-
this.lastEmitTime -= duration;
|
|
21867
|
-
this.time -= duration;
|
|
21868
|
-
emission.bursts.forEach(function(b) {
|
|
21869
|
-
return b.reset();
|
|
21870
|
-
});
|
|
21871
|
-
this.particleLink.forEach(function(content) {
|
|
21872
|
-
content[0] -= duration;
|
|
21873
|
-
content[2] -= duration;
|
|
21874
|
-
content[3].delay -= duration;
|
|
21875
|
-
});
|
|
21876
|
-
this.renderer.minusTimeForLoop(duration);
|
|
21877
|
-
} else {
|
|
21878
|
-
this.ended = true;
|
|
21879
|
-
var endBehavior = this.item.endBehavior;
|
|
21880
|
-
if (endBehavior === EndBehavior.freeze) {
|
|
21881
|
-
this.frozen = true;
|
|
21882
|
-
}
|
|
21883
21870
|
}
|
|
21884
|
-
} else if (this.item.endBehavior
|
|
21885
|
-
|
|
21886
|
-
|
|
21887
|
-
|
|
21888
|
-
|
|
21889
|
-
|
|
21871
|
+
} else if (this.item.endBehavior === EndBehavior.restart) {
|
|
21872
|
+
updateTrail();
|
|
21873
|
+
this.loopStartTime = now - duration;
|
|
21874
|
+
this.lastEmitTime -= duration;
|
|
21875
|
+
this.time -= duration;
|
|
21876
|
+
emission.bursts.forEach(function(b) {
|
|
21877
|
+
return b.reset();
|
|
21878
|
+
});
|
|
21879
|
+
this.particleLink.forEach(function(content) {
|
|
21880
|
+
content[0] -= duration;
|
|
21881
|
+
content[2] -= duration;
|
|
21882
|
+
content[3].delay -= duration;
|
|
21883
|
+
});
|
|
21884
|
+
this.renderer.minusTimeForLoop(duration);
|
|
21885
|
+
} else {
|
|
21886
|
+
this.ended = true;
|
|
21887
|
+
var endBehavior = this.item.endBehavior;
|
|
21888
|
+
if (endBehavior === EndBehavior.freeze) {
|
|
21889
|
+
this.frozen = true;
|
|
21890
|
+
}
|
|
21891
|
+
}
|
|
21892
|
+
} else if (this.item.endBehavior !== EndBehavior.restart) {
|
|
21893
|
+
if (EndBehavior.destroy === this.item.endBehavior) {
|
|
21894
|
+
var node = link.last;
|
|
21895
|
+
if (node && node.content[0] < this.time) {
|
|
21896
|
+
this.destroyed = true;
|
|
21890
21897
|
}
|
|
21891
21898
|
}
|
|
21892
|
-
updateTrail();
|
|
21893
21899
|
}
|
|
21900
|
+
updateTrail();
|
|
21894
21901
|
};
|
|
21895
21902
|
_proto.drawStencilMask = function drawStencilMask(renderer) {
|
|
21896
21903
|
if (!this.isActiveAndEnabled) {
|
|
@@ -31613,7 +31620,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31613
31620
|
return ret;
|
|
31614
31621
|
}
|
|
31615
31622
|
|
|
31616
|
-
var version$1 = "2.7.
|
|
31623
|
+
var version$1 = "2.7.4";
|
|
31617
31624
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31618
31625
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31619
31626
|
var reverseParticle = false;
|
|
@@ -34889,7 +34896,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
|
|
|
34889
34896
|
registerPlugin("particle", ParticleLoader, exports.VFXItem);
|
|
34890
34897
|
registerPlugin("cal", CalculateLoader, exports.VFXItem);
|
|
34891
34898
|
registerPlugin("interact", InteractLoader, exports.VFXItem);
|
|
34892
|
-
var version = "2.7.
|
|
34899
|
+
var version = "2.7.4";
|
|
34893
34900
|
logger.info("Core version: " + version + ".");
|
|
34894
34901
|
|
|
34895
34902
|
exports.AbstractPlugin = AbstractPlugin;
|