@galacean/effects-core 2.3.0-beta.3 → 2.3.1

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.
@@ -95,7 +95,6 @@ export declare class ShapeComponent extends MeshComponent {
95
95
  private hasFill;
96
96
  private shapeDirty;
97
97
  private graphicsPath;
98
- private curveValues;
99
98
  private fillAttribute;
100
99
  private strokeAttributes;
101
100
  private shapeAttribute;
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.3.0-beta.3
6
+ * Version: v2.3.1
7
7
  */
8
8
 
9
9
  'use strict';
@@ -930,10 +930,10 @@ var PluginSystem = /*#__PURE__*/ function() {
930
930
  });
931
931
  })();
932
932
  };
933
- _proto.precompile = function precompile(compositions, renderer, options) {
933
+ _proto.precompile = function precompile(compositions, renderer) {
934
934
  for(var _iterator = _create_for_of_iterator_helper_loose(this.plugins), _step; !(_step = _iterator()).done;){
935
935
  var plugin = _step.value;
936
- plugin.precompile(compositions, renderer, options);
936
+ plugin.precompile(compositions, renderer);
937
937
  }
938
938
  };
939
939
  _proto.loadResources = function loadResources(scene, options) {
@@ -1008,7 +1008,7 @@ function getPluginUsageInfo(name) {
1008
1008
  * 在加载到 JSON 后,就可以进行提前编译
1009
1009
  * @param json
1010
1010
  * @param player
1011
- */ _proto.precompile = function precompile(compositions, renderer, options) {};
1011
+ */ _proto.precompile = function precompile(compositions, renderer) {};
1012
1012
  _proto.onCompositionConstructed = function onCompositionConstructed(composition, scene) {};
1013
1013
  _proto.onCompositionItemLifeBegin = function onCompositionItemLifeBegin(composition, item) {};
1014
1014
  _proto.onCompositionItemLifeEnd = function onCompositionItemLifeEnd(composition, item) {};
@@ -16327,7 +16327,6 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16327
16327
  _this.hasFill = false;
16328
16328
  _this.shapeDirty = true;
16329
16329
  _this.graphicsPath = new GraphicsPath();
16330
- _this.curveValues = [];
16331
16330
  _this.vert = "\nprecision highp float;\n\nattribute vec3 aPos;//x y\n\nuniform mat4 effects_MatrixVP;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_ObjectToWorld;\n\nvoid main() {\n vec4 pos = vec4(aPos.xyz, 1.0);\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * pos;\n}\n";
16332
16331
  _this.frag = "\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n color.rgb *= color.a;\n gl_FragColor = color;\n}\n";
16333
16332
  if (!_this.geometry) {
@@ -16509,31 +16508,25 @@ exports.ShapeComponent = /*#__PURE__*/ function(MeshComponent) {
16509
16508
  var easingOuts = customShapeAtribute.easingOuts;
16510
16509
  for(var _iterator = _create_for_of_iterator_helper_loose(customShapeAtribute.shapes), _step; !(_step = _iterator()).done;){
16511
16510
  var shape = _step.value;
16512
- this.curveValues = [];
16513
16511
  var indices = shape.indexes;
16512
+ var startPoint = points[indices[0].point];
16513
+ this.graphicsPath.moveTo(startPoint.x, startPoint.y);
16514
16514
  for(var i = 1; i < indices.length; i++){
16515
16515
  var pointIndex = indices[i];
16516
16516
  var lastPointIndex = indices[i - 1];
16517
- this.curveValues.push({
16518
- point: points[pointIndex.point],
16519
- controlPoint1: easingOuts[lastPointIndex.easingOut],
16520
- controlPoint2: easingIns[pointIndex.easingIn]
16521
- });
16522
- }
16523
- // Push the last curve
16524
- this.curveValues.push({
16525
- point: points[indices[0].point],
16526
- controlPoint1: easingOuts[indices[indices.length - 1].easingOut],
16527
- controlPoint2: easingIns[indices[0].easingIn]
16528
- });
16529
- this.graphicsPath.moveTo(this.curveValues[this.curveValues.length - 1].point.x, this.curveValues[this.curveValues.length - 1].point.y);
16530
- for(var _iterator1 = _create_for_of_iterator_helper_loose(this.curveValues), _step1; !(_step1 = _iterator1()).done;){
16531
- var curveValue = _step1.value;
16532
- var point = curveValue.point;
16533
- var control1 = curveValue.controlPoint1;
16534
- var control2 = curveValue.controlPoint2;
16535
- this.graphicsPath.bezierCurveTo(control1.x, control1.y, control2.x, control2.y, point.x, point.y, 1);
16517
+ var point = points[pointIndex.point];
16518
+ var lastPoint = points[lastPointIndex.point];
16519
+ var control1 = easingOuts[lastPointIndex.easingOut];
16520
+ var control2 = easingIns[pointIndex.easingIn];
16521
+ this.graphicsPath.bezierCurveTo(control1.x + lastPoint.x, control1.y + lastPoint.y, control2.x + point.x, control2.y + point.y, point.x, point.y, 1);
16536
16522
  }
16523
+ var pointIndex1 = indices[0];
16524
+ var lastPointIndex1 = indices[indices.length - 1];
16525
+ var point1 = points[pointIndex1.point];
16526
+ var lastPoint1 = points[lastPointIndex1.point];
16527
+ var control11 = easingOuts[lastPointIndex1.easingOut];
16528
+ var control21 = easingIns[pointIndex1.easingIn];
16529
+ this.graphicsPath.bezierCurveTo(control11.x + lastPoint1.x, control11.y + lastPoint1.y, control21.x + point1.x, control21.y + point1.y, point1.x, point1.y, 1);
16537
16530
  if (shape.close) {
16538
16531
  this.graphicsPath.closePath();
16539
16532
  }
@@ -26654,14 +26647,36 @@ function getStandardInteractContent(ui) {
26654
26647
  // @ts-expect-error
26655
26648
  customShapeComponent.fill = customShapeComponent.shapes[0].fill;
26656
26649
  }
26650
+ // easingIn 和 easingOut 绝对坐标转相对坐标
26651
+ var easingInFlag = new Array(customShapeComponent.easingIns.length);
26652
+ var easingOutFlag = new Array(customShapeComponent.easingOuts.length).fill(false);
26653
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(customShapeComponent.shapes), _step1; !(_step1 = _iterator1()).done;){
26654
+ var shape = _step1.value;
26655
+ for(var _iterator2 = _create_for_of_iterator_helper_loose(shape.indexes), _step2; !(_step2 = _iterator2()).done;){
26656
+ var index = _step2.value;
26657
+ var point = customShapeComponent.points[index.point];
26658
+ var easingIn = customShapeComponent.easingIns[index.easingIn];
26659
+ var easingOut = customShapeComponent.easingOuts[index.easingOut];
26660
+ if (!easingInFlag[index.easingIn]) {
26661
+ easingIn.x -= point.x;
26662
+ easingIn.y -= point.y;
26663
+ easingInFlag[index.easingIn] = true;
26664
+ }
26665
+ if (!easingOutFlag[index.easingOut]) {
26666
+ easingOut.x -= point.x;
26667
+ easingOut.y -= point.y;
26668
+ easingOutFlag[index.easingOut] = true;
26669
+ }
26670
+ }
26671
+ }
26657
26672
  }
26658
26673
  }
26659
26674
  }
26660
26675
  // Composition id 转 guid
26661
26676
  var compositionId = json.compositionId;
26662
26677
  var compositionIdToGUIDMap = {};
26663
- for(var _iterator1 = _create_for_of_iterator_helper_loose(json.compositions), _step1; !(_step1 = _iterator1()).done;){
26664
- var composition = _step1.value;
26678
+ for(var _iterator3 = _create_for_of_iterator_helper_loose(json.compositions), _step3; !(_step3 = _iterator3()).done;){
26679
+ var composition = _step3.value;
26665
26680
  var guid = generateGUID();
26666
26681
  compositionIdToGUIDMap[composition.id] = guid;
26667
26682
  if (composition.id === compositionId) {
@@ -26670,8 +26685,8 @@ function getStandardInteractContent(ui) {
26670
26685
  composition.id = guid;
26671
26686
  }
26672
26687
  // 预合成元素 refId 同步改为生成的合成 guid
26673
- for(var _iterator2 = _create_for_of_iterator_helper_loose(json.items), _step2; !(_step2 = _iterator2()).done;){
26674
- var item = _step2.value;
26688
+ for(var _iterator4 = _create_for_of_iterator_helper_loose(json.items), _step4; !(_step4 = _iterator4()).done;){
26689
+ var item = _step4.value;
26675
26690
  if (item.content) {
26676
26691
  var compositionOptions = item.content.options;
26677
26692
  if (compositionOptions && compositionOptions.refId !== undefined) {
@@ -27525,8 +27540,10 @@ function getStandardJSON(json) {
27525
27540
  json = version30Migration(version21Migration(json));
27526
27541
  }
27527
27542
  // 3.x 版本格式转换
27528
- if (mainVersion < 4 || mainVersion === 4 && minorVersion < 2) {
27529
- json = version31Migration(json);
27543
+ if (mainVersion < 4) {
27544
+ if (mainVersion === 3 && minorVersion < 2) {
27545
+ json = version31Migration(json);
27546
+ }
27530
27547
  }
27531
27548
  return json;
27532
27549
  }
@@ -32079,7 +32096,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
32079
32096
  registerPlugin("particle", ParticleLoader, exports.VFXItem);
32080
32097
  registerPlugin("cal", CalculateLoader, exports.VFXItem);
32081
32098
  registerPlugin("interact", InteractLoader, exports.VFXItem);
32082
- var version = "2.3.0-beta.3";
32099
+ var version = "2.3.1";
32083
32100
  logger.info("Core version: " + version + ".");
32084
32101
 
32085
32102
  exports.AbstractPlugin = AbstractPlugin;