@esotericsoftware/spine-webgl 4.3.4 → 4.3.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.
@@ -1303,17 +1303,14 @@ var Animation = class {
1303
1303
  * @param loop True if `time` beyond the {@link duration} repeats the animation, else the last frame is used.
1304
1304
  * @param events If any events are fired, they are added to this list. Pass null to ignore fired events or if no timelines fire
1305
1305
  * events.
1306
- * @param alpha 0 applies setup or current values (depending on `fromSetup`), 1 uses timeline values, and
1307
- * intermediate values interpolate between them. Adjusting `alpha` over time can mix an animation in or
1308
- * out.
1309
- * @param fromSetup If true, `alpha` transitions between setup and timeline values, setup values are used before the
1310
- * first frame (current values are not used). If false, `alpha` transitions between current and timeline
1311
- * values, no change is made before the first frame.
1306
+ * @param alpha 0 applies setup or current values (depending on `from`), 1 uses timeline values, and intermediate
1307
+ * values interpolate between them. Adjusting `alpha` over time can mix an animation in or out.
1308
+ * @param from Controls how `alpha` and `add` mix from current or setup pose values to timeline values.
1312
1309
  * @param add If true, for timelines that support it, their values are added to the setup or current values (depending on
1313
- * `fromSetup`).
1310
+ * `from`).
1314
1311
  * @param out True when the animation is mixing out, else it is mixing in. Used by timelines that perform instant transitions.
1315
1312
  * @param appliedPose True to modify {@link Posed.appliedPose}, else {@link Posed.pose} is modified. */
1316
- apply(skeleton, lastTime, time, loop, events, alpha, fromSetup, add, out, appliedPose) {
1313
+ apply(skeleton, lastTime, time, loop, events, alpha, from, add, out, appliedPose) {
1317
1314
  if (!skeleton) throw new Error("skeleton cannot be null.");
1318
1315
  if (loop && this.duration !== 0) {
1319
1316
  time %= this.duration;
@@ -1321,9 +1318,15 @@ var Animation = class {
1321
1318
  }
1322
1319
  const timelines = this.timelines;
1323
1320
  for (let i = 0, n = timelines.length; i < n; i++)
1324
- timelines[i].apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose);
1321
+ timelines[i].apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose);
1325
1322
  }
1326
1323
  };
