@galacean/effects-specification 2.0.0-alpha.1 → 2.0.0-alpha.3

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.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Name: @galacean/effects-specification
3
3
  * Description: Galacean Effects JSON Specification
4
4
  * Author: Ant Group CO., Ltd.
5
- * Version: v2.0.0-alpha.1
5
+ * Version: v2.0.0-alpha.3
6
6
  */
7
7
 
8
8
  'use strict';
@@ -618,6 +618,12 @@ var ModelBoundingType;
618
618
  ModelBoundingType[ModelBoundingType["sphere"] = 3] = "sphere";
619
619
  })(ModelBoundingType || (ModelBoundingType = {}));
620
620
 
621
+ var CameraType;
622
+ (function (CameraType) {
623
+ CameraType["orthographic"] = "orthographic";
624
+ CameraType["perspective"] = "perspective";
625
+ })(CameraType || (CameraType = {}));
626
+
621
627
  // 材质类型
622
628
  var MaterialType;
623
629
  (function (MaterialType) {
@@ -1535,7 +1541,7 @@ function version22Migration(json) {
1535
1541
  */
1536
1542
  function version30Migration(json) {
1537
1543
  var e_1, _a;
1538
- var _b, _c, _d, _e;
1544
+ var _b, _c, _d, _e, _f, _g, _h, _j;
1539
1545
  var result = Object.assign({}, json, {
1540
1546
  items: [],
1541
1547
  components: [],
@@ -1563,15 +1569,15 @@ function version30Migration(json) {
1563
1569
  }
1564
1570
  }
1565
1571
  var _loop_1 = function (composition) {
1566
- var e_2, _h, e_3, _j;
1572
+ var e_2, _m, e_3, _o;
1567
1573
  // composition 的 endbehaviour 兼容
1568
1574
  if (composition.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY || composition.endBehavior === END_BEHAVIOR_PAUSE) {
1569
1575
  composition.endBehavior = END_BEHAVIOR_FREEZE;
1570
1576
  }
1571
1577
  var itemGuidMap = {};
1572
1578
  try {
1573
- for (var _k = (e_2 = void 0, __values(composition.items)), _l = _k.next(); !_l.done; _l = _k.next()) {
1574
- var item = _l.value;
1579
+ for (var _p = (e_2 = void 0, __values(composition.items)), _q = _p.next(); !_q.done; _q = _p.next()) {
1580
+ var item = _q.value;
1575
1581
  itemGuidMap[item.id] = generateGUID();
1576
1582
  // TODO: 编辑器测试用,上线后删除
1577
1583
  //@ts-expect-error
@@ -1582,7 +1588,7 @@ function version30Migration(json) {
1582
1588
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
1583
1589
  finally {
1584
1590
  try {
1585
- if (_l && !_l.done && (_h = _k.return)) _h.call(_k);
1591
+ if (_q && !_q.done && (_m = _p.return)) _m.call(_p);
1586
1592
  }
1587
1593
  finally { if (e_2) throw e_2.error; }
1588
1594
  }
@@ -1603,8 +1609,8 @@ function version30Migration(json) {
1603
1609
  composition.items[index] = { id: item.id };
1604
1610
  });
1605
1611
  try {
1606
- for (var _m = (e_3 = void 0, __values(result.items)), _o = _m.next(); !_o.done; _o = _m.next()) {
1607
- var item = _o.value;
1612
+ for (var _r = (e_3 = void 0, __values(result.items)), _s = _r.next(); !_s.done; _s = _r.next()) {
1613
+ var item = _s.value;
1608
1614
  // 原 texture 索引转为统一 guid 索引
1609
1615
  if (item.content) {
1610
1616
  if (item.content.renderer) {
@@ -1653,13 +1659,10 @@ function version30Migration(json) {
1653
1659
  var startSize = item.transform.size;
1654
1660
  // 兼容旧JSON(anchor和particleOrigin可能同时存在)
1655
1661
  if (!renderer.anchor && renderer.particleOrigin !== undefined) {
1656
- //@ts-expect-error
1657
- item.transform.position.x += -realAnchor[0] * startSize.x;
1658
- //@ts-expect-error
1659
- item.transform.position.y += -realAnchor[1] * startSize.y;
1662
+ item.transform.position.x += -realAnchor[0] * ((_f = startSize === null || startSize === void 0 ? void 0 : startSize.x) !== null && _f !== void 0 ? _f : 1);
1663
+ item.transform.position.y += -realAnchor[1] * ((_g = startSize === null || startSize === void 0 ? void 0 : startSize.y) !== null && _g !== void 0 ? _g : 1);
1660
1664
  }
1661
- //@ts-expect-error
1662
- item.transform.anchor = { x: realAnchor[0] * startSize.x, y: realAnchor[1] * startSize.y };
1665
+ item.transform.anchor = { x: realAnchor[0] * ((_h = startSize === null || startSize === void 0 ? void 0 : startSize.x) !== null && _h !== void 0 ? _h : 1), y: realAnchor[1] * ((_j = startSize === null || startSize === void 0 ? void 0 : startSize.y) !== null && _j !== void 0 ? _j : 1) };
1663
1666
  }
1664
1667
  }
1665
1668
  if (item.type === ItemType.particle) {
@@ -1811,22 +1814,22 @@ function version30Migration(json) {
1811
1814
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
1812
1815
  finally {
1813
1816
  try {
1814
- if (_o && !_o.done && (_j = _m.return)) _j.call(_m);
1817
+ if (_s && !_s.done && (_o = _r.return)) _o.call(_r);
1815
1818
  }
1816
1819
  finally { if (e_3) throw e_3.error; }
1817
1820
  }
1818
1821
  };
1819
1822
  try {
1820
1823
  // 更正Composition.endBehavior
1821
- for (var _f = __values(json.compositions), _g = _f.next(); !_g.done; _g = _f.next()) {
1822
- var composition = _g.value;
1824
+ for (var _k = __values(json.compositions), _l = _k.next(); !_l.done; _l = _k.next()) {
1825
+ var composition = _l.value;
1823
1826
  _loop_1(composition);
1824
1827
  }
1825
1828
  }
1826
1829
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
1827
1830
  finally {
1828
1831
  try {
1829
- if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
1832
+ if (_l && !_l.done && (_a = _k.return)) _a.call(_k);
1830
1833
  }
1831
1834
  finally { if (e_1) throw e_1.error; }
1832
1835
  }