@esotericsoftware/spine-webgl 4.2.25 → 4.2.27

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.
@@ -4,6 +4,7 @@ var spine = (() => {
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
8
  var __export = (target, all) => {
8
9
  for (var name in all)
9
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -17,6 +18,10 @@ var spine = (() => {
17
18
  return to;
18
19
  };
19
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var __publicField = (obj, key, value) => {
22
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
23
+ return value;
24
+ };
20
25
 
21
26
  // spine-webgl/src/index.ts
22
27
  var src_exports = {};
@@ -98,6 +103,16 @@ var spine = (() => {
98
103
  PathConstraintMixTimeline: () => PathConstraintMixTimeline,
99
104
  PathConstraintPositionTimeline: () => PathConstraintPositionTimeline,
100
105
  PathConstraintSpacingTimeline: () => PathConstraintSpacingTimeline,
106
+ Physics: () => Physics,
107
+ PhysicsConstraintDampingTimeline: () => PhysicsConstraintDampingTimeline,
108
+ PhysicsConstraintGravityTimeline: () => PhysicsConstraintGravityTimeline,
109
+ PhysicsConstraintInertiaTimeline: () => PhysicsConstraintInertiaTimeline,
110
+ PhysicsConstraintMassTimeline: () => PhysicsConstraintMassTimeline,
111
+ PhysicsConstraintMixTimeline: () => PhysicsConstraintMixTimeline,
112
+ PhysicsConstraintResetTimeline: () => PhysicsConstraintResetTimeline,
113
+ PhysicsConstraintStrengthTimeline: () => PhysicsConstraintStrengthTimeline,
114
+ PhysicsConstraintTimeline: () => PhysicsConstraintTimeline,
115
+ PhysicsConstraintWindTimeline: () => PhysicsConstraintWindTimeline,
101
116
  PointAttachment: () => PointAttachment,
102
117
  PolygonBatcher: () => PolygonBatcher,
103
118
  Pool: () => Pool,
@@ -127,7 +142,7 @@ var spine = (() => {
127
142
  ShearTimeline: () => ShearTimeline,
128
143
  ShearXTimeline: () => ShearXTimeline,
129
144
  ShearYTimeline: () => ShearYTimeline,
130
- Skeleton: () => Skeleton,
145
+ Skeleton: () => Skeleton2,
131
146
  SkeletonBinary: () => SkeletonBinary,
132
147
  SkeletonBounds: () => SkeletonBounds,
133
148
  SkeletonClipping: () => SkeletonClipping,
@@ -173,9 +188,7 @@ var spine = (() => {
173
188
 
174
189
  // spine-core/src/Utils.ts
175
190
  var IntSet = class {
176
- constructor() {
177
- this.array = new Array();
178
- }
191
+ array = new Array();
179
192
  add(value) {
180
193
  let contains = this.contains(value);
181
194
  this.array[value | 0] = value | 0;
@@ -192,10 +205,8 @@ var spine = (() => {
192
205
  }
193
206
  };
194
207
  var StringSet = class {
195
- constructor() {
196
- this.entries = {};
197
- this.size = 0;
198
- }
208
+ entries = {};
209
+ size = 0;
199
210
  add(value) {
200
211
  let contains = this.entries[value];
201
212
  this.entries[value] = true;
@@ -290,11 +301,11 @@ var spine = (() => {
290
301
  }
291
302
  };
292
303
  var Color = _Color;
293
- Color.WHITE = new _Color(1, 1, 1, 1);
294
- Color.RED = new _Color(1, 0, 0, 1);
295
- Color.GREEN = new _Color(0, 1, 0, 1);
296
- Color.BLUE = new _Color(0, 0, 1, 1);
297
- Color.MAGENTA = new _Color(1, 0, 1, 1);
304
+ __publicField(Color, "WHITE", new _Color(1, 1, 1, 1));
305
+ __publicField(Color, "RED", new _Color(1, 0, 0, 1));
306
+ __publicField(Color, "GREEN", new _Color(0, 1, 0, 1));
307
+ __publicField(Color, "BLUE", new _Color(0, 0, 1, 1));
308
+ __publicField(Color, "MAGENTA", new _Color(1, 0, 1, 1));
298
309
  var _MathUtils = class {
299
310
  static clamp(value, min, max) {
300
311
  if (value < min)
@@ -309,6 +320,9 @@ var spine = (() => {
309
320
  static sinDeg(degrees) {
310
321
  return Math.sin(degrees * _MathUtils.degRad);
311
322
  }
323
+ static atan2Deg(y, x) {
324
+ return Math.atan2(y, x) * _MathUtils.degRad;
325
+ }
312
326
  static signum(value) {
313
327
  return value > 0 ? 1 : value < 0 ? -1 : 0;
314
328
  }
@@ -334,21 +348,22 @@ var spine = (() => {
334
348
  }
335
349
  };
336
350
  var MathUtils = _MathUtils;
337
- MathUtils.PI = 3.1415927;
338
- MathUtils.PI2 = _MathUtils.PI * 2;
339
- MathUtils.radiansToDegrees = 180 / _MathUtils.PI;
340
- MathUtils.radDeg = _MathUtils.radiansToDegrees;
341
- MathUtils.degreesToRadians = _MathUtils.PI / 180;
342
- MathUtils.degRad = _MathUtils.degreesToRadians;
351
+ __publicField(MathUtils, "PI", 3.1415927);
352
+ __publicField(MathUtils, "PI2", _MathUtils.PI * 2);
353
+ __publicField(MathUtils, "invPI2", 1 / _MathUtils.PI2);
354
+ __publicField(MathUtils, "radiansToDegrees", 180 / _MathUtils.PI);
355
+ __publicField(MathUtils, "radDeg", _MathUtils.radiansToDegrees);
356
+ __publicField(MathUtils, "degreesToRadians", _MathUtils.PI / 180);
357
+ __publicField(MathUtils, "degRad", _MathUtils.degreesToRadians);
343
358
  var Interpolation = class {
344
359
  apply(start, end, a) {
345
360
  return start + (end - start) * this.applyInternal(a);
346
361
  }
347
362
  };
348
363
  var Pow = class extends Interpolation {
364
+ power = 2;
349
365
  constructor(power) {
350
366
  super();
351
- this.power = 2;
352
367
  this.power = power;
353
368
  }
354
369
  applyInternal(a) {
@@ -437,7 +452,7 @@ var spine = (() => {
437
452
  }
438
453
  };
439
454
  var Utils = _Utils;
440
- Utils.SUPPORTS_TYPED_ARRAYS = typeof Float32Array !== "undefined";
455
+ __publicField(Utils, "SUPPORTS_TYPED_ARRAYS", typeof Float32Array !== "undefined");
441
456
  var DebugUtils = class {
442
457
  static logBones(skeleton) {
443
458
  for (let i = 0; i < skeleton.bones.length; i++) {
@@ -447,8 +462,9 @@ var spine = (() => {
447
462
  }
448
463
  };
449
464
  var Pool = class {
465
+ items = new Array();
466
+ instantiator;
450
467
  constructor(instantiator) {
451
- this.items = new Array();
452
468
  this.instantiator = instantiator;
453
469
  }
454
470
  obtain() {
@@ -492,15 +508,13 @@ var spine = (() => {
492
508
  }
493
509
  };
494
510
  var TimeKeeper = class {
495
- constructor() {
496
- this.maxDelta = 0.064;
497
- this.framesPerSecond = 0;
498
- this.delta = 0;
499
- this.totalTime = 0;
500
- this.lastTime = Date.now() / 1e3;
501
- this.frameCount = 0;
502
- this.frameTime = 0;
503
- }
511
+ maxDelta = 0.064;
512
+ framesPerSecond = 0;
513
+ delta = 0;
514
+ totalTime = 0;
515
+ lastTime = Date.now() / 1e3;
516
+ frameCount = 0;
517
+ frameTime = 0;
504
518
  update() {
505
519
  let now = Date.now() / 1e3;
506
520
  this.delta = now - this.lastTime;
@@ -518,11 +532,12 @@ var spine = (() => {
518
532
  }
519
533
  };
520
534
  var WindowedMean = class {
535
+ values;
536
+ addedValues = 0;
537
+ lastValue = 0;
538
+ mean = 0;
539
+ dirty = true;
521
540
  constructor(windowSize = 32) {
522
- this.addedValues = 0;
523
- this.lastValue = 0;
524
- this.mean = 0;
525
- this.dirty = true;
526
541
  this.values = new Array(windowSize);
527
542
  }
528
543
  hasEnoughData() {
@@ -553,6 +568,7 @@ var spine = (() => {
553
568
 
554
569
  // spine-core/src/attachments/Attachment.ts
555
570
  var Attachment = class {
571
+ name;
556
572
  constructor(name) {
557
573
  if (!name)
558
574
  throw new Error("name cannot be null.");
@@ -560,24 +576,24 @@ var spine = (() => {
560
576
  }
561
577
  };
562
578
  var _VertexAttachment = class extends Attachment {
579
+ /** The unique ID for this attachment. */
580
+ id = _VertexAttachment.nextID++;
581
+ /** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting
582
+ * the vertex followed by that many bone indices, which is the index of the bone in {@link Skeleton#bones}. Will be null
583
+ * if this attachment has no weights. */
584
+ bones = null;
585
+ /** The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are `x,y`
586
+ * entries for each vertex. For a weighted attachment, the values are `x,y,weight` entries for each bone affecting
587
+ * each vertex. */
588
+ vertices = [];
589
+ /** The maximum number of world vertex values that can be output by
590
+ * {@link #computeWorldVertices()} using the `count` parameter. */
591
+ worldVerticesLength = 0;
592
+ /** Timelines for the timeline attachment are also applied to this attachment.
593
+ * May be null if no attachment-specific timelines should be applied. */
594
+ timelineAttachment = this;
563
595
  constructor(name) {
564
596
  super(name);
565
- /** The unique ID for this attachment. */
566
- this.id = _VertexAttachment.nextID++;
567
- /** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting
568
- * the vertex followed by that many bone indices, which is the index of the bone in {@link Skeleton#bones}. Will be null
569
- * if this attachment has no weights. */
570
- this.bones = null;
571
- /** The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are `x,y`
572
- * entries for each vertex. For a weighted attachment, the values are `x,y,weight` entries for each bone affecting
573
- * each vertex. */
574
- this.vertices = [];
575
- /** The maximum number of world vertex values that can be output by
576
- * {@link #computeWorldVertices()} using the `count` parameter. */
577
- this.worldVerticesLength = 0;
578
- /** Timelines for the timeline attachment are also applied to this attachment.
579
- * May be null if no attachment-specific timelines should be applied. */
580
- this.timelineAttachment = this;
581
597
  }
582
598
  /** Transforms the attachment's local {@link #vertices} to world coordinates. If the slot's {@link Slot#deform} is
583
599
  * not empty, it is used to deform the vertices.
@@ -664,16 +680,17 @@ var spine = (() => {
664
680
  }
665
681
  };
666
682
  var VertexAttachment = _VertexAttachment;
667
- VertexAttachment.nextID = 0;
683
+ __publicField(VertexAttachment, "nextID", 0);
668
684
 
669
685
  // spine-core/src/attachments/Sequence.ts
670
686
  var _Sequence = class {
687
+ id = _Sequence.nextID();
688
+ regions;
689
+ start = 0;
690
+ digits = 0;
691
+ /** The index of the region to show for the setup pose. */
692
+ setupIndex = 0;
671
693
  constructor(count) {
672
- this.id = _Sequence.nextID();
673
- this.start = 0;
674
- this.digits = 0;
675
- /** The index of the region to show for the setup pose. */
676
- this.setupIndex = 0;
677
694
  this.regions = new Array(count);
678
695
  }
679
696
  copy() {
@@ -709,7 +726,7 @@ var spine = (() => {
709
726
  }
710
727
  };
711
728
  var Sequence = _Sequence;
712
- Sequence._nextID = 0;
729
+ __publicField(Sequence, "_nextID", 0);
713
730
  var SequenceMode = /* @__PURE__ */ ((SequenceMode2) => {
714
731
  SequenceMode2[SequenceMode2["hold"] = 0] = "hold";
715
732
  SequenceMode2[SequenceMode2["once"] = 1] = "once";
@@ -732,9 +749,13 @@ var spine = (() => {
732
749
 
733
750
  // spine-core/src/Animation.ts
734
751
  var Animation = class {
752
+ /** The animation's name, which is unique across all animations in the skeleton. */
753
+ name;
754
+ timelines = [];
755
+ timelineIds = new StringSet();
756
+ /** The duration of the animation in seconds, which is the highest time of all keys in the timeline. */
757
+ duration;
735
758
  constructor(name, timelines, duration) {
736
- this.timelines = [];
737
- this.timelineIds = new StringSet();
738
759
  if (!name)
739
760
  throw new Error("name cannot be null.");
740
761
  this.name = name;
@@ -805,9 +826,19 @@ var spine = (() => {
805
826
  pathConstraintPosition: 16,
806
827
  pathConstraintSpacing: 17,
807
828
  pathConstraintMix: 18,
808
- sequence: 19
829
+ physicsConstraintInertia: 19,
830
+ physicsConstraintStrength: 20,
831
+ physicsConstraintDamping: 21,
832
+ physicsConstraintMass: 22,
833
+ physicsConstraintWind: 23,
834
+ physicsConstraintGravity: 24,
835
+ physicsConstraintMix: 25,
836
+ physicsConstraintReset: 26,
837
+ sequence: 27
809
838
  };
810
839
  var Timeline = class {
840
+ propertyIds;
841
+ frames;
811
842
  constructor(frameCount, propertyIds) {
812
843
  this.propertyIds = propertyIds;
813
844
  this.frames = Utils.newFloatArray(frameCount * this.getFrameEntries());
@@ -840,6 +871,7 @@ var spine = (() => {
840
871
  }
841
872
  };
842
873
  var CurveTimeline = class extends Timeline {
874
+ curves;
843
875
  // type, x, y, ...
844
876
  constructor(frameCount, bezierCount, propertyIds) {
845
877
  super(frameCount, propertyIds);
@@ -980,6 +1012,94 @@ var spine = (() => {
980
1012
  /*BEZIER*/
981
1013
  );
982
1014
  }
1015
+ getRelativeValue(time, alpha, blend, current, setup) {
1016
+ if (time < this.frames[0]) {
1017
+ switch (blend) {
1018
+ case 0 /* setup */:
1019
+ return setup;
1020
+ case 1 /* first */:
1021
+ return current + (setup - current) * alpha;
1022
+ }
1023
+ return current;
1024
+ }
1025
+ let value = this.getCurveValue(time);
1026
+ switch (blend) {
1027
+ case 0 /* setup */:
1028
+ return setup + value * alpha;
1029
+ case 1 /* first */:
1030
+ case 2 /* replace */:
1031
+ value += setup - current;
1032
+ }
1033
+ return current + value * alpha;
1034
+ }
1035
+ getAbsoluteValue(time, alpha, blend, current, setup) {
1036
+ if (time < this.frames[0]) {
1037
+ switch (blend) {
1038
+ case 0 /* setup */:
1039
+ return setup;
1040
+ case 1 /* first */:
1041
+ return current + (setup - current) * alpha;
1042
+ }
1043
+ return current;
1044
+ }
1045
+ let value = this.getCurveValue(time);
1046
+ if (blend == 0 /* setup */)
1047
+ return setup + (value - setup) * alpha;
1048
+ return current + (value - current) * alpha;
1049
+ }
1050
+ getAbsoluteValue2(time, alpha, blend, current, setup, value) {
1051
+ if (time < this.frames[0]) {
1052
+ switch (blend) {
1053
+ case 0 /* setup */:
1054
+ return setup;
1055
+ case 1 /* first */:
1056
+ return current + (setup - current) * alpha;
1057
+ }
1058
+ return current;
1059
+ }
1060
+ if (blend == 0 /* setup */)
1061
+ return setup + (value - setup) * alpha;
1062
+ return current + (value - current) * alpha;
1063
+ }
1064
+ getScaleValue(time, alpha, blend, direction, current, setup) {
1065
+ const frames = this.frames;
1066
+ if (time < frames[0]) {
1067
+ switch (blend) {
1068
+ case 0 /* setup */:
1069
+ return setup;
1070
+ case 1 /* first */:
1071
+ return current + (setup - current) * alpha;
1072
+ }
1073
+ return current;
1074
+ }
1075
+ let value = this.getCurveValue(time) * setup;
1076
+ if (alpha == 1) {
1077
+ if (blend == 3 /* add */)
1078
+ return current + value - setup;
1079
+ return value;
1080
+ }
1081
+ if (direction == 1 /* mixOut */) {
1082
+ switch (blend) {
1083
+ case 0 /* setup */:
1084
+ return setup + (Math.abs(value) * MathUtils.signum(setup) - setup) * alpha;
1085
+ case 1 /* first */:
1086
+ case 2 /* replace */:
1087
+ return current + (Math.abs(value) * MathUtils.signum(current) - current) * alpha;
1088
+ }
1089
+ } else {
1090
+ let s = 0;
1091
+ switch (blend) {
1092
+ case 0 /* setup */:
1093
+ s = Math.abs(setup) * MathUtils.signum(value);
1094
+ return s + (value - s) * alpha;
1095
+ case 1 /* first */:
1096
+ case 2 /* replace */:
1097
+ s = Math.abs(current) * MathUtils.signum(value);
1098
+ return s + (value - s) * alpha;
1099
+ }
1100
+ }
1101
+ return current + (value - setup) * alpha;
1102
+ }
983
1103
  };
984
1104
  var CurveTimeline2 = class extends CurveTimeline {
985
1105
  /** @param bezierCount The maximum number of Bezier curves. See {@link #shrink(int)}.
@@ -1007,40 +1127,19 @@ var spine = (() => {
1007
1127
  }
1008
1128
  };
1009
1129
  var RotateTimeline = class extends CurveTimeline1 {
1130
+ boneIndex = 0;
1010
1131
  constructor(frameCount, bezierCount, boneIndex) {
1011
1132
  super(frameCount, bezierCount, Property.rotate + "|" + boneIndex);
1012
- this.boneIndex = 0;
1013
1133
  this.boneIndex = boneIndex;
1014
1134
  }
1015
1135
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1016
1136
  let bone = skeleton.bones[this.boneIndex];
1017
- if (!bone.active)
1018
- return;
1019
- let frames = this.frames;
1020
- if (time < frames[0]) {
1021
- switch (blend) {
1022
- case 0 /* setup */:
1023
- bone.rotation = bone.data.rotation;
1024
- return;
1025
- case 1 /* first */:
1026
- bone.rotation += (bone.data.rotation - bone.rotation) * alpha;
1027
- }
1028
- return;
1029
- }
1030
- let r = this.getCurveValue(time);
1031
- switch (blend) {
1032
- case 0 /* setup */:
1033
- bone.rotation = bone.data.rotation + r * alpha;
1034
- break;
1035
- case 1 /* first */:
1036
- case 2 /* replace */:
1037
- r += bone.data.rotation - bone.rotation;
1038
- case 3 /* add */:
1039
- bone.rotation += r * alpha;
1040
- }
1137
+ if (bone.active)
1138
+ bone.rotation = this.getRelativeValue(time, alpha, blend, bone.rotation, bone.data.rotation);
1041
1139
  }
1042
1140
  };
1043
1141
  var TranslateTimeline = class extends CurveTimeline2 {
1142
+ boneIndex = 0;
1044
1143
  constructor(frameCount, bezierCount, boneIndex) {
1045
1144
  super(
1046
1145
  frameCount,
@@ -1048,7 +1147,6 @@ var spine = (() => {
1048
1147
  Property.x + "|" + boneIndex,
1049
1148
  Property.y + "|" + boneIndex
1050
1149
  );
1051
- this.boneIndex = 0;
1052
1150
  this.boneIndex = boneIndex;
1053
1151
  }
1054
1152
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
@@ -1146,76 +1244,31 @@ var spine = (() => {
1146
1244
  }
1147
1245
  };
1148
1246
  var TranslateXTimeline = class extends CurveTimeline1 {
1247
+ boneIndex = 0;
1149
1248
  constructor(frameCount, bezierCount, boneIndex) {
1150
1249
  super(frameCount, bezierCount, Property.x + "|" + boneIndex);
1151
- this.boneIndex = 0;
1152
1250
  this.boneIndex = boneIndex;
1153
1251
  }
1154
1252
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1155
1253
  let bone = skeleton.bones[this.boneIndex];
1156
- if (!bone.active)
1157
- return;
1158
- let frames = this.frames;
1159
- if (time < frames[0]) {
1160
- switch (blend) {
1161
- case 0 /* setup */:
1162
- bone.x = bone.data.x;
1163
- return;
1164
- case 1 /* first */:
1165
- bone.x += (bone.data.x - bone.x) * alpha;
1166
- }
1167
- return;
1168
- }
1169
- let x = this.getCurveValue(time);
1170
- switch (blend) {
1171
- case 0 /* setup */:
1172
- bone.x = bone.data.x + x * alpha;
1173
- break;
1174
- case 1 /* first */:
1175
- case 2 /* replace */:
1176
- bone.x += (bone.data.x + x - bone.x) * alpha;
1177
- break;
1178
- case 3 /* add */:
1179
- bone.x += x * alpha;
1180
- }
1254
+ if (bone.active)
1255
+ bone.x = this.getRelativeValue(time, alpha, blend, bone.x, bone.data.x);
1181
1256
  }
1182
1257
  };
1183
1258
  var TranslateYTimeline = class extends CurveTimeline1 {
1259
+ boneIndex = 0;
1184
1260
  constructor(frameCount, bezierCount, boneIndex) {
1185
1261
  super(frameCount, bezierCount, Property.y + "|" + boneIndex);
1186
- this.boneIndex = 0;
1187
1262
  this.boneIndex = boneIndex;
1188
1263
  }
1189
1264
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1190
1265
  let bone = skeleton.bones[this.boneIndex];
1191
- if (!bone.active)
1192
- return;
1193
- let frames = this.frames;
1194
- if (time < frames[0]) {
1195
- switch (blend) {
1196
- case 0 /* setup */:
1197
- bone.y = bone.data.y;
1198
- return;
1199
- case 1 /* first */:
1200
- bone.y += (bone.data.y - bone.y) * alpha;
1201
- }
1202
- return;
1203
- }
1204
- let y = this.getCurveValue(time);
1205
- switch (blend) {
1206
- case 0 /* setup */:
1207
- bone.y = bone.data.y + y * alpha;
1208
- break;
1209
- case 1 /* first */:
1210
- case 2 /* replace */:
1211
- bone.y += (bone.data.y + y - bone.y) * alpha;
1212
- break;
1213
- case 3 /* add */:
1214
- bone.y += y * alpha;
1215
- }
1266
+ if (bone.active)
1267
+ bone.y = this.getRelativeValue(time, alpha, blend, bone.y, bone.data.y);
1216
1268
  }
1217
1269
  };
1218
1270
  var ScaleTimeline = class extends CurveTimeline2 {
1271
+ boneIndex = 0;
1219
1272
  constructor(frameCount, bezierCount, boneIndex) {
1220
1273
  super(
1221
1274
  frameCount,
@@ -1223,7 +1276,6 @@ var spine = (() => {
1223
1276
  Property.scaleX + "|" + boneIndex,
1224
1277
  Property.scaleY + "|" + boneIndex
1225
1278
  );
1226
- this.boneIndex = 0;
1227
1279
  this.boneIndex = boneIndex;
1228
1280
  }
1229
1281
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
@@ -1359,128 +1411,31 @@ var spine = (() => {
1359
1411
  }
1360
1412
  };
1361
1413
  var ScaleXTimeline = class extends CurveTimeline1 {
1414
+ boneIndex = 0;
1362
1415
  constructor(frameCount, bezierCount, boneIndex) {
1363
1416
  super(frameCount, bezierCount, Property.scaleX + "|" + boneIndex);
1364
- this.boneIndex = 0;
1365
1417
  this.boneIndex = boneIndex;
1366
1418
  }
1367
1419
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1368
1420
  let bone = skeleton.bones[this.boneIndex];
1369
- if (!bone.active)
1370
- return;
1371
- let frames = this.frames;
1372
- if (time < frames[0]) {
1373
- switch (blend) {
1374
- case 0 /* setup */:
1375
- bone.scaleX = bone.data.scaleX;
1376
- return;
1377
- case 1 /* first */:
1378
- bone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha;
1379
- }
1380
- return;
1381
- }
1382
- let x = this.getCurveValue(time) * bone.data.scaleX;
1383
- if (alpha == 1) {
1384
- if (blend == 3 /* add */)
1385
- bone.scaleX += x - bone.data.scaleX;
1386
- else
1387
- bone.scaleX = x;
1388
- } else {
1389
- let bx = 0;
1390
- if (direction == 1 /* mixOut */) {
1391
- switch (blend) {
1392
- case 0 /* setup */:
1393
- bx = bone.data.scaleX;
1394
- bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
1395
- break;
1396
- case 1 /* first */:
1397
- case 2 /* replace */:
1398
- bx = bone.scaleX;
1399
- bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
1400
- break;
1401
- case 3 /* add */:
1402
- bone.scaleX += (x - bone.data.scaleX) * alpha;
1403
- }
1404
- } else {
1405
- switch (blend) {
1406
- case 0 /* setup */:
1407
- bx = Math.abs(bone.data.scaleX) * MathUtils.signum(x);
1408
- bone.scaleX = bx + (x - bx) * alpha;
1409
- break;
1410
- case 1 /* first */:
1411
- case 2 /* replace */:
1412
- bx = Math.abs(bone.scaleX) * MathUtils.signum(x);
1413
- bone.scaleX = bx + (x - bx) * alpha;
1414
- break;
1415
- case 3 /* add */:
1416
- bone.scaleX += (x - bone.data.scaleX) * alpha;
1417
- }
1418
- }
1419
- }
1421
+ if (bone.active)
1422
+ bone.scaleX = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleX);
1420
1423
  }
1421
1424
  };
1422
1425
  var ScaleYTimeline = class extends CurveTimeline1 {
1426
+ boneIndex = 0;
1423
1427
  constructor(frameCount, bezierCount, boneIndex) {
1424
1428
  super(frameCount, bezierCount, Property.scaleY + "|" + boneIndex);
1425
- this.boneIndex = 0;
1426
1429
  this.boneIndex = boneIndex;
1427
1430
  }
1428
1431
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1429
1432
  let bone = skeleton.bones[this.boneIndex];
1430
- if (!bone.active)
1431
- return;
1432
- let frames = this.frames;
1433
- if (time < frames[0]) {
1434
- switch (blend) {
1435
- case 0 /* setup */:
1436
- bone.scaleY = bone.data.scaleY;
1437
- return;
1438
- case 1 /* first */:
1439
- bone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha;
1440
- }
1441
- return;
1442
- }
1443
- let y = this.getCurveValue(time) * bone.data.scaleY;
1444
- if (alpha == 1) {
1445
- if (blend == 3 /* add */)
1446
- bone.scaleY += y - bone.data.scaleY;
1447
- else
1448
- bone.scaleY = y;
1449
- } else {
1450
- let by = 0;
1451
- if (direction == 1 /* mixOut */) {
1452
- switch (blend) {
1453
- case 0 /* setup */:
1454
- by = bone.data.scaleY;
1455
- bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
1456
- break;
1457
- case 1 /* first */:
1458
- case 2 /* replace */:
1459
- by = bone.scaleY;
1460
- bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
1461
- break;
1462
- case 3 /* add */:
1463
- bone.scaleY += (y - bone.data.scaleY) * alpha;
1464
- }
1465
- } else {
1466
- switch (blend) {
1467
- case 0 /* setup */:
1468
- by = Math.abs(bone.data.scaleY) * MathUtils.signum(y);
1469
- bone.scaleY = by + (y - by) * alpha;
1470
- break;
1471
- case 1 /* first */:
1472
- case 2 /* replace */:
1473
- by = Math.abs(bone.scaleY) * MathUtils.signum(y);
1474
- bone.scaleY = by + (y - by) * alpha;
1475
- break;
1476
- case 3 /* add */:
1477
- bone.scaleY += (y - bone.data.scaleY) * alpha;
1478
- }
1479
- }
1480
- }
1433
+ if (bone.active)
1434
+ bone.scaleY = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleY);
1481
1435
  }
1482
1436
  };
1483
1437
  var ShearTimeline = class extends CurveTimeline2 {
1438
+ boneIndex = 0;
1484
1439
  constructor(frameCount, bezierCount, boneIndex) {
1485
1440
  super(
1486
1441
  frameCount,
@@ -1488,7 +1443,6 @@ var spine = (() => {
1488
1443
  Property.shearX + "|" + boneIndex,
1489
1444
  Property.shearY + "|" + boneIndex
1490
1445
  );
1491
- this.boneIndex = 0;
1492
1446
  this.boneIndex = boneIndex;
1493
1447
  }
1494
1448
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
@@ -1586,82 +1540,36 @@ var spine = (() => {
1586
1540
  }
1587
1541
  };
1588
1542
  var ShearXTimeline = class extends CurveTimeline1 {
1543
+ boneIndex = 0;
1589
1544
  constructor(frameCount, bezierCount, boneIndex) {
1590
1545
  super(frameCount, bezierCount, Property.shearX + "|" + boneIndex);
1591
- this.boneIndex = 0;
1592
1546
  this.boneIndex = boneIndex;
1593
1547
  }
1594
1548
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1595
1549
  let bone = skeleton.bones[this.boneIndex];
1596
- if (!bone.active)
1597
- return;
1598
- let frames = this.frames;
1599
- if (time < frames[0]) {
1600
- switch (blend) {
1601
- case 0 /* setup */:
1602
- bone.shearX = bone.data.shearX;
1603
- return;
1604
- case 1 /* first */:
1605
- bone.shearX += (bone.data.shearX - bone.shearX) * alpha;
1606
- }
1607
- return;
1608
- }
1609
- let x = this.getCurveValue(time);
1610
- switch (blend) {
1611
- case 0 /* setup */:
1612
- bone.shearX = bone.data.shearX + x * alpha;
1613
- break;
1614
- case 1 /* first */:
1615
- case 2 /* replace */:
1616
- bone.shearX += (bone.data.shearX + x - bone.shearX) * alpha;
1617
- break;
1618
- case 3 /* add */:
1619
- bone.shearX += x * alpha;
1620
- }
1550
+ if (bone.active)
1551
+ bone.shearX = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearX);
1621
1552
  }
1622
1553
  };
1623
1554
  var ShearYTimeline = class extends CurveTimeline1 {
1555
+ boneIndex = 0;
1624
1556
  constructor(frameCount, bezierCount, boneIndex) {
1625
1557
  super(frameCount, bezierCount, Property.shearY + "|" + boneIndex);
1626
- this.boneIndex = 0;
1627
1558
  this.boneIndex = boneIndex;
1628
1559
  }
1629
1560
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
1630
1561
  let bone = skeleton.bones[this.boneIndex];
1631
- if (!bone.active)
1632
- return;
1633
- let frames = this.frames;
1634
- if (time < frames[0]) {
1635
- switch (blend) {
1636
- case 0 /* setup */:
1637
- bone.shearY = bone.data.shearY;
1638
- return;
1639
- case 1 /* first */:
1640
- bone.shearY += (bone.data.shearY - bone.shearY) * alpha;
1641
- }
1642
- return;
1643
- }
1644
- let y = this.getCurveValue(time);
1645
- switch (blend) {
1646
- case 0 /* setup */:
1647
- bone.shearY = bone.data.shearY + y * alpha;
1648
- break;
1649
- case 1 /* first */:
1650
- case 2 /* replace */:
1651
- bone.shearY += (bone.data.shearY + y - bone.shearY) * alpha;
1652
- break;
1653
- case 3 /* add */:
1654
- bone.shearY += y * alpha;
1655
- }
1562
+ if (bone.active)
1563
+ bone.shearY = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearY);
1656
1564
  }
1657
1565
  };
1658
1566
  var RGBATimeline = class extends CurveTimeline {
1567
+ slotIndex = 0;
1659
1568
  constructor(frameCount, bezierCount, slotIndex) {
1660
1569
  super(frameCount, bezierCount, [
1661
1570
  Property.rgb + "|" + slotIndex,
1662
1571
  Property.alpha + "|" + slotIndex
1663
1572
  ]);
1664
- this.slotIndex = 0;
1665
1573
  this.slotIndex = slotIndex;
1666
1574
  }
1667
1575
  getFrameEntries() {
@@ -1819,11 +1727,11 @@ var spine = (() => {
1819
1727
  }
1820
1728
  };
1821
1729
  var RGBTimeline = class extends CurveTimeline {
1730
+ slotIndex = 0;
1822
1731
  constructor(frameCount, bezierCount, slotIndex) {
1823
1732
  super(frameCount, bezierCount, [
1824
1733
  Property.rgb + "|" + slotIndex
1825
1734
  ]);
1826
- this.slotIndex = 0;
1827
1735
  this.slotIndex = slotIndex;
1828
1736
  }
1829
1737
  getFrameEntries() {
@@ -1962,9 +1870,9 @@ var spine = (() => {
1962
1870
  }
1963
1871
  };
1964
1872
  var AlphaTimeline = class extends CurveTimeline1 {
1873
+ slotIndex = 0;
1965
1874
  constructor(frameCount, bezierCount, slotIndex) {
1966
1875
  super(frameCount, bezierCount, Property.alpha + "|" + slotIndex);
1967
- this.slotIndex = 0;
1968
1876
  this.slotIndex = slotIndex;
1969
1877
  }
1970
1878
  apply(skeleton, lastTime, time, events, alpha, blend, direction) {
@@ -1994,13 +1902,13 @@ var spine = (() => {
1994
1902
  }
1995
1903
  };
1996
1904
  var RGBA2Timeline = class extends CurveTimeline {
1905
+ slotIndex = 0;
1997
1906
  constructor(frameCount, bezierCount, slotIndex) {
1998
1907
  super(frameCount, bezierCount, [
1999
1908
  Property.rgb + "|" + slotIndex,
2000
1909
  Property.alpha + "|" + slotIndex,
2001
1910
  Property.rgb2 + "|" + slotIndex
2002
1911
  ]);
2003
- this.slotIndex = 0;
2004
1912
  this.slotIndex = slotIndex;
2005
1913
  }
2006
1914
  getFrameEntries() {
@@ -2241,12 +2149,12 @@ var spine = (() => {
2241
2149
  }
2242
2150
  };
2243
2151
  var RGB2Timeline = class extends CurveTimeline {
2152
+ slotIndex = 0;
2244
2153
  constructor(frameCount, bezierCount, slotIndex) {
2245
2154
  super(frameCount, bezierCount, [
2246
2155
  Property.rgb + "|" + slotIndex,
2247
2156
  Property.rgb2 + "|" + slotIndex
2248
2157
  ]);
2249
- this.slotIndex = 0;
2250
2158
  this.slotIndex = slotIndex;
2251
2159
  }
2252
2160
  getFrameEntries() {
@@ -2472,11 +2380,13 @@ var spine = (() => {
2472
2380
  }
2473
2381
  };
2474
2382
  var AttachmentTimeline = class extends Timeline {
2383
+ slotIndex = 0;
2384
+ /** The attachment name for each key frame. May contain null values to clear the attachment. */
2385
+ attachmentNames;
2475
2386
  constructor(frameCount, slotIndex) {
2476
2387
  super(frameCount, [
2477
2388
  Property.attachment + "|" + slotIndex
2478
2389
  ]);
2479
- this.slotIndex = 0;
2480
2390
  this.slotIndex = slotIndex;
2481
2391
  this.attachmentNames = new Array(frameCount);
2482
2392
  }
@@ -2509,11 +2419,15 @@ var spine = (() => {
2509
2419
  }
2510
2420
  };
2511
2421
  var DeformTimeline = class extends CurveTimeline {
2422
+ slotIndex = 0;
2423
+ /** The attachment that will be deformed. */
2424
+ attachment;
2425
+ /** The vertices for each key frame. */
2426
+ vertices;
2512
2427
  constructor(frameCount, bezierCount, slotIndex, attachment) {
2513
2428
  super(frameCount, bezierCount, [
2514
2429
  Property.deform + "|" + slotIndex + "|" + attachment.id
2515
2430
  ]);
2516
- this.slotIndex = 0;
2517
2431
  this.slotIndex = slotIndex;
2518
2432
  this.attachment = attachment;
2519
2433
  this.vertices = new Array(frameCount);
@@ -2734,6 +2648,8 @@ var spine = (() => {
2734
2648
  }
2735
2649
  };
2736
2650
  var _EventTimeline = class extends Timeline {
2651
+ /** The event for each key frame. */
2652
+ events;
2737
2653
  constructor(frameCount) {
2738
2654
  super(frameCount, _EventTimeline.propertyIds);
2739
2655
  this.events = new Array(frameCount);
@@ -2776,8 +2692,10 @@ var spine = (() => {
2776
2692
  }
2777
2693
  };
2778
2694
  var EventTimeline = _EventTimeline;
2779
- EventTimeline.propertyIds = ["" + Property.event];
2695
+ __publicField(EventTimeline, "propertyIds", ["" + Property.event]);
2780
2696
  var _DrawOrderTimeline = class extends Timeline {
2697
+ /** The draw order for each key frame. See {@link #setFrame(int, float, int[])}. */
2698
+ drawOrders;
2781
2699
  constructor(frameCount) {
2782
2700
  super(frameCount, _DrawOrderTimeline.propertyIds);
2783
2701
  this.drawOrders = new Array(frameCount);
@@ -2816,15 +2734,15 @@ var spine = (() => {
2816
2734
  }
2817
2735
  };
2818
2736
  var DrawOrderTimeline = _DrawOrderTimeline;
2819
- DrawOrderTimeline.propertyIds = ["" + Property.drawOrder];
2737
+ __publicField(DrawOrderTimeline, "propertyIds", ["" + Property.drawOrder]);
2820
2738
  var IkConstraintTimeline = class extends CurveTimeline {
2739
+ /** The index of the IK constraint in {@link Skeleton#getIkConstraints()} that will be changed when this timeline is */
2740
+ constraintIndex = 0;
2821
2741
  constructor(frameCount, bezierCount, ikConstraintIndex) {
2822
2742
  super(frameCount, bezierCount, [
2823
2743
  Property.ikConstraint + "|" + ikConstraintIndex
2824
2744
  ]);
2825
- /** The index of the IK constraint slot in {@link Skeleton#ikConstraints} that will be changed. */
2826
- this.ikConstraintIndex = 0;
2827
- this.ikConstraintIndex = ikConstraintIndex;
2745
+ this.constraintIndex = ikConstraintIndex;
2828
2746
  }
2829
2747
  getFrameEntries() {
2830
2748
  return 6;
@@ -2855,7 +2773,7 @@ var spine = (() => {
2855
2773
  ] = stretch ? 1 : 0;
2856
2774
  }
2857
2775
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
2858
- let constraint = skeleton.ikConstraints[this.ikConstraintIndex];
2776
+ let constraint = skeleton.ikConstraints[this.constraintIndex];
2859
2777
  if (!constraint.active)
2860
2778
  return;
2861
2779
  let frames = this.frames;
@@ -2980,13 +2898,13 @@ var spine = (() => {
2980
2898
  }
2981
2899
  };
2982
2900
  var TransformConstraintTimeline = class extends CurveTimeline {
2901
+ /** The index of the transform constraint slot in {@link Skeleton#transformConstraints} that will be changed. */
2902
+ constraintIndex = 0;
2983
2903
  constructor(frameCount, bezierCount, transformConstraintIndex) {
2984
2904
  super(frameCount, bezierCount, [
2985
2905
  Property.transformConstraint + "|" + transformConstraintIndex
2986
2906
  ]);
2987
- /** The index of the transform constraint slot in {@link Skeleton#transformConstraints} that will be changed. */
2988
- this.transformConstraintIndex = 0;
2989
- this.transformConstraintIndex = transformConstraintIndex;
2907
+ this.constraintIndex = transformConstraintIndex;
2990
2908
  }
2991
2909
  getFrameEntries() {
2992
2910
  return 7;
@@ -3022,7 +2940,7 @@ var spine = (() => {
3022
2940
  ] = mixShearY;
3023
2941
  }
3024
2942
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
3025
- let constraint = skeleton.transformConstraints[this.transformConstraintIndex];
2943
+ let constraint = skeleton.transformConstraints[this.constraintIndex];
3026
2944
  if (!constraint.active)
3027
2945
  return;
3028
2946
  let frames = this.frames;
@@ -3203,71 +3121,42 @@ var spine = (() => {
3203
3121
  }
3204
3122
  };
3205
3123
  var PathConstraintPositionTimeline = class extends CurveTimeline1 {
3124
+ /** The index of the path constraint in {@link Skeleton#getPathConstraints()} that will be changed when this timeline is
3125
+ * applied. */
3126
+ constraintIndex = 0;
3206
3127
  constructor(frameCount, bezierCount, pathConstraintIndex) {
3207
3128
  super(frameCount, bezierCount, Property.pathConstraintPosition + "|" + pathConstraintIndex);
3208
- /** The index of the path constraint slot in {@link Skeleton#pathConstraints} that will be changed. */
3209
- this.pathConstraintIndex = 0;
3210
- this.pathConstraintIndex = pathConstraintIndex;
3129
+ this.constraintIndex = pathConstraintIndex;
3211
3130
  }
3212
3131
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
3213
- let constraint = skeleton.pathConstraints[this.pathConstraintIndex];
3214
- if (!constraint.active)
3215
- return;
3216
- let frames = this.frames;
3217
- if (time < frames[0]) {
3218
- switch (blend) {
3219
- case 0 /* setup */:
3220
- constraint.position = constraint.data.position;
3221
- return;
3222
- case 1 /* first */:
3223
- constraint.position += (constraint.data.position - constraint.position) * alpha;
3224
- }
3225
- return;
3226
- }
3227
- let position = this.getCurveValue(time);
3228
- if (blend == 0 /* setup */)
3229
- constraint.position = constraint.data.position + (position - constraint.data.position) * alpha;
3230
- else
3231
- constraint.position += (position - constraint.position) * alpha;
3132
+ let constraint = skeleton.pathConstraints[this.constraintIndex];
3133
+ if (constraint.active)
3134
+ constraint.position = this.getAbsoluteValue(time, alpha, blend, constraint.position, constraint.data.position);
3232
3135
  }
3233
3136
  };
3234
3137
  var PathConstraintSpacingTimeline = class extends CurveTimeline1 {
3138
+ /** The index of the path constraint in {@link Skeleton#getPathConstraints()} that will be changed when this timeline is
3139
+ * applied. */
3140
+ constraintIndex = 0;
3235
3141
  constructor(frameCount, bezierCount, pathConstraintIndex) {
3236
3142
  super(frameCount, bezierCount, Property.pathConstraintSpacing + "|" + pathConstraintIndex);
3237
- /** The index of the path constraint slot in {@link Skeleton#getPathConstraints()} that will be changed. */
3238
- this.pathConstraintIndex = 0;
3239
- this.pathConstraintIndex = pathConstraintIndex;
3143
+ this.constraintIndex = pathConstraintIndex;
3240
3144
  }
3241
3145
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
3242
- let constraint = skeleton.pathConstraints[this.pathConstraintIndex];
3243
- if (!constraint.active)
3244
- return;
3245
- let frames = this.frames;
3246
- if (time < frames[0]) {
3247
- switch (blend) {
3248
- case 0 /* setup */:
3249
- constraint.spacing = constraint.data.spacing;
3250
- return;
3251
- case 1 /* first */:
3252
- constraint.spacing += (constraint.data.spacing - constraint.spacing) * alpha;
3253
- }
3254
- return;
3255
- }
3256
- let spacing = this.getCurveValue(time);
3257
- if (blend == 0 /* setup */)
3258
- constraint.spacing = constraint.data.spacing + (spacing - constraint.data.spacing) * alpha;
3259
- else
3260
- constraint.spacing += (spacing - constraint.spacing) * alpha;
3146
+ let constraint = skeleton.pathConstraints[this.constraintIndex];
3147
+ if (constraint.active)
3148
+ constraint.spacing = this.getAbsoluteValue(time, alpha, blend, constraint.spacing, constraint.data.spacing);
3261
3149
  }
3262
3150
  };
3263
3151
  var PathConstraintMixTimeline = class extends CurveTimeline {
3152
+ /** The index of the path constraint in {@link Skeleton#getPathConstraints()} that will be changed when this timeline is
3153
+ * applied. */
3154
+ constraintIndex = 0;
3264
3155
  constructor(frameCount, bezierCount, pathConstraintIndex) {
3265
3156
  super(frameCount, bezierCount, [
3266
3157
  Property.pathConstraintMix + "|" + pathConstraintIndex
3267
3158
  ]);
3268
- /** The index of the path constraint slot in {@link Skeleton#getPathConstraints()} that will be changed. */
3269
- this.pathConstraintIndex = 0;
3270
- this.pathConstraintIndex = pathConstraintIndex;
3159
+ this.constraintIndex = pathConstraintIndex;
3271
3160
  }
3272
3161
  getFrameEntries() {
3273
3162
  return 4;
@@ -3290,7 +3179,7 @@ var spine = (() => {
3290
3179
  ] = mixY;
3291
3180
  }
3292
3181
  apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
3293
- let constraint = skeleton.pathConstraints[this.pathConstraintIndex];
3182
+ let constraint = skeleton.pathConstraints[this.constraintIndex];
3294
3183
  if (!constraint.active)
3295
3184
  return;
3296
3185
  let frames = this.frames;
@@ -3397,7 +3286,199 @@ var spine = (() => {
3397
3286
  }
3398
3287
  }
3399
3288
  };
3289
+ var PhysicsConstraintTimeline = class extends CurveTimeline1 {
3290
+ /** The index of the physics constraint in {@link Skeleton#getPhysicsConstraints()} that will be changed when this timeline
3291
+ * is applied, or -1 if all physics constraints in the skeleton will be changed. */
3292
+ constraintIndex = 0;
3293
+ /** @param physicsConstraintIndex -1 for all physics constraints in the skeleton. */
3294
+ constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3295
+ super(frameCount, bezierCount, property + "|" + physicsConstraintIndex);
3296
+ this.constraintIndex = physicsConstraintIndex;
3297
+ }
3298
+ apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
3299
+ let constraint;
3300
+ if (this.constraintIndex == -1) {
3301
+ const value = time >= this.frames[0] ? this.getCurveValue(time) : 0;
3302
+ for (const constraint2 of skeleton.physicsConstraints) {
3303
+ if (constraint2.active && this.global(constraint2.data))
3304
+ this.set(constraint2, this.getAbsoluteValue2(time, alpha, blend, this.get(constraint2), this.setup(constraint2), value));
3305
+ }
3306
+ } else {
3307
+ constraint = skeleton.physicsConstraints[this.constraintIndex];
3308
+ if (constraint.active)
3309
+ this.set(constraint, this.getAbsoluteValue(time, alpha, blend, this.get(constraint), this.setup(constraint)));
3310
+ }
3311
+ }
3312
+ };
3313
+ var PhysicsConstraintInertiaTimeline = class extends PhysicsConstraintTimeline {
3314
+ constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3315
+ super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintInertia);
3316
+ }
3317
+ setup(constraint) {
3318
+ return constraint.data.inertia;
3319
+ }
3320
+ get(constraint) {
3321
+ return constraint.inertia;
3322
+ }
3323
+ set(constraint, value) {
3324
+ constraint.inertia = value;
3325
+ }
3326
+ global(constraint) {
3327
+ return constraint.inertiaGlobal;
3328
+ }
3329
+ };
3330
+ var PhysicsConstraintStrengthTimeline = class extends PhysicsConstraintTimeline {
3331
+ constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3332
+ super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintStrength);
3333
+ }
3334
+ setup(constraint) {
3335
+ return constraint.data.strength;
3336
+ }
3337
+ get(constraint) {
3338
+ return constraint.strength;
3339
+ }
3340
+ set(constraint, value) {
3341
+ constraint.strength = value;
3342
+ }
3343
+ global(constraint) {
3344
+ return constraint.strengthGlobal;
3345
+ }
3346
+ };
3347
+ var PhysicsConstraintDampingTimeline = class extends PhysicsConstraintTimeline {
3348
+ constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3349
+ super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintDamping);
3350
+ }
3351
+ setup(constraint) {
3352
+ return constraint.data.damping;
3353
+ }
3354
+ get(constraint) {
3355
+ return constraint.damping;
3356
+ }
3357
+ set(constraint, value) {
3358
+ constraint.damping = value;
3359
+ }
3360
+ global(constraint) {
3361
+ return constraint.dampingGlobal;
3362
+ }
3363
+ };
3364
+ var PhysicsConstraintMassTimeline = class extends PhysicsConstraintTimeline {
3365
+ constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3366
+ super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintMass);
3367
+ }
3368
+ setup(constraint) {
3369
+ return 1 / constraint.data.massInverse;
3370
+ }
3371
+ get(constraint) {
3372
+ return 1 / constraint.massInverse;
3373
+ }
3374
+ set(constraint, value) {
3375
+ constraint.massInverse = 1 / value;
3376
+ }
3377
+ global(constraint) {
3378
+ return constraint.massGlobal;
3379
+ }
3380
+ };
3381
+ var PhysicsConstraintWindTimeline = class extends PhysicsConstraintTimeline {
3382
+ constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3383
+ super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintWind);
3384
+ }
3385
+ setup(constraint) {
3386
+ return constraint.data.wind;
3387
+ }
3388
+ get(constraint) {
3389
+ return constraint.wind;
3390
+ }
3391
+ set(constraint, value) {
3392
+ constraint.wind = value;
3393
+ }
3394
+ global(constraint) {
3395
+ return constraint.windGlobal;
3396
+ }
3397
+ };
3398
+ var PhysicsConstraintGravityTimeline = class extends PhysicsConstraintTimeline {
3399
+ constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3400
+ super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintGravity);
3401
+ }
3402
+ setup(constraint) {
3403
+ return constraint.data.gravity;
3404
+ }
3405
+ get(constraint) {
3406
+ return constraint.gravity;
3407
+ }
3408
+ set(constraint, value) {
3409
+ constraint.gravity = value;
3410
+ }
3411
+ global(constraint) {
3412
+ return constraint.gravityGlobal;
3413
+ }
3414
+ };
3415
+ var PhysicsConstraintMixTimeline = class extends PhysicsConstraintTimeline {
3416
+ constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
3417
+ super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintMix);
3418
+ }
3419
+ setup(constraint) {
3420
+ return constraint.data.mix;
3421
+ }
3422
+ get(constraint) {
3423
+ return constraint.mix;
3424
+ }
3425
+ set(constraint, value) {
3426
+ constraint.mix = value;
3427
+ }
3428
+ global(constraint) {
3429
+ return constraint.mixGlobal;
3430
+ }
3431
+ };
3432
+ var _PhysicsConstraintResetTimeline = class extends Timeline {
3433
+ /** The index of the physics constraint in {@link Skeleton#getPhysicsConstraints()} that will be reset when this timeline is
3434
+ * applied, or -1 if all physics constraints in the skeleton will be reset. */
3435
+ constraintIndex;
3436
+ /** @param physicsConstraintIndex -1 for all physics constraints in the skeleton. */
3437
+ constructor(frameCount, physicsConstraintIndex) {
3438
+ super(frameCount, _PhysicsConstraintResetTimeline.propertyIds);
3439
+ this.constraintIndex = physicsConstraintIndex;
3440
+ }
3441
+ getFrameCount() {
3442
+ return this.frames.length;
3443
+ }
3444
+ /** Sets the time for the specified frame.
3445
+ * @param frame Between 0 and <code>frameCount</code>, inclusive. */
3446
+ setFrame(frame, time) {
3447
+ this.frames[frame] = time;
3448
+ }
3449
+ /** Resets the physics constraint when frames > <code>lastTime</code> and <= <code>time</code>. */
3450
+ apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
3451
+ let constraint;
3452
+ if (this.constraintIndex != -1) {
3453
+ constraint = skeleton.physicsConstraints[this.constraintIndex];
3454
+ if (!constraint.active)
3455
+ return;
3456
+ }
3457
+ const frames = this.frames;
3458
+ if (lastTime > time) {
3459
+ this.apply(skeleton, lastTime, Number.MAX_VALUE, [], alpha, blend, direction);
3460
+ lastTime = -1;
3461
+ } else if (lastTime >= frames[frames.length - 1])
3462
+ return;
3463
+ if (time < frames[0])
3464
+ return;
3465
+ if (lastTime < frames[0] || time >= frames[Timeline.search1(frames, lastTime) + 1]) {
3466
+ if (constraint != null)
3467
+ constraint.reset();
3468
+ else {
3469
+ for (const constraint2 of skeleton.physicsConstraints) {
3470
+ if (constraint2.active)
3471
+ constraint2.reset();
3472
+ }
3473
+ }
3474
+ }
3475
+ }
3476
+ };
3477
+ var PhysicsConstraintResetTimeline = _PhysicsConstraintResetTimeline;
3478
+ __publicField(PhysicsConstraintResetTimeline, "propertyIds", [Property.physicsConstraintReset.toString()]);
3400
3479
  var _SequenceTimeline = class extends Timeline {
3480
+ slotIndex;
3481
+ attachment;
3401
3482
  constructor(frameCount, slotIndex, attachment) {
3402
3483
  super(frameCount, [
3403
3484
  Property.sequence + "|" + slotIndex + "|" + attachment.sequence.id
@@ -3482,32 +3563,34 @@ var spine = (() => {
3482
3563
  }
3483
3564
  };
3484
3565
  var SequenceTimeline = _SequenceTimeline;
3485
- SequenceTimeline.ENTRIES = 3;
3486
- SequenceTimeline.MODE = 1;
3487
- SequenceTimeline.DELAY = 2;
3566
+ __publicField(SequenceTimeline, "ENTRIES", 3);
3567
+ __publicField(SequenceTimeline, "MODE", 1);
3568
+ __publicField(SequenceTimeline, "DELAY", 2);
3488
3569
 
3489
3570
  // spine-core/src/AnimationState.ts
3490
3571
  var _AnimationState = class {
3491
- constructor(data) {
3492
- /** The list of tracks that currently have animations, which may contain null entries. */
3493
- this.tracks = new Array();
3494
- /** Multiplier for the delta time when the animation state is updated, causing time for all animations and mixes to play slower
3495
- * or faster. Defaults to 1.
3496
- *
3497
- * See TrackEntry {@link TrackEntry#timeScale} for affecting a single animation. */
3498
- this.timeScale = 1;
3499
- this.unkeyedState = 0;
3500
- this.events = new Array();
3501
- this.listeners = new Array();
3502
- this.queue = new EventQueue(this);
3503
- this.propertyIDs = new StringSet();
3504
- this.animationsChanged = false;
3505
- this.trackEntryPool = new Pool(() => new TrackEntry());
3506
- this.data = data;
3507
- }
3508
3572
  static emptyAnimation() {
3509
3573
  return _AnimationState._emptyAnimation;
3510
3574
  }
3575
+ /** The AnimationStateData to look up mix durations. */
3576
+ data;
3577
+ /** The list of tracks that currently have animations, which may contain null entries. */
3578
+ tracks = new Array();
3579
+ /** Multiplier for the delta time when the animation state is updated, causing time for all animations and mixes to play slower
3580
+ * or faster. Defaults to 1.
3581
+ *
3582
+ * See TrackEntry {@link TrackEntry#timeScale} for affecting a single animation. */
3583
+ timeScale = 1;
3584
+ unkeyedState = 0;
3585
+ events = new Array();
3586
+ listeners = new Array();
3587
+ queue = new EventQueue(this);
3588
+ propertyIDs = new StringSet();
3589
+ animationsChanged = false;
3590
+ trackEntryPool = new Pool(() => new TrackEntry());
3591
+ constructor(data) {
3592
+ this.data = data;
3593
+ }
3511
3594
  /** Increments each track entry {@link TrackEntry#trackTime()}, setting queued animations as current if needed. */
3512
3595
  update(delta) {
3513
3596
  delta *= this.timeScale;
@@ -3599,11 +3682,12 @@ var spine = (() => {
3599
3682
  continue;
3600
3683
  applied = true;
3601
3684
  let blend = i2 == 0 ? 1 /* first */ : current.mixBlend;
3602
- let mix = current.alpha;
3685
+ let alpha = current.alpha;
3603
3686
  if (current.mixingFrom)
3604
- mix *= this.applyMixingFrom(current, skeleton, blend);
3687
+ alpha *= this.applyMixingFrom(current, skeleton, blend);
3605
3688
  else if (current.trackTime >= current.trackEnd && !current.next)
3606
- mix = 0;
3689
+ alpha = 0;
3690
+ let attachments = alpha >= current.alphaAttachmentThreshold;
3607
3691
  let animationLast = current.animationLast, animationTime = current.getAnimationTime(), applyTime = animationTime;
3608
3692
  let applyEvents = events;
3609
3693
  if (current.reverse) {
@@ -3612,14 +3696,16 @@ var spine = (() => {
3612
3696
  }
3613
3697
  let timelines = current.animation.timelines;
3614
3698
  let timelineCount = timelines.length;
3615
- if (i2 == 0 && mix == 1 || blend == 3 /* add */) {
3699
+ if (i2 == 0 && alpha == 1 || blend == 3 /* add */) {
3700
+ if (i2 == 0)
3701
+ attachments = true;
3616
3702
  for (let ii = 0; ii < timelineCount; ii++) {
3617
- Utils.webkit602BugfixHelper(mix, blend);
3703
+ Utils.webkit602BugfixHelper(alpha, blend);
3618
3704
  var timeline = timelines[ii];
3619
3705
  if (timeline instanceof AttachmentTimeline)
3620
- this.applyAttachmentTimeline(timeline, skeleton, applyTime, blend, true);
3706
+ this.applyAttachmentTimeline(timeline, skeleton, applyTime, blend, attachments);
3621
3707
  else
3622
- timeline.apply(skeleton, animationLast, applyTime, applyEvents, mix, blend, 0 /* mixIn */);
3708
+ timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, blend, 0 /* mixIn */);
3623
3709
  }
3624
3710
  } else {
3625
3711
  let timelineMode = current.timelineMode;
@@ -3631,12 +3717,12 @@ var spine = (() => {
3631
3717
  let timeline2 = timelines[ii];
3632
3718
  let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend : 0 /* setup */;
3633
3719
  if (!shortestRotation && timeline2 instanceof RotateTimeline) {
3634
- this.applyRotateTimeline(timeline2, skeleton, applyTime, mix, timelineBlend, current.timelinesRotation, ii << 1, firstFrame);
3720
+ this.applyRotateTimeline(timeline2, skeleton, applyTime, alpha, timelineBlend, current.timelinesRotation, ii << 1, firstFrame);
3635
3721
  } else if (timeline2 instanceof AttachmentTimeline) {
3636
- this.applyAttachmentTimeline(timeline2, skeleton, applyTime, blend, true);
3722
+ this.applyAttachmentTimeline(timeline2, skeleton, applyTime, blend, attachments);
3637
3723
  } else {
3638
- Utils.webkit602BugfixHelper(mix, blend);
3639
- timeline2.apply(skeleton, animationLast, applyTime, applyEvents, mix, timelineBlend, 0 /* mixIn */);
3724
+ Utils.webkit602BugfixHelper(alpha, blend);
3725
+ timeline2.apply(skeleton, animationLast, applyTime, applyEvents, alpha, timelineBlend, 0 /* mixIn */);
3640
3726
  }
3641
3727
  }
3642
3728
  }
@@ -3674,7 +3760,7 @@ var spine = (() => {
3674
3760
  if (blend != 1 /* first */)
3675
3761
  blend = from.mixBlend;
3676
3762
  }
3677
- let attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold;
3763
+ let attachments = mix < from.mixAttachmentThreshold, drawOrder = mix < from.mixDrawOrderThreshold;
3678
3764
  let timelines = from.animation.timelines;
3679
3765
  let timelineCount = timelines.length;
3680
3766
  let alphaHold = from.alpha * to.interruptAlpha, alphaMix = alphaHold * (1 - mix);
@@ -3729,7 +3815,7 @@ var spine = (() => {
3729
3815
  if (!shortestRotation && timeline instanceof RotateTimeline)
3730
3816
  this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, timelineBlend, from.timelinesRotation, i << 1, firstFrame);
3731
3817
  else if (timeline instanceof AttachmentTimeline)
3732
- this.applyAttachmentTimeline(timeline, skeleton, applyTime, timelineBlend, attachments);
3818
+ this.applyAttachmentTimeline(timeline, skeleton, applyTime, timelineBlend, attachments && alpha >= from.alphaAttachmentThreshold);
3733
3819
  else {
3734
3820
  Utils.webkit602BugfixHelper(alpha, blend);
3735
3821
  if (drawOrder && timeline instanceof DrawOrderTimeline && timelineBlend == 0 /* setup */)
@@ -3789,7 +3875,7 @@ var spine = (() => {
3789
3875
  r2 = bone.data.rotation + timeline.getCurveValue(time);
3790
3876
  }
3791
3877
  let total = 0, diff = r2 - r1;
3792
- diff -= (16384 - (16384.499999999996 - diff / 360 | 0)) * 360;
3878
+ diff -= Math.ceil(diff / 360 - 0.5) * 360;
3793
3879
  if (diff == 0) {
3794
3880
  total = timelinesRotation[i];
3795
3881
  } else {
@@ -4046,8 +4132,9 @@ var spine = (() => {
4046
4132
  entry.reverse = false;
4047
4133
  entry.shortestRotation = false;
4048
4134
  entry.eventThreshold = 0;
4049
- entry.attachmentThreshold = 0;
4050
- entry.drawOrderThreshold = 0;
4135
+ entry.alphaAttachmentThreshold = 0;
4136
+ entry.mixAttachmentThreshold = 0;
4137
+ entry.mixDrawOrderThreshold = 0;
4051
4138
  entry.animationStart = 0;
4052
4139
  entry.animationEnd = animation.duration;
4053
4140
  entry.animationLast = -1;
@@ -4159,141 +4246,151 @@ var spine = (() => {
4159
4246
  }
4160
4247
  };
4161
4248
  var AnimationState = _AnimationState;
4162
- AnimationState._emptyAnimation = new Animation("<empty>", [], 0);
4249
+ __publicField(AnimationState, "_emptyAnimation", new Animation("<empty>", [], 0));
4163
4250
  var TrackEntry = class {
4164
- constructor() {
4165
- /** The animation to apply for this track entry. */
4166
- this.animation = null;
4167
- this.previous = null;
4168
- /** The animation queued to start after this animation, or null. `next` makes up a linked list. */
4169
- this.next = null;
4170
- /** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no
4171
- * mixing is currently occuring. When mixing from multiple animations, `mixingFrom` makes up a linked list. */
4172
- this.mixingFrom = null;
4173
- /** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is
4174
- * currently occuring. When mixing to multiple animations, `mixingTo` makes up a linked list. */
4175
- this.mixingTo = null;
4176
- /** The listener for events generated by this track entry, or null.
4177
- *
4178
- * A track entry returned from {@link AnimationState#setAnimation()} is already the current animation
4179
- * for the track, so the track entry listener {@link AnimationStateListener#start()} will not be called. */
4180
- this.listener = null;
4181
- /** The index of the track where this track entry is either current or queued.
4182
- *
4183
- * See {@link AnimationState#getCurrent()}. */
4184
- this.trackIndex = 0;
4185
- /** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
4186
- * duration. */
4187
- this.loop = false;
4188
- /** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead
4189
- * of being mixed out.
4190
- *
4191
- * When mixing between animations that key the same property, if a lower track also keys that property then the value will
4192
- * briefly dip toward the lower track value during the mix. This happens because the first animation mixes from 100% to 0%
4193
- * while the second animation mixes from 0% to 100%. Setting `holdPrevious` to true applies the first animation
4194
- * at 100% during the mix so the lower track value is overwritten. Such dipping does not occur on the lowest track which
4195
- * keys the property, only when a higher track also keys the property.
4196
- *
4197
- * Snapping will occur if `holdPrevious` is true and this animation does not key all the same properties as the
4198
- * previous animation. */
4199
- this.holdPrevious = false;
4200
- this.reverse = false;
4201
- this.shortestRotation = false;
4202
- /** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
4203
- * `eventThreshold`, event timelines are applied while this animation is being mixed out. Defaults to 0, so event
4204
- * timelines are not applied while this animation is being mixed out. */
4205
- this.eventThreshold = 0;
4206
- /** When the mix percentage ({@link #mixtime} / {@link #mixDuration}) is less than the
4207
- * `attachmentThreshold`, attachment timelines are applied while this animation is being mixed out. Defaults to
4208
- * 0, so attachment timelines are not applied while this animation is being mixed out. */
4209
- this.attachmentThreshold = 0;
4210
- /** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
4211
- * `drawOrderThreshold`, draw order timelines are applied while this animation is being mixed out. Defaults to 0,
4212
- * so draw order timelines are not applied while this animation is being mixed out. */
4213
- this.drawOrderThreshold = 0;
4214
- /** Seconds when this animation starts, both initially and after looping. Defaults to 0.
4215
- *
4216
- * When changing the `animationStart` time, it often makes sense to set {@link #animationLast} to the same
4217
- * value to prevent timeline keys before the start time from triggering. */
4218
- this.animationStart = 0;
4219
- /** Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will
4220
- * loop back to {@link #animationStart} at this time. Defaults to the animation {@link Animation#duration}. */
4221
- this.animationEnd = 0;
4222
- /** The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this
4223
- * animation is applied, event timelines will fire all events between the `animationLast` time (exclusive) and
4224
- * `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation
4225
- * is applied. */
4226
- this.animationLast = 0;
4227
- this.nextAnimationLast = 0;
4228
- /** Seconds to postpone playing the animation. When this track entry is the current track entry, `delay`
4229
- * postpones incrementing the {@link #trackTime}. When this track entry is queued, `delay` is the time from
4230
- * the start of the previous animation to when this track entry will become the current track entry (ie when the previous
4231
- * track entry {@link TrackEntry#trackTime} >= this track entry's `delay`).
4232
- *
4233
- * {@link #timeScale} affects the delay. */
4234
- this.delay = 0;
4235
- /** Current time in seconds this track entry has been the current track entry. The track time determines
4236
- * {@link #animationTime}. The track time can be set to start the animation at a time other than 0, without affecting
4237
- * looping. */
4238
- this.trackTime = 0;
4239
- this.trackLast = 0;
4240
- this.nextTrackLast = 0;
4241
- /** The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float
4242
- * value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time
4243
- * is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the
4244
- * properties keyed by the animation are set to the setup pose and the track is cleared.
4245
- *
4246
- * It may be desired to use {@link AnimationState#addEmptyAnimation()} rather than have the animation
4247
- * abruptly cease being applied. */
4248
- this.trackEnd = 0;
4249
- /** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
4250
- * faster. Defaults to 1.
4251
- *
4252
- * {@link #mixTime} is not affected by track entry time scale, so {@link #mixDuration} may need to be adjusted to
4253
- * match the animation speed.
4254
- *
4255
- * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
4256
- * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, assuming time scale to be 1. If
4257
- * the time scale is not 1, the delay may need to be adjusted.
4258
- *
4259
- * See AnimationState {@link AnimationState#timeScale} for affecting all animations. */
4260
- this.timeScale = 0;
4261
- /** Values < 1 mix this animation with the skeleton's current pose (usually the pose resulting from lower tracks). Defaults
4262
- * to 1, which overwrites the skeleton's current pose with this animation.
4263
- *
4264
- * Typically track 0 is used to completely pose the skeleton, then alpha is used on higher tracks. It doesn't make sense to
4265
- * use alpha on track 0 if the skeleton pose is from the last frame render. */
4266
- this.alpha = 0;
4267
- /** Seconds from 0 to the {@link #getMixDuration()} when mixing from the previous animation to this animation. May be
4268
- * slightly more than `mixDuration` when the mix is complete. */
4269
- this.mixTime = 0;
4270
- /** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by AnimationStateData
4271
- * {@link AnimationStateData#getMix()} based on the animation before this animation (if any).
4272
- *
4273
- * A mix duration of 0 still mixes out over one frame to provide the track entry being mixed out a chance to revert the
4274
- * properties it was animating.
4275
- *
4276
- * The `mixDuration` can be set manually rather than use the value from
4277
- * {@link AnimationStateData#getMix()}. In that case, the `mixDuration` can be set for a new
4278
- * track entry only before {@link AnimationState#update(float)} is first called.
4279
- *
4280
- * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
4281
- * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set
4282
- * afterward. */
4283
- this.mixDuration = 0;
4284
- this.interruptAlpha = 0;
4285
- this.totalAlpha = 0;
4286
- /** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
4287
- * replaces the values from the lower tracks with the animation values. {@link MixBlend#add} adds the animation values to
4288
- * the values from the lower tracks.
4289
- *
4290
- * The `mixBlend` can be set for a new track entry only before {@link AnimationState#apply()} is first
4291
- * called. */
4292
- this.mixBlend = 2 /* replace */;
4293
- this.timelineMode = new Array();
4294
- this.timelineHoldMix = new Array();
4295
- this.timelinesRotation = new Array();
4296
- }
4251
+ /** The animation to apply for this track entry. */
4252
+ animation = null;
4253
+ previous = null;
4254
+ /** The animation queued to start after this animation, or null. `next` makes up a linked list. */
4255
+ next = null;
4256
+ /** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no
4257
+ * mixing is currently occuring. When mixing from multiple animations, `mixingFrom` makes up a linked list. */
4258
+ mixingFrom = null;
4259
+ /** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is
4260
+ * currently occuring. When mixing to multiple animations, `mixingTo` makes up a linked list. */
4261
+ mixingTo = null;
4262
+ /** The listener for events generated by this track entry, or null.
4263
+ *
4264
+ * A track entry returned from {@link AnimationState#setAnimation()} is already the current animation
4265
+ * for the track, so the track entry listener {@link AnimationStateListener#start()} will not be called. */
4266
+ listener = null;
4267
+ /** The index of the track where this track entry is either current or queued.
4268
+ *
4269
+ * See {@link AnimationState#getCurrent()}. */
4270
+ trackIndex = 0;
4271
+ /** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
4272
+ * duration. */
4273
+ loop = false;
4274
+ /** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead
4275
+ * of being mixed out.
4276
+ *
4277
+ * When mixing between animations that key the same property, if a lower track also keys that property then the value will
4278
+ * briefly dip toward the lower track value during the mix. This happens because the first animation mixes from 100% to 0%
4279
+ * while the second animation mixes from 0% to 100%. Setting `holdPrevious` to true applies the first animation
4280
+ * at 100% during the mix so the lower track value is overwritten. Such dipping does not occur on the lowest track which
4281
+ * keys the property, only when a higher track also keys the property.
4282
+ *
4283
+ * Snapping will occur if `holdPrevious` is true and this animation does not key all the same properties as the
4284
+ * previous animation. */
4285
+ holdPrevious = false;
4286
+ reverse = false;
4287
+ shortestRotation = false;
4288
+ /** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
4289
+ * `eventThreshold`, event timelines are applied while this animation is being mixed out. Defaults to 0, so event
4290
+ * timelines are not applied while this animation is being mixed out. */
4291
+ eventThreshold = 0;
4292
+ /** When the mix percentage ({@link #mixtime} / {@link #mixDuration}) is less than the
4293
+ * `attachmentThreshold`, attachment timelines are applied while this animation is being mixed out. Defaults to
4294
+ * 0, so attachment timelines are not applied while this animation is being mixed out. */
4295
+ mixAttachmentThreshold = 0;
4296
+ /** When {@link #getAlpha()} is greater than <code>alphaAttachmentThreshold</code>, attachment timelines are applied.
4297
+ * Defaults to 0, so attachment timelines are always applied. */
4298
+ alphaAttachmentThreshold = 0;
4299
+ /** When the mix percentage ({@link #getMixTime()} / {@link #getMixDuration()}) is less than the
4300
+ * <code>mixDrawOrderThreshold</code>, draw order timelines are applied while this animation is being mixed out. Defaults to
4301
+ * 0, so draw order timelines are not applied while this animation is being mixed out. */
4302
+ mixDrawOrderThreshold = 0;
4303
+ /** Seconds when this animation starts, both initially and after looping. Defaults to 0.
4304
+ *
4305
+ * When changing the `animationStart` time, it often makes sense to set {@link #animationLast} to the same
4306
+ * value to prevent timeline keys before the start time from triggering. */
4307
+ animationStart = 0;
4308
+ /** Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will
4309
+ * loop back to {@link #animationStart} at this time. Defaults to the animation {@link Animation#duration}. */
4310
+ animationEnd = 0;
4311
+ /** The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this
4312
+ * animation is applied, event timelines will fire all events between the `animationLast` time (exclusive) and
4313
+ * `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation
4314
+ * is applied. */
4315
+ animationLast = 0;
4316
+ nextAnimationLast = 0;
4317
+ /** Seconds to postpone playing the animation. When this track entry is the current track entry, `delay`
4318
+ * postpones incrementing the {@link #trackTime}. When this track entry is queued, `delay` is the time from
4319
+ * the start of the previous animation to when this track entry will become the current track entry (ie when the previous
4320
+ * track entry {@link TrackEntry#trackTime} >= this track entry's `delay`).
4321
+ *
4322
+ * {@link #timeScale} affects the delay. */
4323
+ delay = 0;
4324
+ /** Current time in seconds this track entry has been the current track entry. The track time determines
4325
+ * {@link #animationTime}. The track time can be set to start the animation at a time other than 0, without affecting
4326
+ * looping. */
4327
+ trackTime = 0;
4328
+ trackLast = 0;
4329
+ nextTrackLast = 0;
4330
+ /** The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float
4331
+ * value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time
4332
+ * is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the
4333
+ * properties keyed by the animation are set to the setup pose and the track is cleared.
4334
+ *
4335
+ * It may be desired to use {@link AnimationState#addEmptyAnimation()} rather than have the animation
4336
+ * abruptly cease being applied. */
4337
+ trackEnd = 0;
4338
+ /** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
4339
+ * faster. Defaults to 1.
4340
+ *
4341
+ * {@link #mixTime} is not affected by track entry time scale, so {@link #mixDuration} may need to be adjusted to
4342
+ * match the animation speed.
4343
+ *
4344
+ * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
4345
+ * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, assuming time scale to be 1. If
4346
+ * the time scale is not 1, the delay may need to be adjusted.
4347
+ *
4348
+ * See AnimationState {@link AnimationState#timeScale} for affecting all animations. */
4349
+ timeScale = 0;
4350
+ /** Values < 1 mix this animation with the skeleton's current pose (usually the pose resulting from lower tracks). Defaults
4351
+ * to 1, which overwrites the skeleton's current pose with this animation.
4352
+ *
4353
+ * Typically track 0 is used to completely pose the skeleton, then alpha is used on higher tracks. It doesn't make sense to
4354
+ * use alpha on track 0 if the skeleton pose is from the last frame render. */
4355
+ alpha = 0;
4356
+ /** Seconds from 0 to the {@link #getMixDuration()} when mixing from the previous animation to this animation. May be
4357
+ * slightly more than `mixDuration` when the mix is complete. */
4358
+ mixTime = 0;
4359
+ /** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by AnimationStateData
4360
+ * {@link AnimationStateData#getMix()} based on the animation before this animation (if any).
4361
+ *
4362
+ * A mix duration of 0 still mixes out over one frame to provide the track entry being mixed out a chance to revert the
4363
+ * properties it was animating.
4364
+ *
4365
+ * The `mixDuration` can be set manually rather than use the value from
4366
+ * {@link AnimationStateData#getMix()}. In that case, the `mixDuration` can be set for a new
4367
+ * track entry only before {@link AnimationState#update(float)} is first called.
4368
+ *
4369
+ * When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
4370
+ * {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set
4371
+ * afterward. */
4372
+ _mixDuration = 0;
4373
+ interruptAlpha = 0;
4374
+ totalAlpha = 0;
4375
+ get mixDuration() {
4376
+ return this._mixDuration;
4377
+ }
4378
+ set mixDuration(mixDuration) {
4379
+ this._mixDuration = mixDuration;
4380
+ if (this.previous != null && this.delay <= 0)
4381
+ this.delay += this.previous.getTrackComplete() - mixDuration;
4382
+ this.delay = this.delay;
4383
+ }
4384
+ /** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
4385
+ * replaces the values from the lower tracks with the animation values. {@link MixBlend#add} adds the animation values to
4386
+ * the values from the lower tracks.
4387
+ *
4388
+ * The `mixBlend` can be set for a new track entry only before {@link AnimationState#apply()} is first
4389
+ * called. */
4390
+ mixBlend = 2 /* replace */;
4391
+ timelineMode = new Array();
4392
+ timelineHoldMix = new Array();
4393
+ timelinesRotation = new Array();
4297
4394
  reset() {
4298
4395
  this.next = null;
4299
4396
  this.previous = null;
@@ -4347,11 +4444,18 @@ var spine = (() => {
4347
4444
  }
4348
4445
  return this.trackTime;
4349
4446
  }
4447
+ /** Returns true if this track entry has been applied at least once.
4448
+ * <p>
4449
+ * See {@link AnimationState#apply(Skeleton)}. */
4450
+ wasApplied() {
4451
+ return this.nextTrackLast != -1;
4452
+ }
4350
4453
  };
4351
4454
  var EventQueue = class {
4455
+ objects = [];
4456
+ drainDisabled = false;
4457
+ animState;
4352
4458
  constructor(animState) {
4353
- this.objects = [];
4354
- this.drainDisabled = false;
4355
4459
  this.animState = animState;
4356
4460
  }
4357
4461
  start(entry) {
@@ -4488,10 +4592,12 @@ var spine = (() => {
4488
4592
 
4489
4593
  // spine-core/src/AnimationStateData.ts
4490
4594
  var AnimationStateData = class {
4595
+ /** The SkeletonData to look up animations when they are specified by name. */
4596
+ skeletonData;
4597
+ animationToMixTime = {};
4598
+ /** The mix duration to use when no mix duration has been defined between two animations. */
4599
+ defaultMix = 0;
4491
4600
  constructor(skeletonData) {
4492
- this.animationToMixTime = {};
4493
- /** The mix duration to use when no mix duration has been defined between two animations. */
4494
- this.defaultMix = 0;
4495
4601
  if (!skeletonData)
4496
4602
  throw new Error("skeletonData cannot be null.");
4497
4603
  this.skeletonData = skeletonData;
@@ -4530,9 +4636,9 @@ var spine = (() => {
4530
4636
 
4531
4637
  // spine-core/src/attachments/BoundingBoxAttachment.ts
4532
4638
  var BoundingBoxAttachment = class extends VertexAttachment {
4639
+ color = new Color(1, 1, 1, 1);
4533
4640
  constructor(name) {
4534
4641
  super(name);
4535
- this.color = new Color(1, 1, 1, 1);
4536
4642
  }
4537
4643
  copy() {
4538
4644
  let copy = new BoundingBoxAttachment(this.name);
@@ -4544,16 +4650,16 @@ var spine = (() => {
4544
4650
 
4545
4651
  // spine-core/src/attachments/ClippingAttachment.ts
4546
4652
  var ClippingAttachment = class extends VertexAttachment {
4653
+ /** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
4654
+ * the skeleton's rendering. */
4655
+ endSlot = null;
4656
+ // Nonessential.
4657
+ /** The color of the clipping polygon as it was in Spine. Available only when nonessential data was exported. Clipping polygons
4658
+ * are not usually rendered at runtime. */
4659
+ color = new Color(0.2275, 0.2275, 0.8078, 1);
4547
4660
  // ce3a3aff
4548
4661
  constructor(name) {
4549
4662
  super(name);
4550
- /** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
4551
- * the skeleton's rendering. */
4552
- this.endSlot = null;
4553
- // Nonessential.
4554
- /** The color of the clipping polygon as it was in Spine. Available only when nonessential data was exported. Clipping polygons
4555
- * are not usually rendered at runtime. */
4556
- this.color = new Color(0.2275, 0.2275, 0.8078, 1);
4557
4663
  }
4558
4664
  copy() {
4559
4665
  let copy = new ClippingAttachment(this.name);
@@ -4566,6 +4672,7 @@ var spine = (() => {
4566
4672
 
4567
4673
  // spine-core/src/Texture.ts
4568
4674
  var Texture = class {
4675
+ _image;
4569
4676
  constructor(image) {
4570
4677
  this._image = image;
4571
4678
  }
@@ -4590,19 +4697,18 @@ var spine = (() => {
4590
4697
  return TextureWrap3;
4591
4698
  })(TextureWrap || {});
4592
4699
  var TextureRegion = class {
4593
- constructor() {
4594
- this.u = 0;
4595
- this.v = 0;
4596
- this.u2 = 0;
4597
- this.v2 = 0;
4598
- this.width = 0;
4599
- this.height = 0;
4600
- this.degrees = 0;
4601
- this.offsetX = 0;
4602
- this.offsetY = 0;
4603
- this.originalWidth = 0;
4604
- this.originalHeight = 0;
4605
- }
4700
+ texture;
4701
+ u = 0;
4702
+ v = 0;
4703
+ u2 = 0;
4704
+ v2 = 0;
4705
+ width = 0;
4706
+ height = 0;
4707
+ degrees = 0;
4708
+ offsetX = 0;
4709
+ offsetY = 0;
4710
+ originalWidth = 0;
4711
+ originalHeight = 0;
4606
4712
  };
4607
4713
  var FakeTexture = class extends Texture {
4608
4714
  setFilters(minFilter, magFilter) {
@@ -4615,9 +4721,9 @@ var spine = (() => {
4615
4721
 
4616
4722
  // spine-core/src/TextureAtlas.ts
4617
4723
  var TextureAtlas = class {
4724
+ pages = new Array();
4725
+ regions = new Array();
4618
4726
  constructor(atlasText) {
4619
- this.pages = new Array();
4620
- this.regions = new Array();
4621
4727
  let reader = new TextureAtlasReader(atlasText);
4622
4728
  let entry = new Array(4);
4623
4729
  let pageFields = {};
@@ -4765,15 +4871,15 @@ var spine = (() => {
4765
4871
  page.setTexture(assetManager.get(pathPrefix + page.name));
4766
4872
  }
4767
4873
  dispose() {
4768
- var _a;
4769
4874
  for (let i = 0; i < this.pages.length; i++) {
4770
- (_a = this.pages[i].texture) == null ? void 0 : _a.dispose();
4875
+ this.pages[i].texture?.dispose();
4771
4876
  }
4772
4877
  }
4773
4878
  };
4774
4879
  var TextureAtlasReader = class {
4880
+ lines;
4881
+ index = 0;
4775
4882
  constructor(text) {
4776
- this.index = 0;
4777
4883
  this.lines = text.split(/\r\n|\r|\n/);
4778
4884
  }
4779
4885
  readLine() {
@@ -4805,16 +4911,17 @@ var spine = (() => {
4805
4911
  }
4806
4912
  };
4807
4913
  var TextureAtlasPage = class {
4914
+ name;
4915
+ minFilter = 9728 /* Nearest */;
4916
+ magFilter = 9728 /* Nearest */;
4917
+ uWrap = 33071 /* ClampToEdge */;
4918
+ vWrap = 33071 /* ClampToEdge */;
4919
+ texture = null;
4920
+ width = 0;
4921
+ height = 0;
4922
+ pma = false;
4923
+ regions = new Array();
4808
4924
  constructor(name) {
4809
- this.minFilter = 9728 /* Nearest */;
4810
- this.magFilter = 9728 /* Nearest */;
4811
- this.uWrap = 33071 /* ClampToEdge */;
4812
- this.vWrap = 33071 /* ClampToEdge */;
4813
- this.texture = null;
4814
- this.width = 0;
4815
- this.height = 0;
4816
- this.pma = false;
4817
- this.regions = new Array();
4818
4925
  this.name = name;
4819
4926
  }
4820
4927
  setTexture(texture) {
@@ -4826,18 +4933,20 @@ var spine = (() => {
4826
4933
  }
4827
4934
  };
4828
4935
  var TextureAtlasRegion = class extends TextureRegion {
4936
+ page;
4937
+ name;
4938
+ x = 0;
4939
+ y = 0;
4940
+ offsetX = 0;
4941
+ offsetY = 0;
4942
+ originalWidth = 0;
4943
+ originalHeight = 0;
4944
+ index = 0;
4945
+ degrees = 0;
4946
+ names = null;
4947
+ values = null;
4829
4948
  constructor(page, name) {
4830
4949
  super();
4831
- this.x = 0;
4832
- this.y = 0;
4833
- this.offsetX = 0;
4834
- this.offsetY = 0;
4835
- this.originalWidth = 0;
4836
- this.originalHeight = 0;
4837
- this.index = 0;
4838
- this.degrees = 0;
4839
- this.names = null;
4840
- this.values = null;
4841
4950
  this.page = page;
4842
4951
  this.name = name;
4843
4952
  page.regions.push(this);
@@ -4846,31 +4955,33 @@ var spine = (() => {
4846
4955
 
4847
4956
  // spine-core/src/attachments/MeshAttachment.ts
4848
4957
  var MeshAttachment = class extends VertexAttachment {
4958
+ region = null;
4959
+ /** The name of the texture region for this attachment. */
4960
+ path;
4961
+ /** The UV pair for each vertex, normalized within the texture region. */
4962
+ regionUVs = [];
4963
+ /** The UV pair for each vertex, normalized within the entire texture.
4964
+ *
4965
+ * See {@link #updateUVs}. */
4966
+ uvs = [];
4967
+ /** Triplets of vertex indices which describe the mesh's triangulation. */
4968
+ triangles = [];
4969
+ /** The color to tint the mesh. */
4970
+ color = new Color(1, 1, 1, 1);
4971
+ /** The width of the mesh's image. Available only when nonessential data was exported. */
4972
+ width = 0;
4973
+ /** The height of the mesh's image. Available only when nonessential data was exported. */
4974
+ height = 0;
4975
+ /** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */
4976
+ hullLength = 0;
4977
+ /** Vertex index pairs describing edges for controling triangulation. Mesh triangles will never cross edges. Only available if
4978
+ * nonessential data was exported. Triangulation is not performed at runtime. */
4979
+ edges = [];
4980
+ parentMesh = null;
4981
+ sequence = null;
4982
+ tempColor = new Color(0, 0, 0, 0);
4849
4983
  constructor(name, path) {
4850
4984
  super(name);
4851
- this.region = null;
4852
- /** The UV pair for each vertex, normalized within the texture region. */
4853
- this.regionUVs = [];
4854
- /** The UV pair for each vertex, normalized within the entire texture.
4855
- *
4856
- * See {@link #updateUVs}. */
4857
- this.uvs = [];
4858
- /** Triplets of vertex indices which describe the mesh's triangulation. */
4859
- this.triangles = [];
4860
- /** The color to tint the mesh. */
4861
- this.color = new Color(1, 1, 1, 1);
4862
- /** The width of the mesh's image. Available only when nonessential data was exported. */
4863
- this.width = 0;
4864
- /** The height of the mesh's image. Available only when nonessential data was exported. */
4865
- this.height = 0;
4866
- /** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */
4867
- this.hullLength = 0;
4868
- /** Vertex index pairs describing edges for controling triangulation. Mesh triangles will never cross edges. Only available if
4869
- * nonessential data was exported. Triangulation is not performed at runtime. */
4870
- this.edges = [];
4871
- this.parentMesh = null;
4872
- this.sequence = null;
4873
- this.tempColor = new Color(0, 0, 0, 0);
4874
4985
  this.path = path;
4875
4986
  }
4876
4987
  /** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or
@@ -4997,18 +5108,18 @@ var spine = (() => {
4997
5108
 
4998
5109
  // spine-core/src/attachments/PathAttachment.ts
4999
5110
  var PathAttachment = class extends VertexAttachment {
5111
+ /** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
5112
+ lengths = [];
5113
+ /** If true, the start and end knots are connected. */
5114
+ closed = false;
5115
+ /** If true, additional calculations are performed to make calculating positions along the path more accurate. If false, fewer
5116
+ * calculations are performed but calculating positions along the path is less accurate. */
5117
+ constantSpeed = false;
5118
+ /** The color of the path as it was in Spine. Available only when nonessential data was exported. Paths are not usually
5119
+ * rendered at runtime. */
5120
+ color = new Color(1, 1, 1, 1);
5000
5121
  constructor(name) {
5001
5122
  super(name);
5002
- /** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
5003
- this.lengths = [];
5004
- /** If true, the start and end knots are connected. */
5005
- this.closed = false;
5006
- /** If true, additional calculations are performed to make calculating positions along the path more accurate. If false, fewer
5007
- * calculations are performed but calculating positions along the path is less accurate. */
5008
- this.constantSpeed = false;
5009
- /** The color of the path as it was in Spine. Available only when nonessential data was exported. Paths are not usually
5010
- * rendered at runtime. */
5011
- this.color = new Color(1, 1, 1, 1);
5012
5123
  }
5013
5124
  copy() {
5014
5125
  let copy = new PathAttachment(this.name);
@@ -5024,14 +5135,14 @@ var spine = (() => {
5024
5135
 
5025
5136
  // spine-core/src/attachments/PointAttachment.ts
5026
5137
  var PointAttachment = class extends VertexAttachment {
5138
+ x = 0;
5139
+ y = 0;
5140
+ rotation = 0;
5141
+ /** The color of the point attachment as it was in Spine. Available only when nonessential data was exported. Point attachments
5142
+ * are not usually rendered at runtime. */
5143
+ color = new Color(0.38, 0.94, 0, 1);
5027
5144
  constructor(name) {
5028
5145
  super(name);
5029
- this.x = 0;
5030
- this.y = 0;
5031
- this.rotation = 0;
5032
- /** The color of the point attachment as it was in Spine. Available only when nonessential data was exported. Point attachments
5033
- * are not usually rendered at runtime. */
5034
- this.color = new Color(0.38, 0.94, 0, 1);
5035
5146
  }
5036
5147
  computeWorldPosition(bone, point) {
5037
5148
  point.x = this.x * bone.a + this.y * bone.b + bone.worldX;
@@ -5039,10 +5150,10 @@ var spine = (() => {
5039
5150
  return point;
5040
5151
  }
5041
5152
  computeWorldRotation(bone) {
5042
- let cos = MathUtils.cosDeg(this.rotation), sin = MathUtils.sinDeg(this.rotation);
5043
- let x = cos * bone.a + sin * bone.b;
5044
- let y = cos * bone.c + sin * bone.d;
5045
- return Math.atan2(y, x) * MathUtils.radDeg;
5153
+ const r = this.rotation * MathUtils.degRad, cos = Math.cos(r), sin = Math.sin(r);
5154
+ const x = cos * bone.a + sin * bone.b;
5155
+ const y = cos * bone.c + sin * bone.d;
5156
+ return MathUtils.atan2Deg(y, x);
5046
5157
  }
5047
5158
  copy() {
5048
5159
  let copy = new PointAttachment(this.name);
@@ -5056,32 +5167,34 @@ var spine = (() => {
5056
5167
 
5057
5168
  // spine-core/src/attachments/RegionAttachment.ts
5058
5169
  var _RegionAttachment = class extends Attachment {
5170
+ /** The local x translation. */
5171
+ x = 0;
5172
+ /** The local y translation. */
5173
+ y = 0;
5174
+ /** The local scaleX. */
5175
+ scaleX = 1;
5176
+ /** The local scaleY. */
5177
+ scaleY = 1;
5178
+ /** The local rotation. */
5179
+ rotation = 0;
5180
+ /** The width of the region attachment in Spine. */
5181
+ width = 0;
5182
+ /** The height of the region attachment in Spine. */
5183
+ height = 0;
5184
+ /** The color to tint the region attachment. */
5185
+ color = new Color(1, 1, 1, 1);
5186
+ /** The name of the texture region for this attachment. */
5187
+ path;
5188
+ region = null;
5189
+ sequence = null;
5190
+ /** For each of the 4 vertices, a pair of <code>x,y</code> values that is the local position of the vertex.
5191
+ *
5192
+ * See {@link #updateOffset()}. */
5193
+ offset = Utils.newFloatArray(8);
5194
+ uvs = Utils.newFloatArray(8);
5195
+ tempColor = new Color(1, 1, 1, 1);
5059
5196
  constructor(name, path) {
5060
5197
  super(name);
5061
- /** The local x translation. */
5062
- this.x = 0;
5063
- /** The local y translation. */
5064
- this.y = 0;
5065
- /** The local scaleX. */
5066
- this.scaleX = 1;
5067
- /** The local scaleY. */
5068
- this.scaleY = 1;
5069
- /** The local rotation. */
5070
- this.rotation = 0;
5071
- /** The width of the region attachment in Spine. */
5072
- this.width = 0;
5073
- /** The height of the region attachment in Spine. */
5074
- this.height = 0;
5075
- /** The color to tint the region attachment. */
5076
- this.color = new Color(1, 1, 1, 1);
5077
- this.region = null;
5078
- this.sequence = null;
5079
- /** For each of the 4 vertices, a pair of <code>x,y</code> values that is the local position of the vertex.
5080
- *
5081
- * See {@link #updateOffset()}. */
5082
- this.offset = Utils.newFloatArray(8);
5083
- this.uvs = Utils.newFloatArray(8);
5084
- this.tempColor = new Color(1, 1, 1, 1);
5085
5198
  this.path = path;
5086
5199
  }
5087
5200
  /** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */
@@ -5107,7 +5220,7 @@ var spine = (() => {
5107
5220
  let localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
5108
5221
  let localX2 = localX + this.region.width * regionScaleX;
5109
5222
  let localY2 = localY + this.region.height * regionScaleY;
5110
- let radians = this.rotation * Math.PI / 180;
5223
+ let radians = this.rotation * MathUtils.degRad;
5111
5224
  let cos = Math.cos(radians);
5112
5225
  let sin = Math.sin(radians);
5113
5226
  let x = this.x, y = this.y;
@@ -5202,41 +5315,42 @@ var spine = (() => {
5202
5315
  }
5203
5316
  };
5204
5317
  var RegionAttachment = _RegionAttachment;
5205
- RegionAttachment.X1 = 0;
5206
- RegionAttachment.Y1 = 1;
5207
- RegionAttachment.C1R = 2;
5208
- RegionAttachment.C1G = 3;
5209
- RegionAttachment.C1B = 4;
5210
- RegionAttachment.C1A = 5;
5211
- RegionAttachment.U1 = 6;
5212
- RegionAttachment.V1 = 7;
5213
- RegionAttachment.X2 = 8;
5214
- RegionAttachment.Y2 = 9;
5215
- RegionAttachment.C2R = 10;
5216
- RegionAttachment.C2G = 11;
5217
- RegionAttachment.C2B = 12;
5218
- RegionAttachment.C2A = 13;
5219
- RegionAttachment.U2 = 14;
5220
- RegionAttachment.V2 = 15;
5221
- RegionAttachment.X3 = 16;
5222
- RegionAttachment.Y3 = 17;
5223
- RegionAttachment.C3R = 18;
5224
- RegionAttachment.C3G = 19;
5225
- RegionAttachment.C3B = 20;
5226
- RegionAttachment.C3A = 21;
5227
- RegionAttachment.U3 = 22;
5228
- RegionAttachment.V3 = 23;
5229
- RegionAttachment.X4 = 24;
5230
- RegionAttachment.Y4 = 25;
5231
- RegionAttachment.C4R = 26;
5232
- RegionAttachment.C4G = 27;
5233
- RegionAttachment.C4B = 28;
5234
- RegionAttachment.C4A = 29;
5235
- RegionAttachment.U4 = 30;
5236
- RegionAttachment.V4 = 31;
5318
+ __publicField(RegionAttachment, "X1", 0);
5319
+ __publicField(RegionAttachment, "Y1", 1);
5320
+ __publicField(RegionAttachment, "C1R", 2);
5321
+ __publicField(RegionAttachment, "C1G", 3);
5322
+ __publicField(RegionAttachment, "C1B", 4);
5323
+ __publicField(RegionAttachment, "C1A", 5);
5324
+ __publicField(RegionAttachment, "U1", 6);
5325
+ __publicField(RegionAttachment, "V1", 7);
5326
+ __publicField(RegionAttachment, "X2", 8);
5327
+ __publicField(RegionAttachment, "Y2", 9);
5328
+ __publicField(RegionAttachment, "C2R", 10);
5329
+ __publicField(RegionAttachment, "C2G", 11);
5330
+ __publicField(RegionAttachment, "C2B", 12);
5331
+ __publicField(RegionAttachment, "C2A", 13);
5332
+ __publicField(RegionAttachment, "U2", 14);
5333
+ __publicField(RegionAttachment, "V2", 15);
5334
+ __publicField(RegionAttachment, "X3", 16);
5335
+ __publicField(RegionAttachment, "Y3", 17);
5336
+ __publicField(RegionAttachment, "C3R", 18);
5337
+ __publicField(RegionAttachment, "C3G", 19);
5338
+ __publicField(RegionAttachment, "C3B", 20);
5339
+ __publicField(RegionAttachment, "C3A", 21);
5340
+ __publicField(RegionAttachment, "U3", 22);
5341
+ __publicField(RegionAttachment, "V3", 23);
5342
+ __publicField(RegionAttachment, "X4", 24);
5343
+ __publicField(RegionAttachment, "Y4", 25);
5344
+ __publicField(RegionAttachment, "C4R", 26);
5345
+ __publicField(RegionAttachment, "C4G", 27);
5346
+ __publicField(RegionAttachment, "C4B", 28);
5347
+ __publicField(RegionAttachment, "C4A", 29);
5348
+ __publicField(RegionAttachment, "U4", 30);
5349
+ __publicField(RegionAttachment, "V4", 31);
5237
5350
 
5238
5351
  // spine-core/src/AtlasAttachmentLoader.ts
5239
5352
  var AtlasAttachmentLoader = class {
5353
+ atlas;
5240
5354
  constructor(atlas) {
5241
5355
  this.atlas = atlas;
5242
5356
  }
@@ -5290,36 +5404,42 @@ var spine = (() => {
5290
5404
 
5291
5405
  // spine-core/src/BoneData.ts
5292
5406
  var BoneData = class {
5407
+ /** The index of the bone in {@link Skeleton#getBones()}. */
5408
+ index = 0;
5409
+ /** The name of the bone, which is unique across all bones in the skeleton. */
5410
+ name;
5411
+ /** @returns May be null. */
5412
+ parent = null;
5413
+ /** The bone's length. */
5414
+ length = 0;
5415
+ /** The local x translation. */
5416
+ x = 0;
5417
+ /** The local y translation. */
5418
+ y = 0;
5419
+ /** The local rotation in degrees, counter clockwise. */
5420
+ rotation = 0;
5421
+ /** The local scaleX. */
5422
+ scaleX = 1;
5423
+ /** The local scaleY. */
5424
+ scaleY = 1;
5425
+ /** The local shearX. */
5426
+ shearX = 0;
5427
+ /** The local shearX. */
5428
+ shearY = 0;
5429
+ /** The transform mode for how parent world transforms affect this bone. */
5430
+ transformMode = TransformMode.Normal;
5431
+ /** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
5432
+ * bone.
5433
+ * @see Skin#bones */
5434
+ skinRequired = false;
5435
+ /** The color of the bone as it was in Spine. Available only when nonessential data was exported. Bones are not usually
5436
+ * rendered at runtime. */
5437
+ color = new Color();
5438
+ /** The bone icon as it was in Spine, or null if nonessential data was not exported. */
5439
+ icon;
5440
+ /** False if the bone was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
5441
+ visible = false;
5293
5442
  constructor(index, name, parent) {
5294
- /** The index of the bone in {@link Skeleton#getBones()}. */
5295
- this.index = 0;
5296
- /** @returns May be null. */
5297
- this.parent = null;
5298
- /** The bone's length. */
5299
- this.length = 0;
5300
- /** The local x translation. */
5301
- this.x = 0;
5302
- /** The local y translation. */
5303
- this.y = 0;
5304
- /** The local rotation. */
5305
- this.rotation = 0;
5306
- /** The local scaleX. */
5307
- this.scaleX = 1;
5308
- /** The local scaleY. */
5309
- this.scaleY = 1;
5310
- /** The local shearX. */
5311
- this.shearX = 0;
5312
- /** The local shearX. */
5313
- this.shearY = 0;
5314
- /** The transform mode for how parent world transforms affect this bone. */
5315
- this.transformMode = TransformMode.Normal;
5316
- /** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
5317
- * bone.
5318
- * @see Skin#bones */
5319
- this.skinRequired = false;
5320
- /** The color of the bone as it was in Spine. Available only when nonessential data was exported. Bones are not usually
5321
- * rendered at runtime. */
5322
- this.color = new Color();
5323
5443
  if (index < 0)
5324
5444
  throw new Error("index must be >= 0.");
5325
5445
  if (!name)
@@ -5340,54 +5460,58 @@ var spine = (() => {
5340
5460
 
5341
5461
  // spine-core/src/Bone.ts
5342
5462
  var Bone = class {
5463
+ /** The bone's setup pose data. */
5464
+ data;
5465
+ /** The skeleton this bone belongs to. */
5466
+ skeleton;
5467
+ /** The parent bone, or null if this is the root bone. */
5468
+ parent = null;
5469
+ /** The immediate children of this bone. */
5470
+ children = new Array();
5471
+ /** The local x translation. */
5472
+ x = 0;
5473
+ /** The local y translation. */
5474
+ y = 0;
5475
+ /** The local rotation in degrees, counter clockwise. */
5476
+ rotation = 0;
5477
+ /** The local scaleX. */
5478
+ scaleX = 0;
5479
+ /** The local scaleY. */
5480
+ scaleY = 0;
5481
+ /** The local shearX. */
5482
+ shearX = 0;
5483
+ /** The local shearY. */
5484
+ shearY = 0;
5485
+ /** The applied local x translation. */
5486
+ ax = 0;
5487
+ /** The applied local y translation. */
5488
+ ay = 0;
5489
+ /** The applied local rotation in degrees, counter clockwise. */
5490
+ arotation = 0;
5491
+ /** The applied local scaleX. */
5492
+ ascaleX = 0;
5493
+ /** The applied local scaleY. */
5494
+ ascaleY = 0;
5495
+ /** The applied local shearX. */
5496
+ ashearX = 0;
5497
+ /** The applied local shearY. */
5498
+ ashearY = 0;
5499
+ /** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
5500
+ a = 0;
5501
+ /** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
5502
+ b = 0;
5503
+ /** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
5504
+ c = 0;
5505
+ /** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
5506
+ d = 0;
5507
+ /** The world X position. If changed, {@link #updateAppliedTransform()} should be called. */
5508
+ worldY = 0;
5509
+ /** The world Y position. If changed, {@link #updateAppliedTransform()} should be called. */
5510
+ worldX = 0;
5511
+ sorted = false;
5512
+ active = false;
5343
5513
  /** @param parent May be null. */
5344
5514
  constructor(data, skeleton, parent) {
5345
- /** The parent bone, or null if this is the root bone. */
5346
- this.parent = null;
5347
- /** The immediate children of this bone. */
5348
- this.children = new Array();
5349
- /** The local x translation. */
5350
- this.x = 0;
5351
- /** The local y translation. */
5352
- this.y = 0;
5353
- /** The local rotation in degrees, counter clockwise. */
5354
- this.rotation = 0;
5355
- /** The local scaleX. */
5356
- this.scaleX = 0;
5357
- /** The local scaleY. */
5358
- this.scaleY = 0;
5359
- /** The local shearX. */
5360
- this.shearX = 0;
5361
- /** The local shearY. */
5362
- this.shearY = 0;
5363
- /** The applied local x translation. */
5364
- this.ax = 0;
5365
- /** The applied local y translation. */
5366
- this.ay = 0;
5367
- /** The applied local rotation in degrees, counter clockwise. */
5368
- this.arotation = 0;
5369
- /** The applied local scaleX. */
5370
- this.ascaleX = 0;
5371
- /** The applied local scaleY. */
5372
- this.ascaleY = 0;
5373
- /** The applied local shearX. */
5374
- this.ashearX = 0;
5375
- /** The applied local shearY. */
5376
- this.ashearY = 0;
5377
- /** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
5378
- this.a = 0;
5379
- /** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
5380
- this.b = 0;
5381
- /** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
5382
- this.c = 0;
5383
- /** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
5384
- this.d = 0;
5385
- /** The world X position. If changed, {@link #updateAppliedTransform()} should be called. */
5386
- this.worldY = 0;
5387
- /** The world Y position. If changed, {@link #updateAppliedTransform()} should be called. */
5388
- this.worldX = 0;
5389
- this.sorted = false;
5390
- this.active = false;
5391
5515
  if (!data)
5392
5516
  throw new Error("data cannot be null.");
5393
5517
  if (!skeleton)
@@ -5403,7 +5527,7 @@ var spine = (() => {
5403
5527
  return this.active;
5404
5528
  }
5405
5529
  /** Computes the world transform using the parent bone and this bone's local applied transform. */
5406
- update() {
5530
+ update(physics) {
5407
5531
  this.updateWorldTransformWith(this.ax, this.ay, this.arotation, this.ascaleX, this.ascaleY, this.ashearX, this.ashearY);
5408
5532
  }
5409
5533
  /** Computes the world transform using the parent bone and this bone's local transform.
@@ -5428,13 +5552,13 @@ var spine = (() => {
5428
5552
  let parent = this.parent;
5429
5553
  if (!parent) {
5430
5554
  let skeleton = this.skeleton;
5431
- let rotationY = rotation + 90 + shearY;
5432
- let sx = skeleton.scaleX;
5433
- let sy = skeleton.scaleY;
5434
- this.a = MathUtils.cosDeg(rotation + shearX) * scaleX * sx;
5435
- this.b = MathUtils.cosDeg(rotationY) * scaleY * sx;
5436
- this.c = MathUtils.sinDeg(rotation + shearX) * scaleX * sy;
5437
- this.d = MathUtils.sinDeg(rotationY) * scaleY * sy;
5555
+ const sx = skeleton.scaleX, sy = skeleton.scaleY;
5556
+ const rx = (rotation + shearX) * MathUtils.degRad;
5557
+ const ry = (rotation + 90 + shearY) * MathUtils.degRad;
5558
+ this.a = Math.cos(rx) * scaleX * sx;
5559
+ this.b = Math.cos(ry) * scaleY * sx;
5560
+ this.c = Math.sin(rx) * scaleX * sy;
5561
+ this.d = Math.sin(ry) * scaleY * sy;
5438
5562
  this.worldX = x * sx + skeleton.x;
5439
5563
  this.worldY = y * sy + skeleton.y;
5440
5564
  return;
@@ -5444,11 +5568,12 @@ var spine = (() => {
5444
5568
  this.worldY = pc * x + pd * y + parent.worldY;
5445
5569
  switch (this.data.transformMode) {
5446
5570
  case 0 /* Normal */: {
5447
- let rotationY = rotation + 90 + shearY;
5448
- let la = MathUtils.cosDeg(rotation + shearX) * scaleX;
5449
- let lb = MathUtils.cosDeg(rotationY) * scaleY;
5450
- let lc = MathUtils.sinDeg(rotation + shearX) * scaleX;
5451
- let ld = MathUtils.sinDeg(rotationY) * scaleY;
5571
+ const rx = (rotation + shearX) * MathUtils.degRad;
5572
+ const ry = (rotation + 90 + shearY) * MathUtils.degRad;
5573
+ const la = Math.cos(rx) * scaleX;
5574
+ const lb = Math.cos(ry) * scaleY;
5575
+ const lc = Math.sin(rx) * scaleX;
5576
+ const ld = Math.sin(ry) * scaleY;
5452
5577
  this.a = pa * la + pb * lc;
5453
5578
  this.b = pa * lb + pb * ld;
5454
5579
  this.c = pc * la + pd * lc;
@@ -5456,11 +5581,12 @@ var spine = (() => {
5456
5581
  return;
5457
5582
  }
5458
5583
  case 1 /* OnlyTranslation */: {
5459
- let rotationY = rotation + 90 + shearY;
5460
- this.a = MathUtils.cosDeg(rotation + shearX) * scaleX;
5461
- this.b = MathUtils.cosDeg(rotationY) * scaleY;
5462
- this.c = MathUtils.sinDeg(rotation + shearX) * scaleX;
5463
- this.d = MathUtils.sinDeg(rotationY) * scaleY;
5584
+ const rx = (rotation + shearX) * MathUtils.degRad;
5585
+ const ry = (rotation + 90 + shearY) * MathUtils.degRad;
5586
+ this.a = Math.cos(rx) * scaleX;
5587
+ this.b = Math.cos(ry) * scaleY;
5588
+ this.c = Math.sin(rx) * scaleX;
5589
+ this.d = Math.sin(ry) * scaleY;
5464
5590
  break;
5465
5591
  }
5466
5592
  case 2 /* NoRotationOrReflection */: {
@@ -5478,12 +5604,12 @@ var spine = (() => {
5478
5604
  pc = 0;
5479
5605
  prx = 90 - Math.atan2(pd, pb) * MathUtils.radDeg;
5480
5606
  }
5481
- let rx = rotation + shearX - prx;
5482
- let ry = rotation + shearY - prx + 90;
5483
- let la = MathUtils.cosDeg(rx) * scaleX;
5484
- let lb = MathUtils.cosDeg(ry) * scaleY;
5485
- let lc = MathUtils.sinDeg(rx) * scaleX;
5486
- let ld = MathUtils.sinDeg(ry) * scaleY;
5607
+ const rx = (rotation + shearX - prx) * MathUtils.degRad;
5608
+ const ry = (rotation + shearY - prx + 90) * MathUtils.degRad;
5609
+ const la = Math.cos(rx) * scaleX;
5610
+ const lb = Math.cos(ry) * scaleY;
5611
+ const lc = Math.sin(rx) * scaleX;
5612
+ const ld = Math.sin(ry) * scaleY;
5487
5613
  this.a = pa * la - pb * lc;
5488
5614
  this.b = pa * lb - pb * ld;
5489
5615
  this.c = pc * la + pd * lc;
@@ -5492,8 +5618,8 @@ var spine = (() => {
5492
5618
  }
5493
5619
  case 3 /* NoScale */:
5494
5620
  case 4 /* NoScaleOrReflection */: {
5495
- let cos = MathUtils.cosDeg(rotation);
5496
- let sin = MathUtils.sinDeg(rotation);
5621
+ rotation *= MathUtils.degRad;
5622
+ const cos = Math.cos(rotation), sin = Math.sin(rotation);
5497
5623
  let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
5498
5624
  let zc = (pc * cos + pd * sin) / this.skeleton.scaleY;
5499
5625
  let s = Math.sqrt(za * za + zc * zc);
@@ -5504,13 +5630,15 @@ var spine = (() => {
5504
5630
  s = Math.sqrt(za * za + zc * zc);
5505
5631
  if (this.data.transformMode == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
5506
5632
  s = -s;
5507
- let r = Math.PI / 2 + Math.atan2(zc, za);
5508
- let zb = Math.cos(r) * s;
5509
- let zd = Math.sin(r) * s;
5510
- let la = MathUtils.cosDeg(shearX) * scaleX;
5511
- let lb = MathUtils.cosDeg(90 + shearY) * scaleY;
5512
- let lc = MathUtils.sinDeg(shearX) * scaleX;
5513
- let ld = MathUtils.sinDeg(90 + shearY) * scaleY;
5633
+ rotation = Math.PI / 2 + Math.atan2(zc, za);
5634
+ const zb = Math.cos(rotation) * s;
5635
+ const zd = Math.sin(rotation) * s;
5636
+ shearX *= MathUtils.degRad;
5637
+ shearY = (90 + shearY) * MathUtils.degRad;
5638
+ const la = Math.cos(shearX) * scaleX;
5639
+ const lb = Math.cos(shearY) * scaleY;
5640
+ const lc = Math.sin(shearX) * scaleX;
5641
+ const ld = Math.sin(shearY) * scaleY;
5514
5642
  this.a = za * la + zb * lc;
5515
5643
  this.b = za * lb + zb * ld;
5516
5644
  this.c = zc * la + zd * lc;
@@ -5534,22 +5662,6 @@ var spine = (() => {
5534
5662
  this.shearX = data.shearX;
5535
5663
  this.shearY = data.shearY;
5536
5664
  }
5537
- /** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */
5538
- getWorldRotationX() {
5539
- return Math.atan2(this.c, this.a) * MathUtils.radDeg;
5540
- }
5541
- /** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */
5542
- getWorldRotationY() {
5543
- return Math.atan2(this.d, this.b) * MathUtils.radDeg;
5544
- }
5545
- /** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */
5546
- getWorldScaleX() {
5547
- return Math.sqrt(this.a * this.a + this.c * this.c);
5548
- }
5549
- /** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */
5550
- getWorldScaleY() {
5551
- return Math.sqrt(this.b * this.b + this.d * this.d);
5552
- }
5553
5665
  /** Computes the applied transform values from the world transform.
5554
5666
  *
5555
5667
  * If the world transform is modified (by a constraint, {@link #rotateWorld(float)}, etc) then this method should be called so
@@ -5636,6 +5748,22 @@ var spine = (() => {
5636
5748
  this.arotation = 90 - Math.atan2(rd, rb) * MathUtils.radDeg;
5637
5749
  }
5638
5750
  }
5751
+ /** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */
5752
+ getWorldRotationX() {
5753
+ return Math.atan2(this.c, this.a) * MathUtils.radDeg;
5754
+ }
5755
+ /** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */
5756
+ getWorldRotationY() {
5757
+ return Math.atan2(this.d, this.b) * MathUtils.radDeg;
5758
+ }
5759
+ /** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */
5760
+ getWorldScaleX() {
5761
+ return Math.sqrt(this.a * this.a + this.c * this.c);
5762
+ }
5763
+ /** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */
5764
+ getWorldScaleY() {
5765
+ return Math.sqrt(this.b * this.b + this.d * this.d);
5766
+ }
5639
5767
  /** Transforms a point from world coordinates to the bone's local coordinates. */
5640
5768
  worldToLocal(world) {
5641
5769
  let invDet = 1 / (this.a * this.d - this.b * this.c);
@@ -5651,6 +5779,18 @@ var spine = (() => {
5651
5779
  local.y = x * this.c + y * this.d + this.worldY;
5652
5780
  return local;
5653
5781
  }
5782
+ /** Transforms a point from world coordinates to the parent bone's local coordinates. */
5783
+ worldToParent(world) {
5784
+ if (world == null)
5785
+ throw new Error("world cannot be null.");
5786
+ return this.parent == null ? world : this.parent.worldToLocal(world);
5787
+ }
5788
+ /** Transforms a point from the parent bone's coordinates to world coordinates. */
5789
+ parentToWorld(world) {
5790
+ if (world == null)
5791
+ throw new Error("world cannot be null.");
5792
+ return this.parent == null ? world : this.parent.localToWorld(world);
5793
+ }
5654
5794
  /** Transforms a world rotation to a local rotation. */
5655
5795
  worldToLocalRotation(worldRotation) {
5656
5796
  let sin = MathUtils.sinDeg(worldRotation), cos = MathUtils.cosDeg(worldRotation);
@@ -5664,15 +5804,16 @@ var spine = (() => {
5664
5804
  }
5665
5805
  /** Rotates the world transform the specified amount.
5666
5806
  * <p>
5667
- * After changes are made to the world transform, {@link #updateAppliedTransform()} should be called and {@link #update()} will
5668
- * need to be called on any child bones, recursively. */
5807
+ * After changes are made to the world transform, {@link #updateAppliedTransform()} should be called and
5808
+ * {@link #update(Physics)} will need to be called on any child bones, recursively. */
5669
5809
  rotateWorld(degrees) {
5670
- let a = this.a, b = this.b, c = this.c, d = this.d;
5671
- let cos = MathUtils.cosDeg(degrees), sin = MathUtils.sinDeg(degrees);
5672
- this.a = cos * a - sin * c;
5673
- this.b = cos * b - sin * d;
5674
- this.c = sin * a + cos * c;
5675
- this.d = sin * b + cos * d;
5810
+ degrees *= MathUtils.degRad;
5811
+ const sin = Math.sin(degrees), cos = Math.cos(degrees);
5812
+ const ra = this.a, rb = this.b;
5813
+ this.a = cos * ra - sin * this.c;
5814
+ this.b = cos * rb - sin * this.d;
5815
+ this.c = sin * ra + cos * this.c;
5816
+ this.d = sin * rb + cos * this.d;
5676
5817
  }
5677
5818
  };
5678
5819
 
@@ -5687,12 +5828,14 @@ var spine = (() => {
5687
5828
 
5688
5829
  // spine-core/src/AssetManagerBase.ts
5689
5830
  var AssetManagerBase = class {
5831
+ pathPrefix = "";
5832
+ textureLoader;
5833
+ downloader;
5834
+ assets = {};
5835
+ errors = {};
5836
+ toLoad = 0;
5837
+ loaded = 0;
5690
5838
  constructor(textureLoader, pathPrefix = "", downloader = new Downloader()) {
5691
- this.pathPrefix = "";
5692
- this.assets = {};
5693
- this.errors = {};
5694
- this.toLoad = 0;
5695
- this.loaded = 0;
5696
5839
  this.textureLoader = textureLoader;
5697
5840
  this.pathPrefix = pathPrefix;
5698
5841
  this.downloader = downloader;
@@ -5877,10 +6020,8 @@ var spine = (() => {
5877
6020
  }
5878
6021
  };
5879
6022
  var Downloader = class {
5880
- constructor() {
5881
- this.callbacks = {};
5882
- this.rawDataUris = {};
5883
- }
6023
+ callbacks = {};
6024
+ rawDataUris = {};
5884
6025
  dataUriToString(dataUri) {
5885
6026
  if (!dataUri.startsWith("data:")) {
5886
6027
  throw new Error("Not a data URI.");
@@ -5987,13 +6128,14 @@ var spine = (() => {
5987
6128
 
5988
6129
  // spine-core/src/Event.ts
5989
6130
  var Event = class {
6131
+ data;
6132
+ intValue = 0;
6133
+ floatValue = 0;
6134
+ stringValue = null;
6135
+ time = 0;
6136
+ volume = 0;
6137
+ balance = 0;
5990
6138
  constructor(time, data) {
5991
- this.intValue = 0;
5992
- this.floatValue = 0;
5993
- this.stringValue = null;
5994
- this.time = 0;
5995
- this.volume = 0;
5996
- this.balance = 0;
5997
6139
  if (!data)
5998
6140
  throw new Error("data cannot be null.");
5999
6141
  this.time = time;
@@ -6003,32 +6145,39 @@ var spine = (() => {
6003
6145
 
6004
6146
  // spine-core/src/EventData.ts
6005
6147
  var EventData = class {
6148
+ name;
6149
+ intValue = 0;
6150
+ floatValue = 0;
6151
+ stringValue = null;
6152
+ audioPath = null;
6153
+ volume = 0;
6154
+ balance = 0;
6006
6155
  constructor(name) {
6007
- this.intValue = 0;
6008
- this.floatValue = 0;
6009
- this.stringValue = null;
6010
- this.audioPath = null;
6011
- this.volume = 0;
6012
- this.balance = 0;
6013
6156
  this.name = name;
6014
6157
  }
6015
6158
  };
6016
6159
 
6017
6160
  // spine-core/src/IkConstraint.ts
6018
6161
  var IkConstraint = class {
6162
+ /** The IK constraint's setup pose data. */
6163
+ data;
6164
+ /** The bones that will be modified by this IK constraint. */
6165
+ bones;
6166
+ /** The bone that is the IK target. */
6167
+ target;
6168
+ /** Controls the bend direction of the IK bones, either 1 or -1. */
6169
+ bendDirection = 0;
6170
+ /** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
6171
+ compress = false;
6172
+ /** When true, if the target is out of range, the parent bone is scaled to reach it. If more than one bone is being constrained
6173
+ * and the parent bone has local nonuniform scale, stretch is not applied. */
6174
+ stretch = false;
6175
+ /** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
6176
+ mix = 1;
6177
+ /** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
6178
+ softness = 0;
6179
+ active = false;
6019
6180
  constructor(data, skeleton) {
6020
- /** Controls the bend direction of the IK bones, either 1 or -1. */
6021
- this.bendDirection = 0;
6022
- /** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
6023
- this.compress = false;
6024
- /** When true, if the target is out of range, the parent bone is scaled to reach it. If more than one bone is being constrained
6025
- * and the parent bone has local nonuniform scale, stretch is not applied. */
6026
- this.stretch = false;
6027
- /** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
6028
- this.mix = 1;
6029
- /** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
6030
- this.softness = 0;
6031
- this.active = false;
6032
6181
  if (!data)
6033
6182
  throw new Error("data cannot be null.");
6034
6183
  if (!skeleton)
@@ -6054,7 +6203,15 @@ var spine = (() => {
6054
6203
  isActive() {
6055
6204
  return this.active;
6056
6205
  }
6057
- update() {
6206
+ setToSetupPose() {
6207
+ const data = this.data;
6208
+ this.mix = data.mix;
6209
+ this.softness = data.softness;
6210
+ this.bendDirection = data.bendDirection;
6211
+ this.compress = data.compress;
6212
+ this.stretch = data.stretch;
6213
+ }
6214
+ update(physics) {
6058
6215
  if (this.mix == 0)
6059
6216
  return;
6060
6217
  let target = this.target;
@@ -6113,12 +6270,15 @@ var spine = (() => {
6113
6270
  tx = targetX - bone.worldX;
6114
6271
  ty = targetY - bone.worldY;
6115
6272
  }
6116
- let b = bone.data.length * sx, dd = Math.sqrt(tx * tx + ty * ty);
6117
- if (compress && dd < b || stretch && dd > b && b > 1e-4) {
6118
- let s = (dd / b - 1) * alpha + 1;
6119
- sx *= s;
6120
- if (uniform)
6121
- sy *= s;
6273
+ const b = bone.data.length * sx;
6274
+ if (b > 1e-4) {
6275
+ const dd = tx * tx + ty * ty;
6276
+ if (compress && dd < b * b || stretch && dd > b * b) {
6277
+ const s = (Math.sqrt(dd) / b - 1) * alpha + 1;
6278
+ sx *= s;
6279
+ if (uniform)
6280
+ sy *= s;
6281
+ }
6122
6282
  }
6123
6283
  }
6124
6284
  bone.updateWorldTransformWith(
@@ -6286,27 +6446,10 @@ var spine = (() => {
6286
6446
 
6287
6447
  // spine-core/src/IkConstraintData.ts
6288
6448
  var IkConstraintData = class extends ConstraintData {
6289
- constructor(name) {
6290
- super(name, 0, false);
6291
- /** The bones that are constrained by this IK constraint. */
6292
- this.bones = new Array();
6293
- /** The bone that is the IK target. */
6294
- this._target = null;
6295
- /** Controls the bend direction of the IK bones, either 1 or -1. */
6296
- this.bendDirection = 1;
6297
- /** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
6298
- this.compress = false;
6299
- /** When true, if the target is out of range, the parent bone is scaled to reach it. If more than one bone is being constrained
6300
- * and the parent bone has local nonuniform scale, stretch is not applied. */
6301
- this.stretch = false;
6302
- /** When true, only a single bone is being constrained, and {@link #getCompress()} or {@link #getStretch()} is used, the bone
6303
- * is scaled on both the X and Y axes. */
6304
- this.uniform = false;
6305
- /** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
6306
- this.mix = 1;
6307
- /** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
6308
- this.softness = 0;
6309
- }
6449
+ /** The bones that are constrained by this IK constraint. */
6450
+ bones = new Array();
6451
+ /** The bone that is the IK target. */
6452
+ _target = null;
6310
6453
  set target(boneData) {
6311
6454
  this._target = boneData;
6312
6455
  }
@@ -6316,32 +6459,31 @@ var spine = (() => {
6316
6459
  else
6317
6460
  return this._target;
6318
6461
  }
6462
+ /** Controls the bend direction of the IK bones, either 1 or -1. */
6463
+ bendDirection = 1;
6464
+ /** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
6465
+ compress = false;
6466
+ /** When true, if the target is out of range, the parent bone is scaled to reach it. If more than one bone is being constrained
6467
+ * and the parent bone has local nonuniform scale, stretch is not applied. */
6468
+ stretch = false;
6469
+ /** When true, only a single bone is being constrained, and {@link #getCompress()} or {@link #getStretch()} is used, the bone
6470
+ * is scaled on both the X and Y axes. */
6471
+ uniform = false;
6472
+ /** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
6473
+ mix = 1;
6474
+ /** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
6475
+ softness = 0;
6476
+ constructor(name) {
6477
+ super(name, 0, false);
6478
+ }
6319
6479
  };
6320
6480
 
6321
6481
  // spine-core/src/PathConstraintData.ts
6322
6482
  var PathConstraintData = class extends ConstraintData {
6323
- constructor(name) {
6324
- super(name, 0, false);
6325
- /** The bones that will be modified by this path constraint. */
6326
- this.bones = new Array();
6327
- /** The slot whose path attachment will be used to constrained the bones. */
6328
- this._target = null;
6329
- /** The mode for positioning the first bone on the path. */
6330
- this.positionMode = PositionMode.Fixed;
6331
- /** The mode for positioning the bones after the first bone on the path. */
6332
- this.spacingMode = SpacingMode.Fixed;
6333
- /** The mode for adjusting the rotation of the bones. */
6334
- this.rotateMode = RotateMode.Chain;
6335
- /** An offset added to the constrained bone rotation. */
6336
- this.offsetRotation = 0;
6337
- /** The position along the path. */
6338
- this.position = 0;
6339
- /** The spacing between bones. */
6340
- this.spacing = 0;
6341
- this.mixRotate = 0;
6342
- this.mixX = 0;
6343
- this.mixY = 0;
6344
- }
6483
+ /** The bones that will be modified by this path constraint. */
6484
+ bones = new Array();
6485
+ /** The slot whose path attachment will be used to constrained the bones. */
6486
+ _target = null;
6345
6487
  set target(slotData) {
6346
6488
  this._target = slotData;
6347
6489
  }
@@ -6351,6 +6493,24 @@ var spine = (() => {
6351
6493
  else
6352
6494
  return this._target;
6353
6495
  }
6496
+ /** The mode for positioning the first bone on the path. */
6497
+ positionMode = PositionMode.Fixed;
6498
+ /** The mode for positioning the bones after the first bone on the path. */
6499
+ spacingMode = SpacingMode.Fixed;
6500
+ /** The mode for adjusting the rotation of the bones. */
6501
+ rotateMode = RotateMode.Chain;
6502
+ /** An offset added to the constrained bone rotation. */
6503
+ offsetRotation = 0;
6504
+ /** The position along the path. */
6505
+ position = 0;
6506
+ /** The spacing between bones. */
6507
+ spacing = 0;
6508
+ mixRotate = 0;
6509
+ mixX = 0;
6510
+ mixY = 0;
6511
+ constructor(name) {
6512
+ super(name, 0, false);
6513
+ }
6354
6514
  };
6355
6515
  var PositionMode = /* @__PURE__ */ ((PositionMode2) => {
6356
6516
  PositionMode2[PositionMode2["Fixed"] = 0] = "Fixed";
@@ -6373,21 +6533,27 @@ var spine = (() => {
6373
6533
 
6374
6534
  // spine-core/src/PathConstraint.ts
6375
6535
  var _PathConstraint = class {
6536
+ /** The path constraint's setup pose data. */
6537
+ data;
6538
+ /** The bones that will be modified by this path constraint. */
6539
+ bones;
6540
+ /** The slot whose path attachment will be used to constrained the bones. */
6541
+ target;
6542
+ /** The position along the path. */
6543
+ position = 0;
6544
+ /** The spacing between bones. */
6545
+ spacing = 0;
6546
+ mixRotate = 0;
6547
+ mixX = 0;
6548
+ mixY = 0;
6549
+ spaces = new Array();
6550
+ positions = new Array();
6551
+ world = new Array();
6552
+ curves = new Array();
6553
+ lengths = new Array();
6554
+ segments = new Array();
6555
+ active = false;
6376
6556
  constructor(data, skeleton) {
6377
- /** The position along the path. */
6378
- this.position = 0;
6379
- /** The spacing between bones. */
6380
- this.spacing = 0;
6381
- this.mixRotate = 0;
6382
- this.mixX = 0;
6383
- this.mixY = 0;
6384
- this.spaces = new Array();
6385
- this.positions = new Array();
6386
- this.world = new Array();
6387
- this.curves = new Array();
6388
- this.lengths = new Array();
6389
- this.segments = new Array();
6390
- this.active = false;
6391
6557
  if (!data)
6392
6558
  throw new Error("data cannot be null.");
6393
6559
  if (!skeleton)
@@ -6413,7 +6579,15 @@ var spine = (() => {
6413
6579
  isActive() {
6414
6580
  return this.active;
6415
6581
  }
6416
- update() {
6582
+ setToSetupPose() {
6583
+ const data = this.data;
6584
+ this.position = data.position;
6585
+ this.spacing = data.spacing;
6586
+ this.mixRotate = data.mixRotate;
6587
+ this.mixX = data.mixX;
6588
+ this.mixY = data.mixY;
6589
+ }
6590
+ update(physics) {
6417
6591
  let attachment = this.target.getAttachment();
6418
6592
  if (!(attachment instanceof PathAttachment))
6419
6593
  return;
@@ -6432,12 +6606,8 @@ var spine = (() => {
6432
6606
  for (let i = 0, n = spacesCount - 1; i < n; i++) {
6433
6607
  let bone = bones[i];
6434
6608
  let setupLength = bone.data.length;
6435
- if (setupLength < _PathConstraint.epsilon)
6436
- lengths[i] = 0;
6437
- else {
6438
- let x = setupLength * bone.a, y = setupLength * bone.c;
6439
- lengths[i] = Math.sqrt(x * x + y * y);
6440
- }
6609
+ let x = setupLength * bone.a, y = setupLength * bone.c;
6610
+ lengths[i] = Math.sqrt(x * x + y * y);
6441
6611
  }
6442
6612
  }
6443
6613
  Utils.arrayFill(spaces, 1, spacesCount, spacing);
@@ -6807,27 +6977,266 @@ var spine = (() => {
6807
6977
  }
6808
6978
  };
6809
6979
  var PathConstraint = _PathConstraint;
6810
- PathConstraint.NONE = -1;
6811
- PathConstraint.BEFORE = -2;
6812
- PathConstraint.AFTER = -3;
6813
- PathConstraint.epsilon = 1e-5;
6980
+ __publicField(PathConstraint, "NONE", -1);
6981
+ __publicField(PathConstraint, "BEFORE", -2);
6982
+ __publicField(PathConstraint, "AFTER", -3);
6983
+ __publicField(PathConstraint, "epsilon", 1e-5);
6984
+
6985
+ // spine-core/src/PhysicsConstraint.ts
6986
+ var PhysicsConstraint = class {
6987
+ data;
6988
+ _bone = null;
6989
+ /** The bone constrained by this physics constraint. */
6990
+ set bone(bone) {
6991
+ this._bone = bone;
6992
+ }
6993
+ get bone() {
6994
+ if (!this._bone)
6995
+ throw new Error("Bone not set.");
6996
+ else
6997
+ return this._bone;
6998
+ }
6999
+ inertia = 0;
7000
+ strength = 0;
7001
+ damping = 0;
7002
+ massInverse = 0;
7003
+ wind = 0;
7004
+ gravity = 0;
7005
+ mix = 0;
7006
+ _reset = true;
7007
+ ux = 0;
7008
+ uy = 0;
7009
+ cx = 0;
7010
+ cy = 0;
7011
+ tx = 0;
7012
+ ty = 0;
7013
+ xOffset = 0;
7014
+ xVelocity = 0;
7015
+ yOffset = 0;
7016
+ yVelocity = 0;
7017
+ rotateOffset = 0;
7018
+ rotateVelocity = 0;
7019
+ scaleOffset = 0;
7020
+ scaleVelocity = 0;
7021
+ active = false;
7022
+ skeleton;
7023
+ remaining = 0;
7024
+ lastTime = 0;
7025
+ constructor(data, skeleton) {
7026
+ this.data = data;
7027
+ this.skeleton = skeleton;
7028
+ this.bone = skeleton.bones[data.bone.index];
7029
+ this.inertia = data.inertia;
7030
+ this.strength = data.strength;
7031
+ this.damping = data.damping;
7032
+ this.massInverse = data.massInverse;
7033
+ this.wind = data.wind;
7034
+ this.gravity = data.gravity;
7035
+ this.mix = data.mix;
7036
+ }
7037
+ reset() {
7038
+ this.remaining = 0;
7039
+ this.lastTime = this.skeleton.time;
7040
+ this._reset = true;
7041
+ this.xOffset = 0;
7042
+ this.xVelocity = 0;
7043
+ this.yOffset = 0;
7044
+ this.yVelocity = 0;
7045
+ this.rotateOffset = 0;
7046
+ this.rotateVelocity = 0;
7047
+ this.scaleOffset = 0;
7048
+ this.scaleVelocity = 0;
7049
+ }
7050
+ setToSetupPose() {
7051
+ const data = this.data;
7052
+ this.inertia = data.inertia;
7053
+ this.strength = data.strength;
7054
+ this.damping = data.damping;
7055
+ this.massInverse = data.massInverse;
7056
+ this.wind = data.wind;
7057
+ this.gravity = data.gravity;
7058
+ this.mix = data.mix;
7059
+ }
7060
+ isActive() {
7061
+ return this.active;
7062
+ }
7063
+ /** Applies the constraint to the constrained bones. */
7064
+ update(physics) {
7065
+ const mix = this.mix;
7066
+ if (mix == 0)
7067
+ return;
7068
+ const x = this.data.x > 0, y = this.data.y > 0, rotateOrShearX = this.data.rotate > 0 || this.data.shearX > 0, scaleX = this.data.scaleX > 0;
7069
+ const bone = this.bone;
7070
+ const l = bone.data.length;
7071
+ switch (physics) {
7072
+ case 0 /* none */:
7073
+ return;
7074
+ case 1 /* reset */:
7075
+ this.reset();
7076
+ case 2 /* update */:
7077
+ this.remaining += Math.max(this.skeleton.time - this.lastTime, 0);
7078
+ this.lastTime = this.skeleton.time;
7079
+ const bx = bone.worldX, by = bone.worldY;
7080
+ if (this._reset) {
7081
+ this._reset = false;
7082
+ this.ux = bx;
7083
+ this.uy = by;
7084
+ } else {
7085
+ let remaining = this.remaining, i = this.inertia, step = this.data.step;
7086
+ if (x || y) {
7087
+ if (x) {
7088
+ this.xOffset += (this.ux - bx) * i;
7089
+ this.ux = bx;
7090
+ }
7091
+ if (y) {
7092
+ this.yOffset += (this.uy - by) * i;
7093
+ this.uy = by;
7094
+ }
7095
+ if (remaining >= step) {
7096
+ const m = this.massInverse * step, e = this.strength, w = this.wind * 100, g = this.gravity * -100;
7097
+ const d = Math.pow(this.damping, 60 * step);
7098
+ do {
7099
+ if (x) {
7100
+ this.xVelocity += (w - this.xOffset * e) * m;
7101
+ this.xOffset += this.xVelocity * step;
7102
+ this.xVelocity *= d;
7103
+ }
7104
+ if (y) {
7105
+ this.yVelocity += (g - this.yOffset * e) * m;
7106
+ this.yOffset += this.yVelocity * step;
7107
+ this.yVelocity *= d;
7108
+ }
7109
+ remaining -= step;
7110
+ } while (remaining >= step);
7111
+ }
7112
+ if (x)
7113
+ bone.worldX += this.xOffset * mix * this.data.x;
7114
+ if (y)
7115
+ bone.worldY += this.yOffset * mix * this.data.y;
7116
+ }
7117
+ if (rotateOrShearX || scaleX) {
7118
+ let ca = Math.atan2(bone.c, bone.a), c = 0, s = 0, mr = 0;
7119
+ if (rotateOrShearX) {
7120
+ mr = mix * this.data.rotate;
7121
+ let dx = this.cx - bone.worldX, dy = this.cy - bone.worldY, r = Math.atan2(dy + this.ty, dx + this.tx) - ca - this.rotateOffset * mr;
7122
+ this.rotateOffset += (r - Math.ceil(r * MathUtils.invPI2 - 0.5) * MathUtils.PI2) * i;
7123
+ r = this.rotateOffset * mr + ca;
7124
+ c = Math.cos(r);
7125
+ s = Math.sin(r);
7126
+ if (scaleX) {
7127
+ r = l * bone.getWorldScaleX();
7128
+ if (r > 0)
7129
+ this.scaleOffset += (dx * c + dy * s) * i / r;
7130
+ }
7131
+ } else {
7132
+ c = Math.cos(ca);
7133
+ s = Math.sin(ca);
7134
+ const r = l * bone.getWorldScaleX();
7135
+ if (r > 0)
7136
+ this.scaleOffset += ((this.cx - bone.worldX) * c + (this.cy - bone.worldY) * s) * i / r;
7137
+ }
7138
+ remaining = this.remaining;
7139
+ if (remaining >= step) {
7140
+ const m = this.massInverse * step, e = this.strength, w = this.wind, g = this.gravity;
7141
+ const d = Math.pow(this.damping, 60 * step);
7142
+ while (true) {
7143
+ remaining -= step;
7144
+ if (scaleX) {
7145
+ this.scaleVelocity += (w * c - g * s - this.scaleOffset * e) * m;
7146
+ this.scaleOffset += this.scaleVelocity * step;
7147
+ this.scaleVelocity *= d;
7148
+ }
7149
+ if (rotateOrShearX) {
7150
+ this.rotateVelocity += (-0.01 * l * (w * s + g * c) - this.rotateOffset * e) * m;
7151
+ this.rotateOffset += this.rotateVelocity * step;
7152
+ this.rotateVelocity *= d;
7153
+ if (remaining < step)
7154
+ break;
7155
+ const r = this.rotateOffset * mr + ca;
7156
+ c = Math.cos(r);
7157
+ s = Math.sin(r);
7158
+ } else if (remaining < step)
7159
+ break;
7160
+ }
7161
+ }
7162
+ }
7163
+ this.remaining = remaining;
7164
+ }
7165
+ this.cx = bone.worldX;
7166
+ this.cy = bone.worldY;
7167
+ break;
7168
+ case 3 /* pose */:
7169
+ if (x)
7170
+ bone.worldX += this.xOffset * mix * this.data.x;
7171
+ if (y)
7172
+ bone.worldY += this.yOffset * mix * this.data.y;
7173
+ }
7174
+ if (rotateOrShearX) {
7175
+ let o = this.rotateOffset * mix, s = 0, c = 0, a = 0;
7176
+ if (this.data.shearX > 0) {
7177
+ let r = 0;
7178
+ if (this.data.rotate > 0) {
7179
+ r = o * this.data.rotate;
7180
+ s = Math.sin(r);
7181
+ c = Math.cos(r);
7182
+ a = bone.b;
7183
+ bone.b = c * a - s * bone.d;
7184
+ bone.d = s * a + c * bone.d;
7185
+ }
7186
+ r += o * this.data.shearX;
7187
+ s = Math.sin(r);
7188
+ c = Math.cos(r);
7189
+ a = bone.a;
7190
+ bone.a = c * a - s * bone.c;
7191
+ bone.c = s * a + c * bone.c;
7192
+ } else {
7193
+ o *= this.data.rotate;
7194
+ s = Math.sin(o);
7195
+ c = Math.cos(o);
7196
+ a = bone.a;
7197
+ bone.a = c * a - s * bone.c;
7198
+ bone.c = s * a + c * bone.c;
7199
+ a = bone.b;
7200
+ bone.b = c * a - s * bone.d;
7201
+ bone.d = s * a + c * bone.d;
7202
+ }
7203
+ }
7204
+ if (scaleX) {
7205
+ const s = 1 + this.scaleOffset * mix * this.data.scaleX;
7206
+ bone.a *= s;
7207
+ bone.c *= s;
7208
+ }
7209
+ if (physics != 3 /* pose */) {
7210
+ this.tx = l * bone.a;
7211
+ this.ty = l * bone.c;
7212
+ }
7213
+ bone.updateAppliedTransform();
7214
+ }
7215
+ };
6814
7216
 
6815
7217
  // spine-core/src/Slot.ts
6816
7218
  var Slot = class {
7219
+ /** The slot's setup pose data. */
7220
+ data;
7221
+ /** The bone this slot belongs to. */
7222
+ bone;
7223
+ /** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
7224
+ * color tinting. */
7225
+ color;
7226
+ /** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
7227
+ * color's alpha is not used. */
7228
+ darkColor = null;
7229
+ attachment = null;
7230
+ attachmentState = 0;
7231
+ /** The index of the texture region to display when the slot's attachment has a {@link Sequence}. -1 represents the
7232
+ * {@link Sequence#getSetupIndex()}. */
7233
+ sequenceIndex = -1;
7234
+ /** Values to deform the slot's attachment. For an unweighted mesh, the entries are local positions for each vertex. For a
7235
+ * weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions.
7236
+ *
7237
+ * See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
7238
+ deform = new Array();
6817
7239
  constructor(data, bone) {
6818
- /** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
6819
- * color's alpha is not used. */
6820
- this.darkColor = null;
6821
- this.attachment = null;
6822
- this.attachmentState = 0;
6823
- /** The index of the texture region to display when the slot's attachment has a {@link Sequence}. -1 represents the
6824
- * {@link Sequence#getSetupIndex()}. */
6825
- this.sequenceIndex = -1;
6826
- /** Values to deform the slot's attachment. For an unweighted mesh, the entries are local positions for each vertex. For a
6827
- * weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions.
6828
- *
6829
- * See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
6830
- this.deform = new Array();
6831
7240
  if (!data)
6832
7241
  throw new Error("data cannot be null.");
6833
7242
  if (!bone)
@@ -6874,15 +7283,21 @@ var spine = (() => {
6874
7283
 
6875
7284
  // spine-core/src/TransformConstraint.ts
6876
7285
  var TransformConstraint = class {
7286
+ /** The transform constraint's setup pose data. */
7287
+ data;
7288
+ /** The bones that will be modified by this transform constraint. */
7289
+ bones;
7290
+ /** The target bone whose world transform will be copied to the constrained bones. */
7291
+ target;
7292
+ mixRotate = 0;
7293
+ mixX = 0;
7294
+ mixY = 0;
7295
+ mixScaleX = 0;
7296
+ mixScaleY = 0;
7297
+ mixShearY = 0;
7298
+ temp = new Vector2();
7299
+ active = false;
6877
7300
  constructor(data, skeleton) {
6878
- this.mixRotate = 0;
6879
- this.mixX = 0;
6880
- this.mixY = 0;
6881
- this.mixScaleX = 0;
6882
- this.mixScaleY = 0;
6883
- this.mixShearY = 0;
6884
- this.temp = new Vector2();
6885
- this.active = false;
6886
7301
  if (!data)
6887
7302
  throw new Error("data cannot be null.");
6888
7303
  if (!skeleton)
@@ -6909,7 +7324,16 @@ var spine = (() => {
6909
7324
  isActive() {
6910
7325
  return this.active;
6911
7326
  }
6912
- update() {
7327
+ setToSetupPose() {
7328
+ const data = this.data;
7329
+ this.mixRotate = data.mixRotate;
7330
+ this.mixX = data.mixX;
7331
+ this.mixY = data.mixY;
7332
+ this.mixScaleX = data.mixScaleX;
7333
+ this.mixScaleY = data.mixScaleY;
7334
+ this.mixShearY = data.mixShearY;
7335
+ }
7336
+ update(physics) {
6913
7337
  if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
6914
7338
  return;
6915
7339
  if (this.data.local) {
@@ -7049,7 +7473,7 @@ var spine = (() => {
7049
7473
  let rotation = bone.arotation;
7050
7474
  if (mixRotate != 0) {
7051
7475
  let r = target.arotation - rotation + this.data.offsetRotation;
7052
- r -= (16384 - (16384.499999999996 - r / 360 | 0)) * 360;
7476
+ r -= Math.ceil(r / 360 - 0.5) * 360;
7053
7477
  rotation += r * mixRotate;
7054
7478
  }
7055
7479
  let x = bone.ax, y = bone.ay;
@@ -7063,7 +7487,7 @@ var spine = (() => {
7063
7487
  let shearY = bone.ashearY;
7064
7488
  if (mixShearY != 0) {
7065
7489
  let r = target.ashearY - shearY + this.data.offsetShearY;
7066
- r -= (16384 - (16384.499999999996 - r / 360 | 0)) * 360;
7490
+ r -= Math.ceil(r / 360 - 0.5) * 360;
7067
7491
  shearY += r * mixShearY;
7068
7492
  }
7069
7493
  bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
@@ -7088,21 +7512,49 @@ var spine = (() => {
7088
7512
 
7089
7513
  // spine-core/src/Skeleton.ts
7090
7514
  var _Skeleton = class {
7515
+ /** The skeleton's setup pose data. */
7516
+ data;
7517
+ /** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
7518
+ bones;
7519
+ /** The skeleton's slots. */
7520
+ slots;
7521
+ /** The skeleton's slots in the order they should be drawn. The returned array may be modified to change the draw order. */
7522
+ drawOrder;
7523
+ /** The skeleton's IK constraints. */
7524
+ ikConstraints;
7525
+ /** The skeleton's transform constraints. */
7526
+ transformConstraints;
7527
+ /** The skeleton's path constraints. */
7528
+ pathConstraints;
7529
+ /** The skeleton's physics constraints. */
7530
+ physicsConstraints;
7531
+ /** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */
7532
+ _updateCache = new Array();
7533
+ /** The skeleton's current skin. May be null. */
7534
+ skin = null;
7535
+ /** The color to tint all the skeleton's attachments. */
7536
+ color;
7537
+ /** Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale
7538
+ * inheritance. */
7539
+ scaleX = 1;
7540
+ /** Scales the entire skeleton on the Y axis. This affects all bones, even if the bone's transform mode disallows scale
7541
+ * inheritance. */
7542
+ _scaleY = 1;
7543
+ get scaleY() {
7544
+ return _Skeleton.yDown ? -this._scaleY : this._scaleY;
7545
+ }
7546
+ set scaleY(scaleY) {
7547
+ this._scaleY = scaleY;
7548
+ }
7549
+ /** Sets the skeleton X position, which is added to the root bone worldX position. */
7550
+ x = 0;
7551
+ /** Sets the skeleton Y position, which is added to the root bone worldY position. */
7552
+ y = 0;
7553
+ /** Returns the skeleton's time. This is used for time-based manipulations, such as {@link PhysicsConstraint}.
7554
+ * <p>
7555
+ * See {@link #update(float)}. */
7556
+ time = 0;
7091
7557
  constructor(data) {
7092
- /** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */
7093
- this._updateCache = new Array();
7094
- /** The skeleton's current skin. May be null. */
7095
- this.skin = null;
7096
- /** Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale
7097
- * inheritance. */
7098
- this.scaleX = 1;
7099
- /** Scales the entire skeleton on the Y axis. This affects all bones, even if the bone's transform mode disallows scale
7100
- * inheritance. */
7101
- this._scaleY = 1;
7102
- /** Sets the skeleton X position, which is added to the root bone worldX position. */
7103
- this.x = 0;
7104
- /** Sets the skeleton Y position, which is added to the root bone worldY position. */
7105
- this.y = 0;
7106
7558
  if (!data)
7107
7559
  throw new Error("data cannot be null.");
7108
7560
  this.data = data;
@@ -7143,15 +7595,14 @@ var spine = (() => {
7143
7595
  let pathConstraintData = data.pathConstraints[i];
7144
7596
  this.pathConstraints.push(new PathConstraint(pathConstraintData, this));
7145
7597
  }
7598
+ this.physicsConstraints = new Array();
7599
+ for (let i = 0; i < data.physicsConstraints.length; i++) {
7600
+ let physicsConstraintData = data.physicsConstraints[i];
7601
+ this.physicsConstraints.push(new PhysicsConstraint(physicsConstraintData, this));
7602
+ }
7146
7603
  this.color = new Color(1, 1, 1, 1);
7147
7604
  this.updateCache();
7148
7605
  }
7149
- get scaleY() {
7150
- return _Skeleton.yDown ? -this._scaleY : this._scaleY;
7151
- }
7152
- set scaleY(scaleY) {
7153
- this._scaleY = scaleY;
7154
- }
7155
7606
  /** Caches information about bones and constraints. Must be called if the {@link #getSkin()} is modified or if bones,
7156
7607
  * constraints, or weighted path attachments are added or removed. */
7157
7608
  updateCache() {
@@ -7177,8 +7628,9 @@ var spine = (() => {
7177
7628
  let ikConstraints = this.ikConstraints;
7178
7629
  let transformConstraints = this.transformConstraints;
7179
7630
  let pathConstraints = this.pathConstraints;
7180
- let ikCount = ikConstraints.length, transformCount = transformConstraints.length, pathCount = pathConstraints.length;
7181
- let constraintCount = ikCount + transformCount + pathCount;
7631
+ let physicsConstraints = this.physicsConstraints;
7632
+ let ikCount = ikConstraints.length, transformCount = transformConstraints.length, pathCount = pathConstraints.length, physicsCount = this.physicsConstraints.length;
7633
+ let constraintCount = ikCount + transformCount + pathCount + physicsCount;
7182
7634
  outer:
7183
7635
  for (let i = 0; i < constraintCount; i++) {
7184
7636
  for (let ii = 0; ii < ikCount; ii++) {
@@ -7202,6 +7654,13 @@ var spine = (() => {
7202
7654
  continue outer;
7203
7655
  }
7204
7656
  }
7657
+ for (let ii = 0; ii < physicsCount; ii++) {
7658
+ const constraint = physicsConstraints[ii];
7659
+ if (constraint.data.order == i) {
7660
+ this.sortPhysicsConstraint(constraint);
7661
+ continue outer;
7662
+ }
7663
+ }
7205
7664
  }
7206
7665
  for (let i = 0, n = bones.length; i < n; i++)
7207
7666
  this.sortBone(bones[i]);
@@ -7300,6 +7759,16 @@ var spine = (() => {
7300
7759
  }
7301
7760
  }
7302
7761
  }
7762
+ sortPhysicsConstraint(constraint) {
7763
+ const bone = constraint.bone;
7764
+ constraint.active = bone.active && !constraint.data.skinRequired || this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true);
7765
+ if (!constraint.active)
7766
+ return;
7767
+ this.sortBone(bone);
7768
+ this._updateCache.push(constraint);
7769
+ this.sortReset(bone.children);
7770
+ bone.sorted = true;
7771
+ }
7303
7772
  sortBone(bone) {
7304
7773
  if (!bone)
7305
7774
  return;
@@ -7325,7 +7794,9 @@ var spine = (() => {
7325
7794
  *
7326
7795
  * See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
7327
7796
  * Runtimes Guide. */
7328
- updateWorldTransform() {
7797
+ updateWorldTransform(physics) {
7798
+ if (!physics)
7799
+ throw new Error("physics is undefined");
7329
7800
  let bones = this.bones;
7330
7801
  for (let i = 0, n = bones.length; i < n; i++) {
7331
7802
  let bone = bones[i];
@@ -7339,20 +7810,21 @@ var spine = (() => {
7339
7810
  }
7340
7811
  let updateCache = this._updateCache;
7341
7812
  for (let i = 0, n = updateCache.length; i < n; i++)
7342
- updateCache[i].update();
7813
+ updateCache[i].update(physics);
7343
7814
  }
7344
- updateWorldTransformWith(parent) {
7815
+ updateWorldTransformWith(physics, parent) {
7345
7816
  let rootBone = this.getRootBone();
7346
7817
  if (!rootBone)
7347
7818
  throw new Error("Root bone must not be null.");
7348
7819
  let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
7349
7820
  rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
7350
7821
  rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
7351
- let rotationY = rootBone.rotation + 90 + rootBone.shearY;
7352
- let la = MathUtils.cosDeg(rootBone.rotation + rootBone.shearX) * rootBone.scaleX;
7353
- let lb = MathUtils.cosDeg(rotationY) * rootBone.scaleY;
7354
- let lc = MathUtils.sinDeg(rootBone.rotation + rootBone.shearX) * rootBone.scaleX;
7355
- let ld = MathUtils.sinDeg(rotationY) * rootBone.scaleY;
7822
+ const rx = (rootBone.rotation + rootBone.shearX) * MathUtils.degRad;
7823
+ const ry = (rootBone.rotation + 90 + rootBone.shearY) * MathUtils.degRad;
7824
+ const la = Math.cos(rx) * rootBone.scaleX;
7825
+ const lb = Math.cos(ry) * rootBone.scaleY;
7826
+ const lc = Math.sin(rx) * rootBone.scaleX;
7827
+ const ld = Math.sin(ry) * rootBone.scaleY;
7356
7828
  rootBone.a = (pa * la + pb * lc) * this.scaleX;
7357
7829
  rootBone.b = (pa * lb + pb * ld) * this.scaleX;
7358
7830
  rootBone.c = (pc * la + pd * lc) * this.scaleY;
@@ -7361,7 +7833,7 @@ var spine = (() => {
7361
7833
  for (let i = 0, n = updateCache.length; i < n; i++) {
7362
7834
  let updatable = updateCache[i];
7363
7835
  if (updatable != rootBone)
7364
- updatable.update();
7836
+ updatable.update(physics);
7365
7837
  }
7366
7838
  }
7367
7839
  /** Sets the bones, constraints, and slots to their setup pose values. */
@@ -7371,39 +7843,16 @@ var spine = (() => {
7371
7843
  }
7372
7844
  /** Sets the bones and constraints to their setup pose values. */
7373
7845
  setBonesToSetupPose() {
7374
- let bones = this.bones;
7375
- for (let i = 0, n = bones.length; i < n; i++)
7376
- bones[i].setToSetupPose();
7377
- let ikConstraints = this.ikConstraints;
7378
- for (let i = 0, n = ikConstraints.length; i < n; i++) {
7379
- let constraint = ikConstraints[i];
7380
- constraint.mix = constraint.data.mix;
7381
- constraint.softness = constraint.data.softness;
7382
- constraint.bendDirection = constraint.data.bendDirection;
7383
- constraint.compress = constraint.data.compress;
7384
- constraint.stretch = constraint.data.stretch;
7385
- }
7386
- let transformConstraints = this.transformConstraints;
7387
- for (let i = 0, n = transformConstraints.length; i < n; i++) {
7388
- let constraint = transformConstraints[i];
7389
- let data = constraint.data;
7390
- constraint.mixRotate = data.mixRotate;
7391
- constraint.mixX = data.mixX;
7392
- constraint.mixY = data.mixY;
7393
- constraint.mixScaleX = data.mixScaleX;
7394
- constraint.mixScaleY = data.mixScaleY;
7395
- constraint.mixShearY = data.mixShearY;
7396
- }
7397
- let pathConstraints = this.pathConstraints;
7398
- for (let i = 0, n = pathConstraints.length; i < n; i++) {
7399
- let constraint = pathConstraints[i];
7400
- let data = constraint.data;
7401
- constraint.position = data.position;
7402
- constraint.spacing = data.spacing;
7403
- constraint.mixRotate = data.mixRotate;
7404
- constraint.mixX = data.mixX;
7405
- constraint.mixY = data.mixY;
7406
- }
7846
+ for (const bone of this.bones)
7847
+ bone.setToSetupPose();
7848
+ for (const constraint of this.ikConstraints)
7849
+ constraint.setToSetupPose();
7850
+ for (const constraint of this.transformConstraints)
7851
+ constraint.setToSetupPose();
7852
+ for (const constraint of this.pathConstraints)
7853
+ constraint.setToSetupPose();
7854
+ for (const constraint of this.physicsConstraints)
7855
+ constraint.setToSetupPose();
7407
7856
  }
7408
7857
  /** Sets the slots and draw order to their setup pose values. */
7409
7858
  setSlotsToSetupPose() {
@@ -7541,13 +7990,7 @@ var spine = (() => {
7541
7990
  findIkConstraint(constraintName) {
7542
7991
  if (!constraintName)
7543
7992
  throw new Error("constraintName cannot be null.");
7544
- let ikConstraints = this.ikConstraints;
7545
- for (let i = 0, n = ikConstraints.length; i < n; i++) {
7546
- let ikConstraint = ikConstraints[i];
7547
- if (ikConstraint.data.name == constraintName)
7548
- return ikConstraint;
7549
- }
7550
- return null;
7993
+ return this.ikConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
7551
7994
  }
7552
7995
  /** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
7553
7996
  * this method than to call it repeatedly.
@@ -7555,13 +7998,7 @@ var spine = (() => {
7555
7998
  findTransformConstraint(constraintName) {
7556
7999
  if (!constraintName)
7557
8000
  throw new Error("constraintName cannot be null.");
7558
- let transformConstraints = this.transformConstraints;
7559
- for (let i = 0, n = transformConstraints.length; i < n; i++) {
7560
- let constraint = transformConstraints[i];
7561
- if (constraint.data.name == constraintName)
7562
- return constraint;
7563
- }
7564
- return null;
8001
+ return this.transformConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
7565
8002
  }
7566
8003
  /** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
7567
8004
  * than to call it repeatedly.
@@ -7569,13 +8006,14 @@ var spine = (() => {
7569
8006
  findPathConstraint(constraintName) {
7570
8007
  if (!constraintName)
7571
8008
  throw new Error("constraintName cannot be null.");
7572
- let pathConstraints = this.pathConstraints;
7573
- for (let i = 0, n = pathConstraints.length; i < n; i++) {
7574
- let constraint = pathConstraints[i];
7575
- if (constraint.data.name == constraintName)
7576
- return constraint;
7577
- }
7578
- return null;
8009
+ return this.pathConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
8010
+ }
8011
+ /** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this
8012
+ * method than to call it repeatedly. */
8013
+ findPhysicsConstraint(constraintName) {
8014
+ if (constraintName == null)
8015
+ throw new Error("constraintName cannot be null.");
8016
+ return this.physicsConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
7579
8017
  }
7580
8018
  /** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose as `{ x: number, y: number, width: number, height: number }`.
7581
8019
  * Note that this method will create temporary objects which can add to garbage collection pressure. Use `getBounds()` if garbage collection is a concern. */
@@ -7626,57 +8064,68 @@ var spine = (() => {
7626
8064
  offset.set(minX, minY);
7627
8065
  size.set(maxX - minX, maxY - minY);
7628
8066
  }
8067
+ /** Increments the skeleton's {@link #time}. */
8068
+ update(delta) {
8069
+ this.time += delta;
8070
+ }
7629
8071
  };
7630
- var Skeleton = _Skeleton;
7631
- Skeleton.yDown = false;
8072
+ var Skeleton2 = _Skeleton;
8073
+ __publicField(Skeleton2, "yDown", false);
8074
+ var Physics = /* @__PURE__ */ ((Physics2) => {
8075
+ Physics2[Physics2["none"] = 0] = "none";
8076
+ Physics2[Physics2["reset"] = 1] = "reset";
8077
+ Physics2[Physics2["update"] = 2] = "update";
8078
+ Physics2[Physics2["pose"] = 3] = "pose";
8079
+ return Physics2;
8080
+ })(Physics || {});
7632
8081
 
7633
8082
  // spine-core/src/SkeletonData.ts
7634
8083
  var SkeletonData = class {
7635
- constructor() {
7636
- /** The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null. */
7637
- this.name = null;
7638
- /** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
7639
- this.bones = new Array();
7640
- // Ordered parents first.
7641
- /** The skeleton's slots. */
7642
- this.slots = new Array();
7643
- // Setup pose draw order.
7644
- this.skins = new Array();
7645
- /** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.
7646
- *
7647
- * See {@link Skeleton#getAttachmentByName()}.
7648
- * May be null. */
7649
- this.defaultSkin = null;
7650
- /** The skeleton's events. */
7651
- this.events = new Array();
7652
- /** The skeleton's animations. */
7653
- this.animations = new Array();
7654
- /** The skeleton's IK constraints. */
7655
- this.ikConstraints = new Array();
7656
- /** The skeleton's transform constraints. */
7657
- this.transformConstraints = new Array();
7658
- /** The skeleton's path constraints. */
7659
- this.pathConstraints = new Array();
7660
- /** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */
7661
- this.x = 0;
7662
- /** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */
7663
- this.y = 0;
7664
- /** The width of the skeleton's axis aligned bounding box in the setup pose. */
7665
- this.width = 0;
7666
- /** The height of the skeleton's axis aligned bounding box in the setup pose. */
7667
- this.height = 0;
7668
- /** The Spine version used to export the skeleton data, or null. */
7669
- this.version = null;
7670
- /** The skeleton data hash. This value will change if any of the skeleton data has changed. May be null. */
7671
- this.hash = null;
7672
- // Nonessential
7673
- /** The dopesheet FPS in Spine. Available only when nonessential data was exported. */
7674
- this.fps = 0;
7675
- /** The path to the images directory as defined in Spine. Available only when nonessential data was exported. May be null. */
7676
- this.imagesPath = null;
7677
- /** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. May be null. */
7678
- this.audioPath = null;
7679
- }
8084
+ /** The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null. */
8085
+ name = null;
8086
+ /** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
8087
+ bones = new Array();
8088
+ // Ordered parents first.
8089
+ /** The skeleton's slots. */
8090
+ slots = new Array();
8091
+ // Setup pose draw order.
8092
+ skins = new Array();
8093
+ /** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.
8094
+ *
8095
+ * See {@link Skeleton#getAttachmentByName()}.
8096
+ * May be null. */
8097
+ defaultSkin = null;
8098
+ /** The skeleton's events. */
8099
+ events = new Array();
8100
+ /** The skeleton's animations. */
8101
+ animations = new Array();
8102
+ /** The skeleton's IK constraints. */
8103
+ ikConstraints = new Array();
8104
+ /** The skeleton's transform constraints. */
8105
+ transformConstraints = new Array();
8106
+ /** The skeleton's path constraints. */
8107
+ pathConstraints = new Array();
8108
+ /** The skeleton's physics constraints. */
8109
+ physicsConstraints = new Array();
8110
+ /** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */
8111
+ x = 0;
8112
+ /** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */
8113
+ y = 0;
8114
+ /** The width of the skeleton's axis aligned bounding box in the setup pose. */
8115
+ width = 0;
8116
+ /** The height of the skeleton's axis aligned bounding box in the setup pose. */
8117
+ height = 0;
8118
+ /** The Spine version used to export the skeleton data, or null. */
8119
+ version = null;
8120
+ /** The skeleton data hash. This value will change if any of the skeleton data has changed. May be null. */
8121
+ hash = null;
8122
+ // Nonessential
8123
+ /** The dopesheet FPS in Spine. Available only when nonessential data was exported. */
8124
+ fps = 0;
8125
+ /** The path to the images directory as defined in Spine. Available only when nonessential data was exported. May be null. */
8126
+ imagesPath = null;
8127
+ /** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. May be null. */
8128
+ audioPath = null;
7680
8129
  /** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it
7681
8130
  * multiple times.
7682
8131
  * @returns May be null. */
@@ -7753,9 +8202,9 @@ var spine = (() => {
7753
8202
  findIkConstraint(constraintName) {
7754
8203
  if (!constraintName)
7755
8204
  throw new Error("constraintName cannot be null.");
7756
- let ikConstraints = this.ikConstraints;
8205
+ const ikConstraints = this.ikConstraints;
7757
8206
  for (let i = 0, n = ikConstraints.length; i < n; i++) {
7758
- let constraint = ikConstraints[i];
8207
+ const constraint = ikConstraints[i];
7759
8208
  if (constraint.name == constraintName)
7760
8209
  return constraint;
7761
8210
  }
@@ -7767,9 +8216,9 @@ var spine = (() => {
7767
8216
  findTransformConstraint(constraintName) {
7768
8217
  if (!constraintName)
7769
8218
  throw new Error("constraintName cannot be null.");
7770
- let transformConstraints = this.transformConstraints;
8219
+ const transformConstraints = this.transformConstraints;
7771
8220
  for (let i = 0, n = transformConstraints.length; i < n; i++) {
7772
- let constraint = transformConstraints[i];
8221
+ const constraint = transformConstraints[i];
7773
8222
  if (constraint.name == constraintName)
7774
8223
  return constraint;
7775
8224
  }
@@ -7781,9 +8230,23 @@ var spine = (() => {
7781
8230
  findPathConstraint(constraintName) {
7782
8231
  if (!constraintName)
7783
8232
  throw new Error("constraintName cannot be null.");
7784
- let pathConstraints = this.pathConstraints;
8233
+ const pathConstraints = this.pathConstraints;
7785
8234
  for (let i = 0, n = pathConstraints.length; i < n; i++) {
7786
- let constraint = pathConstraints[i];
8235
+ const constraint = pathConstraints[i];
8236
+ if (constraint.name == constraintName)
8237
+ return constraint;
8238
+ }
8239
+ return null;
8240
+ }
8241
+ /** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this method
8242
+ * than to call it multiple times.
8243
+ * @return May be null. */
8244
+ findPhysicsConstraint(constraintName) {
8245
+ if (!constraintName)
8246
+ throw new Error("constraintName cannot be null.");
8247
+ const physicsConstraints = this.physicsConstraints;
8248
+ for (let i = 0, n = physicsConstraints.length; i < n; i++) {
8249
+ const constraint = physicsConstraints[i];
7787
8250
  if (constraint.name == constraintName)
7788
8251
  return constraint;
7789
8252
  }
@@ -7800,10 +8263,15 @@ var spine = (() => {
7800
8263
  }
7801
8264
  };
7802
8265
  var Skin = class {
8266
+ /** The skin's name, which is unique across all skins in the skeleton. */
8267
+ name;
8268
+ attachments = new Array();
8269
+ bones = Array();
8270
+ constraints = new Array();
8271
+ /** The color of the skin as it was in Spine, or a default color if nonessential data was not exported. */
8272
+ color = new Color(0.99607843, 0.61960787, 0.30980393, 1);
8273
+ // fe9e4fff
7803
8274
  constructor(name) {
7804
- this.attachments = new Array();
7805
- this.bones = Array();
7806
- this.constraints = new Array();
7807
8275
  if (!name)
7808
8276
  throw new Error("name cannot be null.");
7809
8277
  this.name = name;
@@ -7960,19 +8428,25 @@ var spine = (() => {
7960
8428
 
7961
8429
  // spine-core/src/SlotData.ts
7962
8430
  var SlotData = class {
8431
+ /** The index of the slot in {@link Skeleton#getSlots()}. */
8432
+ index = 0;
8433
+ /** The name of the slot, which is unique across all slots in the skeleton. */
8434
+ name;
8435
+ /** The bone this slot belongs to. */
8436
+ boneData;
8437
+ /** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
8438
+ * color tinting. */
8439
+ color = new Color(1, 1, 1, 1);
8440
+ /** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
8441
+ * color's alpha is not used. */
8442
+ darkColor = null;
8443
+ /** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
8444
+ attachmentName = null;
8445
+ /** The blend mode for drawing the slot's attachment. */
8446
+ blendMode = BlendMode.Normal;
8447
+ /** False if the slot was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
8448
+ visible = true;
7963
8449
  constructor(index, name, boneData) {
7964
- /** The index of the slot in {@link Skeleton#getSlots()}. */
7965
- this.index = 0;
7966
- /** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
7967
- * color tinting. */
7968
- this.color = new Color(1, 1, 1, 1);
7969
- /** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
7970
- * color's alpha is not used. */
7971
- this.darkColor = null;
7972
- /** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
7973
- this.attachmentName = null;
7974
- /** The blend mode for drawing the slot's attachment. */
7975
- this.blendMode = BlendMode.Normal;
7976
8450
  if (index < 0)
7977
8451
  throw new Error("index must be >= 0.");
7978
8452
  if (!name)
@@ -7994,33 +8468,10 @@ var spine = (() => {
7994
8468
 
7995
8469
  // spine-core/src/TransformConstraintData.ts
7996
8470
  var TransformConstraintData = class extends ConstraintData {
7997
- constructor(name) {
7998
- super(name, 0, false);
7999
- /** The bones that will be modified by this transform constraint. */
8000
- this.bones = new Array();
8001
- /** The target bone whose world transform will be copied to the constrained bones. */
8002
- this._target = null;
8003
- this.mixRotate = 0;
8004
- this.mixX = 0;
8005
- this.mixY = 0;
8006
- this.mixScaleX = 0;
8007
- this.mixScaleY = 0;
8008
- this.mixShearY = 0;
8009
- /** An offset added to the constrained bone rotation. */
8010
- this.offsetRotation = 0;
8011
- /** An offset added to the constrained bone X translation. */
8012
- this.offsetX = 0;
8013
- /** An offset added to the constrained bone Y translation. */
8014
- this.offsetY = 0;
8015
- /** An offset added to the constrained bone scaleX. */
8016
- this.offsetScaleX = 0;
8017
- /** An offset added to the constrained bone scaleY. */
8018
- this.offsetScaleY = 0;
8019
- /** An offset added to the constrained bone shearY. */
8020
- this.offsetShearY = 0;
8021
- this.relative = false;
8022
- this.local = false;
8023
- }
8471
+ /** The bones that will be modified by this transform constraint. */
8472
+ bones = new Array();
8473
+ /** The target bone whose world transform will be copied to the constrained bones. */
8474
+ _target = null;
8024
8475
  set target(boneData) {
8025
8476
  this._target = boneData;
8026
8477
  }
@@ -8030,17 +8481,41 @@ var spine = (() => {
8030
8481
  else
8031
8482
  return this._target;
8032
8483
  }
8484
+ mixRotate = 0;
8485
+ mixX = 0;
8486
+ mixY = 0;
8487
+ mixScaleX = 0;
8488
+ mixScaleY = 0;
8489
+ mixShearY = 0;
8490
+ /** An offset added to the constrained bone rotation. */
8491
+ offsetRotation = 0;
8492
+ /** An offset added to the constrained bone X translation. */
8493
+ offsetX = 0;
8494
+ /** An offset added to the constrained bone Y translation. */
8495
+ offsetY = 0;
8496
+ /** An offset added to the constrained bone scaleX. */
8497
+ offsetScaleX = 0;
8498
+ /** An offset added to the constrained bone scaleY. */
8499
+ offsetScaleY = 0;
8500
+ /** An offset added to the constrained bone shearY. */
8501
+ offsetShearY = 0;
8502
+ relative = false;
8503
+ local = false;
8504
+ constructor(name) {
8505
+ super(name, 0, false);
8506
+ }
8033
8507
  };
8034
8508
 
8035
8509
  // spine-core/src/SkeletonBinary.ts
8036
8510
  var SkeletonBinary = class {
8511
+ /** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
8512
+ * runtime than were used in Spine.
8513
+ *
8514
+ * See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
8515
+ scale = 1;
8516
+ attachmentLoader;
8517
+ linkedMeshes = new Array();
8037
8518
  constructor(attachmentLoader) {
8038
- /** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
8039
- * runtime than were used in Spine.
8040
- *
8041
- * See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
8042
- this.scale = 1;
8043
- this.linkedMeshes = new Array();
8044
8519
  this.attachmentLoader = attachmentLoader;
8045
8520
  }
8046
8521
  readSkeletonData(binary) {
@@ -9054,6 +9529,11 @@ var spine = (() => {
9054
9529
  }
9055
9530
  };
9056
9531
  var LinkedMesh = class {
9532
+ parent;
9533
+ skin;
9534
+ slotIndex;
9535
+ mesh;
9536
+ inheritTimeline;
9057
9537
  constructor(mesh, skin, slotIndex, parent, inheritDeform) {
9058
9538
  this.mesh = mesh;
9059
9539
  this.skin = skin;
@@ -9147,23 +9627,21 @@ var spine = (() => {
9147
9627
 
9148
9628
  // spine-core/src/SkeletonBounds.ts
9149
9629
  var SkeletonBounds = class {
9150
- constructor() {
9151
- /** The left edge of the axis aligned bounding box. */
9152
- this.minX = 0;
9153
- /** The bottom edge of the axis aligned bounding box. */
9154
- this.minY = 0;
9155
- /** The right edge of the axis aligned bounding box. */
9156
- this.maxX = 0;
9157
- /** The top edge of the axis aligned bounding box. */
9158
- this.maxY = 0;
9159
- /** The visible bounding boxes. */
9160
- this.boundingBoxes = new Array();
9161
- /** The world vertices for the bounding box polygons. */
9162
- this.polygons = new Array();
9163
- this.polygonPool = new Pool(() => {
9164
- return Utils.newFloatArray(16);
9165
- });
9166
- }
9630
+ /** The left edge of the axis aligned bounding box. */
9631
+ minX = 0;
9632
+ /** The bottom edge of the axis aligned bounding box. */
9633
+ minY = 0;
9634
+ /** The right edge of the axis aligned bounding box. */
9635
+ maxX = 0;
9636
+ /** The top edge of the axis aligned bounding box. */
9637
+ maxY = 0;
9638
+ /** The visible bounding boxes. */
9639
+ boundingBoxes = new Array();
9640
+ /** The world vertices for the bounding box polygons. */
9641
+ polygons = new Array();
9642
+ polygonPool = new Pool(() => {
9643
+ return Utils.newFloatArray(16);
9644
+ });
9167
9645
  /** Clears any previous polygons, finds all visible bounding box attachments, and computes the world vertices for each bounding
9168
9646
  * box's polygon.
9169
9647
  * @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the
@@ -9334,19 +9812,17 @@ var spine = (() => {
9334
9812
 
9335
9813
  // spine-core/src/Triangulator.ts
9336
9814
  var Triangulator = class {
9337
- constructor() {
9338
- this.convexPolygons = new Array();
9339
- this.convexPolygonsIndices = new Array();
9340
- this.indicesArray = new Array();
9341
- this.isConcaveArray = new Array();
9342
- this.triangles = new Array();
9343
- this.polygonPool = new Pool(() => {
9344
- return new Array();
9345
- });
9346
- this.polygonIndicesPool = new Pool(() => {
9347
- return new Array();
9348
- });
9349
- }
9815
+ convexPolygons = new Array();
9816
+ convexPolygonsIndices = new Array();
9817
+ indicesArray = new Array();
9818
+ isConcaveArray = new Array();
9819
+ triangles = new Array();
9820
+ polygonPool = new Pool(() => {
9821
+ return new Array();
9822
+ });
9823
+ polygonIndicesPool = new Pool(() => {
9824
+ return new Array();
9825
+ });
9350
9826
  triangulate(verticesArray) {
9351
9827
  let vertices = verticesArray;
9352
9828
  let vertexCount = verticesArray.length >> 1;
@@ -9550,16 +10026,14 @@ var spine = (() => {
9550
10026
 
9551
10027
  // spine-core/src/SkeletonClipping.ts
9552
10028
  var SkeletonClipping = class {
9553
- constructor() {
9554
- this.triangulator = new Triangulator();
9555
- this.clippingPolygon = new Array();
9556
- this.clipOutput = new Array();
9557
- this.clippedVertices = new Array();
9558
- this.clippedTriangles = new Array();
9559
- this.scratch = new Array();
9560
- this.clipAttachment = null;
9561
- this.clippingPolygons = null;
9562
- }
10029
+ triangulator = new Triangulator();
10030
+ clippingPolygon = new Array();
10031
+ clipOutput = new Array();
10032
+ clippedVertices = new Array();
10033
+ clippedTriangles = new Array();
10034
+ scratch = new Array();
10035
+ clipAttachment = null;
10036
+ clippingPolygons = null;
9563
10037
  clipStart(slot, clip) {
9564
10038
  if (this.clipAttachment)
9565
10039
  return 0;
@@ -9839,13 +10313,14 @@ var spine = (() => {
9839
10313
 
9840
10314
  // spine-core/src/SkeletonJson.ts
9841
10315
  var SkeletonJson = class {
10316
+ attachmentLoader;
10317
+ /** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
10318
+ * runtime than were used in Spine.
10319
+ *
10320
+ * See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
10321
+ scale = 1;
10322
+ linkedMeshes = new Array();
9842
10323
  constructor(attachmentLoader) {
9843
- /** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
9844
- * runtime than were used in Spine.
9845
- *
9846
- * See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
9847
- this.scale = 1;
9848
- this.linkedMeshes = new Array();
9849
10324
  this.attachmentLoader = attachmentLoader;
9850
10325
  }
9851
10326
  readSkeletonData(json) {
@@ -10707,6 +11182,11 @@ var spine = (() => {
10707
11182
  }
10708
11183
  };
10709
11184
  var LinkedMesh2 = class {
11185
+ parent;
11186
+ skin;
11187
+ slotIndex;
11188
+ mesh;
11189
+ inheritTimeline;
10710
11190
  constructor(mesh, skin, slotIndex, parent, inheritDeform) {
10711
11191
  this.mesh = mesh;
10712
11192
  this.skin = skin;
@@ -10793,8 +11273,10 @@ var spine = (() => {
10793
11273
 
10794
11274
  // spine-webgl/src/WebGL.ts
10795
11275
  var ManagedWebGLRenderingContext = class {
11276
+ canvas;
11277
+ gl;
11278
+ restorables = new Array();
10796
11279
  constructor(canvasOrContext, contextConfig = { alpha: "true" }) {
10797
- this.restorables = new Array();
10798
11280
  if (!(canvasOrContext instanceof WebGLRenderingContext || typeof WebGL2RenderingContext !== "undefined" && canvasOrContext instanceof WebGL2RenderingContext)) {
10799
11281
  let canvas = canvasOrContext;
10800
11282
  this.gl = canvas.getContext("webgl2", contextConfig) || canvas.getContext("webgl", contextConfig);
@@ -10825,11 +11307,12 @@ var spine = (() => {
10825
11307
 
10826
11308
  // spine-webgl/src/GLTexture.ts
10827
11309
  var _GLTexture = class extends Texture {
11310
+ context;
11311
+ texture = null;
11312
+ boundUnit = 0;
11313
+ useMipMaps = false;
10828
11314
  constructor(context, image, useMipMaps = false) {
10829
11315
  super(image);
10830
- this.texture = null;
10831
- this.boundUnit = 0;
10832
- this.useMipMaps = false;
10833
11316
  this.context = context instanceof ManagedWebGLRenderingContext ? context : new ManagedWebGLRenderingContext(context);
10834
11317
  this.useMipMaps = useMipMaps;
10835
11318
  this.restore();
@@ -10909,7 +11392,7 @@ var spine = (() => {
10909
11392
  }
10910
11393
  };
10911
11394
  var GLTexture = _GLTexture;
10912
- GLTexture.DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL = false;
11395
+ __publicField(GLTexture, "DISABLE_UNPACK_PREMULTIPLIED_ALPHA_WEBGL", false);
10913
11396
 
10914
11397
  // spine-webgl/src/AssetManager.ts
10915
11398
  var AssetManager = class extends AssetManagerBase {
@@ -10922,10 +11405,10 @@ var spine = (() => {
10922
11405
 
10923
11406
  // spine-webgl/src/Vector3.ts
10924
11407
  var Vector3 = class {
11408
+ x = 0;
11409
+ y = 0;
11410
+ z = 0;
10925
11411
  constructor(x = 0, y = 0, z = 0) {
10926
- this.x = 0;
10927
- this.y = 0;
10928
- this.z = 0;
10929
11412
  this.x = x;
10930
11413
  this.y = y;
10931
11414
  this.z = z;
@@ -11022,9 +11505,9 @@ var spine = (() => {
11022
11505
  var M32 = 11;
11023
11506
  var M33 = 15;
11024
11507
  var _Matrix4 = class {
11508
+ temp = new Float32Array(16);
11509
+ values = new Float32Array(16);
11025
11510
  constructor() {
11026
- this.temp = new Float32Array(16);
11027
- this.values = new Float32Array(16);
11028
11511
  let v = this.values;
11029
11512
  v[M00] = 1;
11030
11513
  v[M11] = 1;
@@ -11255,26 +11738,26 @@ var spine = (() => {
11255
11738
  }
11256
11739
  };
11257
11740
  var Matrix42 = _Matrix4;
11258
- Matrix42.xAxis = new Vector3();
11259
- Matrix42.yAxis = new Vector3();
11260
- Matrix42.zAxis = new Vector3();
11261
- Matrix42.tmpMatrix = new _Matrix4();
11741
+ __publicField(Matrix42, "xAxis", new Vector3());
11742
+ __publicField(Matrix42, "yAxis", new Vector3());
11743
+ __publicField(Matrix42, "zAxis", new Vector3());
11744
+ __publicField(Matrix42, "tmpMatrix", new _Matrix4());
11262
11745
 
11263
11746
  // spine-webgl/src/Camera.ts
11264
11747
  var OrthoCamera = class {
11748
+ position = new Vector3(0, 0, 0);
11749
+ direction = new Vector3(0, 0, -1);
11750
+ up = new Vector3(0, 1, 0);
11751
+ near = 0;
11752
+ far = 100;
11753
+ zoom = 1;
11754
+ viewportWidth = 0;
11755
+ viewportHeight = 0;
11756
+ projectionView = new Matrix42();
11757
+ inverseProjectionView = new Matrix42();
11758
+ projection = new Matrix42();
11759
+ view = new Matrix42();
11265
11760
  constructor(viewportWidth, viewportHeight) {
11266
- this.position = new Vector3(0, 0, 0);
11267
- this.direction = new Vector3(0, 0, -1);
11268
- this.up = new Vector3(0, 1, 0);
11269
- this.near = 0;
11270
- this.far = 100;
11271
- this.zoom = 1;
11272
- this.viewportWidth = 0;
11273
- this.viewportHeight = 0;
11274
- this.projectionView = new Matrix42();
11275
- this.inverseProjectionView = new Matrix42();
11276
- this.projection = new Matrix42();
11277
- this.view = new Matrix42();
11278
11761
  this.viewportWidth = viewportWidth;
11279
11762
  this.viewportHeight = viewportHeight;
11280
11763
  this.update();
@@ -11321,15 +11804,16 @@ var spine = (() => {
11321
11804
 
11322
11805
  // spine-webgl/src/Input.ts
11323
11806
  var Input = class {
11807
+ element;
11808
+ mouseX = 0;
11809
+ mouseY = 0;
11810
+ buttonDown = false;
11811
+ touch0 = null;
11812
+ touch1 = null;
11813
+ initialPinchDistance = 0;
11814
+ listeners = new Array();
11815
+ eventListeners = [];
11324
11816
  constructor(element) {
11325
- this.mouseX = 0;
11326
- this.mouseY = 0;
11327
- this.buttonDown = false;
11328
- this.touch0 = null;
11329
- this.touch1 = null;
11330
- this.initialPinchDistance = 0;
11331
- this.listeners = new Array();
11332
- this.eventListeners = [];
11333
11817
  this.element = element;
11334
11818
  this.setupCallbacks(element);
11335
11819
  }
@@ -11592,18 +12076,21 @@ var spine = (() => {
11592
12076
  constructor(context, vertexShader, fragmentShader) {
11593
12077
  this.vertexShader = vertexShader;
11594
12078
  this.fragmentShader = fragmentShader;
11595
- this.vs = null;
11596
- this.fs = null;
11597
- this.program = null;
11598
- this.tmp2x2 = new Float32Array(2 * 2);
11599
- this.tmp3x3 = new Float32Array(3 * 3);
11600
- this.tmp4x4 = new Float32Array(4 * 4);
11601
12079
  this.vsSource = vertexShader;
11602
12080
  this.fsSource = fragmentShader;
11603
12081
  this.context = context instanceof ManagedWebGLRenderingContext ? context : new ManagedWebGLRenderingContext(context);
11604
12082
  this.context.addRestorable(this);
11605
12083
  this.compile();
11606
12084
  }
12085
+ context;
12086
+ vs = null;
12087
+ vsSource;
12088
+ fs = null;
12089
+ fsSource;
12090
+ program = null;
12091
+ tmp2x2 = new Float32Array(2 * 2);
12092
+ tmp3x3 = new Float32Array(3 * 3);
12093
+ tmp4x4 = new Float32Array(4 * 4);
11607
12094
  getProgram() {
11608
12095
  return this.program;
11609
12096
  }
@@ -11837,24 +12324,17 @@ void main () {
11837
12324
  }
11838
12325
  };
11839
12326
  var Shader = _Shader;
11840
- Shader.MVP_MATRIX = "u_projTrans";
11841
- Shader.POSITION = "a_position";
11842
- Shader.COLOR = "a_color";
11843
- Shader.COLOR2 = "a_color2";
11844
- Shader.TEXCOORDS = "a_texCoords";
11845
- Shader.SAMPLER = "u_texture";
12327
+ __publicField(Shader, "MVP_MATRIX", "u_projTrans");
12328
+ __publicField(Shader, "POSITION", "a_position");
12329
+ __publicField(Shader, "COLOR", "a_color");
12330
+ __publicField(Shader, "COLOR2", "a_color2");
12331
+ __publicField(Shader, "TEXCOORDS", "a_texCoords");
12332
+ __publicField(Shader, "SAMPLER", "u_texture");
11846
12333
 
11847
12334
  // spine-webgl/src/Mesh.ts
11848
12335
  var Mesh = class {
11849
12336
  constructor(context, attributes, maxVertices, maxIndices) {
11850
12337
  this.attributes = attributes;
11851
- this.verticesBuffer = null;
11852
- this.verticesLength = 0;
11853
- this.dirtyVertices = false;
11854
- this.indicesBuffer = null;
11855
- this.indicesLength = 0;
11856
- this.dirtyIndices = false;
11857
- this.elementsPerVertex = 0;
11858
12338
  this.context = context instanceof ManagedWebGLRenderingContext ? context : new ManagedWebGLRenderingContext(context);
11859
12339
  this.elementsPerVertex = 0;
11860
12340
  for (let i = 0; i < attributes.length; i++) {
@@ -11864,6 +12344,16 @@ void main () {
11864
12344
  this.indices = new Uint16Array(maxIndices);
11865
12345
  this.context.addRestorable(this);
11866
12346
  }
12347
+ context;
12348
+ vertices;
12349
+ verticesBuffer = null;
12350
+ verticesLength = 0;
12351
+ dirtyVertices = false;
12352
+ indices;
12353
+ indicesBuffer = null;
12354
+ indicesLength = 0;
12355
+ dirtyIndices = false;
12356
+ elementsPerVertex = 0;
11867
12357
  getAttributes() {
11868
12358
  return this.attributes;
11869
12359
  }
@@ -12030,14 +12520,19 @@ void main () {
12030
12520
  var GL_ONE_MINUS_SRC_ALPHA = 771;
12031
12521
  var GL_DST_COLOR = 774;
12032
12522
  var _PolygonBatcher = class {
12523
+ context;
12524
+ drawCalls = 0;
12525
+ isDrawing = false;
12526
+ mesh;
12527
+ shader = null;
12528
+ lastTexture = null;
12529
+ verticesLength = 0;
12530
+ indicesLength = 0;
12531
+ srcColorBlend;
12532
+ srcAlphaBlend;
12533
+ dstBlend;
12534
+ cullWasEnabled = false;
12033
12535
  constructor(context, twoColorTint = true, maxVertices = 10920) {
12034
- this.drawCalls = 0;
12035
- this.isDrawing = false;
12036
- this.shader = null;
12037
- this.lastTexture = null;
12038
- this.verticesLength = 0;
12039
- this.indicesLength = 0;
12040
- this.cullWasEnabled = false;
12041
12536
  if (maxVertices > 10920)
12042
12537
  throw new Error("Can't have more than 10920 triangles per batch: " + maxVertices);
12043
12538
  this.context = context instanceof ManagedWebGLRenderingContext ? context : new ManagedWebGLRenderingContext(context);
@@ -12141,24 +12636,29 @@ void main () {
12141
12636
  }
12142
12637
  };
12143
12638
  var PolygonBatcher = _PolygonBatcher;
12144
- PolygonBatcher.disableCulling = false;
12145
- PolygonBatcher.globalDrawCalls = 0;
12146
- PolygonBatcher.blendModesGL = [
12639
+ __publicField(PolygonBatcher, "disableCulling", false);
12640
+ __publicField(PolygonBatcher, "globalDrawCalls", 0);
12641
+ __publicField(PolygonBatcher, "blendModesGL", [
12147
12642
  { srcRgb: GL_SRC_ALPHA, srcRgbPma: GL_ONE, dstRgb: GL_ONE_MINUS_SRC_ALPHA, srcAlpha: GL_ONE },
12148
12643
  { srcRgb: GL_SRC_ALPHA, srcRgbPma: GL_ONE, dstRgb: GL_ONE, srcAlpha: GL_ONE },
12149
12644
  { srcRgb: GL_DST_COLOR, srcRgbPma: GL_DST_COLOR, dstRgb: GL_ONE_MINUS_SRC_ALPHA, srcAlpha: GL_ONE },
12150
12645
  { srcRgb: GL_ONE, srcRgbPma: GL_ONE, dstRgb: GL_ONE_MINUS_SRC_COLOR, srcAlpha: GL_ONE }
12151
- ];
12646
+ ]);
12152
12647
 
12153
12648
  // spine-webgl/src/ShapeRenderer.ts
12154
12649
  var ShapeRenderer = class {
12650
+ context;
12651
+ isDrawing = false;
12652
+ mesh;
12653
+ shapeType = ShapeType.Filled;
12654
+ color = new Color(1, 1, 1, 1);
12655
+ shader = null;
12656
+ vertexIndex = 0;
12657
+ tmp = new Vector2();
12658
+ srcColorBlend;
12659
+ srcAlphaBlend;
12660
+ dstBlend;
12155
12661
  constructor(context, maxVertices = 10920) {
12156
- this.isDrawing = false;
12157
- this.shapeType = ShapeType.Filled;
12158
- this.color = new Color(1, 1, 1, 1);
12159
- this.shader = null;
12160
- this.vertexIndex = 0;
12161
- this.tmp = new Vector2();
12162
12662
  if (maxVertices > 10920)
12163
12663
  throw new Error("Can't have more than 10920 triangles per batch: " + maxVertices);
12164
12664
  this.context = context instanceof ManagedWebGLRenderingContext ? context : new ManagedWebGLRenderingContext(context);
@@ -12455,28 +12955,29 @@ void main () {
12455
12955
 
12456
12956
  // spine-webgl/src/SkeletonDebugRenderer.ts
12457
12957
  var _SkeletonDebugRenderer = class {
12958
+ boneLineColor = new Color(1, 0, 0, 1);
12959
+ boneOriginColor = new Color(0, 1, 0, 1);
12960
+ attachmentLineColor = new Color(0, 0, 1, 0.5);
12961
+ triangleLineColor = new Color(1, 0.64, 0, 0.5);
12962
+ pathColor = new Color().setFromString("FF7F00");
12963
+ clipColor = new Color(0.8, 0, 0, 2);
12964
+ aabbColor = new Color(0, 1, 0, 0.5);
12965
+ drawBones = true;
12966
+ drawRegionAttachments = true;
12967
+ drawBoundingBoxes = true;
12968
+ drawMeshHull = true;
12969
+ drawMeshTriangles = true;
12970
+ drawPaths = true;
12971
+ drawSkeletonXY = false;
12972
+ drawClipping = true;
12973
+ premultipliedAlpha = false;
12974
+ scale = 1;
12975
+ boneWidth = 2;
12976
+ context;
12977
+ bounds = new SkeletonBounds();
12978
+ temp = new Array();
12979
+ vertices = Utils.newFloatArray(2 * 1024);
12458
12980
  constructor(context) {
12459
- this.boneLineColor = new Color(1, 0, 0, 1);
12460
- this.boneOriginColor = new Color(0, 1, 0, 1);
12461
- this.attachmentLineColor = new Color(0, 0, 1, 0.5);
12462
- this.triangleLineColor = new Color(1, 0.64, 0, 0.5);
12463
- this.pathColor = new Color().setFromString("FF7F00");
12464
- this.clipColor = new Color(0.8, 0, 0, 2);
12465
- this.aabbColor = new Color(0, 1, 0, 0.5);
12466
- this.drawBones = true;
12467
- this.drawRegionAttachments = true;
12468
- this.drawBoundingBoxes = true;
12469
- this.drawMeshHull = true;
12470
- this.drawMeshTriangles = true;
12471
- this.drawPaths = true;
12472
- this.drawSkeletonXY = false;
12473
- this.drawClipping = true;
12474
- this.premultipliedAlpha = false;
12475
- this.scale = 1;
12476
- this.boneWidth = 2;
12477
- this.bounds = new SkeletonBounds();
12478
- this.temp = new Array();
12479
- this.vertices = Utils.newFloatArray(2 * 1024);
12480
12981
  this.context = context instanceof ManagedWebGLRenderingContext ? context : new ManagedWebGLRenderingContext(context);
12481
12982
  }
12482
12983
  draw(shapes, skeleton, ignoredBones) {
@@ -12653,8 +13154,8 @@ void main () {
12653
13154
  }
12654
13155
  };
12655
13156
  var SkeletonDebugRenderer = _SkeletonDebugRenderer;
12656
- SkeletonDebugRenderer.LIGHT_GRAY = new Color(192 / 255, 192 / 255, 192 / 255, 1);
12657
- SkeletonDebugRenderer.GREEN = new Color(0, 1, 0, 1);
13157
+ __publicField(SkeletonDebugRenderer, "LIGHT_GRAY", new Color(192 / 255, 192 / 255, 192 / 255, 1));
13158
+ __publicField(SkeletonDebugRenderer, "GREEN", new Color(0, 1, 0, 1));
12658
13159
 
12659
13160
  // spine-webgl/src/SkeletonRenderer.ts
12660
13161
  var Renderable = class {
@@ -12665,18 +13166,19 @@ void main () {
12665
13166
  }
12666
13167
  };
12667
13168
  var _SkeletonRenderer = class {
13169
+ premultipliedAlpha = false;
13170
+ tempColor = new Color();
13171
+ tempColor2 = new Color();
13172
+ vertices;
13173
+ vertexSize = 2 + 2 + 4;
13174
+ twoColorTint = false;
13175
+ renderable = new Renderable([], 0, 0);
13176
+ clipper = new SkeletonClipping();
13177
+ temp = new Vector2();
13178
+ temp2 = new Vector2();
13179
+ temp3 = new Color();
13180
+ temp4 = new Color();
12668
13181
  constructor(context, twoColorTint = true) {
12669
- this.premultipliedAlpha = false;
12670
- this.tempColor = new Color();
12671
- this.tempColor2 = new Color();
12672
- this.vertexSize = 2 + 2 + 4;
12673
- this.twoColorTint = false;
12674
- this.renderable = new Renderable([], 0, 0);
12675
- this.clipper = new SkeletonClipping();
12676
- this.temp = new Vector2();
12677
- this.temp2 = new Vector2();
12678
- this.temp3 = new Color();
12679
- this.temp4 = new Color();
12680
13182
  this.twoColorTint = twoColorTint;
12681
13183
  if (twoColorTint)
12682
13184
  this.vertexSize += 4;
@@ -12821,7 +13323,7 @@ void main () {
12821
13323
  }
12822
13324
  };
12823
13325
  var SkeletonRenderer = _SkeletonRenderer;
12824
- SkeletonRenderer.QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0];
13326
+ __publicField(SkeletonRenderer, "QUAD_TRIANGLES", [0, 1, 2, 2, 3, 0]);
12825
13327
 
12826
13328
  // spine-webgl/src/SceneRenderer.ts
12827
13329
  var quad = [
@@ -12861,9 +13363,18 @@ void main () {
12861
13363
  var QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0];
12862
13364
  var WHITE = new Color(1, 1, 1, 1);
12863
13365
  var SceneRenderer = class {
13366
+ context;
13367
+ canvas;
13368
+ camera;
13369
+ batcher;
13370
+ twoColorTint = false;
13371
+ batcherShader;
13372
+ shapes;
13373
+ shapesShader;
13374
+ activeRenderer = null;
13375
+ skeletonRenderer;
13376
+ skeletonDebugRenderer;
12864
13377
  constructor(canvas, context, twoColorTint = true) {
12865
- this.twoColorTint = false;
12866
- this.activeRenderer = null;
12867
13378
  this.canvas = canvas;
12868
13379
  this.context = context instanceof ManagedWebGLRenderingContext ? context : new ManagedWebGLRenderingContext(context);
12869
13380
  this.twoColorTint = twoColorTint;
@@ -13296,15 +13807,16 @@ void main () {
13296
13807
  var logoHeight = 108;
13297
13808
  var spinnerSize = 163;
13298
13809
  var LoadingScreen = class {
13810
+ renderer;
13811
+ logo = null;
13812
+ spinner = null;
13813
+ angle = 0;
13814
+ fadeOut = 0;
13815
+ fadeIn = 0;
13816
+ timeKeeper = new TimeKeeper();
13817
+ backgroundColor = new Color(0.135, 0.135, 0.135, 1);
13818
+ tempColor = new Color();
13299
13819
  constructor(renderer) {
13300
- this.logo = null;
13301
- this.spinner = null;
13302
- this.angle = 0;
13303
- this.fadeOut = 0;
13304
- this.fadeIn = 0;
13305
- this.timeKeeper = new TimeKeeper();
13306
- this.backgroundColor = new Color(0.135, 0.135, 0.135, 1);
13307
- this.tempColor = new Color();
13308
13820
  this.renderer = renderer;
13309
13821
  this.timeKeeper.maxDelta = 9;
13310
13822
  if (!logoImage) {
@@ -13323,9 +13835,8 @@ void main () {
13323
13835
  }
13324
13836
  }
13325
13837
  dispose() {
13326
- var _a, _b;
13327
- (_a = this.logo) == null ? void 0 : _a.dispose();
13328
- (_b = this.spinner) == null ? void 0 : _b.dispose();
13838
+ this.logo?.dispose();
13839
+ this.spinner?.dispose();
13329
13840
  }
13330
13841
  draw(complete = false) {
13331
13842
  if (loaded < 2 || complete && this.fadeOut > FADE_OUT)
@@ -13398,9 +13909,6 @@ void main () {
13398
13909
  /** Constructs a new spine canvas, rendering to the provided HTML canvas. */
13399
13910
  constructor(canvas, config) {
13400
13911
  this.config = config;
13401
- /** Tracks the current time, delta, and other time related statistics. */
13402
- this.time = new TimeKeeper();
13403
- this.disposed = false;
13404
13912
  if (!config.pathPrefix)
13405
13913
  config.pathPrefix = "";
13406
13914
  if (!config.app)
@@ -13456,6 +13964,20 @@ void main () {
13456
13964
  };
13457
13965
  requestAnimationFrame(waitForAssets);
13458
13966
  }
13967
+ context;
13968
+ /** Tracks the current time, delta, and other time related statistics. */
13969
+ time = new TimeKeeper();
13970
+ /** The HTML canvas to render to. */
13971
+ htmlCanvas;
13972
+ /** The WebGL rendering context. */
13973
+ gl;
13974
+ /** The scene renderer for easy drawing of skeletons, shapes, and images. */
13975
+ renderer;
13976
+ /** The asset manager to load assets with. */
13977
+ assetManager;
13978
+ /** The input processor used to listen to mouse, touch, and keyboard events. */
13979
+ input;
13980
+ disposed = false;
13459
13981
  /** Clears the canvas with the given color. The color values are given in the range [0,1]. */
13460
13982
  clear(r, g, b, a) {
13461
13983
  this.gl.clearColor(r, g, b, a);