1324
+ var MixFrom = /* @__PURE__ */ ((MixFrom2) => {
1325
+ MixFrom2[MixFrom2["current"] = 0] = "current";
1326
+ MixFrom2[MixFrom2["setup"] = 1] = "setup";
1327
+ MixFrom2[MixFrom2["first"] = 2] = "first";
1328
+ return MixFrom2;
1329
+ })(MixFrom || {});
1327
1330
  var Property = /* @__PURE__ */ ((Property2) => {
1328
1331
  Property2[Property2["rotate"] = 0] = "rotate";
1329
1332
  Property2[Property2["x"] = 1] = "x";
@@ -1340,28 +1343,31 @@ var Property = /* @__PURE__ */ ((Property2) => {
1340
1343
  Property2[Property2["deform"] = 12] = "deform";
1341
1344
  Property2[Property2["event"] = 13] = "event";
1342
1345
  Property2[Property2["drawOrder"] = 14] = "drawOrder";
1343
- Property2[Property2["ikConstraint"] = 15] = "ikConstraint";
1344
- Property2[Property2["transformConstraint"] = 16] = "transformConstraint";
1345
- Property2[Property2["pathConstraintPosition"] = 17] = "pathConstraintPosition";
1346
- Property2[Property2["pathConstraintSpacing"] = 18] = "pathConstraintSpacing";
1347
- Property2[Property2["pathConstraintMix"] = 19] = "pathConstraintMix";
1348
- Property2[Property2["physicsConstraintInertia"] = 20] = "physicsConstraintInertia";
1349
- Property2[Property2["physicsConstraintStrength"] = 21] = "physicsConstraintStrength";
1350
- Property2[Property2["physicsConstraintDamping"] = 22] = "physicsConstraintDamping";
1351
- Property2[Property2["physicsConstraintMass"] = 23] = "physicsConstraintMass";
1352
- Property2[Property2["physicsConstraintWind"] = 24] = "physicsConstraintWind";
1353
- Property2[Property2["physicsConstraintGravity"] = 25] = "physicsConstraintGravity";
1354
- Property2[Property2["physicsConstraintMix"] = 26] = "physicsConstraintMix";
1355
- Property2[Property2["physicsConstraintReset"] = 27] = "physicsConstraintReset";
1356
- Property2[Property2["sequence"] = 28] = "sequence";
1357
- Property2[Property2["sliderTime"] = 29] = "sliderTime";
1358
- Property2[Property2["sliderMix"] = 30] = "sliderMix";
1346
+ Property2[Property2["drawOrderFolder"] = 15] = "drawOrderFolder";
1347
+ Property2[Property2["ikConstraint"] = 16] = "ikConstraint";
1348
+ Property2[Property2["transformConstraint"] = 17] = "transformConstraint";
1349
+ Property2[Property2["pathConstraintPosition"] = 18] = "pathConstraintPosition";
1350
+ Property2[Property2["pathConstraintSpacing"] = 19] = "pathConstraintSpacing";
1351
+ Property2[Property2["pathConstraintMix"] = 20] = "pathConstraintMix";
1352
+ Property2[Property2["physicsConstraintInertia"] = 21] = "physicsConstraintInertia";
1353
+ Property2[Property2["physicsConstraintStrength"] = 22] = "physicsConstraintStrength";
1354
+ Property2[Property2["physicsConstraintDamping"] = 23] = "physicsConstraintDamping";
1355
+ Property2[Property2["physicsConstraintMass"] = 24] = "physicsConstraintMass";
1356
+ Property2[Property2["physicsConstraintWind"] = 25] = "physicsConstraintWind";
1357
+ Property2[Property2["physicsConstraintGravity"] = 26] = "physicsConstraintGravity";
1358
+ Property2[Property2["physicsConstraintMix"] = 27] = "physicsConstraintMix";
1359
+ Property2[Property2["physicsConstraintReset"] = 28] = "physicsConstraintReset";
1360
+ Property2[Property2["sequence"] = 29] = "sequence";
1361
+ Property2[Property2["sliderTime"] = 30] = "sliderTime";
1362
+ Property2[Property2["sliderMix"] = 31] = "sliderMix";
1359
1363
  return Property2;
1360
1364
  })(Property || {});
1361
1365
  var Timeline = class {
1362
1366
  propertyIds;
1363
1367
  frames;
1364
- /** True if this timeline supports additive blending. */
1368
+ /** True if this timeline supports being applied additively.
1369
+ *
1370
+ * See the `add` parameter in {@link Timeline.apply}. */
1365
1371
  additive = false;
1366
1372
  /** True if this timeline sets values instantaneously and does not support interpolation between frames. */
1367
1373
  instant = false;
@@ -1482,7 +1488,7 @@ var CurveTimeline = class extends Timeline {
1482
1488
  return y + (time - x) / (this.frames[frameIndex] - x) * (this.frames[frameIndex + valueOffset] - y);
1483
1489
  }
1484
1490
  };
1485
- var CurveTimeline1 = class extends CurveTimeline {
1491
+ var CurveTimeline1 = class _CurveTimeline1 extends CurveTimeline {
1486
1492
  constructor(frameCount, bezierCount, propertyId) {
1487
1493
  super(frameCount, bezierCount, propertyId);
1488
1494
  }
@@ -1545,41 +1551,51 @@ var CurveTimeline1 = class extends CurveTimeline {
1545
1551
  * See {@link Timeline.apply}.
1546
1552
  * @param current The current value for the property.
1547
1553
  * @param setup The setup value for the property. */
1548
- getRelativeValue(time, alpha, fromSetup, add, current, setup) {
1549
- if (time < this.frames[0]) return fromSetup ? setup : current;
1554
+ getRelativeValue(time, alpha, from, add, current, setup) {
1555
+ if (time < this.frames[0]) return _CurveTimeline1.beforeFirstKey(from, alpha, current, setup);
1550
1556
  const value = this.getCurveValue(time);
1551
- return fromSetup ? setup + value * alpha : current + (add ? value : value + setup - current) * alpha;
1557
+ return from === 1 /* setup */ ? setup + value * alpha : current + (add ? value : value + setup - current) * alpha;
1552
1558
  }
1553
- getAbsoluteValue(time, alpha, fromSetup, add, current, setup, value) {
1559
+ getAbsoluteValue(time, alpha, from, add, current, setup, value) {
1554
1560
  if (value === void 0)
1555
- return this.getAbsoluteValue1(time, alpha, fromSetup, add, current, setup);
1561
+ return this.getAbsoluteValue1(time, alpha, from, add, current, setup);
1556
1562
  else
1557
- return this.getAbsoluteValue2(time, alpha, fromSetup, add, current, setup, value);
1563
+ return this.getAbsoluteValue2(time, alpha, from, add, current, setup, value);
1558
1564
  }
1559
- getAbsoluteValue1(time, alpha, fromSetup, add, current, setup) {
1560
- if (time < this.frames[0]) return fromSetup ? setup : current;
1565
+ getAbsoluteValue1(time, alpha, from, add, current, setup) {
1566
+ if (time < this.frames[0]) return _CurveTimeline1.beforeFirstKey(from, alpha, current, setup);
1561
1567
  const value = this.getCurveValue(time);
1562
- return fromSetup ? setup + (add ? value : value - setup) * alpha : current + (add ? value : value - current) * alpha;
1568
+ return from === 1 /* setup */ ? setup + (add ? value : value - setup) * alpha : current + (add ? value : value - current) * alpha;
1563
1569
  }
1564
- getAbsoluteValue2(time, alpha, fromSetup, add, current, setup, value) {
1565
- if (time < this.frames[0]) return fromSetup ? setup : current;
1566
- return fromSetup ? setup + (add ? value : value - setup) * alpha : current + (add ? value : value - current) * alpha;
1570
+ getAbsoluteValue2(time, alpha, from, add, current, setup, value) {
1571
+ if (time < this.frames[0]) return _CurveTimeline1.beforeFirstKey(from, alpha, current, setup);
1572
+ return from === 1 /* setup */ ? setup + (add ? value : value - setup) * alpha : current + (add ? value : value - current) * alpha;
1567
1573
  }
1568
1574
  /** Returns the interpolated value for scale properties. The timeline and setup values are multiplied and sign adjusted.
1569
1575
  *
1570
1576
  * See {@link Timeline.apply}.
1571
1577
  * @param current The current value for the property.
1572
1578
  * @param setup The setup value for the property. */
1573
- getScaleValue(time, alpha, fromSetup, add, out, current, setup) {
1574
- if (time < this.frames[0]) return fromSetup ? setup : current;
1579
+ getScaleValue(time, alpha, from, add, out, current, setup) {
1580
+ if (time < this.frames[0]) return _CurveTimeline1.beforeFirstKey(from, alpha, current, setup);
1575
1581
  const value = this.getCurveValue(time) * setup;
1576
1582
  if (alpha === 1 && !add) return value;
1577
- let base = fromSetup ? setup : current;
1583
+ let base = from === 1 /* setup */ ? setup : current;
1578
1584
  if (add) return base + (value - setup) * alpha;
1579
1585
  if (out) return base + (Math.abs(value) * Math.sign(base) - base) * alpha;
1580
1586
  base = Math.abs(base) * Math.sign(value);
1581
1587
  return base + (value - base) * alpha;
1582
1588
  }
1589
+ static beforeFirstKey(from, alpha, current, setup) {
1590
+ switch (from) {
1591
+ case 1 /* setup */:
1592
+ return setup;
1593
+ case 2 /* first */:
1594
+ return current + (setup - current) * alpha;
1595
+ case 0 /* current */:
1596
+ return current;
1597
+ }
1598
+ }
1583
1599
  };
1584
1600
  function isBoneTimeline(obj) {
1585
1601
  return typeof obj === "object" && obj !== null && typeof obj.boneIndex === "number";
@@ -1591,10 +1607,10 @@ var BoneTimeline1 = class extends CurveTimeline1 {
1591
1607
  this.boneIndex = boneIndex;
1592
1608
  this.additive = true;
1593
1609
  }
1594
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
1610
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
1595
1611
  const bone = skeleton.bones[this.boneIndex];
1596
1612
  if (bone.active)
1597
- this.apply1(appliedPose ? bone.appliedPose : bone.pose, bone.data.setupPose, time, alpha, fromSetup, add, out);
1613
+ this.apply1(appliedPose ? bone.appliedPose : bone.pose, bone.data.setupPose, time, alpha, from, add, out);
1598
1614
  }
1599
1615
  };
1600
1616
  var BoneTimeline2 = class extends CurveTimeline {
@@ -1624,30 +1640,36 @@ var BoneTimeline2 = class extends CurveTimeline {
1624
1640
  /*VALUE2*/
1625
1641
  ] = value2;
1626
1642
  }
1627
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
1643
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
1628
1644
  const bone = skeleton.bones[this.boneIndex];
1629
1645
  if (bone.active)
1630
- this.apply1(appliedPose ? bone.appliedPose : bone.pose, bone.data.setupPose, time, alpha, fromSetup, add, out);
1646
+ this.apply1(appliedPose ? bone.appliedPose : bone.pose, bone.data.setupPose, time, alpha, from, add, out);
1631
1647
  }
1632
1648
  };
1633
1649
  var RotateTimeline = class extends BoneTimeline1 {
1634
1650
  constructor(frameCount, bezierCount, boneIndex) {
1635
1651
  super(frameCount, bezierCount, boneIndex, 0 /* rotate */);
1636
1652
  }
1637
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1638
- pose.rotation = this.getRelativeValue(time, alpha, fromSetup, add, pose.rotation, setup.rotation);
1653
+ apply1(pose, setup, time, alpha, from, add, out) {
1654
+ pose.rotation = this.getRelativeValue(time, alpha, from, add, pose.rotation, setup.rotation);
1639
1655
  }
1640
1656
  };
1641
1657
  var TranslateTimeline = class extends BoneTimeline2 {
1642
1658
  constructor(frameCount, bezierCount, boneIndex) {
1643
1659
  super(frameCount, bezierCount, boneIndex, 1 /* x */, 2 /* y */);
1644
1660
  }
1645
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1661
+ apply1(pose, setup, time, alpha, from, add, out) {
1646
1662
  const frames = this.frames;
1647
1663
  if (time < frames[0]) {
1648
- if (fromSetup) {
1649
- pose.x = setup.x;
1650
- pose.y = setup.y;
1664
+ switch (from) {
1665
+ case 1 /* setup */:
1666
+ pose.x = setup.x;
1667
+ pose.y = setup.y;
1668
+ break;
1669
+ case 2 /* first */:
1670
+ pose.x += (setup.x - pose.x) * alpha;
1671
+ pose.y += (setup.y - pose.y) * alpha;
1672
+ break;
1651
1673
  }
1652
1674
  return;
1653
1675
  }
@@ -1713,7 +1735,7 @@ var TranslateTimeline = class extends BoneTimeline2 {
1713
1735
  /*BEZIER*/
1714
1736
  );
1715
1737
  }
1716
- if (fromSetup) {
1738
+ if (from === 1 /* setup */) {
1717
1739
  pose.x = setup.x + x * alpha;
1718
1740
  pose.y = setup.y + y * alpha;
1719
1741
  } else if (add) {
@@ -1729,28 +1751,34 @@ var TranslateXTimeline = class extends BoneTimeline1 {
1729
1751
  constructor(frameCount, bezierCount, boneIndex) {
1730
1752
  super(frameCount, bezierCount, boneIndex, 1 /* x */);
1731
1753
  }
1732
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1733
- pose.x = this.getRelativeValue(time, alpha, fromSetup, add, pose.x, setup.x);
1754
+ apply1(pose, setup, time, alpha, from, add, out) {
1755
+ pose.x = this.getRelativeValue(time, alpha, from, add, pose.x, setup.x);
1734
1756
  }
1735
1757
  };
1736
1758
  var TranslateYTimeline = class extends BoneTimeline1 {
1737
1759
  constructor(frameCount, bezierCount, boneIndex) {
1738
1760
  super(frameCount, bezierCount, boneIndex, 2 /* y */);
1739
1761
  }
1740
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1741
- pose.y = this.getRelativeValue(time, alpha, fromSetup, add, pose.y, setup.y);
1762
+ apply1(pose, setup, time, alpha, from, add, out) {
1763
+ pose.y = this.getRelativeValue(time, alpha, from, add, pose.y, setup.y);
1742
1764
  }
1743
1765
  };
1744
1766
  var ScaleTimeline = class extends BoneTimeline2 {
1745
1767
  constructor(frameCount, bezierCount, boneIndex) {
1746
1768
  super(frameCount, bezierCount, boneIndex, 3 /* scaleX */, 4 /* scaleY */);
1747
1769
  }
1748
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1770
+ apply1(pose, setup, time, alpha, from, add, out) {
1749
1771
  const frames = this.frames;
1750
1772
  if (time < frames[0]) {
1751
- if (fromSetup) {
1752
- pose.scaleX = setup.scaleX;
1753
- pose.scaleY = setup.scaleY;
1773
+ switch (from) {
1774
+ case 1 /* setup */:
1775
+ pose.scaleX = setup.scaleX;
1776
+ pose.scaleY = setup.scaleY;
1777
+ break;
1778
+ case 2 /* first */:
1779
+ pose.scaleX += (setup.scaleX - pose.scaleX) * alpha;
1780
+ pose.scaleY += (setup.scaleY - pose.scaleY) * alpha;
1781
+ break;
1754
1782
  }
1755
1783
  return;
1756
1784
  }
@@ -1823,7 +1851,7 @@ var ScaleTimeline = class extends BoneTimeline2 {
1823
1851
  pose.scaleY = y;
1824
1852
  } else {
1825
1853
  let bx = 0, by = 0;
1826
- if (fromSetup) {
1854
+ if (from === 1 /* setup */) {
1827
1855
  bx = setup.scaleX;
1828
1856
  by = setup.scaleY;
1829
1857
  } else {
@@ -1849,28 +1877,34 @@ var ScaleXTimeline = class extends BoneTimeline1 {
1849
1877
  constructor(frameCount, bezierCount, boneIndex) {
1850
1878
  super(frameCount, bezierCount, boneIndex, 3 /* scaleX */);
1851
1879
  }
1852
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1853
- pose.scaleX = this.getScaleValue(time, alpha, fromSetup, add, out, pose.scaleX, setup.scaleX);
1880
+ apply1(pose, setup, time, alpha, from, add, out) {
1881
+ pose.scaleX = this.getScaleValue(time, alpha, from, add, out, pose.scaleX, setup.scaleX);
1854
1882
  }
1855
1883
  };
1856
1884
  var ScaleYTimeline = class extends BoneTimeline1 {
1857
1885
  constructor(frameCount, bezierCount, boneIndex) {
1858
1886
  super(frameCount, bezierCount, boneIndex, 4 /* scaleY */);
1859
1887
  }
1860
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1861
- pose.scaleY = this.getScaleValue(time, alpha, fromSetup, add, out, pose.scaleY, setup.scaleY);
1888
+ apply1(pose, setup, time, alpha, from, add, out) {
1889
+ pose.scaleY = this.getScaleValue(time, alpha, from, add, out, pose.scaleY, setup.scaleY);
1862
1890
  }
1863
1891
  };
1864
1892
  var ShearTimeline = class extends BoneTimeline2 {
1865
1893
  constructor(frameCount, bezierCount, boneIndex) {
1866
1894
  super(frameCount, bezierCount, boneIndex, 5 /* shearX */, 6 /* shearY */);
1867
1895
  }
1868
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1896
+ apply1(pose, setup, time, alpha, from, add, out) {
1869
1897
  const frames = this.frames;
1870
1898
  if (time < frames[0]) {
1871
- if (fromSetup) {
1872
- pose.shearX = setup.shearX;
1873
- pose.shearY = setup.shearY;
1899
+ switch (from) {
1900
+ case 1 /* setup */:
1901
+ pose.shearX = setup.shearX;
1902
+ pose.shearY = setup.shearY;
1903
+ break;
1904
+ case 2 /* first */:
1905
+ pose.shearX += (setup.shearX - pose.shearX) * alpha;
1906
+ pose.shearY += (setup.shearY - pose.shearY) * alpha;
1907
+ break;
1874
1908
  }
1875
1909
  return;
1876
1910
  }
@@ -1936,7 +1970,7 @@ var ShearTimeline = class extends BoneTimeline2 {
1936
1970
  /*BEZIER*/
1937
1971
  );
1938
1972
  }
1939
- if (fromSetup) {
1973
+ if (from === 1 /* setup */) {
1940
1974
  pose.shearX = setup.shearX + x * alpha;
1941
1975
  pose.shearY = setup.shearY + y * alpha;
1942
1976
  } else if (add) {
@@ -1952,16 +1986,16 @@ var ShearXTimeline = class extends BoneTimeline1 {
1952
1986
  constructor(frameCount, bezierCount, boneIndex) {
1953
1987
  super(frameCount, bezierCount, boneIndex, 5 /* shearX */);
1954
1988
  }
1955
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1956
- pose.shearX = this.getRelativeValue(time, alpha, fromSetup, add, pose.shearX, setup.shearX);
1989
+ apply1(pose, setup, time, alpha, from, add, out) {
1990
+ pose.shearX = this.getRelativeValue(time, alpha, from, add, pose.shearX, setup.shearX);
1957
1991
  }
1958
1992
  };
1959
1993
  var ShearYTimeline = class extends BoneTimeline1 {
1960
1994
  constructor(frameCount, bezierCount, boneIndex) {
1961
1995
  super(frameCount, bezierCount, boneIndex, 6 /* shearY */);
1962
1996
  }
1963
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1964
- pose.shearY = this.getRelativeValue(time, alpha, fromSetup, add, pose.shearY, setup.shearY);
1997
+ apply1(pose, setup, time, alpha, from, add, out) {
1998
+ pose.shearY = this.getRelativeValue(time, alpha, from, add, pose.shearY, setup.shearY);
1965
1999
  }
1966
2000
  };
1967
2001
  var InheritTimeline = class extends Timeline {
@@ -1985,16 +2019,16 @@ var InheritTimeline = class extends Timeline {
1985
2019
  /*INHERIT*/
1986
2020
  ] = inherit;
1987
2021
  }
1988
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
2022
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
1989
2023
  const bone = skeleton.bones[this.boneIndex];
1990
2024
  if (!bone.active) return;
1991
2025
  const pose = appliedPose ? bone.appliedPose : bone.pose;
1992
2026
  if (out) {
1993
- if (fromSetup) pose.inherit = bone.data.setupPose.inherit;
2027
+ if (from !== 0 /* current */) pose.inherit = bone.data.setupPose.inherit;
1994
2028
  } else {
1995
2029
  const frames = this.frames;
1996
2030
  if (time < frames[0]) {
1997
- if (fromSetup) pose.inherit = bone.data.setupPose.inherit;
2031
+ if (from !== 0 /* current */) pose.inherit = bone.data.setupPose.inherit;
1998
2032
  } else
1999
2033
  pose.inherit = this.frames[
2000
2034
  Timeline.search(
@@ -2014,9 +2048,9 @@ var SlotCurveTimeline = class extends CurveTimeline {
2014
2048
  super(frameCount, bezierCount, ...propertyIds);
2015
2049
  this.slotIndex = slotIndex;
2016
2050
  }
2017
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
2051
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
2018
2052
  const slot = skeleton.slots[this.slotIndex];
2019
- if (slot.bone.active) this.apply1(slot, appliedPose ? slot.appliedPose : slot.pose, time, alpha, fromSetup, add);
2053
+ if (slot.bone.active) this.apply1(slot, appliedPose ? slot.appliedPose : slot.pose, time, alpha, from, add);
2020
2054
  }
2021
2055
  };
2022
2056
  var RGBATimeline = class extends SlotCurveTimeline {
@@ -2055,11 +2089,24 @@ var RGBATimeline = class extends SlotCurveTimeline {
2055
2089
  /*A*/
2056
2090
  ] = a;
2057
2091
  }
2058
- apply1(slot, pose, time, alpha, fromSetup, add) {
2092
+ apply1(slot, pose, time, alpha, from, add) {
2059
2093
  const color = pose.color;
2060
2094
  const frames = this.frames;
2061
2095
  if (time < frames[0]) {
2062
- if (fromSetup) color.setFromColor(slot.data.setupPose.color);
2096
+ const setup = slot.data.setupPose.color;
2097
+ switch (from) {
2098
+ case 1 /* setup */:
2099
+ color.setFromColor(setup);
2100
+ break;
2101
+ case 2 /* first */:
2102
+ color.add(
2103
+ (setup.r - color.r) * alpha,
2104
+ (setup.g - color.g) * alpha,
2105
+ (setup.b - color.b) * alpha,
2106
+ (setup.a - color.a) * alpha
2107
+ );
2108
+ break;
2109
+ }
2063
2110
  return;
2064
2111
  }
2065
2112
  let r = 0, g = 0, b = 0, a = 0;
@@ -2165,7 +2212,7 @@ var RGBATimeline = class extends SlotCurveTimeline {
2165
2212
  if (alpha === 1)
2166
2213
  color.set(r, g, b, a);
2167
2214
  else {
2168
- if (fromSetup) {
2215
+ if (from === 1 /* setup */) {
2169
2216
  const setup = slot.data.setupPose.color;
2170
2217
  color.set(
2171
2218
  setup.r + (r - setup.r) * alpha,
@@ -2202,16 +2249,25 @@ var RGBTimeline = class extends SlotCurveTimeline {
2202
2249
  /*B*/
2203
2250
  ] = b;
2204
2251
  }
2205
- apply1(slot, pose, time, alpha, fromSetup, add) {
2252
+ apply1(slot, pose, time, alpha, from, add) {
2206
2253
  const color = pose.color;
2207
2254
  let r = 0, g = 0, b = 0;
2208
2255
  const frames = this.frames;
2209
2256
  if (time < frames[0]) {
2210
- if (fromSetup) {
2211
- const setup = slot.data.setupPose.color;
2212
- color.r = setup.r;
2213
- color.g = setup.g;
2214
- color.b = setup.b;
2257
+ const setup = slot.data.setupPose.color;
2258
+ switch (from) {
2259
+ case 1 /* setup */: {
2260
+ color.r = setup.r;
2261
+ color.g = setup.g;
2262
+ color.b = setup.b;
2263
+ break;
2264
+ }
2265
+ case 2 /* first */: {
2266
+ color.r += (setup.r - color.r) * alpha;
2267
+ color.g += (setup.g - color.g) * alpha;
2268
+ color.b += (setup.b - color.b) * alpha;
2269
+ break;
2270
+ }
2215
2271
  }
2216
2272
  return;
2217
2273
  }
@@ -2293,7 +2349,7 @@ var RGBTimeline = class extends SlotCurveTimeline {
2293
2349
  );
2294
2350
  }
2295
2351
  if (alpha !== 1) {
2296
- if (fromSetup) {
2352
+ if (from === 1 /* setup */) {
2297
2353
  const setup = slot.data.setupPose.color;
2298
2354
  r = setup.r + (r - setup.r) * alpha;
2299
2355
  g = setup.g + (g - setup.g) * alpha;
@@ -2315,19 +2371,27 @@ var AlphaTimeline = class extends CurveTimeline1 {
2315
2371
  super(frameCount, bezierCount, `${9 /* alpha */}|${slotIndex}`);
2316
2372
  this.slotIndex = slotIndex;
2317
2373
  }
2318
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
2374
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
2319
2375
  const slot = skeleton.slots[this.slotIndex];
2320
2376
  if (!slot.bone.active) return;
2321
2377
  const color = (appliedPose ? slot.appliedPose : slot.pose).color;
2322
2378
  let a = 0;
2323
2379
  const frames = this.frames;
2324
2380
  if (time < frames[0]) {
2325
- if (fromSetup) color.a = slot.data.setupPose.color.a;
2381
+ const setup = slot.data.setupPose.color.a;
2382
+ switch (from) {
2383
+ case 1 /* setup */:
2384
+ color.a = setup;
2385
+ break;
2386
+ case 2 /* first */:
2387
+ color.a += (setup - color.a) * alpha;
2388
+ break;
2389
+ }
2326
2390
  return;
2327
2391
  }
2328
2392
  a = this.getCurveValue(time);
2329
2393
  if (alpha !== 1) {
2330
- if (fromSetup) {
2394
+ if (from === 1 /* setup */) {
2331
2395
  const setup = slot.data.setupPose.color;
2332
2396
  a = setup.a + (a - setup.a) * alpha;
2333
2397
  } else
@@ -2386,18 +2450,33 @@ var RGBA2Timeline = class extends SlotCurveTimeline {
2386
2450
  /*B2*/
2387
2451
  ] = b2;
2388
2452
  }
2389
- apply1(slot, pose, time, alpha, fromSetup, add) {
2453
+ apply1(slot, pose, time, alpha, from, add) {
2390
2454
  const light = pose.color, dark = pose.darkColor;
2391
2455
  let r2 = 0, g2 = 0, b2 = 0;
2392
2456
  const frames = this.frames;
2393
2457
  if (time < frames[0]) {
2394
- if (fromSetup) {
2395
- const setup = slot.data.setupPose;
2396
- light.setFromColor(setup.color);
2397
- const setupDark = setup.darkColor;
2398
- dark.r = setupDark.r;
2399
- dark.g = setupDark.g;
2400
- dark.b = setupDark.b;
2458
+ const setup = slot.data.setupPose;
2459
+ const setupLight = setup.color, setupDark = setup.darkColor;
2460
+ switch (from) {
2461
+ case 1 /* setup */: {
2462
+ light.setFromColor(setupLight);
2463
+ dark.r = setupDark.r;
2464
+ dark.g = setupDark.g;
2465
+ dark.b = setupDark.b;
2466
+ break;
2467
+ }
2468
+ case 2 /* first */: {
2469
+ light.add(
2470
+ (setupLight.r - light.r) * alpha,
2471
+ (setupLight.g - light.g) * alpha,
2472
+ (setupLight.b - light.b) * alpha,
2473
+ (setupLight.a - light.a) * alpha
2474
+ );
2475
+ dark.r += (setupDark.r - dark.r) * alpha;
2476
+ dark.g += (setupDark.g - dark.g) * alpha;
2477
+ dark.b += (setupDark.b - dark.b) * alpha;
2478
+ break;
2479
+ }
2401
2480
  }
2402
2481
  return;
2403
2482
  }
@@ -2557,7 +2636,7 @@ var RGBA2Timeline = class extends SlotCurveTimeline {
2557
2636
  }
2558
2637
  if (alpha === 1)
2559
2638
  light.set(r, g, b, a);
2560
- else if (fromSetup) {
2639
+ else if (from === 1 /* setup */) {
2561
2640
  const setupPose = slot.data.setupPose;
2562
2641
  let setup = setupPose.color;
2563
2642
  light.set(
@@ -2625,20 +2704,30 @@ var RGB2Timeline = class extends SlotCurveTimeline {
2625
2704
  /*B2*/
2626
2705
  ] = b2;
2627
2706
  }
2628
- apply1(slot, pose, time, alpha, fromSetup, add) {
2707
+ apply1(slot, pose, time, alpha, from, add) {
2629
2708
  const light = pose.color, dark = pose.darkColor;
2630
2709
  let r = 0, g = 0, b = 0, r2 = 0, g2 = 0, b2 = 0;
2631
2710
  const frames = this.frames;
2632
2711
  if (time < frames[0]) {
2633
- if (fromSetup) {
2634
- const setup = slot.data.setupPose;
2635
- const setupLight = setup.color, setupDark = setup.darkColor;
2636
- light.r = setupLight.r;
2637
- light.g = setupLight.g;
2638
- light.b = setupLight.b;
2639
- dark.r = setupDark.r;
2640
- dark.g = setupDark.g;
2641
- dark.b = setupDark.b;
2712
+ const setup = slot.data.setupPose;
2713
+ const setupLight = setup.color, setupDark = setup.darkColor;
2714
+ switch (from) {
2715
+ case 1 /* setup */:
2716
+ light.r = setupLight.r;
2717
+ light.g = setupLight.g;
2718
+ light.b = setupLight.b;
2719
+ dark.r = setupDark.r;
2720
+ dark.g = setupDark.g;
2721
+ dark.b = setupDark.b;
2722
+ break;
2723
+ case 2 /* first */:
2724
+ light.r += (setupLight.r - light.r) * alpha;
2725
+ light.g += (setupLight.g - light.g) * alpha;
2726
+ light.b += (setupLight.b - light.b) * alpha;
2727
+ dark.r += (setupDark.r - dark.r) * alpha;
2728
+ dark.g += (setupDark.g - dark.g) * alpha;
2729
+ dark.b += (setupDark.b - dark.b) * alpha;
2730
+ break;
2642
2731
  }
2643
2732
  return;
2644
2733
  }
@@ -2780,7 +2869,7 @@ var RGB2Timeline = class extends SlotCurveTimeline {
2780
2869
  );
2781
2870
  }
2782
2871
  if (alpha !== 1) {
2783
- if (fromSetup) {
2872
+ if (from === 1 /* setup */) {
2784
2873
  const setupPose = slot.data.setupPose;
2785
2874
  let setup = setupPose.color;
2786
2875
  r = setup.r + (r - setup.r) * alpha;
@@ -2825,12 +2914,12 @@ var AttachmentTimeline = class extends Timeline {
2825
2914
  this.frames[frame] = time;
2826
2915
  this.attachmentNames[frame] = attachmentName;
2827
2916
  }
2828
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
2917
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
2829
2918
  const slot = skeleton.slots[this.slotIndex];
2830
2919
  if (!slot.bone.active) return;
2831
2920
  const pose = appliedPose ? slot.appliedPose : slot.pose;
2832
2921
  if (out || time < this.frames[0]) {
2833
- if (fromSetup) this.setAttachment(skeleton, pose, slot.data.attachmentName);
2922
+ if (from !== 0 /* current */) this.setAttachment(skeleton, pose, slot.data.attachmentName);
2834
2923
  } else
2835
2924
  this.setAttachment(skeleton, pose, this.attachmentNames[Timeline.search(this.frames, time)]);
2836
2925
  }
@@ -2912,15 +3001,15 @@ var DeformTimeline = class extends CurveTimeline {
2912
3001
  const x = curves[n - 2], y = curves[n - 1];
2913
3002
  return y + (1 - y) * (time - x) / (this.frames[frame + this.getFrameEntries()] - x);
2914
3003
  }
2915
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
3004
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
2916
3005
  const slots = skeleton.slots;
2917
3006
  if (!this.attachment.isTimelineActive(slots, this.slotIndex, appliedPose)) return;
2918
3007
  const timelineSlots = this.attachment.timelineSlots;
2919
3008
  const frames = this.frames;
2920
3009
  if (time < frames[0]) {
2921
- this.applyBeforeFirst(slots[this.slotIndex], appliedPose, fromSetup);
3010
+ this.applyBeforeFirst(slots[this.slotIndex], appliedPose, alpha, from);
2922
3011
  for (const slotIndex of timelineSlots)
2923
- this.applyBeforeFirst(slots[slotIndex], appliedPose, fromSetup);
3012
+ this.applyBeforeFirst(slots[slotIndex], appliedPose, alpha, from);
2924
3013
  return;
2925
3014
  }
2926
3015
  let v1, v2;
@@ -2936,17 +3025,49 @@ var DeformTimeline = class extends CurveTimeline {
2936
3025
  v2 = this.vertices[frame + 1];
2937
3026
  }
2938
3027
  const vertexCount = this.vertices[0].length;
2939
- this.applyToSlot(slots[this.slotIndex], appliedPose, v1, v2, percent, vertexCount, alpha, fromSetup, add);
3028
+ this.applyToSlot(slots[this.slotIndex], appliedPose, v1, v2, percent, vertexCount, alpha, from, add);
2940
3029
  for (const slotIndex of timelineSlots)
2941
- this.applyToSlot(slots[slotIndex], appliedPose, v1, v2, percent, vertexCount, alpha, fromSetup, add);
3030
+ this.applyToSlot(slots[slotIndex], appliedPose, v1, v2, percent, vertexCount, alpha, from, add);
3031
+ }
3032
+ applyBeforeFirst(slot, appliedPose, alpha, from) {
3033
+ if (!slot.bone.active) return;
3034
+ const pose = appliedPose ? slot.appliedPose : slot.pose;
3035
+ if (pose.attachment == null || pose.attachment.timelineAttachment !== this.attachment) return;
3036
+ const deformArray = pose.deform;
3037
+ if (deformArray.length === 0) from = 1 /* setup */;
3038
+ switch (from) {
3039
+ case 1 /* setup */:
3040
+ deformArray.length = 0;
3041
+ break;
3042
+ case 2 /* first */: {
3043
+ if (alpha === 1) {
3044
+ deformArray.length = 0;
3045
+ return;
3046
+ }
3047
+ const vertexCount = this.vertices[0].length;
3048
+ deformArray.length = vertexCount;
3049
+ const deform = deformArray;
3050
+ const vertexAttachment = pose.attachment;
3051
+ if (vertexAttachment.bones === null) {
3052
+ const setupVertices = vertexAttachment.vertices;
3053
+ for (let i = 0; i < vertexCount; i++)
3054
+ deform[i] += (setupVertices[i] - deform[i]) * alpha;
3055
+ } else {
3056
+ alpha = 1 - alpha;
3057
+ for (let i = 0; i < vertexCount; i++)
3058
+ deform[i] *= alpha;
3059
+ }
3060
+ }
3061
+ }
2942
3062
  }
2943
- applyToSlot(slot, appliedPose, v1, v2, percent, vertexCount, alpha, fromSetup, add) {
3063
+ applyToSlot(slot, appliedPose, v1, v2, percent, vertexCount, alpha, from, add) {
2944
3064
  if (!slot.bone.active) return;
2945
3065
  const pose = appliedPose ? slot.appliedPose : slot.pose;
2946
3066
  if (pose.attachment === null || pose.attachment.timelineAttachment !== this.attachment) return;
2947
3067
  const vertexAttachment = pose.attachment;
2948
3068
  const deform = pose.deform;
2949
- if (deform.length === 0) fromSetup = true;
3069
+ if (deform.length === 0) from = 1 /* setup */;
3070
+ const fromSetup = from === 1 /* setup */;
2950
3071
  deform.length = vertexCount;
2951
3072
  if (v2 === null) {
2952
3073
  if (alpha === 1) {
@@ -3042,13 +3163,6 @@ var DeformTimeline = class extends CurveTimeline {
3042
3163
  }
3043
3164
  }
3044
3165
  }
3045
- applyBeforeFirst(slot, appliedPose, fromSetup) {
3046
- if (!slot.bone.active) return;
3047
- const pose = appliedPose ? slot.appliedPose : slot.pose;
3048
- if (pose.attachment == null || pose.attachment.timelineAttachment !== this.attachment) return;
3049
- if (pose.deform.length === 0) fromSetup = true;
3050
- if (fromSetup) pose.deform.length = 0;
3051
- }
3052
3166
  };
3053
3167
  var SequenceTimeline = class _SequenceTimeline extends Timeline {
3054
3168
  static ENTRIES = 3;
@@ -3057,7 +3171,7 @@ var SequenceTimeline = class _SequenceTimeline extends Timeline {
3057
3171
  slotIndex;
3058
3172
  attachment;
3059
3173
  constructor(frameCount, slotIndex, attachment) {
3060
- super(frameCount, `${28 /* sequence */}|${slotIndex}|${attachment.sequence.id}`);
3174
+ super(frameCount, `${29 /* sequence */}|${slotIndex}|${attachment.sequence.id}`);
3061
3175
  this.slotIndex = slotIndex;
3062
3176
  this.attachment = attachment;
3063
3177
  this.instant = true;
@@ -3084,13 +3198,13 @@ var SequenceTimeline = class _SequenceTimeline extends Timeline {
3084
3198
  frames[frame + _SequenceTimeline.MODE] = mode | index << 4;
3085
3199
  frames[frame + _SequenceTimeline.DELAY] = delay;
3086
3200
  }
3087
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
3201
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
3088
3202
  const slots = skeleton.slots;
3089
3203
  if (!this.attachment.isTimelineActive(slots, this.slotIndex, appliedPose)) return;
3090
3204
  const timelineSlots = this.attachment.timelineSlots;
3091
3205
  const frames = this.frames;
3092
3206
  if (out || time < frames[0]) {
3093
- if (fromSetup) {
3207
+ if (from !== 0 /* current */) {
3094
3208
  this.setupPose(slots[this.slotIndex], appliedPose);
3095
3209
  for (const slotIndex of timelineSlots)
3096
3210
  this.setupPose(slots[slotIndex], appliedPose);
@@ -3166,12 +3280,12 @@ var EventTimeline = class _EventTimeline extends Timeline {
3166
3280
  this.events[frame] = event;
3167
3281
  }
3168
3282
  /** Fires events for frames > `lastTime` and <= `time`. */
3169
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3283
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3170
3284
  if (!firedEvents) return;
3171
3285
  const frames = this.frames;
3172
3286
  const frameCount = this.frames.length;
3173
3287
  if (lastTime > time) {
3174
- this.apply(null, lastTime, Number.MAX_VALUE, firedEvents, 0, false, false, false, false);
3288
+ this.apply(null, lastTime, Number.MAX_VALUE, firedEvents, 0, from, false, false, false);
3175
3289
  lastTime = -1;
3176
3290
  } else if (lastTime >= frames[frameCount - 1])
3177
3291
  return;
@@ -3211,11 +3325,11 @@ var DrawOrderTimeline = class _DrawOrderTimeline extends Timeline {
3211
3325
  this.frames[frame] = time;
3212
3326
  this.drawOrders[frame] = drawOrder;
3213
3327
  }
3214
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3328
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3215
3329
  const pose = appliedPose ? skeleton.drawOrder.appliedPose : skeleton.drawOrder.pose;
3216
3330
  const setup = skeleton.slots;
3217
3331
  if (out || time < this.frames[0]) {
3218
- if (fromSetup) Utils.arrayCopy(setup, 0, pose, 0, skeleton.slots.length);
3332
+ if (from !== 0 /* current */) Utils.arrayCopy(setup, 0, pose, 0, skeleton.slots.length);
3219
3333
  return;
3220
3334
  }
3221
3335
  const order = this.drawOrders[Timeline.search(this.frames, time)];
@@ -3228,6 +3342,7 @@ var DrawOrderTimeline = class _DrawOrderTimeline extends Timeline {
3228
3342
  }
3229
3343
  };
3230
3344
  var DrawOrderFolderTimeline = class _DrawOrderFolderTimeline extends Timeline {
3345
+ static propertyID = `${15 /* drawOrderFolder */}`;
3231
3346
  slots;
3232
3347
  inFolder;
3233
3348
  drawOrders;
@@ -3246,7 +3361,7 @@ var DrawOrderFolderTimeline = class _DrawOrderFolderTimeline extends Timeline {
3246
3361
  const n = slots.length;
3247
3362
  const ids = new Array(n);
3248
3363
  for (let i = 0; i < n; i++)
3249
- ids[i] = `d${slots[i]}`;
3364
+ ids[i] = `${_DrawOrderFolderTimeline.propertyID}|${slots[i]}`;
3250
3365
  return ids;
3251
3366
  }
3252
3367
  getFrameCount() {
@@ -3268,11 +3383,11 @@ var DrawOrderFolderTimeline = class _DrawOrderFolderTimeline extends Timeline {
3268
3383
  this.frames[frame] = time;
3269
3384
  this.drawOrders[frame] = drawOrder;
3270
3385
  }
3271
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
3386
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
3272
3387
  const pose = appliedPose ? skeleton.drawOrder.appliedPose : skeleton.drawOrder.pose;
3273
3388
  const setup = skeleton.slots;
3274
3389
  if (out || time < this.frames[0]) {
3275
- if (fromSetup) this.setup(pose, setup);
3390
+ if (from !== 0 /* current */) this.setup(pose, setup);
3276
3391
  } else {
3277
3392
  const order = this.drawOrders[Timeline.search(this.frames, time)];
3278
3393
  if (!order)
@@ -3305,7 +3420,7 @@ function isConstraintTimeline(obj) {
3305
3420
  var IkConstraintTimeline = class extends CurveTimeline {
3306
3421
  constraintIndex = 0;
3307
3422
  constructor(frameCount, bezierCount, constraintIndex) {
3308
- super(frameCount, bezierCount, `${15 /* ikConstraint */}|${constraintIndex}`);
3423
+ super(frameCount, bezierCount, `${16 /* ikConstraint */}|${constraintIndex}`);
3309
3424
  this.constraintIndex = constraintIndex;
3310
3425
  }
3311
3426
  getFrameEntries() {
@@ -3339,19 +3454,30 @@ var IkConstraintTimeline = class extends CurveTimeline {
3339
3454
  /*STRETCH*/
3340
3455
  ] = stretch ? 1 : 0;
3341
3456
  }
3342
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3457
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3343
3458
  const constraint = skeleton.constraints[this.constraintIndex];
3344
3459
  if (!constraint.active) return;
3345
3460
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3346
3461
  const frames = this.frames;
3347
3462
  if (time < frames[0]) {
3348
- if (fromSetup) {
3349
- const setup = constraint.data.setupPose;
3350
- pose.mix = setup.mix;
3351
- pose.softness = setup.softness;
3352
- pose.bendDirection = setup.bendDirection;
3353
- pose.compress = setup.compress;
3354
- pose.stretch = setup.stretch;
3463
+ const setup = constraint.data.setupPose;
3464
+ switch (from) {
3465
+ case 1 /* setup */: {
3466
+ pose.mix = setup.mix;
3467
+ pose.softness = setup.softness;
3468
+ pose.bendDirection = setup.bendDirection;
3469
+ pose.compress = setup.compress;
3470
+ pose.stretch = setup.stretch;
3471
+ break;
3472
+ }
3473
+ case 2 /* first */: {
3474
+ pose.mix += (setup.mix - pose.mix) * alpha;
3475
+ pose.softness += (setup.softness - pose.softness) * alpha;
3476
+ pose.bendDirection = setup.bendDirection;
3477
+ pose.compress = setup.compress;
3478
+ pose.stretch = setup.stretch;
3479
+ break;
3480
+ }
3355
3481
  }
3356
3482
  return;
3357
3483
  }
@@ -3417,11 +3543,11 @@ var IkConstraintTimeline = class extends CurveTimeline {
3417
3543
  /*BEZIER*/
3418
3544
  );
3419
3545
  }
3420
- const base = fromSetup ? constraint.data.setupPose : pose;
3546
+ const base = from === 1 /* setup */ ? constraint.data.setupPose : pose;
3421
3547
  pose.mix = base.mix + (mix - base.mix) * alpha;
3422
3548
  pose.softness = base.softness + (softness - base.softness) * alpha;
3423
3549
  if (out) {
3424
- if (fromSetup) {
3550
+ if (from === 1 /* setup */) {
3425
3551
  pose.bendDirection = base.bendDirection;
3426
3552
  pose.compress = base.compress;
3427
3553
  pose.stretch = base.stretch;
@@ -3446,7 +3572,7 @@ var TransformConstraintTimeline = class extends CurveTimeline {
3446
3572
  /** The index of the transform constraint slot in {@link Skeleton.transformConstraints} that will be changed. */
3447
3573
  constraintIndex = 0;
3448
3574
  constructor(frameCount, bezierCount, constraintIndex) {
3449
- super(frameCount, bezierCount, `${16 /* transformConstraint */}|${constraintIndex}`);
3575
+ super(frameCount, bezierCount, `${17 /* transformConstraint */}|${constraintIndex}`);
3450
3576
  this.constraintIndex = constraintIndex;
3451
3577
  this.additive = true;
3452
3578
  }
@@ -3485,20 +3611,32 @@ var TransformConstraintTimeline = class extends CurveTimeline {
3485
3611
  /*SHEARY*/
3486
3612
  ] = mixShearY;
3487
3613
  }
3488
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3614
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3489
3615
  const constraint = skeleton.constraints[this.constraintIndex];
3490
3616
  if (!constraint.active) return;
3491
3617
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3492
3618
  const frames = this.frames;
3493
3619
  if (time < frames[0]) {
3494
- if (fromSetup) {
3495
- const setup = constraint.data.setupPose;
3496
- pose.mixRotate = setup.mixRotate;
3497
- pose.mixX = setup.mixX;
3498
- pose.mixY = setup.mixY;
3499
- pose.mixScaleX = setup.mixScaleX;
3500
- pose.mixScaleY = setup.mixScaleY;
3501
- pose.mixShearY = setup.mixShearY;
3620
+ const setup = constraint.data.setupPose;
3621
+ switch (from) {
3622
+ case 1 /* setup */: {
3623
+ pose.mixRotate = setup.mixRotate;
3624
+ pose.mixX = setup.mixX;
3625
+ pose.mixY = setup.mixY;
3626
+ pose.mixScaleX = setup.mixScaleX;
3627
+ pose.mixScaleY = setup.mixScaleY;
3628
+ pose.mixShearY = setup.mixShearY;
3629
+ break;
3630
+ }
3631
+ case 2 /* first */: {
3632
+ pose.mixRotate += (setup.mixRotate - pose.mixRotate) * alpha;
3633
+ pose.mixX += (setup.mixX - pose.mixX) * alpha;
3634
+ pose.mixY += (setup.mixY - pose.mixY) * alpha;
3635
+ pose.mixScaleX += (setup.mixScaleX - pose.mixScaleX) * alpha;
3636
+ pose.mixScaleY += (setup.mixScaleY - pose.mixScaleY) * alpha;
3637
+ pose.mixShearY += (setup.mixShearY - pose.mixShearY) * alpha;
3638
+ break;
3639
+ }
3502
3640
  }
3503
3641
  return;
3504
3642
  }
@@ -3640,7 +3778,7 @@ var TransformConstraintTimeline = class extends CurveTimeline {
3640
3778
  /*BEZIER*/
3641
3779
  );
3642
3780
  }
3643
- const base = fromSetup ? constraint.data.setupPose : pose;
3781
+ const base = from === 1 /* setup */ ? constraint.data.setupPose : pose;
3644
3782
  if (add) {
3645
3783
  pose.mixRotate = base.mixRotate + rotate * alpha;
3646
3784
  pose.mixX = base.mixX + x * alpha;
@@ -3667,29 +3805,29 @@ var ConstraintTimeline1 = class extends CurveTimeline1 {
3667
3805
  };
3668
3806
  var PathConstraintPositionTimeline = class extends ConstraintTimeline1 {
3669
3807
  constructor(frameCount, bezierCount, constraintIndex) {
3670
- super(frameCount, bezierCount, constraintIndex, 17 /* pathConstraintPosition */);
3808
+ super(frameCount, bezierCount, constraintIndex, 18 /* pathConstraintPosition */);
3671
3809
  this.additive = true;
3672
3810
  }
3673
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3811
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3674
3812
  const constraint = skeleton.constraints[this.constraintIndex];
3675
3813
  if (constraint.active) {
3676
3814
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3677
- pose.position = this.getAbsoluteValue(time, alpha, fromSetup, add, pose.position, constraint.data.setupPose.position);
3815
+ pose.position = this.getAbsoluteValue(time, alpha, from, add, pose.position, constraint.data.setupPose.position);
3678
3816
  }
3679
3817
  }
3680
3818
  };
3681
3819
  var PathConstraintSpacingTimeline = class extends ConstraintTimeline1 {
3682
3820
  constructor(frameCount, bezierCount, constraintIndex) {
3683
- super(frameCount, bezierCount, constraintIndex, 18 /* pathConstraintSpacing */);
3821
+ super(frameCount, bezierCount, constraintIndex, 19 /* pathConstraintSpacing */);
3684
3822
  }
3685
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3823
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3686
3824
  const constraint = skeleton.constraints[this.constraintIndex];
3687
3825
  if (constraint.active) {
3688
3826
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3689
3827
  pose.spacing = this.getAbsoluteValue(
3690
3828
  time,
3691
3829
  alpha,
3692
- fromSetup,
3830
+ from,
3693
3831
  false,
3694
3832
  pose.spacing,
3695
3833
  constraint.data.setupPose.spacing
@@ -3700,7 +3838,7 @@ var PathConstraintSpacingTimeline = class extends ConstraintTimeline1 {
3700
3838
  var PathConstraintMixTimeline = class extends CurveTimeline {
3701
3839
  constraintIndex;
3702
3840
  constructor(frameCount, bezierCount, constraintIndex) {
3703
- super(frameCount, bezierCount, `${19 /* pathConstraintMix */}|${constraintIndex}`);
3841
+ super(frameCount, bezierCount, `${20 /* pathConstraintMix */}|${constraintIndex}`);
3704
3842
  this.constraintIndex = constraintIndex;
3705
3843
  }
3706
3844
  getFrameEntries() {
@@ -3726,17 +3864,26 @@ var PathConstraintMixTimeline = class extends CurveTimeline {
3726
3864
  /*Y*/
3727
3865
  ] = mixY;
3728
3866
  }
3729
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3867
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3730
3868
  const constraint = skeleton.constraints[this.constraintIndex];
3731
3869
  if (!constraint.active) return;
3732
3870
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3733
3871
  const frames = this.frames;
3734
3872
  if (time < frames[0]) {
3735
- if (fromSetup) {
3736
- const setup = constraint.data.setupPose;
3737
- pose.mixRotate = setup.mixRotate;
3738
- pose.mixX = setup.mixX;
3739
- pose.mixY = setup.mixY;
3873
+ const setup = constraint.data.setupPose;
3874
+ switch (from) {
3875
+ case 1 /* setup */: {
3876
+ pose.mixRotate = setup.mixRotate;
3877
+ pose.mixX = setup.mixX;
3878
+ pose.mixY = setup.mixY;
3879
+ break;
3880
+ }
3881
+ case 2 /* first */: {
3882
+ pose.mixRotate += (setup.mixRotate - pose.mixRotate) * alpha;
3883
+ pose.mixX += (setup.mixX - pose.mixX) * alpha;
3884
+ pose.mixY += (setup.mixY - pose.mixY) * alpha;
3885
+ break;
3886
+ }
3740
3887
  }
3741
3888
  return;
3742
3889
  }
@@ -3818,7 +3965,7 @@ var PathConstraintMixTimeline = class extends CurveTimeline {
3818
3965
  /*BEZIER*/
3819
3966
  );
3820
3967
  }
3821
- const base = fromSetup ? constraint.data.setupPose : pose;
3968
+ const base = from === 1 /* setup */ ? constraint.data.setupPose : pose;
3822
3969
  if (add) {
3823
3970
  pose.mixRotate = base.mixRotate + rotate * alpha;
3824
3971
  pose.mixX = base.mixX + x * alpha;
@@ -3835,7 +3982,7 @@ var PhysicsConstraintTimeline = class extends ConstraintTimeline1 {
3835
3982
  constructor(frameCount, bezierCount, constraintIndex, property) {
3836
3983
  super(frameCount, bezierCount, constraintIndex, property);
3837
3984
  }
3838
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3985
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3839
3986
  if (add && !this.additive) add = false;
3840
3987
  if (this.constraintIndex === -1) {
3841
3988
  const value = time >= this.frames[0] ? this.getCurveValue(time) : 0;
@@ -3843,21 +3990,21 @@ var PhysicsConstraintTimeline = class extends ConstraintTimeline1 {
3843
3990
  for (const constraint of constraints) {
3844
3991
  if (constraint.active && this.global(constraint.data)) {
3845
3992
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3846
- this.set(pose, this.getAbsoluteValue(time, alpha, fromSetup, add, this.get(pose), this.get(constraint.data.setupPose), value));
3993
+ this.set(pose, this.getAbsoluteValue(time, alpha, from, add, this.get(pose), this.get(constraint.data.setupPose), value));
3847
3994
  }
3848
3995
  }
3849
3996
  } else {
3850
3997
  const constraint = skeleton.constraints[this.constraintIndex];
3851
3998
  if (constraint.active) {
3852
3999
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3853
- this.set(pose, this.getAbsoluteValue(time, alpha, fromSetup, add, this.get(pose), this.get(constraint.data.setupPose)));
4000
+ this.set(pose, this.getAbsoluteValue(time, alpha, from, add, this.get(pose), this.get(constraint.data.setupPose)));
3854
4001
  }
3855
4002
  }
3856
4003
  }
3857
4004
  };
3858
4005
  var PhysicsConstraintInertiaTimeline = class extends PhysicsConstraintTimeline {
3859
4006
  constructor(frameCount, bezierCount, constraintIndex) {
3860
- super(frameCount, bezierCount, constraintIndex, 20 /* physicsConstraintInertia */);
4007
+ super(frameCount, bezierCount, constraintIndex, 21 /* physicsConstraintInertia */);
3861
4008
  }
3862
4009
  get(pose) {
3863
4010
  return pose.inertia;
@@ -3871,7 +4018,7 @@ var PhysicsConstraintInertiaTimeline = class extends PhysicsConstraintTimeline {
3871
4018
  };
3872
4019
  var PhysicsConstraintStrengthTimeline = class extends PhysicsConstraintTimeline {
3873
4020
  constructor(frameCount, bezierCount, constraintIndex) {
3874
- super(frameCount, bezierCount, constraintIndex, 21 /* physicsConstraintStrength */);
4021
+ super(frameCount, bezierCount, constraintIndex, 22 /* physicsConstraintStrength */);
3875
4022
  }
3876
4023
  get(pose) {
3877
4024
  return pose.strength;
@@ -3885,7 +4032,7 @@ var PhysicsConstraintStrengthTimeline = class extends PhysicsConstraintTimeline
3885
4032
  };
3886
4033
  var PhysicsConstraintDampingTimeline = class extends PhysicsConstraintTimeline {
3887
4034
  constructor(frameCount, bezierCount, constraintIndex) {
3888
- super(frameCount, bezierCount, constraintIndex, 22 /* physicsConstraintDamping */);
4035
+ super(frameCount, bezierCount, constraintIndex, 23 /* physicsConstraintDamping */);
3889
4036
  }
3890
4037
  get(pose) {
3891
4038
  return pose.damping;
@@ -3899,7 +4046,7 @@ var PhysicsConstraintDampingTimeline = class extends PhysicsConstraintTimeline {
3899
4046
  };
3900
4047
  var PhysicsConstraintMassTimeline = class extends PhysicsConstraintTimeline {
3901
4048
  constructor(frameCount, bezierCount, constraintIndex) {
3902
- super(frameCount, bezierCount, constraintIndex, 23 /* physicsConstraintMass */);
4049
+ super(frameCount, bezierCount, constraintIndex, 24 /* physicsConstraintMass */);
3903
4050
  }
3904
4051
  get(pose) {
3905
4052
  return 1 / pose.massInverse;
@@ -3913,7 +4060,7 @@ var PhysicsConstraintMassTimeline = class extends PhysicsConstraintTimeline {
3913
4060
  };
3914
4061
  var PhysicsConstraintWindTimeline = class extends PhysicsConstraintTimeline {
3915
4062
  constructor(frameCount, bezierCount, constraintIndex) {
3916
- super(frameCount, bezierCount, constraintIndex, 24 /* physicsConstraintWind */);
4063
+ super(frameCount, bezierCount, constraintIndex, 25 /* physicsConstraintWind */);
3917
4064
  this.additive = true;
3918
4065
  }
3919
4066
  get(pose) {
@@ -3928,7 +4075,7 @@ var PhysicsConstraintWindTimeline = class extends PhysicsConstraintTimeline {
3928
4075
  };
3929
4076
  var PhysicsConstraintGravityTimeline = class extends PhysicsConstraintTimeline {
3930
4077
  constructor(frameCount, bezierCount, constraintIndex) {
3931
- super(frameCount, bezierCount, constraintIndex, 25 /* physicsConstraintGravity */);
4078
+ super(frameCount, bezierCount, constraintIndex, 26 /* physicsConstraintGravity */);
3932
4079
  this.additive = true;
3933
4080
  }
3934
4081
  get(pose) {
@@ -3943,7 +4090,7 @@ var PhysicsConstraintGravityTimeline = class extends PhysicsConstraintTimeline {
3943
4090
  };
3944
4091
  var PhysicsConstraintMixTimeline = class extends PhysicsConstraintTimeline {
3945
4092
  constructor(frameCount, bezierCount, constraintIndex) {
3946
- super(frameCount, bezierCount, constraintIndex, 26 /* physicsConstraintMix */);
4093
+ super(frameCount, bezierCount, constraintIndex, 27 /* physicsConstraintMix */);
3947
4094
  }
3948
4095
  get(pose) {
3949
4096
  return pose.mix;
@@ -3956,7 +4103,7 @@ var PhysicsConstraintMixTimeline = class extends PhysicsConstraintTimeline {
3956
4103
  }
3957
4104
  };
3958
4105
  var PhysicsConstraintResetTimeline = class _PhysicsConstraintResetTimeline extends Timeline {
3959
- static propertyIds = [27 /* physicsConstraintReset */.toString()];
4106
+ static propertyIds = [28 /* physicsConstraintReset */.toString()];
3960
4107
  /** The index of the physics constraint in {@link Skeleton.contraints} that will be reset when this timeline is
3961
4108
  * applied, or -1 if all physics constraints in the skeleton will be reset. */
3962
4109
  constraintIndex;
@@ -3975,7 +4122,7 @@ var PhysicsConstraintResetTimeline = class _PhysicsConstraintResetTimeline exten
3975
4122
  this.frames[frame] = time;
3976
4123
  }
3977
4124
  /** Resets the physics constraint when frames > `lastTime` and <= `time`. */
3978
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4125
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3979
4126
  let constraint;
3980
4127
  if (this.constraintIndex !== -1) {
3981
4128
  constraint = skeleton.constraints[this.constraintIndex];
@@ -3983,7 +4130,7 @@ var PhysicsConstraintResetTimeline = class _PhysicsConstraintResetTimeline exten
3983
4130
  }
3984
4131
  const frames = this.frames;
3985
4132
  if (lastTime > time) {
3986
- this.apply(skeleton, lastTime, Number.MAX_VALUE, [], alpha, false, false, false, false);
4133
+ this.apply(skeleton, lastTime, Number.MAX_VALUE, [], alpha, from, false, false, false);
3987
4134
  lastTime = -1;
3988
4135
  } else if (lastTime >= frames[frames.length - 1])
3989
4136
  return;
@@ -4001,26 +4148,26 @@ var PhysicsConstraintResetTimeline = class _PhysicsConstraintResetTimeline exten
4001
4148
  };
4002
4149
  var SliderTimeline = class extends ConstraintTimeline1 {
4003
4150
  constructor(frameCount, bezierCount, constraintIndex) {
4004
- super(frameCount, bezierCount, constraintIndex, 29 /* sliderTime */);
4151
+ super(frameCount, bezierCount, constraintIndex, 30 /* sliderTime */);
4005
4152
  }
4006
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4153
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
4007
4154
  const constraint = skeleton.constraints[this.constraintIndex];
4008
4155
  if (constraint.active) {
4009
4156
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
4010
- pose.time = this.getAbsoluteValue(time, alpha, fromSetup, add, pose.time, constraint.data.setupPose.time);
4157
+ pose.time = this.getAbsoluteValue(time, alpha, from, add, pose.time, constraint.data.setupPose.time);
4011
4158
  }
4012
4159
  }
4013
4160
  };
4014
4161
  var SliderMixTimeline = class extends ConstraintTimeline1 {
4015
4162
  constructor(frameCount, bezierCount, constraintIndex) {
4016
- super(frameCount, bezierCount, constraintIndex, 30 /* sliderMix */);
4163
+ super(frameCount, bezierCount, constraintIndex, 31 /* sliderMix */);
4017
4164
  this.additive = true;
4018
4165
  }
4019
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4166
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
4020
4167
  const constraint = skeleton.constraints[this.constraintIndex];
4021
4168
  if (constraint.active) {
4022
4169
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
4023
- pose.mix = this.getAbsoluteValue(time, alpha, fromSetup, add, pose.mix, constraint.data.setupPose.mix);
4170
+ pose.mix = this.getAbsoluteValue(time, alpha, from, add, pose.mix, constraint.data.setupPose.mix);
4024
4171
  }
4025
4172
  }
4026
4173
  };
@@ -4041,7 +4188,7 @@ var AnimationState = class _AnimationState {
4041
4188
  events = [];
4042
4189
  listeners = [];
4043
4190
  queue = new EventQueue(this);
4044
- propertyIds = new StringSet();
4191
+ propertyIds = /* @__PURE__ */ new Map();
4045
4192
  animationsChanged = false;
4046
4193
  trackEntryPool = new Pool(() => new TrackEntry());
4047
4194
  constructor(data) {
@@ -4150,9 +4297,9 @@ var AnimationState = class _AnimationState {
4150
4297
  Utils.webkit602BugfixHelper(alpha);
4151
4298
  const timeline = timelines[ii];
4152
4299
  if (timeline instanceof AttachmentTimeline)
4153
- this.applyAttachmentTimeline(timeline, skeleton, applyTime, true, true);
4300
+ this.applyAttachmentTimeline(timeline, skeleton, applyTime, 1 /* setup */, true);
4154
4301
  else
4155
- timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, true, false, false, false);
4302
+ timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, 1 /* setup */, false, false, false);
4156
4303
  }
4157
4304
  } else {
4158
4305
  const timelineMode = current.timelineMode;
@@ -4162,14 +4309,14 @@ var AnimationState = class _AnimationState {
4162
4309
  if (firstFrame) current.timelinesRotation.length = timelineCount << 1;
4163
4310
  for (let ii = 0; ii < timelineCount; ii++) {
4164
4311
  const timeline = timelines[ii];
4165
- const fromSetup = (timelineMode[ii] & FIRST) !== 0;
4312
+ const from = timelineMode[ii] & MODE;
4166
4313
  if (!shortestRotation && timeline instanceof RotateTimeline) {
4167
- this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, fromSetup, current.timelinesRotation, ii << 1, firstFrame);
4314
+ this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, from, current.timelinesRotation, ii << 1, firstFrame);
4168
4315
  } else if (timeline instanceof AttachmentTimeline) {
4169
- this.applyAttachmentTimeline(timeline, skeleton, applyTime, fromSetup, retainAttachments);
4316
+ this.applyAttachmentTimeline(timeline, skeleton, applyTime, from, retainAttachments);
4170
4317
  } else {
4171
4318
  Utils.webkit602BugfixHelper(alpha);
4172
- timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, fromSetup, add, false, false);
4319
+ timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, from, add, false, false);
4173
4320
  }
4174
4321
  }
4175
4322
  }
@@ -4179,7 +4326,7 @@ var AnimationState = class _AnimationState {
4179
4326
  current.nextAnimationLast = animationTime;
4180
4327
  current.nextTrackLast = current.trackTime;
4181
4328
  }
4182
- const setupState = this.unkeyedState + SETUP;
4329
+ const setupState = this.unkeyedState + ATTACH_SETUP;
4183
4330
  const slots = skeleton.slots;
4184
4331
  for (let i = 0, n = skeleton.slots.length; i < n; i++) {
4185
4332
  const slot = slots[i];
@@ -4217,29 +4364,29 @@ var AnimationState = class _AnimationState {
4217
4364
  for (let i = 0; i < timelineCount; i++) {
4218
4365
  const timeline = timelines[i];
4219
4366
  const mode = timelineMode[i];
4367
+ const mixFrom = mode & MODE;
4220
4368
  let alpha = 0;
4221
4369
  if ((mode & HOLD) !== 0) {
4222
4370
  const holdMix = timelineHoldMix[i];
4223
4371
  alpha = holdMix == null ? alphaHold : alphaHold * (1 - holdMix.mix());
4224
4372
  } else {
4225
- if (!drawOrder && timeline instanceof DrawOrderTimeline) continue;
4373
+ if (!drawOrder && timeline instanceof DrawOrderTimeline && mixFrom === 0 /* current */) continue;
4226
4374
  alpha = alphaMix;
4227
4375
  }
4228
4376
  from.totalAlpha += alpha;
4229
- const fromSetup = (mode & FIRST) !== 0;
4230
4377
  if (!shortestRotation && timeline instanceof RotateTimeline) {
4231
- this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, fromSetup, timelinesRotation, i << 1, firstFrame);
4378
+ this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, mixFrom, timelinesRotation, i << 1, firstFrame);
4232
4379
  } else if (timeline instanceof AttachmentTimeline)
4233
4380
  this.applyAttachmentTimeline(
4234
4381
  timeline,
4235
4382
  skeleton,
4236
4383
  applyTime,
4237
- fromSetup,
4384
+ mixFrom,
4238
4385
  retainAttachments && alpha >= from.alphaAttachmentThreshold
4239
4386
  );
4240
4387
  else {
4241
- const out = !drawOrder || !(timeline instanceof DrawOrderTimeline) || !fromSetup;
4242
- timeline.apply(skeleton, animationLast, applyTime, events, alpha, fromSetup, add, out, false);
4388
+ const out = !drawOrder || !(timeline instanceof DrawOrderTimeline) || mixFrom === 0 /* current */;
4389
+ timeline.apply(skeleton, animationLast, applyTime, events, alpha, mixFrom, add, out, false);
4243
4390
  }
4244
4391
  }
4245
4392
  if (from.reverse && mix < from.eventThreshold) this.eventsReverse(from, animationLast, animationTime);
@@ -4251,10 +4398,10 @@ var AnimationState = class _AnimationState {
4251
4398
  }
4252
4399
  /** Applies the attachment timeline and sets {@link Slot.attachmentState}.
4253
4400
  * @param retain True if the attachment remains after apply, false if temporary for deform timelines. */
4254
- applyAttachmentTimeline(timeline, skeleton, time, fromSetup, retain) {
4401
+ applyAttachmentTimeline(timeline, skeleton, time, from, retain) {
4255
4402
  const slot = skeleton.slots[timeline.slotIndex];
4256
4403
  if (!slot.bone.active) return;
4257
- if (!retain && slot.attachmentState === this.unkeyedState + RETAIN) return;
4404
+ if (!retain && slot.attachmentState === this.unkeyedState + ATTACH_RETAIN) return;
4258
4405
  let setup = time < timeline.frames[0];
4259
4406
  let name = null;
4260
4407
  if (!setup) {
@@ -4262,33 +4409,44 @@ var AnimationState = class _AnimationState {
4262
4409
  setup = !retain && name == null;
4263
4410
  }
4264
4411
  if (setup) {
4265
- if (!fromSetup) return;
4412
+ if (from === 0 /* current */) return;
4266
4413
  name = slot.data.attachmentName;
4267
4414
  }
4268
4415
  slot.pose.setAttachment(name == null ? null : skeleton.getAttachment(slot.data.index, name));
4269
4416
  if (retain)
4270
- slot.attachmentState = this.unkeyedState + RETAIN;
4417
+ slot.attachmentState = this.unkeyedState + ATTACH_RETAIN;
4271
4418
  else if (!setup)
4272
- slot.attachmentState = this.unkeyedState + SETUP;
4419
+ slot.attachmentState = this.unkeyedState + ATTACH_SETUP;
4273
4420
  }
4274
4421
  /** Applies the rotate timeline, mixing with the current pose while keeping the same rotation direction chosen as the shortest
4275
4422
  * the first time the mixing was applied. */
4276
- applyRotateTimeline(timeline, skeleton, time, alpha, fromSetup, timelinesRotation, i, firstFrame) {
4423
+ applyRotateTimeline(timeline, skeleton, time, alpha, from, timelinesRotation, i, firstFrame) {
4277
4424
  if (firstFrame) timelinesRotation[i] = 0;
4278
4425
  if (alpha === 1) {
4279
- timeline.apply(skeleton, 0, time, null, 1, fromSetup, false, false, false);
4426
+ timeline.apply(skeleton, 0, time, null, 1, from, false, false, false);
4280
4427
  return;
4281
4428
  }
4282
4429
  const bone = skeleton.bones[timeline.boneIndex];
4283
4430
  if (!bone.active) return;
4284
4431
  const pose = bone.pose, setup = bone.data.setupPose;
4285
4432
  const frames = timeline.frames;
4433
+ let r1, r2;
4286
4434
  if (time < frames[0]) {
4287
- if (fromSetup) pose.rotation = setup.rotation;
4288
- return;
4435
+ switch (from) {
4436
+ case 1 /* setup */: {
4437
+ pose.rotation = setup.rotation;
4438
+ return;
4439
+ }
4440
+ case 0 /* current */: {
4441
+ return;
4442
+ }
4443
+ }
4444
+ r1 = pose.rotation;
4445
+ r2 = setup.rotation;
4446
+ } else {
4447
+ r1 = from === 1 /* setup */ ? setup.rotation : pose.rotation;
4448
+ r2 = setup.rotation + timeline.getCurveValue(time);
4289
4449
  }
4290
- const r1 = fromSetup ? setup.rotation : pose.rotation;
4291
- const r2 = setup.rotation + timeline.getCurveValue(time);
4292
4450
  let total = 0, diff = r2 - r1;
4293
4451
  diff -= Math.ceil(diff / 360 - 0.5) * 360;
4294
4452
  if (diff === 0) {
@@ -4603,57 +4761,72 @@ var AnimationState = class _AnimationState {
4603
4761
  this.animationsChanged = false;
4604
4762
  const tracks = this.tracks;
4605
4763
  for (let i = 0, n = tracks.length; i < n; i++) {
4606
- let entry = tracks[i];
4607
- if (!entry) continue;
4764
+ const track = tracks[i];
4765
+ if (!track) continue;
4766
+ let entry = track;
4608
4767
  while (entry.mixingFrom)
4609
4768
  entry = entry.mixingFrom;
4610
4769
  do {
4611
- this.computeHold(entry);
4770
+ this.computeHold(entry, track);
4612
4771
  entry = entry.mixingTo;
4613
4772
  } while (entry);
4614
4773
  }
4615
4774
  this.propertyIds.clear();
4616
4775
  }
4617
- computeHold(entry) {
4776
+ computeHold(entry, track) {
4618
4777
  const timelines = entry.animation.timelines;
4619
4778
  const timelinesCount = entry.animation.timelines.length;
4620
4779
  const timelineMode = entry.timelineMode;
4621
4780
  timelineMode.length = timelinesCount;
4622
4781
  const timelineHoldMix = entry.timelineHoldMix;
4623
4782
  timelineHoldMix.length = 0;
4624
- const propertyIds = this.propertyIds;
4625
4783
  const add = entry.additive, keepHold = entry.keepHold;
4626
4784
  const to = entry.mixingTo;
4627
- outer:
4628
- for (let i = 0; i < timelinesCount; i++) {
4629
- const timeline = timelines[i];
4630
- const ids = timeline.propertyIds;
4631
- const first = propertyIds.addAll(ids) && !(timeline instanceof DrawOrderFolderTimeline && propertyIds.contains(DrawOrderTimeline.propertyID));
4632
- if (add && timeline.additive) {
4633
- timelineMode[i] = first ? FIRST : SUBSEQUENT;
4634
- continue;
4635
- }
4636
- for (let from = entry.mixingFrom; from != null; from = from.mixingFrom) {
4637
- if (from.animation.hasTimeline(ids)) {
4638
- timelineMode[i] = SUBSEQUENT;
4639
- continue outer;
4785
+ for (let i = 0; i < timelinesCount; i++) {
4786
+ const timeline = timelines[i];
4787
+ const ids = timeline.propertyIds;
4788
+ const from = this.from(track, timeline, ids);
4789
+ if (add && timeline.additive) {
4790
+ timelineMode[i] = from;
4791
+ continue;
4792
+ }
4793
+ let mode;
4794
+ if (to === null || timeline.instant || to.additive && timeline.additive || !to.animation?.hasTimeline(ids))
4795
+ mode = from;
4796
+ else {
4797
+ mode = from | HOLD;
4798
+ for (let next = to.mixingTo; next != null; next = next.mixingTo) {
4799
+ if (next.additive && timeline.additive || !next.animation?.hasTimeline(ids)) {
4800
+ if (next.mixDuration > 0) timelineHoldMix[i] = next;
4801
+ break;
4640
4802
  }
4641
4803
  }
4642
- let mode;
4643
- if (to === null || timeline.instant || to.additive && timeline.additive || !to.animation?.hasTimeline(ids))
4644
- mode = first ? FIRST : SUBSEQUENT;
4645
- else {
4646
- mode = first ? HOLD_FIRST : HOLD;
4647
- for (let next = to.mixingTo; next != null; next = next.mixingTo) {
4648
- if (next.additive && timeline.additive || !next.animation?.hasTimeline(ids)) {
4649
- if (next.mixDuration > 0) timelineHoldMix[i] = next;
4650
- break;
4651
- }
4652
- }
4804
+ }
4805
+ if (keepHold) mode = mode & ~HOLD | timelineMode[i] & HOLD;
4806
+ timelineMode[i] = mode;
4807
+ }
4808
+ }
4809
+ from(track, timeline, ids) {
4810
+ const propertyIds = this.propertyIds;
4811
+ let from = SETUP;
4812
+ for (let i = 0, n = ids.length; i < n; i++) {
4813
+ const owner = propertyIds.get(ids[i]);
4814
+ if (owner === void 0) {
4815
+ propertyIds.set(ids[i], track);
4816
+ } else {
4817
+ if (owner !== track) {
4818
+ while (++i < n)
4819
+ if (!propertyIds.has(ids[i])) propertyIds.set(ids[i], track);
4820
+ return CURRENT;
4653
4821
  }
4654
- if (keepHold) mode = mode & ~HOLD | timelineMode[i] & HOLD;
4655
- timelineMode[i] = mode;
4822
+ from = FIRST;
4656
4823
  }
4824
+ }
4825
+ if (timeline instanceof DrawOrderFolderTimeline) {
4826
+ const first = propertyIds.get(DrawOrderTimeline.propertyID);
4827
+ if (first != null) return first !== track ? CURRENT : FIRST;
4828
+ }
4829
+ return from;
4657
4830
  }
4658
4831
  /** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
4659
4832
  getTrack(trackIndex) {
@@ -4778,7 +4951,7 @@ var TrackEntry = class {
4778
4951
  * properties keyed by the animation are set to the setup pose and the track is cleared.
4779
4952
  *
4780
4953
  * Usually you want to use {@link AnimationState.addEmptyAnimation} rather than have the animation
4781
- * abruptly cease being applied. */
4954
+ * abruptly cease being applied, leaving the current pose. */
4782
4955
  trackEnd = 0;
4783
4956
  /** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
4784
4957
  * faster. Defaults to 1.
@@ -4862,8 +5035,8 @@ var TrackEntry = class {
4862
5035
  return mix;
4863
5036
  }
4864
5037
  /** For each timeline:
4865
- * - Bit 0, FIRST: 0 = mix from current pose, 1 = mix from setup pose. Timeline is first to set the property.
4866
- * - Bit 1, HOLD: 0 = mix out using alphaMix, 1 = apply full alpha to prevent dipping. Timeline is first on its track to
5038
+ * - Bits 0-1: MixFrom.
5039
+ * - Bit 2, HOLD: 0 = mix out using alphaMix, 1 = apply full alpha to prevent dipping. Timeline is first on its track to
4867
5040
  * set the property and the next entry (mixingTo) also sets it. When held, timelineHoldMix's mix controls how the hold fades
4868
5041
  * out (for 3+ entry chains where the chain eventually stops setting the property). */
4869
5042
  timelineMode = [];
@@ -5057,12 +5230,13 @@ var AnimationStateAdapter = class {
5057
5230
  event(entry, event) {
5058
5231
  }
5059
5232
  };
5060
- var SUBSEQUENT = 0;
5061
- var FIRST = 1;
5062
- var HOLD = 2;
5063
- var HOLD_FIRST = 3;
5233
+ var CURRENT = 0;
5064
5234
  var SETUP = 1;
5065
- var RETAIN = 2;
5235
+ var FIRST = 2;
5236
+ var MODE = 3;
5237
+ var HOLD = 4;
5238
+ var ATTACH_SETUP = 1;
5239
+ var ATTACH_RETAIN = 2;
5066
5240
 
5067
5241
  // spine-core/src/AnimationStateData.ts
5068
5242
  var AnimationStateData = class {
@@ -8110,7 +8284,7 @@ var PhysicsConstraintData = class extends ConstraintData {
8110
8284
  gravityGlobal = false;
8111
8285
  /** True when this constraint's mix is controlled by global slider timelines. */
8112
8286
  mixGlobal = false;
8113
- /** Determines how the {@link BonePose.scaleY} changes when {@link PhysicsConstraintData.scaleX} sets
8287
+ /** Determines how the {@link BonePose.scaleY} changes when {@link BonePose.scaleX} sets
8114
8288
  * {@link BonePose.scaleX}. */
8115
8289
  _scaleYMode = 0 /* None */;
8116
8290
  get scaleYMode() {
@@ -8182,7 +8356,7 @@ var Slider = class _Slider extends Constraint {
8182
8356
  const indices = animation.bones;
8183
8357
  for (let i = 0, n = animation.bones.length; i < n; i++)
8184
8358
  bones[indices[i]].appliedPose.modifyLocal(skeleton);
8185
- animation.apply(skeleton, p.time, p.time, data.loop, null, p.mix, false, data.additive, false, true);
8359
+ animation.apply(skeleton, p.time, p.time, data.loop, null, p.mix, 0 /* current */, data.additive, false, true);
8186
8360
  }
8187
8361
  sort(skeleton) {
8188
8362
  const bone = this.bone;
@@ -8240,6 +8414,9 @@ var SliderData = class extends ConstraintData {
8240
8414
  offset = 0;
8241
8415
  /** When true and a bone is set, the bone's local transform property is read instead of its world transform. */
8242
8416
  local = false;
8417
+ // Nonessential.
8418
+ /** When a bone is set, the maximum slider time for the bone property range, or 0 if nonessential data was not exported. */
8419
+ max = 0;
8243
8420
  constructor(name) {
8244
8421
  super(name, new SliderPose());
8245
8422
  }
@@ -8922,7 +9099,7 @@ var ToShearY = class extends ToProperty {
8922
9099
  if (additive)
8923
9100
  value -= MathUtils.PI / 2;
8924
9101
  else {
8925
- value -= by - Math.atan2(bone.c / sx, bone.a / sy);
9102
+ value -= by - Math.atan2(bone.c / sy, bone.a / sx);
8926
9103
  if (value > MathUtils.PI)
8927
9104
  value -= MathUtils.PI2;
8928
9105
  else if (value < -MathUtils.PI)
@@ -8930,8 +9107,8 @@ var ToShearY = class extends ToProperty {
8930
9107
  }
8931
9108
  value = by + value * pose.mixShearY;
8932
9109
  const s = Math.sqrt(b * b + d * d);
8933
- bone.b = Math.cos(value) * s * sy;
8934
- bone.d = Math.sin(value) * s * sx;
9110
+ bone.b = Math.cos(value) * s * sx;
9111
+ bone.d = Math.sin(value) * s * sy;
8935
9112
  }
8936
9113
  }
8937
9114
  };
@@ -9211,7 +9388,13 @@ var SkeletonBinary = class {
9211
9388
  data.skinRequired = (flags & 1) !== 0;
9212
9389
  data.loop = (flags & 2) !== 0;
9213
9390
  data.additive = (flags & 4) !== 0;
9214
- if ((flags & 8) !== 0) data.setupPose.time = input.readFloat();
9391
+ if ((flags & 8) !== 0) {
9392
+ const value = input.readFloat();
9393
+ if (nonessential && (flags & 64) !== 0)
9394
+ data.max = value;
9395
+ else
9396
+ data.setupPose.time = value;
9397
+ }
9215
9398
  if ((flags & 16) !== 0) data.setupPose.mix = (flags & 32) !== 0 ? input.readFloat() : 1;
9216
9399
  if ((flags & 64) !== 0) {
9217
9400
  data.local = (flags & 128) !== 0;
@@ -11636,7 +11819,6 @@ var SkeletonJson = class {
11636
11819
  data.skinRequired = skinRequired;
11637
11820
  data.additive = getValue(constraintMap, "additive", false);
11638
11821
  data.loop = getValue(constraintMap, "loop", false);
11639
- data.setupPose.time = getValue(constraintMap, "time", 0);
11640
11822
  data.setupPose.mix = getValue(constraintMap, "mix", 1);
11641
11823
  const boneName = constraintMap.bone;
11642
11824
  if (boneName) {
@@ -11648,8 +11830,10 @@ var SkeletonJson = class {
11648
11830
  data.property.offset = getValue(constraintMap, "from", 0) * propertyScale;
11649
11831
  data.offset = getValue(constraintMap, "to", 0);
11650
11832
  data.scale = getValue(constraintMap, "scale", 1) / propertyScale;
11833
+ data.max = getValue(constraintMap, "max", 0);
11651
11834
  data.local = getValue(constraintMap, "local", false);
11652
- }
11835
+ } else
11836
+ data.setupPose.time = getValue(constraintMap, "time", 0);
11653
11837
  skeletonData.constraints.push(data);
11654
11838
  break;
11655
11839
  }
@@ -12226,7 +12410,7 @@ var SkeletonJson = class {
12226
12410
  let mixRotate = getValue(keyMap, "mixRotate", 1);
12227
12411
  let mixX = getValue(keyMap, "mixX", 1), mixY = getValue(keyMap, "mixY", mixX);
12228
12412
  let mixScaleX = getValue(keyMap, "mixScaleX", 1), mixScaleY = getValue(keyMap, "mixScaleY", 1);
12229
- const mixShearY = getValue(keyMap, "mixShearY", 1);
12413
+ let mixShearY = getValue(keyMap, "mixShearY", 1);
12230
12414
  for (let frame = 0, bezier = 0; ; frame++) {
12231
12415
  timeline.setFrame(frame, time, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY);
12232
12416
  const nextMap = timelineMap[frame + 1];
@@ -12254,7 +12438,7 @@ var SkeletonJson = class {
12254
12438
  mixY = mixY2;
12255
12439
  mixScaleX = mixScaleX2;
12256
12440
  mixScaleY = mixScaleY2;
12257
- mixScaleX = mixScaleX2;
12441
+ mixShearY = mixShearY2;
12258
12442
  keyMap = nextMap;
12259
12443
  }
12260
12444
  timelines.push(timeline);
@@ -15567,6 +15751,8 @@ var SpineCanvas = class {
15567
15751
  }
15568
15752
  };
15569
15753
  export {
15754
+ ATTACH_RETAIN,
15755
+ ATTACH_SETUP,
15570
15756
  AlphaTimeline,
15571
15757
  Animation,
15572
15758
  AnimationState,
@@ -15586,6 +15772,7 @@ export {
15586
15772
  BoneTimeline1,
15587
15773
  BoneTimeline2,
15588
15774
  BoundingBoxAttachment,
15775
+ CURRENT,
15589
15776
  CameraController,
15590
15777
  ClippingAttachment,
15591
15778
  Color,
@@ -15618,7 +15805,6 @@ export {
15618
15805
  FromY,
15619
15806
  GLTexture,
15620
15807
  HOLD,
15621
- HOLD_FIRST,
15622
15808
  IkConstraint,
15623
15809
  IkConstraintData,
15624
15810
  IkConstraintPose,
@@ -15645,11 +15831,13 @@ export {
15645
15831
  M31,
15646
15832
  M32,
15647
15833
  M33,
15834
+ MODE,
15648
15835
  ManagedWebGLRenderingContext,
15649
15836
  MathUtils,
15650
15837
  Matrix4,
15651
15838
  Mesh,
15652
15839
  MeshAttachment,
15840
+ MixFrom,
15653
15841
  OrthoCamera,
15654
15842
  PathAttachment,
15655
15843
  PathConstraint,
@@ -15683,7 +15871,6 @@ export {
15683
15871
  Pow,
15684
15872
  PowOut,
15685
15873
  Property,
15686
- RETAIN,
15687
15874
  RGB2Timeline,
15688
15875
  RGBA2Timeline,
15689
15876
  RGBATimeline,
@@ -15693,7 +15880,6 @@ export {
15693
15880
  RotateMode,
15694
15881
  RotateTimeline,
15695
15882
  SETUP,
15696
- SUBSEQUENT,
15697
15883
  ScaleTimeline,
15698
15884
  ScaleXTimeline,
15699
15885
  ScaleYMode,