@galacean/effects-threejs 2.2.5 → 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 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.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
- "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,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.error("Trigger TouchEvent after EventSystem is disposed.");
16303
+ logger.warn("Trigger TouchEvent after EventSystem is disposed.");
16286
16304
  return {
16287
16305
  x: x,
16288
16306
  y: y,
@@ -26024,6 +26042,18 @@ function getStandardInteractContent(ui) {
26024
26042
  });
26025
26043
  return json;
26026
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
+ }
26027
26057
  /**
26028
26058
  * 3.0 以下版本数据适配(runtime 2.0及以上版本支持)
26029
26059
  */ function version30Migration(json) {
@@ -26851,6 +26881,8 @@ function getStandardJSON(json) {
26851
26881
  }
26852
26882
  // 修正老版本数据中,meshItem 以及 lightItem 结束行为错误问题
26853
26883
  version22Migration(json);
26884
+ // 修正老版本数据中,富文本插件名称的问题
26885
+ version31Migration(json);
26854
26886
  if (v0.test(json.version)) {
26855
26887
  var _exec;
26856
26888
  reverseParticle = ((_exec = /^(\d+)/.exec(json.version)) == null ? void 0 : _exec[0]) === "0";
@@ -31393,7 +31425,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem, true);
31393
31425
  registerPlugin("particle", ParticleLoader, exports.VFXItem, true);
31394
31426
  registerPlugin("cal", CalculateLoader, exports.VFXItem, true);
31395
31427
  registerPlugin("interact", InteractLoader, exports.VFXItem, true);
31396
- var version$1 = "2.2.5";
31428
+ var version$1 = "2.2.6";
31397
31429
  logger.info("Core version: " + version$1 + ".");
31398
31430
 
31399
31431
  var _obj;
@@ -33026,7 +33058,7 @@ setMaxSpriteMeshItemCount(8);
33026
33058
  */ Mesh.create = function(engine, props) {
33027
33059
  return new ThreeMesh(engine, props);
33028
33060
  };
33029
- var version = "2.2.5";
33061
+ var version = "2.2.6";
33030
33062
  logger.info("THREEJS plugin version: " + version + ".");
33031
33063
 
33032
33064
  exports.AbstractPlugin = AbstractPlugin;