@galacean/effects-threejs 2.2.5 → 2.2.7

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 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.5
6
+ * Version: v2.2.7
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
- "richtext": "@galacean/effects-plugin-rich-text",
982
+ "rich-text": "@galacean/effects-plugin-rich-text",
983
983
  "spine": "@galacean/effects-plugin-spine"
984
984
  };
985
985
  function getPluginUsageInfo(name) {
@@ -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
- return {
11760
- xIndex: index,
11761
- yIndex: index + 1
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,13 +12685,13 @@ 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) {
12679
- return this.getCurveValue(keyTimeData[0], keyTimeStart);
12689
+ keyframeInfo.getPointIndexInCurve(this.startKeyframe, keyframeInfo.pointIndexCache);
12690
+ return this.startKeyframe[1][keyframeInfo.pointIndexCache.yIndex];
12680
12691
  }
12681
12692
  if (time >= keyTimeEnd) {
12682
- return this.getCurveValue(keyTimeData[keyTimeData.length - 1], keyTimeEnd);
12693
+ keyframeInfo.getPointIndexInCurve(this.endKeyframe, keyframeInfo.pointIndexCache);
12694
+ return this.endKeyframe[1][keyframeInfo.pointIndexCache.yIndex];
12683
12695
  }
12684
12696
  for(var i = 0; i < keyTimeData.length; i++){
12685
12697
  var xMin = this.curveMap[keyTimeData[i]].timeStart;
@@ -16282,7 +16294,7 @@ var EventSystem = /*#__PURE__*/ function() {
16282
16294
  var vy = 0;
16283
16295
  var ts = performance.now();
16284
16296
  if (!_this.target) {
16285
- logger.error("Trigger TouchEvent after EventSystem is disposed.");
16297
+ logger.warn("Trigger TouchEvent after EventSystem is disposed.");
16286
16298
  return {
16287
16299
  x: x,
16288
16300
  y: y,
@@ -26024,6 +26036,18 @@ function getStandardInteractContent(ui) {
26024
26036
  });
26025
26037
  return json;
26026
26038
  }
26039
+ /**
26040
+ * 3.1 版本数据适配
26041
+ * - 富文本插件名称的适配
26042
+ */ function version31Migration(json) {
26043
+ var _json_plugins;
26044
+ (_json_plugins = json.plugins) == null ? void 0 : _json_plugins.forEach(function(plugin, index) {
26045
+ if (plugin === "richtext") {
26046
+ json.plugins[index] = "rich-text";
26047
+ }
26048
+ });
26049
+ return json;
26050
+ }
26027
26051
  /**
26028
26052
  * 3.0 以下版本数据适配(runtime 2.0及以上版本支持)
26029
26053
  */ function version30Migration(json) {
@@ -26851,6 +26875,8 @@ function getStandardJSON(json) {
26851
26875
  }
26852
26876
  // 修正老版本数据中,meshItem 以及 lightItem 结束行为错误问题
26853
26877
  version22Migration(json);
26878
+ // 修正老版本数据中,富文本插件名称的问题
26879
+ version31Migration(json);
26854
26880
  if (v0.test(json.version)) {
26855
26881
  var _exec;
26856
26882
  reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
@@ -31393,7 +31419,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
31393
31419
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
31394
31420
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
31395
31421
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
31396
- var version$1 = "2.2.5";
31422
+ var version$1 = "2.2.7";
31397
31423
  logger.info("Core version: " + version$1 + ".");
31398
31424
 
31399
31425
  var _obj;
@@ -33026,7 +33052,7 @@ setMaxSpriteMeshItemCount(8);
33026
33052
  */ Mesh.create = function(engine, props) {
33027
33053
  return new ThreeMesh(engine, props);
33028
33054
  };
33029
- var version = "2.2.5";
33055
+ var version = "2.2.7";
33030
33056
  logger.info("THREEJS plugin version: " + version + ".");
33031
33057
 
33032
33058
  exports.AbstractPlugin = AbstractPlugin;