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