@esotericsoftware/spine-canvas 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-canvas/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,
@@ -40,6 +42,7 @@ var spine = (() => {
40
42
  BoneTimeline1: () => BoneTimeline1,
41
43
  BoneTimeline2: () => BoneTimeline2,
42
44
  BoundingBoxAttachment: () => BoundingBoxAttachment,
45
+ CURRENT: () => CURRENT,
43
46
  CanvasTexture: () => CanvasTexture,
44
47
  ClippingAttachment: () => ClippingAttachment,
45
48
  Color: () => Color,
@@ -69,7 +72,6 @@ var spine = (() => {
69
72
  FromX: () => FromX,
70
73
  FromY: () => FromY,
71
74
  HOLD: () => HOLD,
72
- HOLD_FIRST: () => HOLD_FIRST,
73
75
  IkConstraint: () => IkConstraint,
74
76
  IkConstraintData: () => IkConstraintData,
75
77
  IkConstraintPose: () => IkConstraintPose,
@@ -78,8 +80,10 @@ var spine = (() => {
78
80
  InheritTimeline: () => InheritTimeline,
79
81
  IntSet: () => IntSet,
80
82
  Interpolation: () => Interpolation,
83
+ MODE: () => MODE,
81
84
  MathUtils: () => MathUtils,
82
85
  MeshAttachment: () => MeshAttachment,
86
+ MixFrom: () => MixFrom,
83
87
  PathAttachment: () => PathAttachment,
84
88
  PathConstraint: () => PathConstraint,
85
89
  PathConstraintData: () => PathConstraintData,
@@ -109,7 +113,6 @@ var spine = (() => {
109
113
  Pow: () => Pow,
110
114
  PowOut: () => PowOut,
111
115
  Property: () => Property,
112
- RETAIN: () => RETAIN,
113
116
  RGB2Timeline: () => RGB2Timeline,
114
117
  RGBA2Timeline: () => RGBA2Timeline,
115
118
  RGBATimeline: () => RGBATimeline,
@@ -118,7 +121,6 @@ var spine = (() => {
118
121
  RotateMode: () => RotateMode,
119
122
  RotateTimeline: () => RotateTimeline,
120
123
  SETUP: () => SETUP,
121
- SUBSEQUENT: () => SUBSEQUENT,
122
124
  ScaleTimeline: () => ScaleTimeline,
123
125
  ScaleXTimeline: () => ScaleXTimeline,
124
126
  ScaleYMode: () => ScaleYMode,
@@ -1490,17 +1492,14 @@ var spine = (() => {
1490
1492
  * @param loop True if `time` beyond the {@link duration} repeats the animation, else the last frame is used.
1491
1493
  * @param events If any events are fired, they are added to this list. Pass null to ignore fired events or if no timelines fire
1492
1494
  * events.
1493
- * @param alpha 0 applies setup or current values (depending on `fromSetup`), 1 uses timeline values, and
1494
- * intermediate values interpolate between them. Adjusting `alpha` over time can mix an animation in or
1495
- * out.
1496
- * @param fromSetup If true, `alpha` transitions between setup and timeline values, setup values are used before the
1497
- * first frame (current values are not used). If false, `alpha` transitions between current and timeline
1498
- * values, no change is made before the first frame.
1495
+ * @param alpha 0 applies setup or current values (depending on `from`), 1 uses timeline values, and intermediate
1496
+ * values interpolate between them. Adjusting `alpha` over time can mix an animation in or out.
1497
+ * @param from Controls how `alpha` and `add` mix from current or setup pose values to timeline values.
1499
1498
  * @param add If true, for timelines that support it, their values are added to the setup or current values (depending on
1500
- * `fromSetup`).
1499
+ * `from`).
1501
1500
  * @param out True when the animation is mixing out, else it is mixing in. Used by timelines that perform instant transitions.
1502
1501
  * @param appliedPose True to modify {@link Posed.appliedPose}, else {@link Posed.pose} is modified. */
1503
- apply(skeleton, lastTime, time, loop, events, alpha, fromSetup, add, out, appliedPose) {
1502
+ apply(skeleton, lastTime, time, loop, events, alpha, from, add, out, appliedPose) {
1504
1503
  if (!skeleton) throw new Error("skeleton cannot be null.");
1505
1504
  if (loop && this.duration !== 0) {
1506
1505
  time %= this.duration;
@@ -1508,9 +1507,15 @@ var spine = (() => {
1508
1507
  }
1509
1508
  const timelines = this.timelines;
1510
1509
  for (let i = 0, n = timelines.length; i < n; i++)
1511
- timelines[i].apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose);
1510
+ timelines[i].apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose);
1512
1511
  }
1513
1512
  };
1513
+ var MixFrom = /* @__PURE__ */ ((MixFrom2) => {
1514
+ MixFrom2[MixFrom2["current"] = 0] = "current";
1515
+ MixFrom2[MixFrom2["setup"] = 1] = "setup";
1516
+ MixFrom2[MixFrom2["first"] = 2] = "first";
1517
+ return MixFrom2;
1518
+ })(MixFrom || {});
1514
1519
  var Property = /* @__PURE__ */ ((Property2) => {
1515
1520
  Property2[Property2["rotate"] = 0] = "rotate";
1516
1521
  Property2[Property2["x"] = 1] = "x";
@@ -1527,28 +1532,31 @@ var spine = (() => {
1527
1532
  Property2[Property2["deform"] = 12] = "deform";
1528
1533
  Property2[Property2["event"] = 13] = "event";
1529
1534
  Property2[Property2["drawOrder"] = 14] = "drawOrder";
1530
- Property2[Property2["ikConstraint"] = 15] = "ikConstraint";
1531
- Property2[Property2["transformConstraint"] = 16] = "transformConstraint";
1532
- Property2[Property2["pathConstraintPosition"] = 17] = "pathConstraintPosition";
1533
- Property2[Property2["pathConstraintSpacing"] = 18] = "pathConstraintSpacing";
1534
- Property2[Property2["pathConstraintMix"] = 19] = "pathConstraintMix";
1535
- Property2[Property2["physicsConstraintInertia"] = 20] = "physicsConstraintInertia";
1536
- Property2[Property2["physicsConstraintStrength"] = 21] = "physicsConstraintStrength";
1537
- Property2[Property2["physicsConstraintDamping"] = 22] = "physicsConstraintDamping";
1538
- Property2[Property2["physicsConstraintMass"] = 23] = "physicsConstraintMass";
1539
- Property2[Property2["physicsConstraintWind"] = 24] = "physicsConstraintWind";
1540
- Property2[Property2["physicsConstraintGravity"] = 25] = "physicsConstraintGravity";
1541
- Property2[Property2["physicsConstraintMix"] = 26] = "physicsConstraintMix";
1542
- Property2[Property2["physicsConstraintReset"] = 27] = "physicsConstraintReset";
1543
- Property2[Property2["sequence"] = 28] = "sequence";
1544
- Property2[Property2["sliderTime"] = 29] = "sliderTime";
1545
- Property2[Property2["sliderMix"] = 30] = "sliderMix";
1535
+ Property2[Property2["drawOrderFolder"] = 15] = "drawOrderFolder";
1536
+ Property2[Property2["ikConstraint"] = 16] = "ikConstraint";
1537
+ Property2[Property2["transformConstraint"] = 17] = "transformConstraint";
1538
+ Property2[Property2["pathConstraintPosition"] = 18] = "pathConstraintPosition";
1539
+ Property2[Property2["pathConstraintSpacing"] = 19] = "pathConstraintSpacing";
1540
+ Property2[Property2["pathConstraintMix"] = 20] = "pathConstraintMix";
1541
+ Property2[Property2["physicsConstraintInertia"] = 21] = "physicsConstraintInertia";
1542
+ Property2[Property2["physicsConstraintStrength"] = 22] = "physicsConstraintStrength";
1543
+ Property2[Property2["physicsConstraintDamping"] = 23] = "physicsConstraintDamping";
1544
+ Property2[Property2["physicsConstraintMass"] = 24] = "physicsConstraintMass";
1545
+ Property2[Property2["physicsConstraintWind"] = 25] = "physicsConstraintWind";
1546
+ Property2[Property2["physicsConstraintGravity"] = 26] = "physicsConstraintGravity";
1547
+ Property2[Property2["physicsConstraintMix"] = 27] = "physicsConstraintMix";
1548
+ Property2[Property2["physicsConstraintReset"] = 28] = "physicsConstraintReset";
1549
+ Property2[Property2["sequence"] = 29] = "sequence";
1550
+ Property2[Property2["sliderTime"] = 30] = "sliderTime";
1551
+ Property2[Property2["sliderMix"] = 31] = "sliderMix";
1546
1552
  return Property2;
1547
1553
  })(Property || {});
1548
1554
  var Timeline = class {
1549
1555
  propertyIds;
1550
1556
  frames;
1551
- /** True if this timeline supports additive blending. */
1557
+ /** True if this timeline supports being applied additively.
1558
+ *
1559
+ * See the `add` parameter in {@link Timeline.apply}. */
1552
1560
  additive = false;
1553
1561
  /** True if this timeline sets values instantaneously and does not support interpolation between frames. */
1554
1562
  instant = false;
@@ -1669,7 +1677,7 @@ var spine = (() => {
1669
1677
  return y + (time - x) / (this.frames[frameIndex] - x) * (this.frames[frameIndex + valueOffset] - y);
1670
1678
  }
1671
1679
  };
1672
- var CurveTimeline1 = class extends CurveTimeline {
1680
+ var CurveTimeline1 = class _CurveTimeline1 extends CurveTimeline {
1673
1681
  constructor(frameCount, bezierCount, propertyId) {
1674
1682
  super(frameCount, bezierCount, propertyId);
1675
1683
  }
@@ -1732,41 +1740,51 @@ var spine = (() => {
1732
1740
  * See {@link Timeline.apply}.
1733
1741
  * @param current The current value for the property.
1734
1742
  * @param setup The setup value for the property. */
1735
- getRelativeValue(time, alpha, fromSetup, add, current, setup) {
1736
- if (time < this.frames[0]) return fromSetup ? setup : current;
1743
+ getRelativeValue(time, alpha, from, add, current, setup) {
1744
+ if (time < this.frames[0]) return _CurveTimeline1.beforeFirstKey(from, alpha, current, setup);
1737
1745
  const value = this.getCurveValue(time);
1738
- return fromSetup ? setup + value * alpha : current + (add ? value : value + setup - current) * alpha;
1746
+ return from === 1 /* setup */ ? setup + value * alpha : current + (add ? value : value + setup - current) * alpha;
1739
1747
  }
1740
- getAbsoluteValue(time, alpha, fromSetup, add, current, setup, value) {
1748
+ getAbsoluteValue(time, alpha, from, add, current, setup, value) {
1741
1749
  if (value === void 0)
1742
- return this.getAbsoluteValue1(time, alpha, fromSetup, add, current, setup);
1750
+ return this.getAbsoluteValue1(time, alpha, from, add, current, setup);
1743
1751
  else
1744
- return this.getAbsoluteValue2(time, alpha, fromSetup, add, current, setup, value);
1752
+ return this.getAbsoluteValue2(time, alpha, from, add, current, setup, value);
1745
1753
  }
1746
- getAbsoluteValue1(time, alpha, fromSetup, add, current, setup) {
1747
- if (time < this.frames[0]) return fromSetup ? setup : current;
1754
+ getAbsoluteValue1(time, alpha, from, add, current, setup) {
1755
+ if (time < this.frames[0]) return _CurveTimeline1.beforeFirstKey(from, alpha, current, setup);
1748
1756
  const value = this.getCurveValue(time);
1749
- return fromSetup ? setup + (add ? value : value - setup) * alpha : current + (add ? value : value - current) * alpha;
1757
+ return from === 1 /* setup */ ? setup + (add ? value : value - setup) * alpha : current + (add ? value : value - current) * alpha;
1750
1758
  }
1751
- getAbsoluteValue2(time, alpha, fromSetup, add, current, setup, value) {
1752
- if (time < this.frames[0]) return fromSetup ? setup : current;
1753
- return fromSetup ? setup + (add ? value : value - setup) * alpha : current + (add ? value : value - current) * alpha;
1759
+ getAbsoluteValue2(time, alpha, from, add, current, setup, value) {
1760
+ if (time < this.frames[0]) return _CurveTimeline1.beforeFirstKey(from, alpha, current, setup);
1761
+ return from === 1 /* setup */ ? setup + (add ? value : value - setup) * alpha : current + (add ? value : value - current) * alpha;
1754
1762
  }
1755
1763
  /** Returns the interpolated value for scale properties. The timeline and setup values are multiplied and sign adjusted.
1756
1764
  *
1757
1765
  * See {@link Timeline.apply}.
1758
1766
  * @param current The current value for the property.
1759
1767
  * @param setup The setup value for the property. */
1760
- getScaleValue(time, alpha, fromSetup, add, out, current, setup) {
1761
- if (time < this.frames[0]) return fromSetup ? setup : current;
1768
+ getScaleValue(time, alpha, from, add, out, current, setup) {
1769
+ if (time < this.frames[0]) return _CurveTimeline1.beforeFirstKey(from, alpha, current, setup);
1762
1770
  const value = this.getCurveValue(time) * setup;
1763
1771
  if (alpha === 1 && !add) return value;
1764
- let base = fromSetup ? setup : current;
1772
+ let base = from === 1 /* setup */ ? setup : current;
1765
1773
  if (add) return base + (value - setup) * alpha;
1766
1774
  if (out) return base + (Math.abs(value) * Math.sign(base) - base) * alpha;
1767
1775
  base = Math.abs(base) * Math.sign(value);
1768
1776
  return base + (value - base) * alpha;
1769
1777
  }
1778
+ static beforeFirstKey(from, alpha, current, setup) {
1779
+ switch (from) {
1780
+ case 1 /* setup */:
1781
+ return setup;
1782
+ case 2 /* first */:
1783
+ return current + (setup - current) * alpha;
1784
+ case 0 /* current */:
1785
+ return current;
1786
+ }
1787
+ }
1770
1788
  };
1771
1789
  function isBoneTimeline(obj) {
1772
1790
  return typeof obj === "object" && obj !== null && typeof obj.boneIndex === "number";
@@ -1778,10 +1796,10 @@ var spine = (() => {
1778
1796
  this.boneIndex = boneIndex;
1779
1797
  this.additive = true;
1780
1798
  }
1781
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
1799
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
1782
1800
  const bone = skeleton.bones[this.boneIndex];
1783
1801
  if (bone.active)
1784
- this.apply1(appliedPose ? bone.appliedPose : bone.pose, bone.data.setupPose, time, alpha, fromSetup, add, out);
1802
+ this.apply1(appliedPose ? bone.appliedPose : bone.pose, bone.data.setupPose, time, alpha, from, add, out);
1785
1803
  }
1786
1804
  };
1787
1805
  var BoneTimeline2 = class extends CurveTimeline {
@@ -1811,30 +1829,36 @@ var spine = (() => {
1811
1829
  /*VALUE2*/
1812
1830
  ] = value2;
1813
1831
  }
1814
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
1832
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
1815
1833
  const bone = skeleton.bones[this.boneIndex];
1816
1834
  if (bone.active)
1817
- this.apply1(appliedPose ? bone.appliedPose : bone.pose, bone.data.setupPose, time, alpha, fromSetup, add, out);
1835
+ this.apply1(appliedPose ? bone.appliedPose : bone.pose, bone.data.setupPose, time, alpha, from, add, out);
1818
1836
  }
1819
1837
  };
1820
1838
  var RotateTimeline = class extends BoneTimeline1 {
1821
1839
  constructor(frameCount, bezierCount, boneIndex) {
1822
1840
  super(frameCount, bezierCount, boneIndex, 0 /* rotate */);
1823
1841
  }
1824
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1825
- pose.rotation = this.getRelativeValue(time, alpha, fromSetup, add, pose.rotation, setup.rotation);
1842
+ apply1(pose, setup, time, alpha, from, add, out) {
1843
+ pose.rotation = this.getRelativeValue(time, alpha, from, add, pose.rotation, setup.rotation);
1826
1844
  }
1827
1845
  };
1828
1846
  var TranslateTimeline = class extends BoneTimeline2 {
1829
1847
  constructor(frameCount, bezierCount, boneIndex) {
1830
1848
  super(frameCount, bezierCount, boneIndex, 1 /* x */, 2 /* y */);
1831
1849
  }
1832
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1850
+ apply1(pose, setup, time, alpha, from, add, out) {
1833
1851
  const frames = this.frames;
1834
1852
  if (time < frames[0]) {
1835
- if (fromSetup) {
1836
- pose.x = setup.x;
1837
- pose.y = setup.y;
1853
+ switch (from) {
1854
+ case 1 /* setup */:
1855
+ pose.x = setup.x;
1856
+ pose.y = setup.y;
1857
+ break;
1858
+ case 2 /* first */:
1859
+ pose.x += (setup.x - pose.x) * alpha;
1860
+ pose.y += (setup.y - pose.y) * alpha;
1861
+ break;
1838
1862
  }
1839
1863
  return;
1840
1864
  }
@@ -1900,7 +1924,7 @@ var spine = (() => {
1900
1924
  /*BEZIER*/
1901
1925
  );
1902
1926
  }
1903
- if (fromSetup) {
1927
+ if (from === 1 /* setup */) {
1904
1928
  pose.x = setup.x + x * alpha;
1905
1929
  pose.y = setup.y + y * alpha;
1906
1930
  } else if (add) {
@@ -1916,28 +1940,34 @@ var spine = (() => {
1916
1940
  constructor(frameCount, bezierCount, boneIndex) {
1917
1941
  super(frameCount, bezierCount, boneIndex, 1 /* x */);
1918
1942
  }
1919
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1920
- pose.x = this.getRelativeValue(time, alpha, fromSetup, add, pose.x, setup.x);
1943
+ apply1(pose, setup, time, alpha, from, add, out) {
1944
+ pose.x = this.getRelativeValue(time, alpha, from, add, pose.x, setup.x);
1921
1945
  }
1922
1946
  };
1923
1947
  var TranslateYTimeline = class extends BoneTimeline1 {
1924
1948
  constructor(frameCount, bezierCount, boneIndex) {
1925
1949
  super(frameCount, bezierCount, boneIndex, 2 /* y */);
1926
1950
  }
1927
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1928
- pose.y = this.getRelativeValue(time, alpha, fromSetup, add, pose.y, setup.y);
1951
+ apply1(pose, setup, time, alpha, from, add, out) {
1952
+ pose.y = this.getRelativeValue(time, alpha, from, add, pose.y, setup.y);
1929
1953
  }
1930
1954
  };
1931
1955
  var ScaleTimeline = class extends BoneTimeline2 {
1932
1956
  constructor(frameCount, bezierCount, boneIndex) {
1933
1957
  super(frameCount, bezierCount, boneIndex, 3 /* scaleX */, 4 /* scaleY */);
1934
1958
  }
1935
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
1959
+ apply1(pose, setup, time, alpha, from, add, out) {
1936
1960
  const frames = this.frames;
1937
1961
  if (time < frames[0]) {
1938
- if (fromSetup) {
1939
- pose.scaleX = setup.scaleX;
1940
- pose.scaleY = setup.scaleY;
1962
+ switch (from) {
1963
+ case 1 /* setup */:
1964
+ pose.scaleX = setup.scaleX;
1965
+ pose.scaleY = setup.scaleY;
1966
+ break;
1967
+ case 2 /* first */:
1968
+ pose.scaleX += (setup.scaleX - pose.scaleX) * alpha;
1969
+ pose.scaleY += (setup.scaleY - pose.scaleY) * alpha;
1970
+ break;
1941
1971
  }
1942
1972
  return;
1943
1973
  }
@@ -2010,7 +2040,7 @@ var spine = (() => {
2010
2040
  pose.scaleY = y;
2011
2041
  } else {
2012
2042
  let bx = 0, by = 0;
2013
- if (fromSetup) {
2043
+ if (from === 1 /* setup */) {
2014
2044
  bx = setup.scaleX;
2015
2045
  by = setup.scaleY;
2016
2046
  } else {
@@ -2036,28 +2066,34 @@ var spine = (() => {
2036
2066
  constructor(frameCount, bezierCount, boneIndex) {
2037
2067
  super(frameCount, bezierCount, boneIndex, 3 /* scaleX */);
2038
2068
  }
2039
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
2040
- pose.scaleX = this.getScaleValue(time, alpha, fromSetup, add, out, pose.scaleX, setup.scaleX);
2069
+ apply1(pose, setup, time, alpha, from, add, out) {
2070
+ pose.scaleX = this.getScaleValue(time, alpha, from, add, out, pose.scaleX, setup.scaleX);
2041
2071
  }
2042
2072
  };
2043
2073
  var ScaleYTimeline = class extends BoneTimeline1 {
2044
2074
  constructor(frameCount, bezierCount, boneIndex) {
2045
2075
  super(frameCount, bezierCount, boneIndex, 4 /* scaleY */);
2046
2076
  }
2047
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
2048
- pose.scaleY = this.getScaleValue(time, alpha, fromSetup, add, out, pose.scaleY, setup.scaleY);
2077
+ apply1(pose, setup, time, alpha, from, add, out) {
2078
+ pose.scaleY = this.getScaleValue(time, alpha, from, add, out, pose.scaleY, setup.scaleY);
2049
2079
  }
2050
2080
  };
2051
2081
  var ShearTimeline = class extends BoneTimeline2 {
2052
2082
  constructor(frameCount, bezierCount, boneIndex) {
2053
2083
  super(frameCount, bezierCount, boneIndex, 5 /* shearX */, 6 /* shearY */);
2054
2084
  }
2055
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
2085
+ apply1(pose, setup, time, alpha, from, add, out) {
2056
2086
  const frames = this.frames;
2057
2087
  if (time < frames[0]) {
2058
- if (fromSetup) {
2059
- pose.shearX = setup.shearX;
2060
- pose.shearY = setup.shearY;
2088
+ switch (from) {
2089
+ case 1 /* setup */:
2090
+ pose.shearX = setup.shearX;
2091
+ pose.shearY = setup.shearY;
2092
+ break;
2093
+ case 2 /* first */:
2094
+ pose.shearX += (setup.shearX - pose.shearX) * alpha;
2095
+ pose.shearY += (setup.shearY - pose.shearY) * alpha;
2096
+ break;
2061
2097
  }
2062
2098
  return;
2063
2099
  }
@@ -2123,7 +2159,7 @@ var spine = (() => {
2123
2159
  /*BEZIER*/
2124
2160
  );
2125
2161
  }
2126
- if (fromSetup) {
2162
+ if (from === 1 /* setup */) {
2127
2163
  pose.shearX = setup.shearX + x * alpha;
2128
2164
  pose.shearY = setup.shearY + y * alpha;
2129
2165
  } else if (add) {
@@ -2139,16 +2175,16 @@ var spine = (() => {
2139
2175
  constructor(frameCount, bezierCount, boneIndex) {
2140
2176
  super(frameCount, bezierCount, boneIndex, 5 /* shearX */);
2141
2177
  }
2142
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
2143
- pose.shearX = this.getRelativeValue(time, alpha, fromSetup, add, pose.shearX, setup.shearX);
2178
+ apply1(pose, setup, time, alpha, from, add, out) {
2179
+ pose.shearX = this.getRelativeValue(time, alpha, from, add, pose.shearX, setup.shearX);
2144
2180
  }
2145
2181
  };
2146
2182
  var ShearYTimeline = class extends BoneTimeline1 {
2147
2183
  constructor(frameCount, bezierCount, boneIndex) {
2148
2184
  super(frameCount, bezierCount, boneIndex, 6 /* shearY */);
2149
2185
  }
2150
- apply1(pose, setup, time, alpha, fromSetup, add, out) {
2151
- pose.shearY = this.getRelativeValue(time, alpha, fromSetup, add, pose.shearY, setup.shearY);
2186
+ apply1(pose, setup, time, alpha, from, add, out) {
2187
+ pose.shearY = this.getRelativeValue(time, alpha, from, add, pose.shearY, setup.shearY);
2152
2188
  }
2153
2189
  };
2154
2190
  var InheritTimeline = class extends Timeline {
@@ -2172,16 +2208,16 @@ var spine = (() => {
2172
2208
  /*INHERIT*/
2173
2209
  ] = inherit;
2174
2210
  }
2175
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
2211
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
2176
2212
  const bone = skeleton.bones[this.boneIndex];
2177
2213
  if (!bone.active) return;
2178
2214
  const pose = appliedPose ? bone.appliedPose : bone.pose;
2179
2215
  if (out) {
2180
- if (fromSetup) pose.inherit = bone.data.setupPose.inherit;
2216
+ if (from !== 0 /* current */) pose.inherit = bone.data.setupPose.inherit;
2181
2217
  } else {
2182
2218
  const frames = this.frames;
2183
2219
  if (time < frames[0]) {
2184
- if (fromSetup) pose.inherit = bone.data.setupPose.inherit;
2220
+ if (from !== 0 /* current */) pose.inherit = bone.data.setupPose.inherit;
2185
2221
  } else
2186
2222
  pose.inherit = this.frames[
2187
2223
  Timeline.search(
@@ -2201,9 +2237,9 @@ var spine = (() => {
2201
2237
  super(frameCount, bezierCount, ...propertyIds);
2202
2238
  this.slotIndex = slotIndex;
2203
2239
  }
2204
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
2240
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
2205
2241
  const slot = skeleton.slots[this.slotIndex];
2206
- if (slot.bone.active) this.apply1(slot, appliedPose ? slot.appliedPose : slot.pose, time, alpha, fromSetup, add);
2242
+ if (slot.bone.active) this.apply1(slot, appliedPose ? slot.appliedPose : slot.pose, time, alpha, from, add);
2207
2243
  }
2208
2244
  };
2209
2245
  var RGBATimeline = class extends SlotCurveTimeline {
@@ -2242,11 +2278,24 @@ var spine = (() => {
2242
2278
  /*A*/
2243
2279
  ] = a;
2244
2280
  }
2245
- apply1(slot, pose, time, alpha, fromSetup, add) {
2281
+ apply1(slot, pose, time, alpha, from, add) {
2246
2282
  const color = pose.color;
2247
2283
  const frames = this.frames;
2248
2284
  if (time < frames[0]) {
2249
- if (fromSetup) color.setFromColor(slot.data.setupPose.color);
2285
+ const setup = slot.data.setupPose.color;
2286
+ switch (from) {
2287
+ case 1 /* setup */:
2288
+ color.setFromColor(setup);
2289
+ break;
2290
+ case 2 /* first */:
2291
+ color.add(
2292
+ (setup.r - color.r) * alpha,
2293
+ (setup.g - color.g) * alpha,
2294
+ (setup.b - color.b) * alpha,
2295
+ (setup.a - color.a) * alpha
2296
+ );
2297
+ break;
2298
+ }
2250
2299
  return;
2251
2300
  }
2252
2301
  let r = 0, g = 0, b = 0, a = 0;
@@ -2352,7 +2401,7 @@ var spine = (() => {
2352
2401
  if (alpha === 1)
2353
2402
  color.set(r, g, b, a);
2354
2403
  else {
2355
- if (fromSetup) {
2404
+ if (from === 1 /* setup */) {
2356
2405
  const setup = slot.data.setupPose.color;
2357
2406
  color.set(
2358
2407
  setup.r + (r - setup.r) * alpha,
@@ -2389,16 +2438,25 @@ var spine = (() => {
2389
2438
  /*B*/
2390
2439
  ] = b;
2391
2440
  }
2392
- apply1(slot, pose, time, alpha, fromSetup, add) {
2441
+ apply1(slot, pose, time, alpha, from, add) {
2393
2442
  const color = pose.color;
2394
2443
  let r = 0, g = 0, b = 0;
2395
2444
  const frames = this.frames;
2396
2445
  if (time < frames[0]) {
2397
- if (fromSetup) {
2398
- const setup = slot.data.setupPose.color;
2399
- color.r = setup.r;
2400
- color.g = setup.g;
2401
- color.b = setup.b;
2446
+ const setup = slot.data.setupPose.color;
2447
+ switch (from) {
2448
+ case 1 /* setup */: {
2449
+ color.r = setup.r;
2450
+ color.g = setup.g;
2451
+ color.b = setup.b;
2452
+ break;
2453
+ }
2454
+ case 2 /* first */: {
2455
+ color.r += (setup.r - color.r) * alpha;
2456
+ color.g += (setup.g - color.g) * alpha;
2457
+ color.b += (setup.b - color.b) * alpha;
2458
+ break;
2459
+ }
2402
2460
  }
2403
2461
  return;
2404
2462
  }
@@ -2480,7 +2538,7 @@ var spine = (() => {
2480
2538
  );
2481
2539
  }
2482
2540
  if (alpha !== 1) {
2483
- if (fromSetup) {
2541
+ if (from === 1 /* setup */) {
2484
2542
  const setup = slot.data.setupPose.color;
2485
2543
  r = setup.r + (r - setup.r) * alpha;
2486
2544
  g = setup.g + (g - setup.g) * alpha;
@@ -2502,19 +2560,27 @@ var spine = (() => {
2502
2560
  super(frameCount, bezierCount, `${9 /* alpha */}|${slotIndex}`);
2503
2561
  this.slotIndex = slotIndex;
2504
2562
  }
2505
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
2563
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
2506
2564
  const slot = skeleton.slots[this.slotIndex];
2507
2565
  if (!slot.bone.active) return;
2508
2566
  const color = (appliedPose ? slot.appliedPose : slot.pose).color;
2509
2567
  let a = 0;
2510
2568
  const frames = this.frames;
2511
2569
  if (time < frames[0]) {
2512
- if (fromSetup) color.a = slot.data.setupPose.color.a;
2570
+ const setup = slot.data.setupPose.color.a;
2571
+ switch (from) {
2572
+ case 1 /* setup */:
2573
+ color.a = setup;
2574
+ break;
2575
+ case 2 /* first */:
2576
+ color.a += (setup - color.a) * alpha;
2577
+ break;
2578
+ }
2513
2579
  return;
2514
2580
  }
2515
2581
  a = this.getCurveValue(time);
2516
2582
  if (alpha !== 1) {
2517
- if (fromSetup) {
2583
+ if (from === 1 /* setup */) {
2518
2584
  const setup = slot.data.setupPose.color;
2519
2585
  a = setup.a + (a - setup.a) * alpha;
2520
2586
  } else
@@ -2573,18 +2639,33 @@ var spine = (() => {
2573
2639
  /*B2*/
2574
2640
  ] = b2;
2575
2641
  }
2576
- apply1(slot, pose, time, alpha, fromSetup, add) {
2642
+ apply1(slot, pose, time, alpha, from, add) {
2577
2643
  const light = pose.color, dark = pose.darkColor;
2578
2644
  let r2 = 0, g2 = 0, b2 = 0;
2579
2645
  const frames = this.frames;
2580
2646
  if (time < frames[0]) {
2581
- if (fromSetup) {
2582
- const setup = slot.data.setupPose;
2583
- light.setFromColor(setup.color);
2584
- const setupDark = setup.darkColor;
2585
- dark.r = setupDark.r;
2586
- dark.g = setupDark.g;
2587
- dark.b = setupDark.b;
2647
+ const setup = slot.data.setupPose;
2648
+ const setupLight = setup.color, setupDark = setup.darkColor;
2649
+ switch (from) {
2650
+ case 1 /* setup */: {
2651
+ light.setFromColor(setupLight);
2652
+ dark.r = setupDark.r;
2653
+ dark.g = setupDark.g;
2654
+ dark.b = setupDark.b;
2655
+ break;
2656
+ }
2657
+ case 2 /* first */: {
2658
+ light.add(
2659
+ (setupLight.r - light.r) * alpha,
2660
+ (setupLight.g - light.g) * alpha,
2661
+ (setupLight.b - light.b) * alpha,
2662
+ (setupLight.a - light.a) * alpha
2663
+ );
2664
+ dark.r += (setupDark.r - dark.r) * alpha;
2665
+ dark.g += (setupDark.g - dark.g) * alpha;
2666
+ dark.b += (setupDark.b - dark.b) * alpha;
2667
+ break;
2668
+ }
2588
2669
  }
2589
2670
  return;
2590
2671
  }
@@ -2744,7 +2825,7 @@ var spine = (() => {
2744
2825
  }
2745
2826
  if (alpha === 1)
2746
2827
  light.set(r, g, b, a);
2747
- else if (fromSetup) {
2828
+ else if (from === 1 /* setup */) {
2748
2829
  const setupPose = slot.data.setupPose;
2749
2830
  let setup = setupPose.color;
2750
2831
  light.set(
@@ -2812,20 +2893,30 @@ var spine = (() => {
2812
2893
  /*B2*/
2813
2894
  ] = b2;
2814
2895
  }
2815
- apply1(slot, pose, time, alpha, fromSetup, add) {
2896
+ apply1(slot, pose, time, alpha, from, add) {
2816
2897
  const light = pose.color, dark = pose.darkColor;
2817
2898
  let r = 0, g = 0, b = 0, r2 = 0, g2 = 0, b2 = 0;
2818
2899
  const frames = this.frames;
2819
2900
  if (time < frames[0]) {
2820
- if (fromSetup) {
2821
- const setup = slot.data.setupPose;
2822
- const setupLight = setup.color, setupDark = setup.darkColor;
2823
- light.r = setupLight.r;
2824
- light.g = setupLight.g;
2825
- light.b = setupLight.b;
2826
- dark.r = setupDark.r;
2827
- dark.g = setupDark.g;
2828
- dark.b = setupDark.b;
2901
+ const setup = slot.data.setupPose;
2902
+ const setupLight = setup.color, setupDark = setup.darkColor;
2903
+ switch (from) {
2904
+ case 1 /* setup */:
2905
+ light.r = setupLight.r;
2906
+ light.g = setupLight.g;
2907
+ light.b = setupLight.b;
2908
+ dark.r = setupDark.r;
2909
+ dark.g = setupDark.g;
2910
+ dark.b = setupDark.b;
2911
+ break;
2912
+ case 2 /* first */:
2913
+ light.r += (setupLight.r - light.r) * alpha;
2914
+ light.g += (setupLight.g - light.g) * alpha;
2915
+ light.b += (setupLight.b - light.b) * alpha;
2916
+ dark.r += (setupDark.r - dark.r) * alpha;
2917
+ dark.g += (setupDark.g - dark.g) * alpha;
2918
+ dark.b += (setupDark.b - dark.b) * alpha;
2919
+ break;
2829
2920
  }
2830
2921
  return;
2831
2922
  }
@@ -2967,7 +3058,7 @@ var spine = (() => {
2967
3058
  );
2968
3059
  }
2969
3060
  if (alpha !== 1) {
2970
- if (fromSetup) {
3061
+ if (from === 1 /* setup */) {
2971
3062
  const setupPose = slot.data.setupPose;
2972
3063
  let setup = setupPose.color;
2973
3064
  r = setup.r + (r - setup.r) * alpha;
@@ -3012,12 +3103,12 @@ var spine = (() => {
3012
3103
  this.frames[frame] = time;
3013
3104
  this.attachmentNames[frame] = attachmentName;
3014
3105
  }
3015
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
3106
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
3016
3107
  const slot = skeleton.slots[this.slotIndex];
3017
3108
  if (!slot.bone.active) return;
3018
3109
  const pose = appliedPose ? slot.appliedPose : slot.pose;
3019
3110
  if (out || time < this.frames[0]) {
3020
- if (fromSetup) this.setAttachment(skeleton, pose, slot.data.attachmentName);
3111
+ if (from !== 0 /* current */) this.setAttachment(skeleton, pose, slot.data.attachmentName);
3021
3112
  } else
3022
3113
  this.setAttachment(skeleton, pose, this.attachmentNames[Timeline.search(this.frames, time)]);
3023
3114
  }
@@ -3099,15 +3190,15 @@ var spine = (() => {
3099
3190
  const x = curves[n - 2], y = curves[n - 1];
3100
3191
  return y + (1 - y) * (time - x) / (this.frames[frame + this.getFrameEntries()] - x);
3101
3192
  }
3102
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
3193
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
3103
3194
  const slots = skeleton.slots;
3104
3195
  if (!this.attachment.isTimelineActive(slots, this.slotIndex, appliedPose)) return;
3105
3196
  const timelineSlots = this.attachment.timelineSlots;
3106
3197
  const frames = this.frames;
3107
3198
  if (time < frames[0]) {
3108
- this.applyBeforeFirst(slots[this.slotIndex], appliedPose, fromSetup);
3199
+ this.applyBeforeFirst(slots[this.slotIndex], appliedPose, alpha, from);
3109
3200
  for (const slotIndex of timelineSlots)
3110
- this.applyBeforeFirst(slots[slotIndex], appliedPose, fromSetup);
3201
+ this.applyBeforeFirst(slots[slotIndex], appliedPose, alpha, from);
3111
3202
  return;
3112
3203
  }
3113
3204
  let v1, v2;
@@ -3123,17 +3214,49 @@ var spine = (() => {
3123
3214
  v2 = this.vertices[frame + 1];
3124
3215
  }
3125
3216
  const vertexCount = this.vertices[0].length;
3126
- this.applyToSlot(slots[this.slotIndex], appliedPose, v1, v2, percent, vertexCount, alpha, fromSetup, add);
3217
+ this.applyToSlot(slots[this.slotIndex], appliedPose, v1, v2, percent, vertexCount, alpha, from, add);
3127
3218
  for (const slotIndex of timelineSlots)
3128
- this.applyToSlot(slots[slotIndex], appliedPose, v1, v2, percent, vertexCount, alpha, fromSetup, add);
3219
+ this.applyToSlot(slots[slotIndex], appliedPose, v1, v2, percent, vertexCount, alpha, from, add);
3129
3220
  }
3130
- applyToSlot(slot, appliedPose, v1, v2, percent, vertexCount, alpha, fromSetup, add) {
3221
+ applyBeforeFirst(slot, appliedPose, alpha, from) {
3222
+ if (!slot.bone.active) return;
3223
+ const pose = appliedPose ? slot.appliedPose : slot.pose;
3224
+ if (pose.attachment == null || pose.attachment.timelineAttachment !== this.attachment) return;
3225
+ const deformArray = pose.deform;
3226
+ if (deformArray.length === 0) from = 1 /* setup */;
3227
+ switch (from) {
3228
+ case 1 /* setup */:
3229
+ deformArray.length = 0;
3230
+ break;
3231
+ case 2 /* first */: {
3232
+ if (alpha === 1) {
3233
+ deformArray.length = 0;
3234
+ return;
3235
+ }
3236
+ const vertexCount = this.vertices[0].length;
3237
+ deformArray.length = vertexCount;
3238
+ const deform = deformArray;
3239
+ const vertexAttachment = pose.attachment;
3240
+ if (vertexAttachment.bones === null) {
3241
+ const setupVertices = vertexAttachment.vertices;
3242
+ for (let i = 0; i < vertexCount; i++)
3243
+ deform[i] += (setupVertices[i] - deform[i]) * alpha;
3244
+ } else {
3245
+ alpha = 1 - alpha;
3246
+ for (let i = 0; i < vertexCount; i++)
3247
+ deform[i] *= alpha;
3248
+ }
3249
+ }
3250
+ }
3251
+ }
3252
+ applyToSlot(slot, appliedPose, v1, v2, percent, vertexCount, alpha, from, add) {
3131
3253
  if (!slot.bone.active) return;
3132
3254
  const pose = appliedPose ? slot.appliedPose : slot.pose;
3133
3255
  if (pose.attachment === null || pose.attachment.timelineAttachment !== this.attachment) return;
3134
3256
  const vertexAttachment = pose.attachment;
3135
3257
  const deform = pose.deform;
3136
- if (deform.length === 0) fromSetup = true;
3258
+ if (deform.length === 0) from = 1 /* setup */;
3259
+ const fromSetup = from === 1 /* setup */;
3137
3260
  deform.length = vertexCount;
3138
3261
  if (v2 === null) {
3139
3262
  if (alpha === 1) {
@@ -3229,13 +3352,6 @@ var spine = (() => {
3229
3352
  }
3230
3353
  }
3231
3354
  }
3232
- applyBeforeFirst(slot, appliedPose, fromSetup) {
3233
- if (!slot.bone.active) return;
3234
- const pose = appliedPose ? slot.appliedPose : slot.pose;
3235
- if (pose.attachment == null || pose.attachment.timelineAttachment !== this.attachment) return;
3236
- if (pose.deform.length === 0) fromSetup = true;
3237
- if (fromSetup) pose.deform.length = 0;
3238
- }
3239
3355
  };
3240
3356
  var SequenceTimeline = class _SequenceTimeline extends Timeline {
3241
3357
  static ENTRIES = 3;
@@ -3244,7 +3360,7 @@ var spine = (() => {
3244
3360
  slotIndex;
3245
3361
  attachment;
3246
3362
  constructor(frameCount, slotIndex, attachment) {
3247
- super(frameCount, `${28 /* sequence */}|${slotIndex}|${attachment.sequence.id}`);
3363
+ super(frameCount, `${29 /* sequence */}|${slotIndex}|${attachment.sequence.id}`);
3248
3364
  this.slotIndex = slotIndex;
3249
3365
  this.attachment = attachment;
3250
3366
  this.instant = true;
@@ -3271,13 +3387,13 @@ var spine = (() => {
3271
3387
  frames[frame + _SequenceTimeline.MODE] = mode | index << 4;
3272
3388
  frames[frame + _SequenceTimeline.DELAY] = delay;
3273
3389
  }
3274
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
3390
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
3275
3391
  const slots = skeleton.slots;
3276
3392
  if (!this.attachment.isTimelineActive(slots, this.slotIndex, appliedPose)) return;
3277
3393
  const timelineSlots = this.attachment.timelineSlots;
3278
3394
  const frames = this.frames;
3279
3395
  if (out || time < frames[0]) {
3280
- if (fromSetup) {
3396
+ if (from !== 0 /* current */) {
3281
3397
  this.setupPose(slots[this.slotIndex], appliedPose);
3282
3398
  for (const slotIndex of timelineSlots)
3283
3399
  this.setupPose(slots[slotIndex], appliedPose);
@@ -3353,12 +3469,12 @@ var spine = (() => {
3353
3469
  this.events[frame] = event;
3354
3470
  }
3355
3471
  /** Fires events for frames > `lastTime` and <= `time`. */
3356
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3472
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3357
3473
  if (!firedEvents) return;
3358
3474
  const frames = this.frames;
3359
3475
  const frameCount = this.frames.length;
3360
3476
  if (lastTime > time) {
3361
- this.apply(null, lastTime, Number.MAX_VALUE, firedEvents, 0, false, false, false, false);
3477
+ this.apply(null, lastTime, Number.MAX_VALUE, firedEvents, 0, from, false, false, false);
3362
3478
  lastTime = -1;
3363
3479
  } else if (lastTime >= frames[frameCount - 1])
3364
3480
  return;
@@ -3398,11 +3514,11 @@ var spine = (() => {
3398
3514
  this.frames[frame] = time;
3399
3515
  this.drawOrders[frame] = drawOrder;
3400
3516
  }
3401
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3517
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3402
3518
  const pose = appliedPose ? skeleton.drawOrder.appliedPose : skeleton.drawOrder.pose;
3403
3519
  const setup = skeleton.slots;
3404
3520
  if (out || time < this.frames[0]) {
3405
- if (fromSetup) Utils.arrayCopy(setup, 0, pose, 0, skeleton.slots.length);
3521
+ if (from !== 0 /* current */) Utils.arrayCopy(setup, 0, pose, 0, skeleton.slots.length);
3406
3522
  return;
3407
3523
  }
3408
3524
  const order = this.drawOrders[Timeline.search(this.frames, time)];
@@ -3415,6 +3531,7 @@ var spine = (() => {
3415
3531
  }
3416
3532
  };
3417
3533
  var DrawOrderFolderTimeline = class _DrawOrderFolderTimeline extends Timeline {
3534
+ static propertyID = `${15 /* drawOrderFolder */}`;
3418
3535
  slots;
3419
3536
  inFolder;
3420
3537
  drawOrders;
@@ -3433,7 +3550,7 @@ var spine = (() => {
3433
3550
  const n = slots.length;
3434
3551
  const ids = new Array(n);
3435
3552
  for (let i = 0; i < n; i++)
3436
- ids[i] = `d${slots[i]}`;
3553
+ ids[i] = `${_DrawOrderFolderTimeline.propertyID}|${slots[i]}`;
3437
3554
  return ids;
3438
3555
  }
3439
3556
  getFrameCount() {
@@ -3455,11 +3572,11 @@ var spine = (() => {
3455
3572
  this.frames[frame] = time;
3456
3573
  this.drawOrders[frame] = drawOrder;
3457
3574
  }
3458
- apply(skeleton, lastTime, time, events, alpha, fromSetup, add, out, appliedPose) {
3575
+ apply(skeleton, lastTime, time, events, alpha, from, add, out, appliedPose) {
3459
3576
  const pose = appliedPose ? skeleton.drawOrder.appliedPose : skeleton.drawOrder.pose;
3460
3577
  const setup = skeleton.slots;
3461
3578
  if (out || time < this.frames[0]) {
3462
- if (fromSetup) this.setup(pose, setup);
3579
+ if (from !== 0 /* current */) this.setup(pose, setup);
3463
3580
  } else {
3464
3581
  const order = this.drawOrders[Timeline.search(this.frames, time)];
3465
3582
  if (!order)
@@ -3492,7 +3609,7 @@ var spine = (() => {
3492
3609
  var IkConstraintTimeline = class extends CurveTimeline {
3493
3610
  constraintIndex = 0;
3494
3611
  constructor(frameCount, bezierCount, constraintIndex) {
3495
- super(frameCount, bezierCount, `${15 /* ikConstraint */}|${constraintIndex}`);
3612
+ super(frameCount, bezierCount, `${16 /* ikConstraint */}|${constraintIndex}`);
3496
3613
  this.constraintIndex = constraintIndex;
3497
3614
  }
3498
3615
  getFrameEntries() {
@@ -3526,19 +3643,30 @@ var spine = (() => {
3526
3643
  /*STRETCH*/
3527
3644
  ] = stretch ? 1 : 0;
3528
3645
  }
3529
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3646
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3530
3647
  const constraint = skeleton.constraints[this.constraintIndex];
3531
3648
  if (!constraint.active) return;
3532
3649
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3533
3650
  const frames = this.frames;
3534
3651
  if (time < frames[0]) {
3535
- if (fromSetup) {
3536
- const setup = constraint.data.setupPose;
3537
- pose.mix = setup.mix;
3538
- pose.softness = setup.softness;
3539
- pose.bendDirection = setup.bendDirection;
3540
- pose.compress = setup.compress;
3541
- pose.stretch = setup.stretch;
3652
+ const setup = constraint.data.setupPose;
3653
+ switch (from) {
3654
+ case 1 /* setup */: {
3655
+ pose.mix = setup.mix;
3656
+ pose.softness = setup.softness;
3657
+ pose.bendDirection = setup.bendDirection;
3658
+ pose.compress = setup.compress;
3659
+ pose.stretch = setup.stretch;
3660
+ break;
3661
+ }
3662
+ case 2 /* first */: {
3663
+ pose.mix += (setup.mix - pose.mix) * alpha;
3664
+ pose.softness += (setup.softness - pose.softness) * alpha;
3665
+ pose.bendDirection = setup.bendDirection;
3666
+ pose.compress = setup.compress;
3667
+ pose.stretch = setup.stretch;
3668
+ break;
3669
+ }
3542
3670
  }
3543
3671
  return;
3544
3672
  }
@@ -3604,11 +3732,11 @@ var spine = (() => {
3604
3732
  /*BEZIER*/
3605
3733
  );
3606
3734
  }
3607
- const base = fromSetup ? constraint.data.setupPose : pose;
3735
+ const base = from === 1 /* setup */ ? constraint.data.setupPose : pose;
3608
3736
  pose.mix = base.mix + (mix - base.mix) * alpha;
3609
3737
  pose.softness = base.softness + (softness - base.softness) * alpha;
3610
3738
  if (out) {
3611
- if (fromSetup) {
3739
+ if (from === 1 /* setup */) {
3612
3740
  pose.bendDirection = base.bendDirection;
3613
3741
  pose.compress = base.compress;
3614
3742
  pose.stretch = base.stretch;
@@ -3633,7 +3761,7 @@ var spine = (() => {
3633
3761
  /** The index of the transform constraint slot in {@link Skeleton.transformConstraints} that will be changed. */
3634
3762
  constraintIndex = 0;
3635
3763
  constructor(frameCount, bezierCount, constraintIndex) {
3636
- super(frameCount, bezierCount, `${16 /* transformConstraint */}|${constraintIndex}`);
3764
+ super(frameCount, bezierCount, `${17 /* transformConstraint */}|${constraintIndex}`);
3637
3765
  this.constraintIndex = constraintIndex;
3638
3766
  this.additive = true;
3639
3767
  }
@@ -3672,20 +3800,32 @@ var spine = (() => {
3672
3800
  /*SHEARY*/
3673
3801
  ] = mixShearY;
3674
3802
  }
3675
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
3803
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3676
3804
  const constraint = skeleton.constraints[this.constraintIndex];
3677
3805
  if (!constraint.active) return;
3678
3806
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3679
3807
  const frames = this.frames;
3680
3808
  if (time < frames[0]) {
3681
- if (fromSetup) {
3682
- const setup = constraint.data.setupPose;
3683
- pose.mixRotate = setup.mixRotate;
3684
- pose.mixX = setup.mixX;
3685
- pose.mixY = setup.mixY;
3686
- pose.mixScaleX = setup.mixScaleX;
3687
- pose.mixScaleY = setup.mixScaleY;
3688
- pose.mixShearY = setup.mixShearY;
3809
+ const setup = constraint.data.setupPose;
3810
+ switch (from) {
3811
+ case 1 /* setup */: {
3812
+ pose.mixRotate = setup.mixRotate;
3813
+ pose.mixX = setup.mixX;
3814
+ pose.mixY = setup.mixY;
3815
+ pose.mixScaleX = setup.mixScaleX;
3816
+ pose.mixScaleY = setup.mixScaleY;
3817
+ pose.mixShearY = setup.mixShearY;
3818
+ break;
3819
+ }
3820
+ case 2 /* first */: {
3821
+ pose.mixRotate += (setup.mixRotate - pose.mixRotate) * alpha;
3822
+ pose.mixX += (setup.mixX - pose.mixX) * alpha;
3823
+ pose.mixY += (setup.mixY - pose.mixY) * alpha;
3824
+ pose.mixScaleX += (setup.mixScaleX - pose.mixScaleX) * alpha;
3825
+ pose.mixScaleY += (setup.mixScaleY - pose.mixScaleY) * alpha;
3826
+ pose.mixShearY += (setup.mixShearY - pose.mixShearY) * alpha;
3827
+ break;
3828
+ }
3689
3829
  }
3690
3830
  return;
3691
3831
  }
@@ -3827,7 +3967,7 @@ var spine = (() => {
3827
3967
  /*BEZIER*/
3828
3968
  );
3829
3969
  }
3830
- const base = fromSetup ? constraint.data.setupPose : pose;
3970
+ const base = from === 1 /* setup */ ? constraint.data.setupPose : pose;
3831
3971
  if (add) {
3832
3972
  pose.mixRotate = base.mixRotate + rotate * alpha;
3833
3973
  pose.mixX = base.mixX + x * alpha;
@@ -3854,29 +3994,29 @@ var spine = (() => {
3854
3994
  };
3855
3995
  var PathConstraintPositionTimeline = class extends ConstraintTimeline1 {
3856
3996
  constructor(frameCount, bezierCount, constraintIndex) {
3857
- super(frameCount, bezierCount, constraintIndex, 17 /* pathConstraintPosition */);
3997
+ super(frameCount, bezierCount, constraintIndex, 18 /* pathConstraintPosition */);
3858
3998
  this.additive = true;
3859
3999
  }
3860
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4000
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3861
4001
  const constraint = skeleton.constraints[this.constraintIndex];
3862
4002
  if (constraint.active) {
3863
4003
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3864
- pose.position = this.getAbsoluteValue(time, alpha, fromSetup, add, pose.position, constraint.data.setupPose.position);
4004
+ pose.position = this.getAbsoluteValue(time, alpha, from, add, pose.position, constraint.data.setupPose.position);
3865
4005
  }
3866
4006
  }
3867
4007
  };
3868
4008
  var PathConstraintSpacingTimeline = class extends ConstraintTimeline1 {
3869
4009
  constructor(frameCount, bezierCount, constraintIndex) {
3870
- super(frameCount, bezierCount, constraintIndex, 18 /* pathConstraintSpacing */);
4010
+ super(frameCount, bezierCount, constraintIndex, 19 /* pathConstraintSpacing */);
3871
4011
  }
3872
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4012
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3873
4013
  const constraint = skeleton.constraints[this.constraintIndex];
3874
4014
  if (constraint.active) {
3875
4015
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3876
4016
  pose.spacing = this.getAbsoluteValue(
3877
4017
  time,
3878
4018
  alpha,
3879
- fromSetup,
4019
+ from,
3880
4020
  false,
3881
4021
  pose.spacing,
3882
4022
  constraint.data.setupPose.spacing
@@ -3887,7 +4027,7 @@ var spine = (() => {
3887
4027
  var PathConstraintMixTimeline = class extends CurveTimeline {
3888
4028
  constraintIndex;
3889
4029
  constructor(frameCount, bezierCount, constraintIndex) {
3890
- super(frameCount, bezierCount, `${19 /* pathConstraintMix */}|${constraintIndex}`);
4030
+ super(frameCount, bezierCount, `${20 /* pathConstraintMix */}|${constraintIndex}`);
3891
4031
  this.constraintIndex = constraintIndex;
3892
4032
  }
3893
4033
  getFrameEntries() {
@@ -3913,17 +4053,26 @@ var spine = (() => {
3913
4053
  /*Y*/
3914
4054
  ] = mixY;
3915
4055
  }
3916
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4056
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
3917
4057
  const constraint = skeleton.constraints[this.constraintIndex];
3918
4058
  if (!constraint.active) return;
3919
4059
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
3920
4060
  const frames = this.frames;
3921
4061
  if (time < frames[0]) {
3922
- if (fromSetup) {
3923
- const setup = constraint.data.setupPose;
3924
- pose.mixRotate = setup.mixRotate;
3925
- pose.mixX = setup.mixX;
3926
- pose.mixY = setup.mixY;
4062
+ const setup = constraint.data.setupPose;
4063
+ switch (from) {
4064
+ case 1 /* setup */: {
4065
+ pose.mixRotate = setup.mixRotate;
4066
+ pose.mixX = setup.mixX;
4067
+ pose.mixY = setup.mixY;
4068
+ break;
4069
+ }
4070
+ case 2 /* first */: {
4071
+ pose.mixRotate += (setup.mixRotate - pose.mixRotate) * alpha;
4072
+ pose.mixX += (setup.mixX - pose.mixX) * alpha;
4073
+ pose.mixY += (setup.mixY - pose.mixY) * alpha;
4074
+ break;
4075
+ }
3927
4076
  }
3928
4077
  return;
3929
4078
  }
@@ -4005,7 +4154,7 @@ var spine = (() => {
4005
4154
  /*BEZIER*/
4006
4155
  );
4007
4156
  }
4008
- const base = fromSetup ? constraint.data.setupPose : pose;
4157
+ const base = from === 1 /* setup */ ? constraint.data.setupPose : pose;
4009
4158
  if (add) {
4010
4159
  pose.mixRotate = base.mixRotate + rotate * alpha;
4011
4160
  pose.mixX = base.mixX + x * alpha;
@@ -4022,7 +4171,7 @@ var spine = (() => {
4022
4171
  constructor(frameCount, bezierCount, constraintIndex, property) {
4023
4172
  super(frameCount, bezierCount, constraintIndex, property);
4024
4173
  }
4025
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4174
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
4026
4175
  if (add && !this.additive) add = false;
4027
4176
  if (this.constraintIndex === -1) {
4028
4177
  const value = time >= this.frames[0] ? this.getCurveValue(time) : 0;
@@ -4030,21 +4179,21 @@ var spine = (() => {
4030
4179
  for (const constraint of constraints) {
4031
4180
  if (constraint.active && this.global(constraint.data)) {
4032
4181
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
4033
- this.set(pose, this.getAbsoluteValue(time, alpha, fromSetup, add, this.get(pose), this.get(constraint.data.setupPose), value));
4182
+ this.set(pose, this.getAbsoluteValue(time, alpha, from, add, this.get(pose), this.get(constraint.data.setupPose), value));
4034
4183
  }
4035
4184
  }
4036
4185
  } else {
4037
4186
  const constraint = skeleton.constraints[this.constraintIndex];
4038
4187
  if (constraint.active) {
4039
4188
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
4040
- this.set(pose, this.getAbsoluteValue(time, alpha, fromSetup, add, this.get(pose), this.get(constraint.data.setupPose)));
4189
+ this.set(pose, this.getAbsoluteValue(time, alpha, from, add, this.get(pose), this.get(constraint.data.setupPose)));
4041
4190
  }
4042
4191
  }
4043
4192
  }
4044
4193
  };
4045
4194
  var PhysicsConstraintInertiaTimeline = class extends PhysicsConstraintTimeline {
4046
4195
  constructor(frameCount, bezierCount, constraintIndex) {
4047
- super(frameCount, bezierCount, constraintIndex, 20 /* physicsConstraintInertia */);
4196
+ super(frameCount, bezierCount, constraintIndex, 21 /* physicsConstraintInertia */);
4048
4197
  }
4049
4198
  get(pose) {
4050
4199
  return pose.inertia;
@@ -4058,7 +4207,7 @@ var spine = (() => {
4058
4207
  };
4059
4208
  var PhysicsConstraintStrengthTimeline = class extends PhysicsConstraintTimeline {
4060
4209
  constructor(frameCount, bezierCount, constraintIndex) {
4061
- super(frameCount, bezierCount, constraintIndex, 21 /* physicsConstraintStrength */);
4210
+ super(frameCount, bezierCount, constraintIndex, 22 /* physicsConstraintStrength */);
4062
4211
  }
4063
4212
  get(pose) {
4064
4213
  return pose.strength;
@@ -4072,7 +4221,7 @@ var spine = (() => {
4072
4221
  };
4073
4222
  var PhysicsConstraintDampingTimeline = class extends PhysicsConstraintTimeline {
4074
4223
  constructor(frameCount, bezierCount, constraintIndex) {
4075
- super(frameCount, bezierCount, constraintIndex, 22 /* physicsConstraintDamping */);
4224
+ super(frameCount, bezierCount, constraintIndex, 23 /* physicsConstraintDamping */);
4076
4225
  }
4077
4226
  get(pose) {
4078
4227
  return pose.damping;
@@ -4086,7 +4235,7 @@ var spine = (() => {
4086
4235
  };
4087
4236
  var PhysicsConstraintMassTimeline = class extends PhysicsConstraintTimeline {
4088
4237
  constructor(frameCount, bezierCount, constraintIndex) {
4089
- super(frameCount, bezierCount, constraintIndex, 23 /* physicsConstraintMass */);
4238
+ super(frameCount, bezierCount, constraintIndex, 24 /* physicsConstraintMass */);
4090
4239
  }
4091
4240
  get(pose) {
4092
4241
  return 1 / pose.massInverse;
@@ -4100,7 +4249,7 @@ var spine = (() => {
4100
4249
  };
4101
4250
  var PhysicsConstraintWindTimeline = class extends PhysicsConstraintTimeline {
4102
4251
  constructor(frameCount, bezierCount, constraintIndex) {
4103
- super(frameCount, bezierCount, constraintIndex, 24 /* physicsConstraintWind */);
4252
+ super(frameCount, bezierCount, constraintIndex, 25 /* physicsConstraintWind */);
4104
4253
  this.additive = true;
4105
4254
  }
4106
4255
  get(pose) {
@@ -4115,7 +4264,7 @@ var spine = (() => {
4115
4264
  };
4116
4265
  var PhysicsConstraintGravityTimeline = class extends PhysicsConstraintTimeline {
4117
4266
  constructor(frameCount, bezierCount, constraintIndex) {
4118
- super(frameCount, bezierCount, constraintIndex, 25 /* physicsConstraintGravity */);
4267
+ super(frameCount, bezierCount, constraintIndex, 26 /* physicsConstraintGravity */);
4119
4268
  this.additive = true;
4120
4269
  }
4121
4270
  get(pose) {
@@ -4130,7 +4279,7 @@ var spine = (() => {
4130
4279
  };
4131
4280
  var PhysicsConstraintMixTimeline = class extends PhysicsConstraintTimeline {
4132
4281
  constructor(frameCount, bezierCount, constraintIndex) {
4133
- super(frameCount, bezierCount, constraintIndex, 26 /* physicsConstraintMix */);
4282
+ super(frameCount, bezierCount, constraintIndex, 27 /* physicsConstraintMix */);
4134
4283
  }
4135
4284
  get(pose) {
4136
4285
  return pose.mix;
@@ -4143,7 +4292,7 @@ var spine = (() => {
4143
4292
  }
4144
4293
  };
4145
4294
  var PhysicsConstraintResetTimeline = class _PhysicsConstraintResetTimeline extends Timeline {
4146
- static propertyIds = [27 /* physicsConstraintReset */.toString()];
4295
+ static propertyIds = [28 /* physicsConstraintReset */.toString()];
4147
4296
  /** The index of the physics constraint in {@link Skeleton.contraints} that will be reset when this timeline is
4148
4297
  * applied, or -1 if all physics constraints in the skeleton will be reset. */
4149
4298
  constraintIndex;
@@ -4162,7 +4311,7 @@ var spine = (() => {
4162
4311
  this.frames[frame] = time;
4163
4312
  }
4164
4313
  /** Resets the physics constraint when frames > `lastTime` and <= `time`. */
4165
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4314
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
4166
4315
  let constraint;
4167
4316
  if (this.constraintIndex !== -1) {
4168
4317
  constraint = skeleton.constraints[this.constraintIndex];
@@ -4170,7 +4319,7 @@ var spine = (() => {
4170
4319
  }
4171
4320
  const frames = this.frames;
4172
4321
  if (lastTime > time) {
4173
- this.apply(skeleton, lastTime, Number.MAX_VALUE, [], alpha, false, false, false, false);
4322
+ this.apply(skeleton, lastTime, Number.MAX_VALUE, [], alpha, from, false, false, false);
4174
4323
  lastTime = -1;
4175
4324
  } else if (lastTime >= frames[frames.length - 1])
4176
4325
  return;
@@ -4188,26 +4337,26 @@ var spine = (() => {
4188
4337
  };
4189
4338
  var SliderTimeline = class extends ConstraintTimeline1 {
4190
4339
  constructor(frameCount, bezierCount, constraintIndex) {
4191
- super(frameCount, bezierCount, constraintIndex, 29 /* sliderTime */);
4340
+ super(frameCount, bezierCount, constraintIndex, 30 /* sliderTime */);
4192
4341
  }
4193
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4342
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
4194
4343
  const constraint = skeleton.constraints[this.constraintIndex];
4195
4344
  if (constraint.active) {
4196
4345
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
4197
- pose.time = this.getAbsoluteValue(time, alpha, fromSetup, add, pose.time, constraint.data.setupPose.time);
4346
+ pose.time = this.getAbsoluteValue(time, alpha, from, add, pose.time, constraint.data.setupPose.time);
4198
4347
  }
4199
4348
  }
4200
4349
  };
4201
4350
  var SliderMixTimeline = class extends ConstraintTimeline1 {
4202
4351
  constructor(frameCount, bezierCount, constraintIndex) {
4203
- super(frameCount, bezierCount, constraintIndex, 30 /* sliderMix */);
4352
+ super(frameCount, bezierCount, constraintIndex, 31 /* sliderMix */);
4204
4353
  this.additive = true;
4205
4354
  }
4206
- apply(skeleton, lastTime, time, firedEvents, alpha, fromSetup, add, out, appliedPose) {
4355
+ apply(skeleton, lastTime, time, firedEvents, alpha, from, add, out, appliedPose) {
4207
4356
  const constraint = skeleton.constraints[this.constraintIndex];
4208
4357
  if (constraint.active) {
4209
4358
  const pose = appliedPose ? constraint.appliedPose : constraint.pose;
4210
- pose.mix = this.getAbsoluteValue(time, alpha, fromSetup, add, pose.mix, constraint.data.setupPose.mix);
4359
+ pose.mix = this.getAbsoluteValue(time, alpha, from, add, pose.mix, constraint.data.setupPose.mix);
4211
4360
  }
4212
4361
  }
4213
4362
  };
@@ -4228,7 +4377,7 @@ var spine = (() => {
4228
4377
  events = [];
4229
4378
  listeners = [];
4230
4379
  queue = new EventQueue(this);
4231
- propertyIds = new StringSet();
4380
+ propertyIds = /* @__PURE__ */ new Map();
4232
4381
  animationsChanged = false;
4233
4382
  trackEntryPool = new Pool(() => new TrackEntry());
4234
4383
  constructor(data) {
@@ -4337,9 +4486,9 @@ var spine = (() => {
4337
4486
  Utils.webkit602BugfixHelper(alpha);
4338
4487
  const timeline = timelines[ii];
4339
4488
  if (timeline instanceof AttachmentTimeline)
4340
- this.applyAttachmentTimeline(timeline, skeleton, applyTime, true, true);
4489
+ this.applyAttachmentTimeline(timeline, skeleton, applyTime, 1 /* setup */, true);
4341
4490
  else
4342
- timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, true, false, false, false);
4491
+ timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, 1 /* setup */, false, false, false);
4343
4492
  }
4344
4493
  } else {
4345
4494
  const timelineMode = current.timelineMode;
@@ -4349,14 +4498,14 @@ var spine = (() => {
4349
4498
  if (firstFrame) current.timelinesRotation.length = timelineCount << 1;
4350
4499
  for (let ii = 0; ii < timelineCount; ii++) {
4351
4500
  const timeline = timelines[ii];
4352
- const fromSetup = (timelineMode[ii] & FIRST) !== 0;
4501
+ const from = timelineMode[ii] & MODE;
4353
4502
  if (!shortestRotation && timeline instanceof RotateTimeline) {
4354
- this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, fromSetup, current.timelinesRotation, ii << 1, firstFrame);
4503
+ this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, from, current.timelinesRotation, ii << 1, firstFrame);
4355
4504
  } else if (timeline instanceof AttachmentTimeline) {
4356
- this.applyAttachmentTimeline(timeline, skeleton, applyTime, fromSetup, retainAttachments);
4505
+ this.applyAttachmentTimeline(timeline, skeleton, applyTime, from, retainAttachments);
4357
4506
  } else {
4358
4507
  Utils.webkit602BugfixHelper(alpha);
4359
- timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, fromSetup, add, false, false);
4508
+ timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, from, add, false, false);
4360
4509
  }
4361
4510
  }
4362
4511
  }
@@ -4366,7 +4515,7 @@ var spine = (() => {
4366
4515
  current.nextAnimationLast = animationTime;
4367
4516
  current.nextTrackLast = current.trackTime;
4368
4517
  }
4369
- const setupState = this.unkeyedState + SETUP;
4518
+ const setupState = this.unkeyedState + ATTACH_SETUP;
4370
4519
  const slots = skeleton.slots;
4371
4520
  for (let i = 0, n = skeleton.slots.length; i < n; i++) {
4372
4521
  const slot = slots[i];
@@ -4404,29 +4553,29 @@ var spine = (() => {
4404
4553
  for (let i = 0; i < timelineCount; i++) {
4405
4554
  const timeline = timelines[i];
4406
4555
  const mode = timelineMode[i];
4407
- const fromSetup = (mode & FIRST) !== 0;
4556
+ const mixFrom = mode & MODE;
4408
4557
  let alpha = 0;
4409
4558
  if ((mode & HOLD) !== 0) {
4410
4559
  const holdMix = timelineHoldMix[i];
4411
4560
  alpha = holdMix == null ? alphaHold : alphaHold * (1 - holdMix.mix());
4412
4561
  } else {
4413
- if (!drawOrder && timeline instanceof DrawOrderTimeline && !fromSetup) continue;
4562
+ if (!drawOrder && timeline instanceof DrawOrderTimeline && mixFrom === 0 /* current */) continue;
4414
4563
  alpha = alphaMix;
4415
4564
  }
4416
4565
  from.totalAlpha += alpha;
4417
4566
  if (!shortestRotation && timeline instanceof RotateTimeline) {
4418
- this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, fromSetup, timelinesRotation, i << 1, firstFrame);
4567
+ this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, mixFrom, timelinesRotation, i << 1, firstFrame);
4419
4568
  } else if (timeline instanceof AttachmentTimeline)
4420
4569
  this.applyAttachmentTimeline(
4421
4570
  timeline,
4422
4571
  skeleton,
4423
4572
  applyTime,
4424
- fromSetup,
4573
+ mixFrom,
4425
4574
  retainAttachments && alpha >= from.alphaAttachmentThreshold
4426
4575
  );
4427
4576
  else {
4428
- const out = !drawOrder || !(timeline instanceof DrawOrderTimeline) || !fromSetup;
4429
- timeline.apply(skeleton, animationLast, applyTime, events, alpha, fromSetup, add, out, false);
4577
+ const out = !drawOrder || !(timeline instanceof DrawOrderTimeline) || mixFrom === 0 /* current */;
4578
+ timeline.apply(skeleton, animationLast, applyTime, events, alpha, mixFrom, add, out, false);
4430
4579
  }
4431
4580
  }
4432
4581
  if (from.reverse && mix < from.eventThreshold) this.eventsReverse(from, animationLast, animationTime);
@@ -4438,10 +4587,10 @@ var spine = (() => {
4438
4587
  }
4439
4588
  /** Applies the attachment timeline and sets {@link Slot.attachmentState}.
4440
4589
  * @param retain True if the attachment remains after apply, false if temporary for deform timelines. */
4441
- applyAttachmentTimeline(timeline, skeleton, time, fromSetup, retain) {
4590
+ applyAttachmentTimeline(timeline, skeleton, time, from, retain) {
4442
4591
  const slot = skeleton.slots[timeline.slotIndex];
4443
4592
  if (!slot.bone.active) return;
4444
- if (!retain && slot.attachmentState === this.unkeyedState + RETAIN) return;
4593
+ if (!retain && slot.attachmentState === this.unkeyedState + ATTACH_RETAIN) return;
4445
4594
  let setup = time < timeline.frames[0];
4446
4595
  let name = null;
4447
4596
  if (!setup) {
@@ -4449,33 +4598,44 @@ var spine = (() => {
4449
4598
  setup = !retain && name == null;
4450
4599
  }
4451
4600
  if (setup) {
4452
- if (!fromSetup) return;
4601
+ if (from === 0 /* current */) return;
4453
4602
  name = slot.data.attachmentName;
4454
4603
  }
4455
4604
  slot.pose.setAttachment(name == null ? null : skeleton.getAttachment(slot.data.index, name));
4456
4605
  if (retain)
4457
- slot.attachmentState = this.unkeyedState + RETAIN;
4606
+ slot.attachmentState = this.unkeyedState + ATTACH_RETAIN;
4458
4607
  else if (!setup)
4459
- slot.attachmentState = this.unkeyedState + SETUP;
4608
+ slot.attachmentState = this.unkeyedState + ATTACH_SETUP;
4460
4609
  }
4461
4610
  /** Applies the rotate timeline, mixing with the current pose while keeping the same rotation direction chosen as the shortest
4462
4611
  * the first time the mixing was applied. */
4463
- applyRotateTimeline(timeline, skeleton, time, alpha, fromSetup, timelinesRotation, i, firstFrame) {
4612
+ applyRotateTimeline(timeline, skeleton, time, alpha, from, timelinesRotation, i, firstFrame) {
4464
4613
  if (firstFrame) timelinesRotation[i] = 0;
4465
4614
  if (alpha === 1) {
4466
- timeline.apply(skeleton, 0, time, null, 1, fromSetup, false, false, false);
4615
+ timeline.apply(skeleton, 0, time, null, 1, from, false, false, false);
4467
4616
  return;
4468
4617
  }
4469
4618
  const bone = skeleton.bones[timeline.boneIndex];
4470
4619
  if (!bone.active) return;
4471
4620
  const pose = bone.pose, setup = bone.data.setupPose;
4472
4621
  const frames = timeline.frames;
4622
+ let r1, r2;
4473
4623
  if (time < frames[0]) {
4474
- if (fromSetup) pose.rotation = setup.rotation;
4475
- return;
4624
+ switch (from) {
4625
+ case 1 /* setup */: {
4626
+ pose.rotation = setup.rotation;
4627
+ return;
4628
+ }
4629
+ case 0 /* current */: {
4630
+ return;
4631
+ }
4632
+ }
4633
+ r1 = pose.rotation;
4634
+ r2 = setup.rotation;
4635
+ } else {
4636
+ r1 = from === 1 /* setup */ ? setup.rotation : pose.rotation;
4637
+ r2 = setup.rotation + timeline.getCurveValue(time);
4476
4638
  }
4477
- const r1 = fromSetup ? setup.rotation : pose.rotation;
4478
- const r2 = setup.rotation + timeline.getCurveValue(time);
4479
4639
  let total = 0, diff = r2 - r1;
4480
4640
  diff -= Math.ceil(diff / 360 - 0.5) * 360;
4481
4641
  if (diff === 0) {
@@ -4790,57 +4950,72 @@ var spine = (() => {
4790
4950
  this.animationsChanged = false;
4791
4951
  const tracks = this.tracks;
4792
4952
  for (let i = 0, n = tracks.length; i < n; i++) {
4793
- let entry = tracks[i];
4794
- if (!entry) continue;
4953
+ const track = tracks[i];
4954
+ if (!track) continue;
4955
+ let entry = track;
4795
4956
  while (entry.mixingFrom)
4796
4957
  entry = entry.mixingFrom;
4797
4958
  do {
4798
- this.computeHold(entry);
4959
+ this.computeHold(entry, track);
4799
4960
  entry = entry.mixingTo;
4800
4961
  } while (entry);
4801
4962
  }
4802
4963
  this.propertyIds.clear();
4803
4964
  }
4804
- computeHold(entry) {
4965
+ computeHold(entry, track) {
4805
4966
  const timelines = entry.animation.timelines;
4806
4967
  const timelinesCount = entry.animation.timelines.length;
4807
4968
  const timelineMode = entry.timelineMode;
4808
4969
  timelineMode.length = timelinesCount;
4809
4970
  const timelineHoldMix = entry.timelineHoldMix;
4810
4971
  timelineHoldMix.length = 0;
4811
- const propertyIds = this.propertyIds;
4812
4972
  const add = entry.additive, keepHold = entry.keepHold;
4813
4973
  const to = entry.mixingTo;
4814
- outer:
4815
- for (let i = 0; i < timelinesCount; i++) {
4816
- const timeline = timelines[i];
4817
- const ids = timeline.propertyIds;
4818
- const first = propertyIds.addAll(ids) && !(timeline instanceof DrawOrderFolderTimeline && propertyIds.contains(DrawOrderTimeline.propertyID));
4819
- if (add && timeline.additive) {
4820
- timelineMode[i] = first ? FIRST : SUBSEQUENT;
4821
- continue;
4822
- }
4823
- for (let from = entry.mixingFrom; from != null; from = from.mixingFrom) {
4824
- if (from.animation.hasTimeline(ids)) {
4825
- timelineMode[i] = SUBSEQUENT;
4826
- continue outer;
4974
+ for (let i = 0; i < timelinesCount; i++) {
4975
+ const timeline = timelines[i];
4976
+ const ids = timeline.propertyIds;
4977
+ const from = this.from(track, timeline, ids);
4978
+ if (add && timeline.additive) {
4979
+ timelineMode[i] = from;
4980
+ continue;
4981
+ }
4982
+ let mode;
4983
+ if (to === null || timeline.instant || to.additive && timeline.additive || !to.animation?.hasTimeline(ids))
4984
+ mode = from;
4985
+ else {
4986
+ mode = from | HOLD;
4987
+ for (let next = to.mixingTo; next != null; next = next.mixingTo) {
4988
+ if (next.additive && timeline.additive || !next.animation?.hasTimeline(ids)) {
4989
+ if (next.mixDuration > 0) timelineHoldMix[i] = next;
4990
+ break;
4827
4991
  }
4828
4992
  }
4829
- let mode;
4830
- if (to === null || timeline.instant || to.additive && timeline.additive || !to.animation?.hasTimeline(ids))
4831
- mode = first ? FIRST : SUBSEQUENT;
4832
- else {
4833
- mode = first ? HOLD_FIRST : HOLD;
4834
- for (let next = to.mixingTo; next != null; next = next.mixingTo) {
4835
- if (next.additive && timeline.additive || !next.animation?.hasTimeline(ids)) {
4836
- if (next.mixDuration > 0) timelineHoldMix[i] = next;
4837
- break;
4838
- }
4839
- }
4993
+ }
4994
+ if (keepHold) mode = mode & ~HOLD | timelineMode[i] & HOLD;
4995
+ timelineMode[i] = mode;
4996
+ }
4997
+ }
4998
+ from(track, timeline, ids) {
4999
+ const propertyIds = this.propertyIds;
5000
+ let from = SETUP;
5001
+ for (let i = 0, n = ids.length; i < n; i++) {
5002
+ const owner = propertyIds.get(ids[i]);
5003
+ if (owner === void 0) {
5004
+ propertyIds.set(ids[i], track);
5005
+ } else {
5006
+ if (owner !== track) {
5007
+ while (++i < n)
5008
+ if (!propertyIds.has(ids[i])) propertyIds.set(ids[i], track);
5009
+ return CURRENT;
4840
5010
  }
4841
- if (keepHold) mode = mode & ~HOLD | timelineMode[i] & HOLD;
4842
- timelineMode[i] = mode;
5011
+ from = FIRST;
4843
5012
  }
5013
+ }
5014
+ if (timeline instanceof DrawOrderFolderTimeline) {
5015
+ const first = propertyIds.get(DrawOrderTimeline.propertyID);
5016
+ if (first != null) return first !== track ? CURRENT : FIRST;
5017
+ }
5018
+ return from;
4844
5019
  }
4845
5020
  /** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
4846
5021
  getTrack(trackIndex) {
@@ -5049,8 +5224,8 @@ var spine = (() => {
5049
5224
  return mix;
5050
5225
  }
5051
5226
  /** For each timeline:
5052
- * - Bit 0, FIRST: 0 = mix from current pose, 1 = mix from setup pose. Timeline is first to set the property.
5053
- * - Bit 1, HOLD: 0 = mix out using alphaMix, 1 = apply full alpha to prevent dipping. Timeline is first on its track to
5227
+ * - Bits 0-1: MixFrom.
5228
+ * - Bit 2, HOLD: 0 = mix out using alphaMix, 1 = apply full alpha to prevent dipping. Timeline is first on its track to
5054
5229
  * set the property and the next entry (mixingTo) also sets it. When held, timelineHoldMix's mix controls how the hold fades
5055
5230
  * out (for 3+ entry chains where the chain eventually stops setting the property). */
5056
5231
  timelineMode = [];
@@ -5244,12 +5419,13 @@ var spine = (() => {
5244
5419
  event(entry, event) {
5245
5420
  }
5246
5421
  };
5247
- var SUBSEQUENT = 0;
5248
- var FIRST = 1;
5249
- var HOLD = 2;
5250
- var HOLD_FIRST = 3;
5422
+ var CURRENT = 0;
5251
5423
  var SETUP = 1;
5252
- var RETAIN = 2;
5424
+ var FIRST = 2;
5425
+ var MODE = 3;
5426
+ var HOLD = 4;
5427
+ var ATTACH_SETUP = 1;
5428
+ var ATTACH_RETAIN = 2;
5253
5429
 
5254
5430
  // spine-core/src/AnimationStateData.ts
5255
5431
  var AnimationStateData = class {
@@ -8369,7 +8545,7 @@ ${error}` : ""}`);
8369
8545
  const indices = animation.bones;
8370
8546
  for (let i = 0, n = animation.bones.length; i < n; i++)
8371
8547
  bones[indices[i]].appliedPose.modifyLocal(skeleton);
8372
- animation.apply(skeleton, p.time, p.time, data.loop, null, p.mix, false, data.additive, false, true);
8548
+ animation.apply(skeleton, p.time, p.time, data.loop, null, p.mix, 0 /* current */, data.additive, false, true);
8373
8549
  }
8374
8550
  sort(skeleton) {
8375
8551
  const bone = this.bone;