@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.mjs 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
  const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
@@ -614,6 +614,12 @@ var ModelBoundingType;
614
614
  ModelBoundingType[ModelBoundingType["sphere"] = 3] = "sphere";
615
615
  })(ModelBoundingType || (ModelBoundingType = {}));
616
616
 
617
+ var CameraType;
618
+ (function (CameraType) {
619
+ CameraType["orthographic"] = "orthographic";
620
+ CameraType["perspective"] = "perspective";
621
+ })(CameraType || (CameraType = {}));
622
+
617
623
  // 材质类型
618
624
  var MaterialType;
619
625
  (function (MaterialType) {
@@ -1531,7 +1537,7 @@ function version22Migration(json) {
1531
1537
  */
1532
1538
  function version30Migration(json) {
1533
1539
  var e_1, _a;
1534
- var _b, _c, _d, _e;
1540
+ var _b, _c, _d, _e, _f, _g, _h, _j;
1535
1541
  var result = Object.assign({}, json, {
1536
1542
  items: [],
1537
1543
  components: [],
@@ -1559,15 +1565,15 @@ function version30Migration(json) {
1559
1565
  }
1560
1566
  }
1561
1567
  var _loop_1 = function (composition) {
1562
- var e_2, _h, e_3, _j;
1568
+ var e_2, _m, e_3, _o;
1563
1569
  // composition 的 endbehaviour 兼容
1564
1570
  if (composition.endBehavior === END_BEHAVIOR_PAUSE_AND_DESTROY || composition.endBehavior === END_BEHAVIOR_PAUSE) {
1565
1571
  composition.endBehavior = END_BEHAVIOR_FREEZE;
1566
1572
  }
1567
1573
  var itemGuidMap = {};
1568
1574
  try {
1569
- for (var _k = (e_2 = void 0, __values(composition.items)), _l = _k.next(); !_l.done; _l = _k.next()) {
1570
- var item = _l.value;
1575
+ for (var _p = (e_2 = void 0, __values(composition.items)), _q = _p.next(); !_q.done; _q = _p.next()) {
1576
+ var item = _q.value;
1571
1577
  itemGuidMap[item.id] = generateGUID();
1572
1578
  // TODO: 编辑器测试用,上线后删除
1573
1579
  //@ts-expect-error
@@ -1578,7 +1584,7 @@ function version30Migration(json) {
1578
1584
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
1579
1585
  finally {
1580
1586
  try {
1581
- if (_l && !_l.done && (_h = _k.return)) _h.call(_k);
1587
+ if (_q && !_q.done && (_m = _p.return)) _m.call(_p);
1582
1588
  }
1583
1589
  finally { if (e_2) throw e_2.error; }
1584
1590
  }
@@ -1599,8 +1605,8 @@ function version30Migration(json) {
1599
1605
  composition.items[index] = { id: item.id };
1600
1606
  });
1601
1607
  try {
1602
- for (var _m = (e_3 = void 0, __values(result.items)), _o = _m.next(); !_o.done; _o = _m.next()) {
1603
- var item = _o.value;
1608
+ for (var _r = (e_3 = void 0, __values(result.items)), _s = _r.next(); !_s.done; _s = _r.next()) {
1609
+ var item = _s.value;
1604
1610
  // 原 texture 索引转为统一 guid 索引
1605
1611
  if (item.content) {
1606
1612
  if (item.content.renderer) {
@@ -1649,13 +1655,10 @@ function version30Migration(json) {
1649
1655
  var startSize = item.transform.size;
1650
1656
  // 兼容旧JSON(anchor和particleOrigin可能同时存在)
1651
1657
  if (!renderer.anchor && renderer.particleOrigin !== undefined) {
1652
- //@ts-expect-error
1653
- item.transform.position.x += -realAnchor[0] * startSize.x;
1654
- //@ts-expect-error
1655
- item.transform.position.y += -realAnchor[1] * startSize.y;
1658
+ item.transform.position.x += -realAnchor[0] * ((_f = startSize === null || startSize === void 0 ? void 0 : startSize.x) !== null && _f !== void 0 ? _f : 1);
1659
+ item.transform.position.y += -realAnchor[1] * ((_g = startSize === null || startSize === void 0 ? void 0 : startSize.y) !== null && _g !== void 0 ? _g : 1);
1656
1660
  }
1657
- //@ts-expect-error
1658
- item.transform.anchor = { x: realAnchor[0] * startSize.x, y: realAnchor[1] * startSize.y };
1661
+ 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) };
1659
1662
  }
1660
1663
  }
1661
1664
  if (item.type === ItemType.particle) {
@@ -1807,22 +1810,22 @@ function version30Migration(json) {
1807
1810
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
1808
1811
  finally {
1809
1812
  try {
1810
- if (_o && !_o.done && (_j = _m.return)) _j.call(_m);
1813
+ if (_s && !_s.done && (_o = _r.return)) _o.call(_r);
1811
1814
  }
1812
1815
  finally { if (e_3) throw e_3.error; }
1813
1816
  }
1814
1817
  };
1815
1818
  try {
1816
1819
  // 更正Composition.endBehavior
1817
- for (var _f = __values(json.compositions), _g = _f.next(); !_g.done; _g = _f.next()) {
1818
- var composition = _g.value;
1820
+ for (var _k = __values(json.compositions), _l = _k.next(); !_l.done; _l = _k.next()) {
1821
+ var composition = _l.value;
1819
1822
  _loop_1(composition);
1820
1823
  }
1821
1824
  }
1822
1825
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
1823
1826
  finally {
1824
1827
  try {
1825
- if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
1828
+ if (_l && !_l.done && (_a = _k.return)) _a.call(_k);
1826
1829
  }
1827
1830
  finally { if (e_1) throw e_1.error; }
1828
1831
  }