@esotericsoftware/spine-core 4.3.5 → 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.
@@ -21,6 +21,8 @@ var spine = (() => {
21
21
  // spine-core/src/index.ts
22
22
  var index_exports = {};
23
23
  __export(index_exports, {
24
+ ATTACH_RETAIN: () => ATTACH_RETAIN,
25
+ ATTACH_SETUP: () => ATTACH_SETUP,
24
26
  AlphaTimeline: () => AlphaTimeline,
25
27
  Animation: () => Animation,
26
28
  AnimationState: () => AnimationState,
@@ -39,6 +41,7 @@ var spine = (() => {
39
41
  BoneTimeline1: () => BoneTimeline1,
40
42
  BoneTimeline2: () => BoneTimeline2,
41
43
  BoundingBoxAttachment: () => BoundingBoxAttachment,
44
+ CURRENT: () => CURRENT,
42
45
  ClippingAttachment: () => ClippingAttachment,
43
46
  Color: () => Color,
44
47
  Constraint: () => Constraint,
@@ -67,7 +70,6 @@ var spine = (() => {
67
70
  FromX: () => FromX,
68
71
  FromY: () => FromY,
69
72
  HOLD: () => HOLD,
70
- HOLD_FIRST: () => HOLD_FIRST,
71
73
  IkConstraint: () => IkConstraint,
72
74
  IkConstraintData: () => IkConstraintData,
73
75
  IkConstraintPose: () => IkConstraintPose,
@@ -76,8 +78,10 @@ var spine = (() => {
76
78
  InheritTimeline: () => InheritTimeline,
77
79
  IntSet: () => IntSet,
78
80
  Interpolation: () => Interpolation,
81
+ MODE: () => MODE,
79
82
  MathUtils: () => MathUtils,
80
83
  MeshAttachment: () => MeshAttachment,
84
+ MixFrom: () => MixFrom,
81
85
  PathAttachment: () => PathAttachment,
82
86
  PathConstraint: () => PathConstraint,
83
87
  PathConstraintData: () => PathConstraintData,
@@ -107,7 +111,6 @@ var spine = (() => {
107
111
  Pow: () => Pow,
108
112
  PowOut: () => PowOut,
109
113
  Property: () => Property,
110
- RETAIN: () => RETAIN,
111
114
  RGB2Timeline: () => RGB2Timeline,
112
115
  RGBA2Timeline: () => RGBA2Timeline,
113
116
  RGBATimeline: () => RGBATimeline,
@@ -116,7 +119,6 @@ var spine = (() => {
116
119
  RotateMode: () => RotateMode,
117
120
  RotateTimeline: () => RotateTimeline,
118
121
  SETUP: () => SETUP,
119
- SUBSEQUENT: () => SUBSEQUENT,
120
122
  ScaleTimeline: () => ScaleTimeline,
121
123
  ScaleXTimeline: () => ScaleXTimeline,
122
124
  ScaleYMode: () => ScaleYMode,
@@ -1487,17 +1489,14 @@ var spine = (() => {
1487
1489
  * @param loop True if `time` beyond the {@link duration} repeats the animation, else the last frame is used.
1488
1490
  * @param events If any events are fired, they are added to this list. Pass null to ignore fired events or if no timelines fire
1489
1491
  * events.
1490
- * @param alpha 0 applies setup or current values (depending on `fromSetup`), 1 uses timeline values, and
1491
- * intermediate values interpolate between them. Adjusting `alpha` over time can mix an animation in or
1492
- * out.
1493
- * @param fromSetup If true, `alpha` transitions between setup and timeline values, setup values are used before the
1494
- * first frame (current values are not used). If false, `alpha` transitions between current and timeline
1495
- * values, no change is made before the first frame.
1492
+ * @param alpha 0 applies setup or current values (depending on `from`), 1 uses timeline values, and intermediate
1493
+ * values interpolate between them. Adjusting `alpha` over time can mix an animation in or out.
1494
+ * @param from Controls how `alpha` and `add` mix from current or setup pose values to timeline values.
1496
1495
  * @param add If true, for timelines that support it, their values are added to the setup or current values (depending on
1497
- * `fromSetup`).
1496
+ * `from`).
1498
1497
  * @param out True when the animation is mixing out, else it is mixing in. Used by timelines that perform instant transitions.
1499
1498
  * @param appliedPose True to modify {@link Posed.appliedPose}, else {@link Posed.pose} is modified. */
1500
- apply(skeleton, lastTime, time, loop, events, alpha, fromSetup, add, out, appliedPose) {
1499
+ apply(skeleton, lastTime, time, loop, events, alpha, from, add, out, appliedPose) {
1501
1500
  if (!skeleton) throw new Error("skeleton cannot be null.");
1502
1501
  if (loop && this.duration !== 0) {
1503
1502
  time %= this.duration;
@@ -1505,9 +1504,15 @@ var spine = (() => {
1505
1504
  }
1506
1505
  const timelines = this.timelines;
1507
1506
  for (let i = 0, n = timelines.length; i < n; i++)
1508
- timelines[i].apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose);
1507
+ timelines[i].apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose);
1509
1508
  }
1510
1509
  };
1510
+ var MixFrom = /* @__PURE__ */ ((MixFrom2) => {
1511
+ MixFrom2[MixFrom2["current"] = 0] = "current";
1512
+ MixFrom2[MixFrom2["setup"] = 1] = "setup";
1513
+ MixFrom2[MixFrom2["first"] = 2] = "first";
1514
+ return MixFrom2;
1515
+ })(MixFrom || {});
1511
1516
  var Property = /* @__PURE__ */ ((Property2) => {
1512
1517
  Property2[Property2["rotate"] = 0] = "rotate";
1513
1518
  Property2[Property2["x"] = 1] = "x";
@@ -1524,28 +1529,31 @@ var spine = (() => {
1524
1529
  Property2[Property2["deform"] = 12] = "deform";
1525
1530
  Property2[Property2["event"] = 13] = "event";
1526
1531
  Property2[Property2["drawOrder"] = 14] = "drawOrder";
1527
- Property2[Property2["ikConstraint"] = 15] = "ikConstraint";
1528
- Property2[Property2["transformConstraint"] = 16] = "transformConstraint";
1529
- Property2[Property2["pathConstraintPosition"] = 17] = "pathConstraintPosition";
1530
- Property2[Property2["pathConstraintSpacing"] = 18] = "pathConstraintSpacing";
1531
- Property2[Property2["pathConstraintMix"] = 19] = "pathConstraintMix";
1532
- Property2[Property2["physicsConstraintInertia"] = 20] = "physicsConstraintInertia";
1533
- Property2[Property2["physicsConstraintStrength"] = 21] = "physicsConstraintStrength";
1534
- Property2[Property2["physicsConstraintDamping"] = 22] = "physicsConstraintDamping";
1535
- Property2[Property2["physicsConstraintMass"] = 23] = "physicsConstraintMass";
1536
- Property2[Property2["physicsConstraintWind"] = 24] = "physicsConstraintWind";
1537
- Property2[Property2["physicsConstraintGravity"] = 25] = "physicsConstraintGravity";
1538
- Property2[Property2["physicsConstraintMix"] = 26] = "physicsConstraintMix";
1539
- Property2[Property2["physicsConstraintReset"] = 27] = "physicsConstraintReset";
1540
- Property2[Property2["sequence"] = 28] = "sequence";
1541
- Property2[Property2["sliderTime"] = 29] = "sliderTime";
1542
- Property2[Property2["sliderMix"] = 30] = "sliderMix";
1532
+ Property2[Property2["drawOrderFolder"] = 15] = "drawOrderFolder";
1533
+ Property2[Property2["ikConstraint"] = 16] = "ikConstraint";
1534
+ Property2[Property2["transformConstraint"] = 17] = "transformConstraint";
1535
+ Property2[Property2["pathConstraintPosition"] = 18] = "pathConstraintPosition";
1536
+ Property2[Property2["pathConstraintSpacing"] = 19] = "pathConstraintSpacing";
1537
+ Property2[Property2["pathConstraintMix"] = 20] = "pathConstraintMix";
1538
+ Property2[Property2["physicsConstraintInertia"] = 21] = "physicsConstraintInertia";
1539
+ Property2[Property2["physicsConstraintStrength"] = 22] = "physicsConstraintStrength";
1540
+ Property2[Property2["physicsConstraintDamping"] = 23] = "physicsConstraintDamping";
1541
+ Property2[Property2["physicsConstraintMass"] = 24] = "physicsConstraintMass";
1542
+ Property2[Property2["physicsConstraintWind"] = 25] = "physicsConstraintWind";
1543
+ Property2[Property2["physicsConstraintGravity"] = 26] = "physicsConstraintGravity";
1544
+ Property2[Property2["physicsConstraintMix"] = 27] = "physicsConstraintMix";
1545
+ Property2[Property2["physicsConstraintReset"] = 28] = "physicsConstraintReset";
1546
+ Property2[Property2["sequence"] = 29] = "sequence";
1547
+ Property2[Property2["sliderTime"] = 30] = "sliderTime";
1548
+ Property2[Property2["sliderMix"] = 31] = "sliderMix";
1543
1549
  return Property2;
1544
1550
  })(Property || {});
1545
1551
  var Timeline = class {
1546
1552
  propertyIds;
1547
1553
  frames;
1548
- /** True if this timeline supports additive blending. */
1554
+ /** True if this timeline supports being applied additively.
1555
+ *
1556
+ * See the `add` parameter in {@link Timeline.apply}. */
1549
1557
  additive = false;
1550
1558
  /** True if this timeline sets values instantaneously and does not support interpolation between frames. */
1551
1559
  instant = false;
@@ -1666,7 +1674,7 @@ var spine = (() => {
1666
1674
  return y + (time - x) / (this.frames[frameIndex] - x) * (this.frames[frameIndex + valueOffset] - y);
1667
1675
  }
1668
1676
  };
1669
- var CurveTimeline1 = class extends CurveTimeline {
1677
+ var CurveTimeline1 = class _CurveTimeline1 extends CurveTimeline {
1670
1678
  constructor(frameCount, bezierCount, propertyId) {
1671
1679
  super(frameCount, bezierCount, propertyId);
1672
1680
  }
@@ -1729,41 +1737,51 @@ var spine = (() => {
1729
1737
  * See {@link Timeline.apply}.
1730
1738
  * @param current The current value for the property.
1731
1739
  * @param setup The setup value for the property. */
1732
- getRelativeValue(time, alpha, fromSetup, add, current, setup) {
1733
- if (time < this.frames[0]) return fromSetup ? setup : current;
1740
+ getRelativeValue(time, alpha, from, add, current, setup) {
1741
+ if (time < this.frames[0]) return _CurveTimeline1.beforeFirstKey(from, alpha, current, setup);
1734
1742
  const value = this.getCurveValue(time);
1735
- return fromSetup ? setup + value * alpha : current + (add ? value : value + setup - current) * alpha;
1743
+ return from === 1 /* setup */ ? setup + value * alpha : current + (add ? value : value + setup - current) * alpha;
1736
1744
  }
1737
- getAbsoluteValue(time, alpha, fromSetup, add, current, setup, value) {
1745
+ getAbsoluteValue(time, alpha, from, add, current, setup, value) {
1738
1746
  if (value === void 0)
1739
- return this.getAbsoluteValue1(time, alpha, fromSetup, add, current, setup);
1747
+ return this.getAbsoluteValue1(time, alpha, from, add, current, setup);
1740
1748
  else
1741
- return this.getAbsoluteValue2(time, alpha, fromSetup, add, current, setup, value);
1749
+ return this.getAbsoluteValue2(time, alpha, from, add, current, setup, value);
1742
1750
  }
1743
- getAbsoluteValue1(time, alpha, fromSetup, add, current, setup) {
1744
- if (time < this.frames[0]) return fromSetup ? setup : current;
1751
+ getAbsoluteValue1(time, alpha, from, add, current, setup) {
1752
+ if (time < this.frames[0]) return _CurveTimeline1.beforeFirstKey(from, alpha, current, setup);
1745
1753
  const value = this.getCurveValue(time);
1746
- return fromSetup ? setup + (add ? value : value - setup) * alpha : current + (add ? value : value - current) * alpha;
1754
+ return from === 1 /* setup */ ? setup + (add ? value : value - setup) * alpha : current + (add ? value : value - current) * alpha;
1747
1755
  }
1748
- getAbsoluteValue2(time, alpha, fromSetup, add, current, setup, value) {
1749
- if (time < this.frames[0]) return fromSetup ? setup : current;
1750
- return fromSetup ? setup + (add ? value : value - setup) * alpha : current + (add ? value : value - current) * alpha;
1756
+ getAbsoluteValue2(time, alpha, from, add, current, setup, value) {
1757
+ if (time < this.frames[0]) return _CurveTimeline1.beforeFirstKey(from, alpha, current, setup);
1758
+ return from === 1 /* setup */ ? setup + (add ? value : value - setup) * alpha : current + (add ? value : value - current) * alpha;
1751
1759
  }
1752
1760
  /** Returns the interpolated value for scale properties. The timeline and setup values are multiplied and sign adjusted.
1753
1761
  *
1754
1762
  * See {@link Timeline.apply}.
1755
1763
  * @param current The current value for the property.
1756
1764
  * @param setup The setup value for the property. */
1757
- getScaleValue(time, alpha, fromSetup, add, out, current, setup) {
1758
- if (time < this.frames[0]) return fromSetup ? setup : current;
1765
+ getScaleValue(time, alpha, from, add, out, current, setup) {
1766
+ if (time < this.frames[0]) return _CurveTimeline1.beforeFirstKey(from, alpha, current, setup);
1759
1767
  const value = this.getCurveValue(time) * setup;
1760
1768
  if (alpha === 1 && !add) return value;
1761
- let base = fromSetup ? setup : current;
1769
+ let base = from === 1 /* setup */ ? setup : current;
1762
1770
  if (add) return base + (value - setup) * alpha;
1763
1771
  if (out) return base + (Math.abs(value) * Math.sign(base) - base) * alpha;
1764
1772
  base = Math.abs(base) * Math.sign(value);
1765
1773
  return base + (value - base) * alpha;
1766
1774
  }
1775
+ static beforeFirstKey(from, alpha, current, setup) {
1776
+ switch (from) {
1777
+ case 1 /* setup */:
1778
+ return setup;
1779
+ case 2 /* first */:
1780
+ return current + (setup - current) * alpha;
1781
+ case 0 /* current */:
1782
+ return current;
1783
+ }
1784
+ }
1767
1785
  };
1768
1786
  function isBoneTimeline(obj) {
1769
1787
  return typeof obj === "object" && obj !== null && typeof obj.boneIndex === "number";
@@ -1775,10 +1793,10 @@ var spine = (() => {
1775
1793
  this.boneIndex = boneIndex;
1776
1794
  this.additive = true;
1777
1795
  }
1778
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
1796
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
1779
1797
  const bone = skeleton.bones[this.boneIndex];
1780
1798
  if (bone.active)
1781
- this.apply1(appliedPose ? bone.appliedPose : bone.pose, bone.data.setupPose, time, alpha, fromSetup, add, out);
1799
+ this.apply1(appliedPose ? bone.appliedPose : bone.pose, bone.data.setupPose, time, alpha, from, add, out);
1782
1800
  }
1783
1801
  };
1784
1802
  var BoneTimeline2 = class extends CurveTimeline {
@@ -1808,30 +1826,36 @@ var spine = (() => {
1808
1826
  /*VALUE2*/
1809
1827
  ] = value2;
1810
1828
  }
1811
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
1829
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
1812
1830
  const bone = skeleton.bones[this.boneIndex];
1813
1831
  if (bone.active)
1814
- this.apply1(appliedPose ? bone.appliedPose : bone.pose, bone.data.setupPose, time, alpha, fromSetup, add, out);
1832
+ this.apply1(appliedPose ? bone.appliedPose : bone.pose, bone.data.setupPose, time, alpha, from, add, out);
1815
1833
  }
1816
1834
  };
1817
1835
  var RotateTimeline = class extends BoneTimeline1 {
1818
1836
  constructor(frameCount, bezierCount, boneIndex) {
1819
1837
  super(frameCount, bezierCount, boneIndex, 0 /* rotate */);
1820
1838
  }
1821
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1822
- pose.rotation = this.getRelativeValue(time, alpha, fromSetup, add, pose.rotation, setup.rotation);
1839
+ apply1(pose, setup, time, alpha, from, add, out) {
1840
+ pose.rotation = this.getRelativeValue(time, alpha, from, add, pose.rotation, setup.rotation);
1823
1841
  }
1824
1842
  };
1825
1843
  var TranslateTimeline = class extends BoneTimeline2 {
1826
1844
  constructor(frameCount, bezierCount, boneIndex) {
1827
1845
  super(frameCount, bezierCount, boneIndex, 1 /* x */, 2 /* y */);
1828
1846
  }
1829
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1847
+ apply1(pose, setup, time, alpha, from, add, out) {
1830
1848
  const frames = this.frames;
1831
1849
  if (time < frames[0]) {
1832
- if (fromSetup) {
1833
- pose.x = setup.x;
1834
- pose.y = setup.y;
1850
+ switch (from) {
1851
+ case 1 /* setup */:
1852
+ pose.x = setup.x;
1853
+ pose.y = setup.y;
1854
+ break;
1855
+ case 2 /* first */:
1856
+ pose.x += (setup.x - pose.x) * alpha;
1857
+ pose.y += (setup.y - pose.y) * alpha;
1858
+ break;
1835
1859
  }
1836
1860
  return;
1837
1861
  }
@@ -1897,7 +1921,7 @@ var spine = (() => {
1897
1921
  /*BEZIER*/
1898
1922
  );
1899
1923
  }
1900
- if (fromSetup) {
1924
+ if (from === 1 /* setup */) {
1901
1925
  pose.x = setup.x + x * alpha;
1902
1926
  pose.y = setup.y + y * alpha;
1903
1927
  } else if (add) {
@@ -1913,28 +1937,34 @@ var spine = (() => {
1913
1937
  constructor(frameCount, bezierCount, boneIndex) {
1914
1938
  super(frameCount, bezierCount, boneIndex, 1 /* x */);
1915
1939
  }
1916
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1917
- pose.x = this.getRelativeValue(time, alpha, fromSetup, add, pose.x, setup.x);
1940
+ apply1(pose, setup, time, alpha, from, add, out) {
1941
+ pose.x = this.getRelativeValue(time, alpha, from, add, pose.x, setup.x);
1918
1942
  }
1919
1943
  };
1920
1944
  var TranslateYTimeline = class extends BoneTimeline1 {
1921
1945
  constructor(frameCount, bezierCount, boneIndex) {
1922
1946
  super(frameCount, bezierCount, boneIndex, 2 /* y */);
1923
1947
  }
1924
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1925
- pose.y = this.getRelativeValue(time, alpha, fromSetup, add, pose.y, setup.y);
1948
+ apply1(pose, setup, time, alpha, from, add, out) {
1949
+ pose.y = this.getRelativeValue(time, alpha, from, add, pose.y, setup.y);
1926
1950
  }
1927
1951
  };
1928
1952
  var ScaleTimeline = class extends BoneTimeline2 {
1929
1953
  constructor(frameCount, bezierCount, boneIndex) {
1930
1954
  super(frameCount, bezierCount, boneIndex, 3 /* scaleX */, 4 /* scaleY */);
1931
1955
  }
1932
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1956
+ apply1(pose, setup, time, alpha, from, add, out) {
1933
1957
  const frames = this.frames;
1934
1958
  if (time < frames[0]) {
1935
- if (fromSetup) {
1936
- pose.scaleX = setup.scaleX;
1937
- pose.scaleY = setup.scaleY;
1959
+ switch (from) {
1960
+ case 1 /* setup */:
1961
+ pose.scaleX = setup.scaleX;
1962
+ pose.scaleY = setup.scaleY;
1963
+ break;
1964
+ case 2 /* first */:
1965
+ pose.scaleX += (setup.scaleX - pose.scaleX) * alpha;
1966
+ pose.scaleY += (setup.scaleY - pose.scaleY) * alpha;
1967
+ break;
1938
1968
  }
1939
1969
  return;
1940
1970
  }
@@ -2007,7 +2037,7 @@ var spine = (() => {
2007
2037
  pose.scaleY = y;
2008
2038
  } else {
2009
2039
  let bx = 0, by = 0;
2010
- if (fromSetup) {
2040
+ if (from === 1 /* setup */) {
2011
2041
  bx = setup.scaleX;
2012
2042
  by = setup.scaleY;
2013
2043
  } else {
@@ -2033,28 +2063,34 @@ var spine = (() => {
2033
2063
  constructor(frameCount, bezierCount, boneIndex) {
2034
2064
  super(frameCount, bezierCount, boneIndex, 3 /* scaleX */);
2035
2065
  }
2036
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
2037
- pose.scaleX = this.getScaleValue(time, alpha, fromSetup, add, out, pose.scaleX, setup.scaleX);
2066
+ apply1(pose, setup, time, alpha, from, add, out) {
2067
+ pose.scaleX = this.getScaleValue(time, alpha, from, add, out, pose.scaleX, setup.scaleX);
2038
2068
  }
2039
2069
  };
2040
2070
  var ScaleYTimeline = class extends BoneTimeline1 {
2041
2071
  constructor(frameCount, bezierCount, boneIndex) {
2042
2072
  super(frameCount, bezierCount, boneIndex, 4 /* scaleY */);
2043
2073
  }
2044
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
2045
- pose.scaleY = this.getScaleValue(time, alpha, fromSetup, add, out, pose.scaleY, setup.scaleY);
2074
+ apply1(pose, setup, time, alpha, from, add, out) {
2075
+ pose.scaleY = this.getScaleValue(time, alpha, from, add, out, pose.scaleY, setup.scaleY);
2046
2076
  }
2047
2077
  };
2048
2078
  var ShearTimeline = class extends BoneTimeline2 {
2049
2079
  constructor(frameCount, bezierCount, boneIndex) {
2050
2080
  super(frameCount, bezierCount, boneIndex, 5 /* shearX */, 6 /* shearY */);
2051
2081
  }
2052
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
2082
+ apply1(pose, setup, time, alpha, from, add, out) {
2053
2083
  const frames = this.frames;
2054
2084
  if (time < frames[0]) {
2055
- if (fromSetup) {
2056
- pose.shearX = setup.shearX;
2057
- pose.shearY = setup.shearY;
2085
+ switch (from) {
2086
+ case 1 /* setup */:
2087
+ pose.shearX = setup.shearX;
2088
+ pose.shearY = setup.shearY;
2089
+ break;
2090
+ case 2 /* first */:
2091
+ pose.shearX += (setup.shearX - pose.shearX) * alpha;
2092
+ pose.shearY += (setup.shearY - pose.shearY) * alpha;
2093
+ break;
2058
2094
  }
2059
2095
  return;
2060
2096
  }
@@ -2120,7 +2156,7 @@ var spine = (() => {
2120
2156
  /*BEZIER*/
2121
2157
  );
2122
2158
  }
2123
- if (fromSetup) {
2159
+ if (from === 1 /* setup */) {
2124
2160
  pose.shearX = setup.shearX + x * alpha;
2125
2161
  pose.shearY = setup.shearY + y * alpha;
2126
2162
  } else if (add) {
@@ -2136,16 +2172,16 @@ var spine = (() => {
2136
2172
  constructor(frameCount, bezierCount, boneIndex) {
2137
2173
  super(frameCount, bezierCount, boneIndex, 5 /* shearX */);
2138
2174
  }
2139
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
2140
- pose.shearX = this.getRelativeValue(time, alpha, fromSetup, add, pose.shearX, setup.shearX);
2175
+ apply1(pose, setup, time, alpha, from, add, out) {
2176
+ pose.shearX = this.getRelativeValue(time, alpha, from, add, pose.shearX, setup.shearX);
2141
2177
  }
2142
2178
  };
2143
2179
  var ShearYTimeline = class extends BoneTimeline1 {
2144
2180
  constructor(frameCount, bezierCount, boneIndex) {
2145
2181
  super(frameCount, bezierCount, boneIndex, 6 /* shearY */);
2146
2182
  }
2147
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
2148
- pose.shearY = this.getRelativeValue(time, alpha, fromSetup, add, pose.shearY, setup.shearY);
2183
+ apply1(pose, setup, time, alpha, from, add, out) {
2184
+ pose.shearY = this.getRelativeValue(time, alpha, from, add, pose.shearY, setup.shearY);
2149
2185
  }
2150
2186
  };
2151
2187
  var InheritTimeline = class extends Timeline {
@@ -2169,16 +2205,16 @@ var spine = (() => {
2169
2205
  /*INHERIT*/
2170
2206
  ] = inherit;
2171
2207
  }
2172
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
2208
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
2173
2209
  const bone = skeleton.bones[this.boneIndex];
2174
2210
  if (!bone.active) return;
2175
2211
  const pose = appliedPose ? bone.appliedPose : bone.pose;
2176
2212
  if (out) {
2177
- if (fromSetup) pose.inherit = bone.data.setupPose.inherit;
2213
+ if (from !== 0 /* current */) pose.inherit = bone.data.setupPose.inherit;
2178
2214
  } else {
2179
2215
  const frames = this.frames;
2180
2216
  if (time < frames[0]) {
2181
- if (fromSetup) pose.inherit = bone.data.setupPose.inherit;
2217
+ if (from !== 0 /* current */) pose.inherit = bone.data.setupPose.inherit;
2182
2218
  } else
2183
2219
  pose.inherit = this.frames[
2184
2220
  Timeline.search(
@@ -2198,9 +2234,9 @@ var spine = (() => {
2198
2234
  super(frameCount, bezierCount, ...propertyIds);
2199
2235
  this.slotIndex = slotIndex;
2200
2236
  }
2201
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
2237
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
2202
2238
  const slot = skeleton.slots[this.slotIndex];
2203
- if (slot.bone.active) this.apply1(slot, appliedPose ? slot.appliedPose : slot.pose, time, alpha, fromSetup, add);
2239
+ if (slot.bone.active) this.apply1(slot, appliedPose ? slot.appliedPose : slot.pose, time, alpha, from, add);
2204
2240
  }
2205
2241
  };
2206
2242
  var RGBATimeline = class extends SlotCurveTimeline {
@@ -2239,11 +2275,24 @@ var spine = (() => {
2239
2275
  /*A*/
2240
2276
  ] = a;
2241
2277
  }
2242
- apply1(slot, pose, time, alpha, fromSetup, add) {
2278
+ apply1(slot, pose, time, alpha, from, add) {
2243
2279
  const color = pose.color;
2244
2280
  const frames = this.frames;
2245
2281
  if (time < frames[0]) {
2246
- if (fromSetup) color.setFromColor(slot.data.setupPose.color);
2282
+ const setup = slot.data.setupPose.color;
2283
+ switch (from) {
2284
+ case 1 /* setup */:
2285
+ color.setFromColor(setup);
2286
+ break;
2287
+ case 2 /* first */:
2288
+ color.add(
2289
+ (setup.r - color.r) * alpha,
2290
+ (setup.g - color.g) * alpha,
2291
+ (setup.b - color.b) * alpha,
2292
+ (setup.a - color.a) * alpha
2293
+ );
2294
+ break;
2295
+ }
2247
2296
  return;
2248
2297
  }
2249
2298
  let r = 0, g = 0, b = 0, a = 0;
@@ -2349,7 +2398,7 @@ var spine = (() => {
2349
2398
  if (alpha === 1)
2350
2399
  color.set(r, g, b, a);
2351
2400
  else {
2352
- if (fromSetup) {
2401
+ if (from === 1 /* setup */) {
2353
2402
  const setup = slot.data.setupPose.color;
2354
2403
  color.set(
2355
2404
  setup.r + (r - setup.r) * alpha,
@@ -2386,16 +2435,25 @@ var spine = (() => {
2386
2435
  /*B*/
2387
2436
  ] = b;
2388
2437
  }
2389
- apply1(slot, pose, time, alpha, fromSetup, add) {
2438
+ apply1(slot, pose, time, alpha, from, add) {
2390
2439
  const color = pose.color;
2391
2440
  let r = 0, g = 0, b = 0;
2392
2441
  const frames = this.frames;
2393
2442
  if (time < frames[0]) {
2394
- if (fromSetup) {
2395
- const setup = slot.data.setupPose.color;
2396
- color.r = setup.r;
2397
- color.g = setup.g;
2398
- color.b = setup.b;
2443
+ const setup = slot.data.setupPose.color;
2444
+ switch (from) {
2445
+ case 1 /* setup */: {
2446
+ color.r = setup.r;
2447
+ color.g = setup.g;
2448
+ color.b = setup.b;
2449
+ break;
2450
+ }
2451
+ case 2 /* first */: {
2452
+ color.r += (setup.r - color.r) * alpha;
2453
+ color.g += (setup.g - color.g) * alpha;
2454
+ color.b += (setup.b - color.b) * alpha;
2455
+ break;
2456
+ }
2399
2457
  }
2400
2458
  return;
2401
2459
  }
@@ -2477,7 +2535,7 @@ var spine = (() => {
2477
2535
  );
2478
2536
  }
2479
2537
  if (alpha !== 1) {
2480
- if (fromSetup) {
2538
+ if (from === 1 /* setup */) {
2481
2539
  const setup = slot.data.setupPose.color;
2482
2540
  r = setup.r + (r - setup.r) * alpha;
2483
2541
  g = setup.g + (g - setup.g) * alpha;
@@ -2499,19 +2557,27 @@ var spine = (() => {
2499
2557
  super(frameCount, bezierCount, `${9 /* alpha */}|${slotIndex}`);
2500
2558
  this.slotIndex = slotIndex;
2501
2559
  }
2502
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
2560
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
2503
2561
  const slot = skeleton.slots[this.slotIndex];
2504
2562
  if (!slot.bone.active) return;
2505
2563
  const color = (appliedPose ? slot.appliedPose : slot.pose).color;
2506
2564
  let a = 0;
2507
2565
  const frames = this.frames;
2508
2566
  if (time < frames[0]) {
2509
- if (fromSetup) color.a = slot.data.setupPose.color.a;
2567
+ const setup = slot.data.setupPose.color.a;
2568
+ switch (from) {
2569
+ case 1 /* setup */:
2570
+ color.a = setup;
2571
+ break;
2572
+ case 2 /* first */:
2573
+ color.a += (setup - color.a) * alpha;
2574
+ break;
2575
+ }
2510
2576
  return;
2511
2577
  }
2512
2578
  a = this.getCurveValue(time);
2513
2579
  if (alpha !== 1) {
2514
- if (fromSetup) {
2580
+ if (from === 1 /* setup */) {
2515
2581
  const setup = slot.data.setupPose.color;
2516
2582
  a = setup.a + (a - setup.a) * alpha;
2517
2583
  } else
@@ -2570,18 +2636,33 @@ var spine = (() => {
2570
2636
  /*B2*/
2571
2637
  ] = b2;
2572
2638
  }
2573
- apply1(slot, pose, time, alpha, fromSetup, add) {
2639
+ apply1(slot, pose, time, alpha, from, add) {
2574
2640
  const light = pose.color, dark = pose.darkColor;
2575
2641
  let r2 = 0, g2 = 0, b2 = 0;
2576
2642
  const frames = this.frames;
2577
2643
  if (time < frames[0]) {
2578
- if (fromSetup) {
2579
- const setup = slot.data.setupPose;
2580
- light.setFromColor(setup.color);
2581
- const setupDark = setup.darkColor;
2582
- dark.r = setupDark.r;
2583
- dark.g = setupDark.g;
2584
- dark.b = setupDark.b;
2644
+ const setup = slot.data.setupPose;
2645
+ const setupLight = setup.color, setupDark = setup.darkColor;
2646
+ switch (from) {
2647
+ case 1 /* setup */: {
2648
+ light.setFromColor(setupLight);
2649
+ dark.r = setupDark.r;
2650
+ dark.g = setupDark.g;
2651
+ dark.b = setupDark.b;
2652
+ break;
2653
+ }
2654
+ case 2 /* first */: {
2655
+ light.add(
2656
+ (setupLight.r - light.r) * alpha,
2657
+ (setupLight.g - light.g) * alpha,
2658
+ (setupLight.b - light.b) * alpha,
2659
+ (setupLight.a - light.a) * alpha
2660
+ );
2661
+ dark.r += (setupDark.r - dark.r) * alpha;
2662
+ dark.g += (setupDark.g - dark.g) * alpha;
2663
+ dark.b += (setupDark.b - dark.b) * alpha;
2664
+ break;
2665
+ }
2585
2666
  }
2586
2667
  return;
2587
2668
  }
@@ -2741,7 +2822,7 @@ var spine = (() => {
2741
2822
  }
2742
2823
  if (alpha === 1)
2743
2824
  light.set(r, g, b, a);
2744
- else if (fromSetup) {
2825
+ else if (from === 1 /* setup */) {
2745
2826
  const setupPose = slot.data.setupPose;
2746
2827
  let setup = setupPose.color;
2747
2828
  light.set(
@@ -2809,20 +2890,30 @@ var spine = (() => {
2809
2890
  /*B2*/
2810
2891
  ] = b2;
2811
2892
  }
2812
- apply1(slot, pose, time, alpha, fromSetup, add) {
2893
+ apply1(slot, pose, time, alpha, from, add) {
2813
2894
  const light = pose.color, dark = pose.darkColor;
2814
2895
  let r = 0, g = 0, b = 0, r2 = 0, g2 = 0, b2 = 0;
2815
2896
  const frames = this.frames;
2816
2897
  if (time < frames[0]) {
2817
- if (fromSetup) {
2818
- const setup = slot.data.setupPose;
2819
- const setupLight = setup.color, setupDark = setup.darkColor;
2820
- light.r = setupLight.r;
2821
- light.g = setupLight.g;
2822
- light.b = setupLight.b;
2823
- dark.r = setupDark.r;
2824
- dark.g = setupDark.g;
2825
- dark.b = setupDark.b;
2898
+ const setup = slot.data.setupPose;
2899
+ const setupLight = setup.color, setupDark = setup.darkColor;
2900
+ switch (from) {
2901
+ case 1 /* setup */:
2902
+ light.r = setupLight.r;
2903
+ light.g = setupLight.g;
2904
+ light.b = setupLight.b;
2905
+ dark.r = setupDark.r;
2906
+ dark.g = setupDark.g;
2907
+ dark.b = setupDark.b;
2908
+ break;
2909
+ case 2 /* first */:
2910
+ light.r += (setupLight.r - light.r) * alpha;
2911
+ light.g += (setupLight.g - light.g) * alpha;
2912
+ light.b += (setupLight.b - light.b) * alpha;
2913
+ dark.r += (setupDark.r - dark.r) * alpha;
2914
+ dark.g += (setupDark.g - dark.g) * alpha;
2915
+ dark.b += (setupDark.b - dark.b) * alpha;
2916
+ break;
2826
2917
  }
2827
2918
  return;
2828
2919
  }
@@ -2964,7 +3055,7 @@ var spine = (() => {
2964
3055
  );
2965
3056
  }
2966
3057
  if (alpha !== 1) {
2967
- if (fromSetup) {
3058
+ if (from === 1 /* setup */) {
2968
3059
  const setupPose = slot.data.setupPose;
2969
3060
  let setup = setupPose.color;
2970
3061
  r = setup.r + (r - setup.r) * alpha;
@@ -3009,12 +3100,12 @@ var spine = (() => {
3009
3100
  this.frames[frame] = time;
3010
3101
  this.attachmentNames[frame] = attachmentName;
3011
3102
  }
3012
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
3103
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
3013
3104
  const slot = skeleton.slots[this.slotIndex];
3014
3105
  if (!slot.bone.active) return;
3015
3106
  const pose = appliedPose ? slot.appliedPose : slot.pose;
3016
3107
  if (out || time < this.frames[0]) {
3017
- if (fromSetup) this.setAttachment(skeleton, pose, slot.data.attachmentName);
3108
+ if (from !== 0 /* current */) this.setAttachment(skeleton, pose, slot.data.attachmentName);
3018
3109
  } else
3019
3110
  this.setAttachment(skeleton, pose, this.attachmentNames[Timeline.search(this.frames, time)]);
3020
3111
  }
@@ -3096,15 +3187,15 @@ var spine = (() => {
3096
3187
  const x = curves[n - 2], y = curves[n - 1];
3097
3188
  return y + (1 - y) * (time - x) / (this.frames[frame + this.getFrameEntries()] - x);
3098
3189
  }
3099
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
3190
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
3100
3191
  const slots = skeleton.slots;
3101
3192
  if (!this.attachment.isTimelineActive(slots, this.slotIndex, appliedPose)) return;
3102
3193
  const timelineSlots = this.attachment.timelineSlots;
3103
3194
  const frames = this.frames;
3104
3195
  if (time < frames[0]) {
3105
- this.applyBeforeFirst(slots[this.slotIndex], appliedPose, fromSetup);
3196
+ this.applyBeforeFirst(slots[this.slotIndex], appliedPose, alpha, from);
3106
3197
  for (const slotIndex of timelineSlots)
3107
- this.applyBeforeFirst(slots[slotIndex], appliedPose, fromSetup);
3198
+ this.applyBeforeFirst(slots[slotIndex], appliedPose, alpha, from);
3108
3199
  return;
3109
3200
  }
3110
3201
  let v1, v2;
@@ -3120,17 +3211,49 @@ var spine = (() => {
3120
3211
  v2 = this.vertices[frame + 1];
3121
3212
  }
3122
3213
  const vertexCount = this.vertices[0].length;
3123
- this.applyToSlot(slots[this.slotIndex], appliedPose, v1, v2, percent, vertexCount, alpha, fromSetup, add);
3214
+ this.applyToSlot(slots[this.slotIndex], appliedPose, v1, v2, percent, vertexCount, alpha, from, add);
3124
3215
  for (const slotIndex of timelineSlots)
3125
- this.applyToSlot(slots[slotIndex], appliedPose, v1, v2, percent, vertexCount, alpha, fromSetup, add);
3216
+ this.applyToSlot(slots[slotIndex], appliedPose, v1, v2, percent, vertexCount, alpha, from, add);
3126
3217
  }
3127
- applyToSlot(slot, appliedPose, v1, v2, percent, vertexCount, alpha, fromSetup, add) {
3218
+ applyBeforeFirst(slot, appliedPose, alpha, from) {
3219
+ if (!slot.bone.active) return;
3220
+ const pose = appliedPose ? slot.appliedPose : slot.pose;
3221
+ if (pose.attachment == null || pose.attachment.timelineAttachment !== this.attachment) return;
3222
+ const deformArray = pose.deform;
3223
+ if (deformArray.length === 0) from = 1 /* setup */;
3224
+ switch (from) {
3225
+ case 1 /* setup */:
3226
+ deformArray.length = 0;
3227
+ break;
3228
+ case 2 /* first */: {
3229
+ if (alpha === 1) {
3230
+ deformArray.length = 0;
3231
+ return;
3232
+ }
3233
+ const vertexCount = this.vertices[0].length;
3234
+ deformArray.length = vertexCount;
3235
+ const deform = deformArray;
3236
+ const vertexAttachment = pose.attachment;
3237
+ if (vertexAttachment.bones === null) {
3238
+ const setupVertices = vertexAttachment.vertices;
3239
+ for (let i = 0; i < vertexCount; i++)
3240
+ deform[i] += (setupVertices[i] - deform[i]) * alpha;
3241
+ } else {
3242
+ alpha = 1 - alpha;
3243
+ for (let i = 0; i < vertexCount; i++)
3244
+ deform[i] *= alpha;
3245
+ }
3246
+ }
3247
+ }
3248
+ }
3249
+ applyToSlot(slot, appliedPose, v1, v2, percent, vertexCount, alpha, from, add) {
3128
3250
  if (!slot.bone.active) return;
3129
3251
  const pose = appliedPose ? slot.appliedPose : slot.pose;
3130
3252
  if (pose.attachment === null || pose.attachment.timelineAttachment !== this.attachment) return;
3131
3253
  const vertexAttachment = pose.attachment;
3132
3254
  const deform = pose.deform;
3133
- if (deform.length === 0) fromSetup = true;
3255
+ if (deform.length === 0) from = 1 /* setup */;
3256
+ const fromSetup = from === 1 /* setup */;
3134
3257
  deform.length = vertexCount;
3135
3258
  if (v2 === null) {
3136
3259
  if (alpha === 1) {
@@ -3226,13 +3349,6 @@ var spine = (() => {
3226
3349
  }
3227
3350
  }
3228
3351
  }
3229
- applyBeforeFirst(slot, appliedPose, fromSetup) {
3230
- if (!slot.bone.active) return;
3231
- const pose = appliedPose ? slot.appliedPose : slot.pose;
3232
- if (pose.attachment == null || pose.attachment.timelineAttachment !== this.attachment) return;
3233
- if (pose.deform.length === 0) fromSetup = true;
3234
- if (fromSetup) pose.deform.length = 0;
3235
- }
3236
3352
  };
3237
3353
  var SequenceTimeline = class _SequenceTimeline extends Timeline {
3238
3354
  static ENTRIES = 3;
@@ -3241,7 +3357,7 @@ var spine = (() => {
3241
3357
  slotIndex;
3242
3358
  attachment;
3243
3359
  constructor(frameCount, slotIndex, attachment) {
3244
- super(frameCount, `${28 /* sequence */}|${slotIndex}|${attachment.sequence.id}`);
3360
+ super(frameCount, `${29 /* sequence */}|${slotIndex}|${attachment.sequence.id}`);
3245
3361
  this.slotIndex = slotIndex;
3246
3362
  this.attachment = attachment;
3247
3363
  this.instant = true;
@@ -3268,13 +3384,13 @@ var spine = (() => {
3268
3384
  frames[frame + _SequenceTimeline.MODE] = mode | index << 4;
3269
3385
  frames[frame + _SequenceTimeline.DELAY] = delay;
3270
3386
  }
3271
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
3387
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
3272
3388
  const slots = skeleton.slots;
3273
3389
  if (!this.attachment.isTimelineActive(slots, this.slotIndex, appliedPose)) return;
3274
3390
  const timelineSlots = this.attachment.timelineSlots;
3275
3391
  const frames = this.frames;
3276
3392
  if (out || time < frames[0]) {
3277
- if (fromSetup) {
3393
+ if (from !== 0 /* current */) {
3278
3394
  this.setupPose(slots[this.slotIndex], appliedPose);
3279
3395
  for (const slotIndex of timelineSlots)
3280
3396
  this.setupPose(slots[slotIndex], appliedPose);
@@ -3350,12 +3466,12 @@ var spine = (() => {
3350
3466
  this.events[frame] = event;
3351
3467
  }
3352
3468
  /** Fires events for frames > `lastTime` and <= `time`. */
3353
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3469
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3354
3470
  if (!firedEvents) return;
3355
3471
  const frames = this.frames;
3356
3472
  const frameCount = this.frames.length;
3357
3473
  if (lastTime > time) {
3358
- this.apply(null, lastTime, Number.MAX_VALUE, firedEvents, 0, false, false, false, false);
3474
+ this.apply(null, lastTime, Number.MAX_VALUE, firedEvents, 0, from, false, false, false);
3359
3475
  lastTime = -1;
3360
3476
  } else if (lastTime >= frames[frameCount - 1])
3361
3477
  return;
@@ -3395,11 +3511,11 @@ var spine = (() => {
3395
3511
  this.frames[frame] = time;
3396
3512
  this.drawOrders[frame] = drawOrder;
3397
3513
  }
3398
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3514
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3399
3515
  const pose = appliedPose ? skeleton.drawOrder.appliedPose : skeleton.drawOrder.pose;
3400
3516
  const setup = skeleton.slots;
3401
3517
  if (out || time < this.frames[0]) {
3402
- if (fromSetup) Utils.arrayCopy(setup, 0, pose, 0, skeleton.slots.length);
3518
+ if (from !== 0 /* current */) Utils.arrayCopy(setup, 0, pose, 0, skeleton.slots.length);
3403
3519
  return;
3404
3520
  }
3405
3521
  const order = this.drawOrders[Timeline.search(this.frames, time)];
@@ -3412,6 +3528,7 @@ var spine = (() => {
3412
3528
  }
3413
3529
  };
3414
3530
  var DrawOrderFolderTimeline = class _DrawOrderFolderTimeline extends Timeline {
3531
+ static propertyID = `${15 /* drawOrderFolder */}`;
3415
3532
  slots;
3416
3533
  inFolder;
3417
3534
  drawOrders;
@@ -3430,7 +3547,7 @@ var spine = (() => {
3430
3547
  const n = slots.length;
3431
3548
  const ids = new Array(n);
3432
3549
  for (let i = 0; i < n; i++)
3433
- ids[i] = `d${slots[i]}`;
3550
+ ids[i] = `${_DrawOrderFolderTimeline.propertyID}|${slots[i]}`;
3434
3551
  return ids;
3435
3552
  }
3436
3553
  getFrameCount() {
@@ -3452,11 +3569,11 @@ var spine = (() => {
3452
3569
  this.frames[frame] = time;
3453
3570
  this.drawOrders[frame] = drawOrder;
3454
3571
  }
3455
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
3572
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
3456
3573
  const pose = appliedPose ? skeleton.drawOrder.appliedPose : skeleton.drawOrder.pose;
3457
3574
  const setup = skeleton.slots;
3458
3575
  if (out || time < this.frames[0]) {
3459
- if (fromSetup) this.setup(pose, setup);
3576
+ if (from !== 0 /* current */) this.setup(pose, setup);
3460
3577
  } else {
3461
3578
  const order = this.drawOrders[Timeline.search(this.frames, time)];
3462
3579
  if (!order)
@@ -3489,7 +3606,7 @@ var spine = (() => {
3489
3606
  var IkConstraintTimeline = class extends CurveTimeline {
3490
3607
  constraintIndex = 0;
3491
3608
  constructor(frameCount, bezierCount, constraintIndex) {
3492
- super(frameCount, bezierCount, `${15 /* ikConstraint */}|${constraintIndex}`);
3609
+ super(frameCount, bezierCount, `${16 /* ikConstraint */}|${constraintIndex}`);
3493
3610
  this.constraintIndex = constraintIndex;
3494
3611
  }
3495
3612
  getFrameEntries() {
@@ -3523,19 +3640,30 @@ var spine = (() => {
3523
3640
  /*STRETCH*/
3524
3641
  ] = stretch ? 1 : 0;
3525
3642
  }
3526
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3643
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3527
3644
  const constraint = skeleton.constraints[this.constraintIndex];
3528
3645
  if (!constraint.active) return;
3529
3646
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3530
3647
  const frames = this.frames;
3531
3648
  if (time < frames[0]) {
3532
- if (fromSetup) {
3533
- const setup = constraint.data.setupPose;
3534
- pose.mix = setup.mix;
3535
- pose.softness = setup.softness;
3536
- pose.bendDirection = setup.bendDirection;
3537
- pose.compress = setup.compress;
3538
- pose.stretch = setup.stretch;
3649
+ const setup = constraint.data.setupPose;
3650
+ switch (from) {
3651
+ case 1 /* setup */: {
3652
+ pose.mix = setup.mix;
3653
+ pose.softness = setup.softness;
3654
+ pose.bendDirection = setup.bendDirection;
3655
+ pose.compress = setup.compress;
3656
+ pose.stretch = setup.stretch;
3657
+ break;
3658
+ }
3659
+ case 2 /* first */: {
3660
+ pose.mix += (setup.mix - pose.mix) * alpha;
3661
+ pose.softness += (setup.softness - pose.softness) * alpha;
3662
+ pose.bendDirection = setup.bendDirection;
3663
+ pose.compress = setup.compress;
3664
+ pose.stretch = setup.stretch;
3665
+ break;
3666
+ }
3539
3667
  }
3540
3668
  return;
3541
3669
  }
@@ -3601,11 +3729,11 @@ var spine = (() => {
3601
3729
  /*BEZIER*/
3602
3730
  );
3603
3731
  }
3604
- const base = fromSetup ? constraint.data.setupPose : pose;
3732
+ const base = from === 1 /* setup */ ? constraint.data.setupPose : pose;
3605
3733
  pose.mix = base.mix + (mix - base.mix) * alpha;
3606
3734
  pose.softness = base.softness + (softness - base.softness) * alpha;
3607
3735
  if (out) {
3608
- if (fromSetup) {
3736
+ if (from === 1 /* setup */) {
3609
3737
  pose.bendDirection = base.bendDirection;
3610
3738
  pose.compress = base.compress;
3611
3739
  pose.stretch = base.stretch;
@@ -3630,7 +3758,7 @@ var spine = (() => {
3630
3758
  /** The index of the transform constraint slot in {@link Skeleton.transformConstraints} that will be changed. */
3631
3759
  constraintIndex = 0;
3632
3760
  constructor(frameCount, bezierCount, constraintIndex) {
3633
- super(frameCount, bezierCount, `${16 /* transformConstraint */}|${constraintIndex}`);
3761
+ super(frameCount, bezierCount, `${17 /* transformConstraint */}|${constraintIndex}`);
3634
3762
  this.constraintIndex = constraintIndex;
3635
3763
  this.additive = true;
3636
3764
  }
@@ -3669,20 +3797,32 @@ var spine = (() => {
3669
3797
  /*SHEARY*/
3670
3798
  ] = mixShearY;
3671
3799
  }
3672
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3800
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3673
3801
  const constraint = skeleton.constraints[this.constraintIndex];
3674
3802
  if (!constraint.active) return;
3675
3803
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3676
3804
  const frames = this.frames;
3677
3805
  if (time < frames[0]) {
3678
- if (fromSetup) {
3679
- const setup = constraint.data.setupPose;
3680
- pose.mixRotate = setup.mixRotate;
3681
- pose.mixX = setup.mixX;
3682
- pose.mixY = setup.mixY;
3683
- pose.mixScaleX = setup.mixScaleX;
3684
- pose.mixScaleY = setup.mixScaleY;
3685
- pose.mixShearY = setup.mixShearY;
3806
+ const setup = constraint.data.setupPose;
3807
+ switch (from) {
3808
+ case 1 /* setup */: {
3809
+ pose.mixRotate = setup.mixRotate;
3810
+ pose.mixX = setup.mixX;
3811
+ pose.mixY = setup.mixY;
3812
+ pose.mixScaleX = setup.mixScaleX;
3813
+ pose.mixScaleY = setup.mixScaleY;
3814
+ pose.mixShearY = setup.mixShearY;
3815
+ break;
3816
+ }
3817
+ case 2 /* first */: {
3818
+ pose.mixRotate += (setup.mixRotate - pose.mixRotate) * alpha;
3819
+ pose.mixX += (setup.mixX - pose.mixX) * alpha;
3820
+ pose.mixY += (setup.mixY - pose.mixY) * alpha;
3821
+ pose.mixScaleX += (setup.mixScaleX - pose.mixScaleX) * alpha;
3822
+ pose.mixScaleY += (setup.mixScaleY - pose.mixScaleY) * alpha;
3823
+ pose.mixShearY += (setup.mixShearY - pose.mixShearY) * alpha;
3824
+ break;
3825
+ }
3686
3826
  }
3687
3827
  return;
3688
3828
  }
@@ -3824,7 +3964,7 @@ var spine = (() => {
3824
3964
  /*BEZIER*/
3825
3965
  );
3826
3966
  }
3827
- const base = fromSetup ? constraint.data.setupPose : pose;
3967
+ const base = from === 1 /* setup */ ? constraint.data.setupPose : pose;
3828
3968
  if (add) {
3829
3969
  pose.mixRotate = base.mixRotate + rotate * alpha;
3830
3970
  pose.mixX = base.mixX + x * alpha;
@@ -3851,29 +3991,29 @@ var spine = (() => {
3851
3991
  };
3852
3992
  var PathConstraintPositionTimeline = class extends ConstraintTimeline1 {
3853
3993
  constructor(frameCount, bezierCount, constraintIndex) {
3854
- super(frameCount, bezierCount, constraintIndex, 17 /* pathConstraintPosition */);
3994
+ super(frameCount, bezierCount, constraintIndex, 18 /* pathConstraintPosition */);
3855
3995
  this.additive = true;
3856
3996
  }
3857
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3997
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3858
3998
  const constraint = skeleton.constraints[this.constraintIndex];
3859
3999
  if (constraint.active) {
3860
4000
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3861
- pose.position = this.getAbsoluteValue(time, alpha, fromSetup, add, pose.position, constraint.data.setupPose.position);
4001
+ pose.position = this.getAbsoluteValue(time, alpha, from, add, pose.position, constraint.data.setupPose.position);
3862
4002
  }
3863
4003
  }
3864
4004
  };
3865
4005
  var PathConstraintSpacingTimeline = class extends ConstraintTimeline1 {
3866
4006
  constructor(frameCount, bezierCount, constraintIndex) {
3867
- super(frameCount, bezierCount, constraintIndex, 18 /* pathConstraintSpacing */);
4007
+ super(frameCount, bezierCount, constraintIndex, 19 /* pathConstraintSpacing */);
3868
4008
  }
3869
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4009
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3870
4010
  const constraint = skeleton.constraints[this.constraintIndex];
3871
4011
  if (constraint.active) {
3872
4012
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3873
4013
  pose.spacing = this.getAbsoluteValue(
3874
4014
  time,
3875
4015
  alpha,
3876
- fromSetup,
4016
+ from,
3877
4017
  false,
3878
4018
  pose.spacing,
3879
4019
  constraint.data.setupPose.spacing
@@ -3884,7 +4024,7 @@ var spine = (() => {
3884
4024
  var PathConstraintMixTimeline = class extends CurveTimeline {
3885
4025
  constraintIndex;
3886
4026
  constructor(frameCount, bezierCount, constraintIndex) {
3887
- super(frameCount, bezierCount, `${19 /* pathConstraintMix */}|${constraintIndex}`);
4027
+ super(frameCount, bezierCount, `${20 /* pathConstraintMix */}|${constraintIndex}`);
3888
4028
  this.constraintIndex = constraintIndex;
3889
4029
  }
3890
4030
  getFrameEntries() {
@@ -3910,17 +4050,26 @@ var spine = (() => {
3910
4050
  /*Y*/
3911
4051
  ] = mixY;
3912
4052
  }
3913
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4053
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3914
4054
  const constraint = skeleton.constraints[this.constraintIndex];
3915
4055
  if (!constraint.active) return;
3916
4056
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3917
4057
  const frames = this.frames;
3918
4058
  if (time < frames[0]) {
3919
- if (fromSetup) {
3920
- const setup = constraint.data.setupPose;
3921
- pose.mixRotate = setup.mixRotate;
3922
- pose.mixX = setup.mixX;
3923
- pose.mixY = setup.mixY;
4059
+ const setup = constraint.data.setupPose;
4060
+ switch (from) {
4061
+ case 1 /* setup */: {
4062
+ pose.mixRotate = setup.mixRotate;
4063
+ pose.mixX = setup.mixX;
4064
+ pose.mixY = setup.mixY;
4065
+ break;
4066
+ }
4067
+ case 2 /* first */: {
4068
+ pose.mixRotate += (setup.mixRotate - pose.mixRotate) * alpha;
4069
+ pose.mixX += (setup.mixX - pose.mixX) * alpha;
4070
+ pose.mixY += (setup.mixY - pose.mixY) * alpha;
4071
+ break;
4072
+ }
3924
4073
  }
3925
4074
  return;
3926
4075
  }
@@ -4002,7 +4151,7 @@ var spine = (() => {
4002
4151
  /*BEZIER*/
4003
4152
  );
4004
4153
  }
4005
- const base = fromSetup ? constraint.data.setupPose : pose;
4154
+ const base = from === 1 /* setup */ ? constraint.data.setupPose : pose;
4006
4155
  if (add) {
4007
4156
  pose.mixRotate = base.mixRotate + rotate * alpha;
4008
4157
  pose.mixX = base.mixX + x * alpha;
@@ -4019,7 +4168,7 @@ var spine = (() => {
4019
4168
  constructor(frameCount, bezierCount, constraintIndex, property) {
4020
4169
  super(frameCount, bezierCount, constraintIndex, property);
4021
4170
  }
4022
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4171
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
4023
4172
  if (add && !this.additive) add = false;
4024
4173
  if (this.constraintIndex === -1) {
4025
4174
  const value = time >= this.frames[0] ? this.getCurveValue(time) : 0;
@@ -4027,21 +4176,21 @@ var spine = (() => {
4027
4176
  for (const constraint of constraints) {
4028
4177
  if (constraint.active && this.global(constraint.data)) {
4029
4178
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
4030
- this.set(pose, this.getAbsoluteValue(time, alpha, fromSetup, add, this.get(pose), this.get(constraint.data.setupPose), value));
4179
+ this.set(pose, this.getAbsoluteValue(time, alpha, from, add, this.get(pose), this.get(constraint.data.setupPose), value));
4031
4180
  }
4032
4181
  }
4033
4182
  } else {
4034
4183
  const constraint = skeleton.constraints[this.constraintIndex];
4035
4184
  if (constraint.active) {
4036
4185
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
4037
- this.set(pose, this.getAbsoluteValue(time, alpha, fromSetup, add, this.get(pose), this.get(constraint.data.setupPose)));
4186
+ this.set(pose, this.getAbsoluteValue(time, alpha, from, add, this.get(pose), this.get(constraint.data.setupPose)));
4038
4187
  }
4039
4188
  }
4040
4189
  }
4041
4190
  };
4042
4191
  var PhysicsConstraintInertiaTimeline = class extends PhysicsConstraintTimeline {
4043
4192
  constructor(frameCount, bezierCount, constraintIndex) {
4044
- super(frameCount, bezierCount, constraintIndex, 20 /* physicsConstraintInertia */);
4193
+ super(frameCount, bezierCount, constraintIndex, 21 /* physicsConstraintInertia */);
4045
4194
  }
4046
4195
  get(pose) {
4047
4196
  return pose.inertia;
@@ -4055,7 +4204,7 @@ var spine = (() => {
4055
4204
  };
4056
4205
  var PhysicsConstraintStrengthTimeline = class extends PhysicsConstraintTimeline {
4057
4206
  constructor(frameCount, bezierCount, constraintIndex) {
4058
- super(frameCount, bezierCount, constraintIndex, 21 /* physicsConstraintStrength */);
4207
+ super(frameCount, bezierCount, constraintIndex, 22 /* physicsConstraintStrength */);
4059
4208
  }
4060
4209
  get(pose) {
4061
4210
  return pose.strength;
@@ -4069,7 +4218,7 @@ var spine = (() => {
4069
4218
  };
4070
4219
  var PhysicsConstraintDampingTimeline = class extends PhysicsConstraintTimeline {
4071
4220
  constructor(frameCount, bezierCount, constraintIndex) {
4072
- super(frameCount, bezierCount, constraintIndex, 22 /* physicsConstraintDamping */);
4221
+ super(frameCount, bezierCount, constraintIndex, 23 /* physicsConstraintDamping */);
4073
4222
  }
4074
4223
  get(pose) {
4075
4224
  return pose.damping;
@@ -4083,7 +4232,7 @@ var spine = (() => {
4083
4232
  };
4084
4233
  var PhysicsConstraintMassTimeline = class extends PhysicsConstraintTimeline {
4085
4234
  constructor(frameCount, bezierCount, constraintIndex) {
4086
- super(frameCount, bezierCount, constraintIndex, 23 /* physicsConstraintMass */);
4235
+ super(frameCount, bezierCount, constraintIndex, 24 /* physicsConstraintMass */);
4087
4236
  }
4088
4237
  get(pose) {
4089
4238
  return 1 / pose.massInverse;
@@ -4097,7 +4246,7 @@ var spine = (() => {
4097
4246
  };
4098
4247
  var PhysicsConstraintWindTimeline = class extends PhysicsConstraintTimeline {
4099
4248
  constructor(frameCount, bezierCount, constraintIndex) {
4100
- super(frameCount, bezierCount, constraintIndex, 24 /* physicsConstraintWind */);
4249
+ super(frameCount, bezierCount, constraintIndex, 25 /* physicsConstraintWind */);
4101
4250
  this.additive = true;
4102
4251
  }
4103
4252
  get(pose) {
@@ -4112,7 +4261,7 @@ var spine = (() => {
4112
4261
  };
4113
4262
  var PhysicsConstraintGravityTimeline = class extends PhysicsConstraintTimeline {
4114
4263
  constructor(frameCount, bezierCount, constraintIndex) {
4115
- super(frameCount, bezierCount, constraintIndex, 25 /* physicsConstraintGravity */);
4264
+ super(frameCount, bezierCount, constraintIndex, 26 /* physicsConstraintGravity */);
4116
4265
  this.additive = true;
4117
4266
  }
4118
4267
  get(pose) {
@@ -4127,7 +4276,7 @@ var spine = (() => {
4127
4276
  };
4128
4277
  var PhysicsConstraintMixTimeline = class extends PhysicsConstraintTimeline {
4129
4278
  constructor(frameCount, bezierCount, constraintIndex) {
4130
- super(frameCount, bezierCount, constraintIndex, 26 /* physicsConstraintMix */);
4279
+ super(frameCount, bezierCount, constraintIndex, 27 /* physicsConstraintMix */);
4131
4280
  }
4132
4281
  get(pose) {
4133
4282
  return pose.mix;
@@ -4140,7 +4289,7 @@ var spine = (() => {
4140
4289
  }
4141
4290
  };
4142
4291
  var PhysicsConstraintResetTimeline = class _PhysicsConstraintResetTimeline extends Timeline {
4143
- static propertyIds = [27 /* physicsConstraintReset */.toString()];
4292
+ static propertyIds = [28 /* physicsConstraintReset */.toString()];
4144
4293
  /** The index of the physics constraint in {@link Skeleton.contraints} that will be reset when this timeline is
4145
4294
  * applied, or -1 if all physics constraints in the skeleton will be reset. */
4146
4295
  constraintIndex;
@@ -4159,7 +4308,7 @@ var spine = (() => {
4159
4308
  this.frames[frame] = time;
4160
4309
  }
4161
4310
  /** Resets the physics constraint when frames > `lastTime` and <= `time`. */
4162
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4311
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
4163
4312
  let constraint;
4164
4313
  if (this.constraintIndex !== -1) {
4165
4314
  constraint = skeleton.constraints[this.constraintIndex];
@@ -4167,7 +4316,7 @@ var spine = (() => {
4167
4316
  }
4168
4317
  const frames = this.frames;
4169
4318
  if (lastTime > time) {
4170
- this.apply(skeleton, lastTime, Number.MAX_VALUE, [], alpha, false, false, false, false);
4319
+ this.apply(skeleton, lastTime, Number.MAX_VALUE, [], alpha, from, false, false, false);
4171
4320
  lastTime = -1;
4172
4321
  } else if (lastTime >= frames[frames.length - 1])
4173
4322
  return;
@@ -4185,26 +4334,26 @@ var spine = (() => {
4185
4334
  };
4186
4335
  var SliderTimeline = class extends ConstraintTimeline1 {
4187
4336
  constructor(frameCount, bezierCount, constraintIndex) {
4188
- super(frameCount, bezierCount, constraintIndex, 29 /* sliderTime */);
4337
+ super(frameCount, bezierCount, constraintIndex, 30 /* sliderTime */);
4189
4338
  }
4190
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4339
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
4191
4340
  const constraint = skeleton.constraints[this.constraintIndex];
4192
4341
  if (constraint.active) {
4193
4342
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
4194
- pose.time = this.getAbsoluteValue(time, alpha, fromSetup, add, pose.time, constraint.data.setupPose.time);
4343
+ pose.time = this.getAbsoluteValue(time, alpha, from, add, pose.time, constraint.data.setupPose.time);
4195
4344
  }
4196
4345
  }
4197
4346
  };
4198
4347
  var SliderMixTimeline = class extends ConstraintTimeline1 {
4199
4348
  constructor(frameCount, bezierCount, constraintIndex) {
4200
- super(frameCount, bezierCount, constraintIndex, 30 /* sliderMix */);
4349
+ super(frameCount, bezierCount, constraintIndex, 31 /* sliderMix */);
4201
4350
  this.additive = true;
4202
4351
  }
4203
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4352
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
4204
4353
  const constraint = skeleton.constraints[this.constraintIndex];
4205
4354
  if (constraint.active) {
4206
4355
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
4207
- pose.mix = this.getAbsoluteValue(time, alpha, fromSetup, add, pose.mix, constraint.data.setupPose.mix);
4356
+ pose.mix = this.getAbsoluteValue(time, alpha, from, add, pose.mix, constraint.data.setupPose.mix);
4208
4357
  }
4209
4358
  }
4210
4359
  };
@@ -4225,7 +4374,7 @@ var spine = (() => {
4225
4374
  events = [];
4226
4375
  listeners = [];
4227
4376
  queue = new EventQueue(this);
4228
- propertyIds = new StringSet();
4377
+ propertyIds = /* @__PURE__ */ new Map();
4229
4378
  animationsChanged = false;
4230
4379
  trackEntryPool = new Pool(() => new TrackEntry());
4231
4380
  constructor(data) {
@@ -4334,9 +4483,9 @@ var spine = (() => {
4334
4483
  Utils.webkit602BugfixHelper(alpha);
4335
4484
  const timeline = timelines[ii];
4336
4485
  if (timeline instanceof AttachmentTimeline)
4337
- this.applyAttachmentTimeline(timeline, skeleton, applyTime, true, true);
4486
+ this.applyAttachmentTimeline(timeline, skeleton, applyTime, 1 /* setup */, true);
4338
4487
  else
4339
- timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, true, false, false, false);
4488
+ timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, 1 /* setup */, false, false, false);
4340
4489
  }
4341
4490
  } else {
4342
4491
  const timelineMode = current.timelineMode;
@@ -4346,14 +4495,14 @@ var spine = (() => {
4346
4495
  if (firstFrame) current.timelinesRotation.length = timelineCount << 1;
4347
4496
  for (let ii = 0; ii < timelineCount; ii++) {
4348
4497
  const timeline = timelines[ii];
4349
- const fromSetup = (timelineMode[ii] & FIRST) !== 0;
4498
+ const from = timelineMode[ii] & MODE;
4350
4499
  if (!shortestRotation && timeline instanceof RotateTimeline) {
4351
- this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, fromSetup, current.timelinesRotation, ii << 1, firstFrame);
4500
+ this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, from, current.timelinesRotation, ii << 1, firstFrame);
4352
4501
  } else if (timeline instanceof AttachmentTimeline) {
4353
- this.applyAttachmentTimeline(timeline, skeleton, applyTime, fromSetup, retainAttachments);
4502
+ this.applyAttachmentTimeline(timeline, skeleton, applyTime, from, retainAttachments);
4354
4503
  } else {
4355
4504
  Utils.webkit602BugfixHelper(alpha);
4356
- timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, fromSetup, add, false, false);
4505
+ timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, from, add, false, false);
4357
4506
  }
4358
4507
  }
4359
4508
  }
@@ -4363,7 +4512,7 @@ var spine = (() => {
4363
4512
  current.nextAnimationLast = animationTime;
4364
4513
  current.nextTrackLast = current.trackTime;
4365
4514
  }
4366
- const setupState = this.unkeyedState + SETUP;
4515
+ const setupState = this.unkeyedState + ATTACH_SETUP;
4367
4516
  const slots = skeleton.slots;
4368
4517
  for (let i = 0, n = skeleton.slots.length; i < n; i++) {
4369
4518
  const slot = slots[i];
@@ -4401,29 +4550,29 @@ var spine = (() => {
4401
4550
  for (let i = 0; i < timelineCount; i++) {
4402
4551
  const timeline = timelines[i];
4403
4552
  const mode = timelineMode[i];
4404
- const fromSetup = (mode & FIRST) !== 0;
4553
+ const mixFrom = mode & MODE;
4405
4554
  let alpha = 0;
4406
4555
  if ((mode & HOLD) !== 0) {
4407
4556
  const holdMix = timelineHoldMix[i];
4408
4557
  alpha = holdMix == null ? alphaHold : alphaHold * (1 - holdMix.mix());
4409
4558
  } else {
4410
- if (!drawOrder && timeline instanceof DrawOrderTimeline && !fromSetup) continue;
4559
+ if (!drawOrder && timeline instanceof DrawOrderTimeline && mixFrom === 0 /* current */) continue;
4411
4560
  alpha = alphaMix;
4412
4561
  }
4413
4562
  from.totalAlpha += alpha;
4414
4563
  if (!shortestRotation && timeline instanceof RotateTimeline) {
4415
- this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, fromSetup, timelinesRotation, i << 1, firstFrame);
4564
+ this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, mixFrom, timelinesRotation, i << 1, firstFrame);
4416
4565
  } else if (timeline instanceof AttachmentTimeline)
4417
4566
  this.applyAttachmentTimeline(
4418
4567
  timeline,
4419
4568
  skeleton,
4420
4569
  applyTime,
4421
- fromSetup,
4570
+ mixFrom,
4422
4571
  retainAttachments && alpha >= from.alphaAttachmentThreshold
4423
4572
  );
4424
4573
  else {
4425
- const out = !drawOrder || !(timeline instanceof DrawOrderTimeline) || !fromSetup;
4426
- timeline.apply(skeleton, animationLast, applyTime, events, alpha, fromSetup, add, out, false);
4574
+ const out = !drawOrder || !(timeline instanceof DrawOrderTimeline) || mixFrom === 0 /* current */;
4575
+ timeline.apply(skeleton, animationLast, applyTime, events, alpha, mixFrom, add, out, false);
4427
4576
  }
4428
4577
  }
4429
4578
  if (from.reverse && mix < from.eventThreshold) this.eventsReverse(from, animationLast, animationTime);
@@ -4435,10 +4584,10 @@ var spine = (() => {
4435
4584
  }
4436
4585
  /** Applies the attachment timeline and sets {@link Slot.attachmentState}.
4437
4586
  * @param retain True if the attachment remains after apply, false if temporary for deform timelines. */
4438
- applyAttachmentTimeline(timeline, skeleton, time, fromSetup, retain) {
4587
+ applyAttachmentTimeline(timeline, skeleton, time, from, retain) {
4439
4588
  const slot = skeleton.slots[timeline.slotIndex];
4440
4589
  if (!slot.bone.active) return;
4441
- if (!retain && slot.attachmentState === this.unkeyedState + RETAIN) return;
4590
+ if (!retain && slot.attachmentState === this.unkeyedState + ATTACH_RETAIN) return;
4442
4591
  let setup = time < timeline.frames[0];
4443
4592
  let name = null;
4444
4593
  if (!setup) {
@@ -4446,33 +4595,44 @@ var spine = (() => {
4446
4595
  setup = !retain && name == null;
4447
4596
  }
4448
4597
  if (setup) {
4449
- if (!fromSetup) return;
4598
+ if (from === 0 /* current */) return;
4450
4599
  name = slot.data.attachmentName;
4451
4600
  }
4452
4601
  slot.pose.setAttachment(name == null ? null : skeleton.getAttachment(slot.data.index, name));
4453
4602
  if (retain)
4454
- slot.attachmentState = this.unkeyedState + RETAIN;
4603
+ slot.attachmentState = this.unkeyedState + ATTACH_RETAIN;
4455
4604
  else if (!setup)
4456
- slot.attachmentState = this.unkeyedState + SETUP;
4605
+ slot.attachmentState = this.unkeyedState + ATTACH_SETUP;
4457
4606
  }
4458
4607
  /** Applies the rotate timeline, mixing with the current pose while keeping the same rotation direction chosen as the shortest
4459
4608
  * the first time the mixing was applied. */
4460
- applyRotateTimeline(timeline, skeleton, time, alpha, fromSetup, timelinesRotation, i, firstFrame) {
4609
+ applyRotateTimeline(timeline, skeleton, time, alpha, from, timelinesRotation, i, firstFrame) {
4461
4610
  if (firstFrame) timelinesRotation[i] = 0;
4462
4611
  if (alpha === 1) {
4463
- timeline.apply(skeleton, 0, time, null, 1, fromSetup, false, false, false);
4612
+ timeline.apply(skeleton, 0, time, null, 1, from, false, false, false);
4464
4613
  return;
4465
4614
  }
4466
4615
  const bone = skeleton.bones[timeline.boneIndex];
4467
4616
  if (!bone.active) return;
4468
4617
  const pose = bone.pose, setup = bone.data.setupPose;
4469
4618
  const frames = timeline.frames;
4619
+ let r1, r2;
4470
4620
  if (time < frames[0]) {
4471
- if (fromSetup) pose.rotation = setup.rotation;
4472
- return;
4621
+ switch (from) {
4622
+ case 1 /* setup */: {
4623
+ pose.rotation = setup.rotation;
4624
+ return;
4625
+ }
4626
+ case 0 /* current */: {
4627
+ return;
4628
+ }
4629
+ }
4630
+ r1 = pose.rotation;
4631
+ r2 = setup.rotation;
4632
+ } else {
4633
+ r1 = from === 1 /* setup */ ? setup.rotation : pose.rotation;
4634
+ r2 = setup.rotation + timeline.getCurveValue(time);
4473
4635
  }
4474
- const r1 = fromSetup ? setup.rotation : pose.rotation;
4475
- const r2 = setup.rotation + timeline.getCurveValue(time);
4476
4636
  let total = 0, diff = r2 - r1;
4477
4637
  diff -= Math.ceil(diff / 360 - 0.5) * 360;
4478
4638
  if (diff === 0) {
@@ -4787,57 +4947,72 @@ var spine = (() => {
4787
4947
  this.animationsChanged = false;
4788
4948
  const tracks = this.tracks;
4789
4949
  for (let i = 0, n = tracks.length; i < n; i++) {
4790
- let entry = tracks[i];
4791
- if (!entry) continue;
4950
+ const track = tracks[i];
4951
+ if (!track) continue;
4952
+ let entry = track;
4792
4953
  while (entry.mixingFrom)
4793
4954
  entry = entry.mixingFrom;
4794
4955
  do {
4795
- this.computeHold(entry);
4956
+ this.computeHold(entry, track);
4796
4957
  entry = entry.mixingTo;
4797
4958
  } while (entry);
4798
4959
  }
4799
4960
  this.propertyIds.clear();
4800
4961
  }
4801
- computeHold(entry) {
4962
+ computeHold(entry, track) {
4802
4963
  const timelines = entry.animation.timelines;
4803
4964
  const timelinesCount = entry.animation.timelines.length;
4804
4965
  const timelineMode = entry.timelineMode;
4805
4966
  timelineMode.length = timelinesCount;
4806
4967
  const timelineHoldMix = entry.timelineHoldMix;
4807
4968
  timelineHoldMix.length = 0;
4808
- const propertyIds = this.propertyIds;
4809
4969
  const add = entry.additive, keepHold = entry.keepHold;
4810
4970
  const to = entry.mixingTo;
4811
- outer:
4812
- for (let i = 0; i < timelinesCount; i++) {
4813
- const timeline = timelines[i];
4814
- const ids = timeline.propertyIds;
4815
- const first = propertyIds.addAll(ids) && !(timeline instanceof DrawOrderFolderTimeline && propertyIds.contains(DrawOrderTimeline.propertyID));
4816
- if (add && timeline.additive) {
4817
- timelineMode[i] = first ? FIRST : SUBSEQUENT;
4818
- continue;
4819
- }
4820
- for (let from = entry.mixingFrom; from != null; from = from.mixingFrom) {
4821
- if (from.animation.hasTimeline(ids)) {
4822
- timelineMode[i] = SUBSEQUENT;
4823
- continue outer;
4971
+ for (let i = 0; i < timelinesCount; i++) {
4972
+ const timeline = timelines[i];
4973
+ const ids = timeline.propertyIds;
4974
+ const from = this.from(track, timeline, ids);
4975
+ if (add && timeline.additive) {
4976
+ timelineMode[i] = from;
4977
+ continue;
4978
+ }
4979
+ let mode;
4980
+ if (to === null || timeline.instant || to.additive && timeline.additive || !to.animation?.hasTimeline(ids))
4981
+ mode = from;
4982
+ else {
4983
+ mode = from | HOLD;
4984
+ for (let next = to.mixingTo; next != null; next = next.mixingTo) {
4985
+ if (next.additive && timeline.additive || !next.animation?.hasTimeline(ids)) {
4986
+ if (next.mixDuration > 0) timelineHoldMix[i] = next;
4987
+ break;
4824
4988
  }
4825
4989
  }
4826
- let mode;
4827
- if (to === null || timeline.instant || to.additive && timeline.additive || !to.animation?.hasTimeline(ids))
4828
- mode = first ? FIRST : SUBSEQUENT;
4829
- else {
4830
- mode = first ? HOLD_FIRST : HOLD;
4831
- for (let next = to.mixingTo; next != null; next = next.mixingTo) {
4832
- if (next.additive && timeline.additive || !next.animation?.hasTimeline(ids)) {
4833
- if (next.mixDuration > 0) timelineHoldMix[i] = next;
4834
- break;
4835
- }
4836
- }
4990
+ }
4991
+ if (keepHold) mode = mode & ~HOLD | timelineMode[i] & HOLD;
4992
+ timelineMode[i] = mode;
4993
+ }
4994
+ }
4995
+ from(track, timeline, ids) {
4996
+ const propertyIds = this.propertyIds;
4997
+ let from = SETUP;
4998
+ for (let i = 0, n = ids.length; i < n; i++) {
4999
+ const owner = propertyIds.get(ids[i]);
5000
+ if (owner === void 0) {
5001
+ propertyIds.set(ids[i], track);
5002
+ } else {
5003
+ if (owner !== track) {
5004
+ while (++i < n)
5005
+ if (!propertyIds.has(ids[i])) propertyIds.set(ids[i], track);
5006
+ return CURRENT;
4837
5007
  }
4838
- if (keepHold) mode = mode & ~HOLD | timelineMode[i] & HOLD;
4839
- timelineMode[i] = mode;
5008
+ from = FIRST;
4840
5009
  }
5010
+ }
5011
+ if (timeline instanceof DrawOrderFolderTimeline) {
5012
+ const first = propertyIds.get(DrawOrderTimeline.propertyID);
5013
+ if (first != null) return first !== track ? CURRENT : FIRST;
5014
+ }
5015
+ return from;
4841
5016
  }
4842
5017
  /** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
4843
5018
  getTrack(trackIndex) {
@@ -5046,8 +5221,8 @@ var spine = (() => {
5046
5221
  return mix;
5047
5222
  }
5048
5223
  /** For each timeline:
5049
- * - Bit 0, FIRST: 0 = mix from current pose, 1 = mix from setup pose. Timeline is first to set the property.
5050
- * - Bit 1, HOLD: 0 = mix out using alphaMix, 1 = apply full alpha to prevent dipping. Timeline is first on its track to
5224
+ * - Bits 0-1: MixFrom.
5225
+ * - Bit 2, HOLD: 0 = mix out using alphaMix, 1 = apply full alpha to prevent dipping. Timeline is first on its track to
5051
5226
  * set the property and the next entry (mixingTo) also sets it. When held, timelineHoldMix's mix controls how the hold fades
5052
5227
  * out (for 3+ entry chains where the chain eventually stops setting the property). */
5053
5228
  timelineMode = [];
@@ -5241,12 +5416,13 @@ var spine = (() => {
5241
5416
  event(entry, event) {
5242
5417
  }
5243
5418
  };
5244
- var SUBSEQUENT = 0;
5245
- var FIRST = 1;
5246
- var HOLD = 2;
5247
- var HOLD_FIRST = 3;
5419
+ var CURRENT = 0;
5248
5420
  var SETUP = 1;
5249
- var RETAIN = 2;
5421
+ var FIRST = 2;
5422
+ var MODE = 3;
5423
+ var HOLD = 4;
5424
+ var ATTACH_SETUP = 1;
5425
+ var ATTACH_RETAIN = 2;
5250
5426
 
5251
5427
  // spine-core/src/AnimationStateData.ts
5252
5428
  var AnimationStateData = class {
@@ -8366,7 +8542,7 @@ ${error}` : ""}`);
8366
8542
  const indices = animation.bones;
8367
8543
  for (let i = 0, n = animation.bones.length; i < n; i++)
8368
8544
  bones[indices[i]].appliedPose.modifyLocal(skeleton);
8369
- animation.apply(skeleton, p.time, p.time, data.loop, null, p.mix, false, data.additive, false, true);
8545
+ animation.apply(skeleton, p.time, p.time, data.loop, null, p.mix, 0 /* current */, data.additive, false, true);
8370
8546
  }
8371
8547
  sort(skeleton) {
8372
8548
  const bone = this.bone;