@galacean/effects-threejs 2.2.4 → 2.2.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/index.js +47 -16
- 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 +47 -16
- 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.2.
|
|
6
|
+
* Version: v2.2.6
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -979,7 +979,7 @@ var pluginInfoMap = {
|
|
|
979
979
|
"video": "@galacean/effects-plugin-multimedia",
|
|
980
980
|
"audio": "@galacean/effects-plugin-multimedia",
|
|
981
981
|
"orientation-transformer": "@galacean/effects-plugin-orientation-transformer",
|
|
982
|
-
"
|
|
982
|
+
"rich-text": "@galacean/effects-plugin-rich-text",
|
|
983
983
|
"spine": "@galacean/effects-plugin-spine"
|
|
984
984
|
};
|
|
985
985
|
function getPluginUsageInfo(name) {
|
|
@@ -5787,7 +5787,7 @@ exports.TextureSourceType = void 0;
|
|
|
5787
5787
|
_this.finish(url, xhr.status, xhr.response);
|
|
5788
5788
|
};
|
|
5789
5789
|
var handleLoad = function() {
|
|
5790
|
-
if (xhr.status == 200
|
|
5790
|
+
if (xhr.status == 200) {
|
|
5791
5791
|
_this.finish(url, 200, xhr.response);
|
|
5792
5792
|
} else {
|
|
5793
5793
|
handleError();
|
|
@@ -5813,7 +5813,7 @@ exports.TextureSourceType = void 0;
|
|
|
5813
5813
|
_proto.finish = function finish(url, status, data) {
|
|
5814
5814
|
var callbacks = this.callbacks[url];
|
|
5815
5815
|
delete this.callbacks[url];
|
|
5816
|
-
var args = status == 200
|
|
5816
|
+
var args = status == 200 ? [
|
|
5817
5817
|
data
|
|
5818
5818
|
] : [
|
|
5819
5819
|
status,
|
|
@@ -11741,25 +11741,35 @@ function numberToFix(a, fixed) {
|
|
|
11741
11741
|
}
|
|
11742
11742
|
|
|
11743
11743
|
var keyframeInfo = {
|
|
11744
|
+
pointIndexCache: {
|
|
11745
|
+
xIndex: 0,
|
|
11746
|
+
yIndex: 0
|
|
11747
|
+
},
|
|
11744
11748
|
/**
|
|
11745
11749
|
* 根据不同关键帧类型,获取位于曲线上的点
|
|
11746
11750
|
*/ getPointInCurve: function getPointInCurve(keyframe) {
|
|
11747
11751
|
keyframe[0]; var data = keyframe[1];
|
|
11748
|
-
var _this_getPointIndexInCurve = this.getPointIndexInCurve(keyframe), xIndex = _this_getPointIndexInCurve.xIndex, yIndex = _this_getPointIndexInCurve.yIndex;
|
|
11752
|
+
var _this_getPointIndexInCurve = this.getPointIndexInCurve(keyframe, this.pointIndexCache), xIndex = _this_getPointIndexInCurve.xIndex, yIndex = _this_getPointIndexInCurve.yIndex;
|
|
11749
11753
|
var time = data[xIndex];
|
|
11750
11754
|
var value = data[yIndex];
|
|
11751
11755
|
return new Vector2(time, value);
|
|
11752
11756
|
},
|
|
11753
11757
|
/**
|
|
11754
11758
|
* 根据不同关键帧类型,获取位于曲线上的点的索引
|
|
11755
|
-
*/ getPointIndexInCurve: function getPointIndexInCurve(keyframe) {
|
|
11759
|
+
*/ getPointIndexInCurve: function getPointIndexInCurve(keyframe, res) {
|
|
11756
11760
|
var type = keyframe[0], markType = keyframe[2];
|
|
11757
11761
|
// 不同类型,存放的时间不同
|
|
11758
11762
|
var index = type === BezierKeyframeType.LINE ? 0 : type === BezierKeyframeType.EASE_OUT ? 0 : type === BezierKeyframeType.EASE_IN ? 2 : type === BezierKeyframeType.EASE ? 2 : type === BezierKeyframeType.HOLD ? markType === BezierKeyframeType.EASE_IN ? 2 : 0 : 0;
|
|
11759
|
-
|
|
11760
|
-
xIndex
|
|
11761
|
-
yIndex
|
|
11762
|
-
|
|
11763
|
+
if (res) {
|
|
11764
|
+
res.xIndex = index;
|
|
11765
|
+
res.yIndex = index + 1;
|
|
11766
|
+
return res;
|
|
11767
|
+
} else {
|
|
11768
|
+
return {
|
|
11769
|
+
xIndex: index,
|
|
11770
|
+
yIndex: index + 1
|
|
11771
|
+
};
|
|
11772
|
+
}
|
|
11763
11773
|
},
|
|
11764
11774
|
/**
|
|
11765
11775
|
* 关键帧左侧是否为缓动类型(否则为线段)
|
|
@@ -12666,6 +12676,8 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
12666
12676
|
timeEnd: Number(e.x)
|
|
12667
12677
|
};
|
|
12668
12678
|
}
|
|
12679
|
+
this.startKeyframe = keyframes[0];
|
|
12680
|
+
this.endKeyframe = keyframes[keyframes.length - 1];
|
|
12669
12681
|
this.keyTimeData = Object.keys(this.curveMap);
|
|
12670
12682
|
};
|
|
12671
12683
|
_proto.getValue = function getValue(time) {
|
|
@@ -12673,12 +12685,18 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
12673
12685
|
var keyTimeData = this.keyTimeData;
|
|
12674
12686
|
var keyTimeStart = this.curveMap[keyTimeData[0]].timeStart;
|
|
12675
12687
|
var keyTimeEnd = this.curveMap[keyTimeData[keyTimeData.length - 1]].timeEnd;
|
|
12676
|
-
// const keyTimeStart = Number(keyTimeData[0].split('&')[0]);
|
|
12677
|
-
// const keyTimeEnd = Number(keyTimeData[keyTimeData.length - 1].split('&')[1]);
|
|
12678
12688
|
if (time <= keyTimeStart) {
|
|
12689
|
+
if (this.startKeyframe[0] === BezierKeyframeType.LINE || this.startKeyframe[0] === BezierKeyframeType.HOLD) {
|
|
12690
|
+
keyframeInfo.getPointIndexInCurve(this.startKeyframe, keyframeInfo.pointIndexCache);
|
|
12691
|
+
return this.endKeyframe[1][keyframeInfo.pointIndexCache.yIndex];
|
|
12692
|
+
}
|
|
12679
12693
|
return this.getCurveValue(keyTimeData[0], keyTimeStart);
|
|
12680
12694
|
}
|
|
12681
12695
|
if (time >= keyTimeEnd) {
|
|
12696
|
+
if (this.endKeyframe[0] === BezierKeyframeType.LINE || this.endKeyframe[0] === BezierKeyframeType.HOLD) {
|
|
12697
|
+
keyframeInfo.getPointIndexInCurve(this.endKeyframe, keyframeInfo.pointIndexCache);
|
|
12698
|
+
return this.endKeyframe[1][keyframeInfo.pointIndexCache.yIndex];
|
|
12699
|
+
}
|
|
12682
12700
|
return this.getCurveValue(keyTimeData[keyTimeData.length - 1], keyTimeEnd);
|
|
12683
12701
|
}
|
|
12684
12702
|
for(var i = 0; i < keyTimeData.length; i++){
|
|
@@ -16282,7 +16300,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
16282
16300
|
var vy = 0;
|
|
16283
16301
|
var ts = performance.now();
|
|
16284
16302
|
if (!_this.target) {
|
|
16285
|
-
logger.
|
|
16303
|
+
logger.warn("Trigger TouchEvent after EventSystem is disposed.");
|
|
16286
16304
|
return {
|
|
16287
16305
|
x: x,
|
|
16288
16306
|
y: y,
|
|
@@ -20770,7 +20788,6 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
20770
20788
|
if (options.removeParticle) {
|
|
20771
20789
|
renderer.removeParticlePoint(pointIndex);
|
|
20772
20790
|
this.clearPointTrail(pointIndex);
|
|
20773
|
-
link.removeNode(node); // TODO: 会多移除一个粒子,为了通过帧对比先保留,等 2.0 合到主分支后移除。
|
|
20774
20791
|
node.content = [
|
|
20775
20792
|
0
|
|
20776
20793
|
];
|
|
@@ -26025,6 +26042,18 @@ function getStandardInteractContent(ui) {
|
|
|
26025
26042
|
});
|
|
26026
26043
|
return json;
|
|
26027
26044
|
}
|
|
26045
|
+
/**
|
|
26046
|
+
* 3.1 版本数据适配
|
|
26047
|
+
* - 富文本插件名称的适配
|
|
26048
|
+
*/ function version31Migration(json) {
|
|
26049
|
+
var _json_plugins;
|
|
26050
|
+
(_json_plugins = json.plugins) == null ? void 0 : _json_plugins.forEach(function(plugin, index) {
|
|
26051
|
+
if (plugin === "richtext") {
|
|
26052
|
+
json.plugins[index] = "rich-text";
|
|
26053
|
+
}
|
|
26054
|
+
});
|
|
26055
|
+
return json;
|
|
26056
|
+
}
|
|
26028
26057
|
/**
|
|
26029
26058
|
* 3.0 以下版本数据适配(runtime 2.0及以上版本支持)
|
|
26030
26059
|
*/ function version30Migration(json) {
|
|
@@ -26852,6 +26881,8 @@ function getStandardJSON(json) {
|
|
|
26852
26881
|
}
|
|
26853
26882
|
// 修正老版本数据中,meshItem 以及 lightItem 结束行为错误问题
|
|
26854
26883
|
version22Migration(json);
|
|
26884
|
+
// 修正老版本数据中,富文本插件名称的问题
|
|
26885
|
+
version31Migration(json);
|
|
26855
26886
|
if (v0.test(json.version)) {
|
|
26856
26887
|
var _exec;
|
|
26857
26888
|
reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
|
|
@@ -31394,7 +31425,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
31394
31425
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
31395
31426
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
31396
31427
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
31397
|
-
var version$1 = "2.2.
|
|
31428
|
+
var version$1 = "2.2.6";
|
|
31398
31429
|
logger.info("Core version: " + version$1 + ".");
|
|
31399
31430
|
|
|
31400
31431
|
var _obj;
|
|
@@ -33027,7 +33058,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
33027
33058
|
*/ Mesh.create = function(engine, props) {
|
|
33028
33059
|
return new ThreeMesh(engine, props);
|
|
33029
33060
|
};
|
|
33030
|
-
var version = "2.2.
|
|
33061
|
+
var version = "2.2.6";
|
|
33031
33062
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
33032
33063
|
|
|
33033
33064
|
exports.AbstractPlugin = AbstractPlugin;
|