@galacean/effects-core 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/fallback/migration.d.ts +5 -0
- package/dist/index.js +46 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -15
- package/dist/index.mjs.map +1 -1
- package/dist/math/keyframe-info.d.ts +8 -1
- package/dist/math/value-getters/value-getter.d.ts +3 -1
- package/package.json +1 -1
|
@@ -7,6 +7,11 @@ export declare function version21Migration(json: JSONSceneLegacy): JSONSceneLega
|
|
|
7
7
|
* 2.2 以下版本数据适配(mars-player@2.5.0 及以上版本支持 2.2 以下数据的适配)
|
|
8
8
|
*/
|
|
9
9
|
export declare function version22Migration(json: JSONSceneLegacy): JSONSceneLegacy;
|
|
10
|
+
/**
|
|
11
|
+
* 3.1 版本数据适配
|
|
12
|
+
* - 富文本插件名称的适配
|
|
13
|
+
*/
|
|
14
|
+
export declare function version31Migration(json: JSONSceneLegacy): JSONSceneLegacy;
|
|
10
15
|
/**
|
|
11
16
|
* 3.0 以下版本数据适配(runtime 2.0及以上版本支持)
|
|
12
17
|
*/
|
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.2.
|
|
6
|
+
* Version: v2.2.6
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -957,7 +957,7 @@ var pluginInfoMap = {
|
|
|
957
957
|
"video": "@galacean/effects-plugin-multimedia",
|
|
958
958
|
"audio": "@galacean/effects-plugin-multimedia",
|
|
959
959
|
"orientation-transformer": "@galacean/effects-plugin-orientation-transformer",
|
|
960
|
-
"
|
|
960
|
+
"rich-text": "@galacean/effects-plugin-rich-text",
|
|
961
961
|
"spine": "@galacean/effects-plugin-spine"
|
|
962
962
|
};
|
|
963
963
|
function getPluginUsageInfo(name) {
|
|
@@ -5765,7 +5765,7 @@ exports.TextureSourceType = void 0;
|
|
|
5765
5765
|
_this.finish(url, xhr.status, xhr.response);
|
|
5766
5766
|
};
|
|
5767
5767
|
var handleLoad = function() {
|
|
5768
|
-
if (xhr.status == 200
|
|
5768
|
+
if (xhr.status == 200) {
|
|
5769
5769
|
_this.finish(url, 200, xhr.response);
|
|
5770
5770
|
} else {
|
|
5771
5771
|
handleError();
|
|
@@ -5791,7 +5791,7 @@ exports.TextureSourceType = void 0;
|
|
|
5791
5791
|
_proto.finish = function finish(url, status, data) {
|
|
5792
5792
|
var callbacks = this.callbacks[url];
|
|
5793
5793
|
delete this.callbacks[url];
|
|
5794
|
-
var args = status == 200
|
|
5794
|
+
var args = status == 200 ? [
|
|
5795
5795
|
data
|
|
5796
5796
|
] : [
|
|
5797
5797
|
status,
|
|
@@ -11719,25 +11719,35 @@ function numberToFix(a, fixed) {
|
|
|
11719
11719
|
}
|
|
11720
11720
|
|
|
11721
11721
|
var keyframeInfo = {
|
|
11722
|
+
pointIndexCache: {
|
|
11723
|
+
xIndex: 0,
|
|
11724
|
+
yIndex: 0
|
|
11725
|
+
},
|
|
11722
11726
|
/**
|
|
11723
11727
|
* 根据不同关键帧类型,获取位于曲线上的点
|
|
11724
11728
|
*/ getPointInCurve: function getPointInCurve(keyframe) {
|
|
11725
11729
|
keyframe[0]; var data = keyframe[1];
|
|
11726
|
-
var _this_getPointIndexInCurve = this.getPointIndexInCurve(keyframe), xIndex = _this_getPointIndexInCurve.xIndex, yIndex = _this_getPointIndexInCurve.yIndex;
|
|
11730
|
+
var _this_getPointIndexInCurve = this.getPointIndexInCurve(keyframe, this.pointIndexCache), xIndex = _this_getPointIndexInCurve.xIndex, yIndex = _this_getPointIndexInCurve.yIndex;
|
|
11727
11731
|
var time = data[xIndex];
|
|
11728
11732
|
var value = data[yIndex];
|
|
11729
11733
|
return new Vector2(time, value);
|
|
11730
11734
|
},
|
|
11731
11735
|
/**
|
|
11732
11736
|
* 根据不同关键帧类型,获取位于曲线上的点的索引
|
|
11733
|
-
*/ getPointIndexInCurve: function getPointIndexInCurve(keyframe) {
|
|
11737
|
+
*/ getPointIndexInCurve: function getPointIndexInCurve(keyframe, res) {
|
|
11734
11738
|
var type = keyframe[0], markType = keyframe[2];
|
|
11735
11739
|
// 不同类型,存放的时间不同
|
|
11736
11740
|
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;
|
|
11737
|
-
|
|
11738
|
-
xIndex
|
|
11739
|
-
yIndex
|
|
11740
|
-
|
|
11741
|
+
if (res) {
|
|
11742
|
+
res.xIndex = index;
|
|
11743
|
+
res.yIndex = index + 1;
|
|
11744
|
+
return res;
|
|
11745
|
+
} else {
|
|
11746
|
+
return {
|
|
11747
|
+
xIndex: index,
|
|
11748
|
+
yIndex: index + 1
|
|
11749
|
+
};
|
|
11750
|
+
}
|
|
11741
11751
|
},
|
|
11742
11752
|
/**
|
|
11743
11753
|
* 关键帧左侧是否为缓动类型(否则为线段)
|
|
@@ -12644,6 +12654,8 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
12644
12654
|
timeEnd: Number(e.x)
|
|
12645
12655
|
};
|
|
12646
12656
|
}
|
|
12657
|
+
this.startKeyframe = keyframes[0];
|
|
12658
|
+
this.endKeyframe = keyframes[keyframes.length - 1];
|
|
12647
12659
|
this.keyTimeData = Object.keys(this.curveMap);
|
|
12648
12660
|
};
|
|
12649
12661
|
_proto.getValue = function getValue(time) {
|
|
@@ -12651,12 +12663,18 @@ var BezierCurve = /*#__PURE__*/ function(ValueGetter) {
|
|
|
12651
12663
|
var keyTimeData = this.keyTimeData;
|
|
12652
12664
|
var keyTimeStart = this.curveMap[keyTimeData[0]].timeStart;
|
|
12653
12665
|
var keyTimeEnd = this.curveMap[keyTimeData[keyTimeData.length - 1]].timeEnd;
|
|
12654
|
-
// const keyTimeStart = Number(keyTimeData[0].split('&')[0]);
|
|
12655
|
-
// const keyTimeEnd = Number(keyTimeData[keyTimeData.length - 1].split('&')[1]);
|
|
12656
12666
|
if (time <= keyTimeStart) {
|
|
12667
|
+
if (this.startKeyframe[0] === BezierKeyframeType.LINE || this.startKeyframe[0] === BezierKeyframeType.HOLD) {
|
|
12668
|
+
keyframeInfo.getPointIndexInCurve(this.startKeyframe, keyframeInfo.pointIndexCache);
|
|
12669
|
+
return this.endKeyframe[1][keyframeInfo.pointIndexCache.yIndex];
|
|
12670
|
+
}
|
|
12657
12671
|
return this.getCurveValue(keyTimeData[0], keyTimeStart);
|
|
12658
12672
|
}
|
|
12659
12673
|
if (time >= keyTimeEnd) {
|
|
12674
|
+
if (this.endKeyframe[0] === BezierKeyframeType.LINE || this.endKeyframe[0] === BezierKeyframeType.HOLD) {
|
|
12675
|
+
keyframeInfo.getPointIndexInCurve(this.endKeyframe, keyframeInfo.pointIndexCache);
|
|
12676
|
+
return this.endKeyframe[1][keyframeInfo.pointIndexCache.yIndex];
|
|
12677
|
+
}
|
|
12660
12678
|
return this.getCurveValue(keyTimeData[keyTimeData.length - 1], keyTimeEnd);
|
|
12661
12679
|
}
|
|
12662
12680
|
for(var i = 0; i < keyTimeData.length; i++){
|
|
@@ -16260,7 +16278,7 @@ var EventSystem = /*#__PURE__*/ function() {
|
|
|
16260
16278
|
var vy = 0;
|
|
16261
16279
|
var ts = performance.now();
|
|
16262
16280
|
if (!_this.target) {
|
|
16263
|
-
logger.
|
|
16281
|
+
logger.warn("Trigger TouchEvent after EventSystem is disposed.");
|
|
16264
16282
|
return {
|
|
16265
16283
|
x: x,
|
|
16266
16284
|
y: y,
|
|
@@ -20748,7 +20766,6 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
|
|
|
20748
20766
|
if (options.removeParticle) {
|
|
20749
20767
|
renderer.removeParticlePoint(pointIndex);
|
|
20750
20768
|
this.clearPointTrail(pointIndex);
|
|
20751
|
-
link.removeNode(node); // TODO: 会多移除一个粒子,为了通过帧对比先保留,等 2.0 合到主分支后移除。
|
|
20752
20769
|
node.content = [
|
|
20753
20770
|
0
|
|
20754
20771
|
];
|
|
@@ -26003,6 +26020,18 @@ function getStandardInteractContent(ui) {
|
|
|
26003
26020
|
});
|
|
26004
26021
|
return json;
|
|
26005
26022
|
}
|
|
26023
|
+
/**
|
|
26024
|
+
* 3.1 版本数据适配
|
|
26025
|
+
* - 富文本插件名称的适配
|
|
26026
|
+
*/ function version31Migration(json) {
|
|
26027
|
+
var _json_plugins;
|
|
26028
|
+
(_json_plugins = json.plugins) == null ? void 0 : _json_plugins.forEach(function(plugin, index) {
|
|
26029
|
+
if (plugin === "richtext") {
|
|
26030
|
+
json.plugins[index] = "rich-text";
|
|
26031
|
+
}
|
|
26032
|
+
});
|
|
26033
|
+
return json;
|
|
26034
|
+
}
|
|
26006
26035
|
/**
|
|
26007
26036
|
* 3.0 以下版本数据适配(runtime 2.0及以上版本支持)
|
|
26008
26037
|
*/ function version30Migration(json) {
|
|
@@ -26830,6 +26859,8 @@ function getStandardJSON(json) {
|
|
|
26830
26859
|
}
|
|
26831
26860
|
// 修正老版本数据中,meshItem 以及 lightItem 结束行为错误问题
|
|
26832
26861
|
version22Migration(json);
|
|
26862
|
+
// 修正老版本数据中,富文本插件名称的问题
|
|
26863
|
+
version31Migration(json);
|
|
26833
26864
|
if (v0.test(json.version)) {
|
|
26834
26865
|
var _exec;
|
|
26835
26866
|
reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
|
|
@@ -31372,7 +31403,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
|
|
|
31372
31403
|
registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
|
|
31373
31404
|
registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
|
|
31374
31405
|
registerPlugin("interact", InteractLoader, exports.VFXItem, true);
|
|
31375
|
-
var version = "2.2.
|
|
31406
|
+
var version = "2.2.6";
|
|
31376
31407
|
logger.info("Core version: " + version + ".");
|
|
31377
31408
|
|
|
31378
31409
|
exports.AbstractPlugin = AbstractPlugin;
|