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