@esotericsoftware/spine-canvas 4.2.80 → 4.2.82
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,7 +4,6 @@ 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;
|
|
8
7
|
var __export = (target, all) => {
|
|
9
8
|
for (var name in all)
|
|
10
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -18,14 +17,10 @@ var spine = (() => {
|
|
|
18
17
|
return to;
|
|
19
18
|
};
|
|
20
19
|
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
|
-
};
|
|
25
20
|
|
|
26
21
|
// spine-canvas/src/index.ts
|
|
27
|
-
var
|
|
28
|
-
__export(
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
29
24
|
AlphaTimeline: () => AlphaTimeline,
|
|
30
25
|
Animation: () => Animation,
|
|
31
26
|
AnimationState: () => AnimationState,
|
|
@@ -191,13 +186,18 @@ var spine = (() => {
|
|
|
191
186
|
this.size = 0;
|
|
192
187
|
}
|
|
193
188
|
};
|
|
194
|
-
var
|
|
189
|
+
var Color = class _Color {
|
|
195
190
|
constructor(r = 0, g = 0, b = 0, a = 0) {
|
|
196
191
|
this.r = r;
|
|
197
192
|
this.g = g;
|
|
198
193
|
this.b = b;
|
|
199
194
|
this.a = a;
|
|
200
195
|
}
|
|
196
|
+
static WHITE = new _Color(1, 1, 1, 1);
|
|
197
|
+
static RED = new _Color(1, 0, 0, 1);
|
|
198
|
+
static GREEN = new _Color(0, 1, 0, 1);
|
|
199
|
+
static BLUE = new _Color(0, 0, 1, 1);
|
|
200
|
+
static MAGENTA = new _Color(1, 0, 1, 1);
|
|
201
201
|
set(r, g, b, a) {
|
|
202
202
|
this.r = r;
|
|
203
203
|
this.g = g;
|
|
@@ -228,22 +228,14 @@ var spine = (() => {
|
|
|
228
228
|
return this.clamp();
|
|
229
229
|
}
|
|
230
230
|
clamp() {
|
|
231
|
-
if (this.r < 0)
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
if (this.
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
if (this.b < 0)
|
|
240
|
-
this.b = 0;
|
|
241
|
-
else if (this.b > 1)
|
|
242
|
-
this.b = 1;
|
|
243
|
-
if (this.a < 0)
|
|
244
|
-
this.a = 0;
|
|
245
|
-
else if (this.a > 1)
|
|
246
|
-
this.a = 1;
|
|
231
|
+
if (this.r < 0) this.r = 0;
|
|
232
|
+
else if (this.r > 1) this.r = 1;
|
|
233
|
+
if (this.g < 0) this.g = 0;
|
|
234
|
+
else if (this.g > 1) this.g = 1;
|
|
235
|
+
if (this.b < 0) this.b = 0;
|
|
236
|
+
else if (this.b > 1) this.b = 1;
|
|
237
|
+
if (this.a < 0) this.a = 0;
|
|
238
|
+
else if (this.a > 1) this.a = 1;
|
|
247
239
|
return this;
|
|
248
240
|
}
|
|
249
241
|
static rgba8888ToColor(color, value) {
|
|
@@ -261,22 +253,21 @@ var spine = (() => {
|
|
|
261
253
|
const hex = (x) => ("0" + (x * 255).toString(16)).slice(-2);
|
|
262
254
|
return Number("0x" + hex(this.r) + hex(this.g) + hex(this.b));
|
|
263
255
|
}
|
|
264
|
-
static fromString(hex) {
|
|
265
|
-
return
|
|
256
|
+
static fromString(hex, color = new _Color()) {
|
|
257
|
+
return color.setFromString(hex);
|
|
266
258
|
}
|
|
267
259
|
};
|
|
268
|
-
var
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
260
|
+
var MathUtils = class _MathUtils {
|
|
261
|
+
static PI = 3.1415927;
|
|
262
|
+
static PI2 = _MathUtils.PI * 2;
|
|
263
|
+
static invPI2 = 1 / _MathUtils.PI2;
|
|
264
|
+
static radiansToDegrees = 180 / _MathUtils.PI;
|
|
265
|
+
static radDeg = _MathUtils.radiansToDegrees;
|
|
266
|
+
static degreesToRadians = _MathUtils.PI / 180;
|
|
267
|
+
static degRad = _MathUtils.degreesToRadians;
|
|
275
268
|
static clamp(value, min, max) {
|
|
276
|
-
if (value < min)
|
|
277
|
-
|
|
278
|
-
if (value > max)
|
|
279
|
-
return max;
|
|
269
|
+
if (value < min) return min;
|
|
270
|
+
if (value > max) return max;
|
|
280
271
|
return value;
|
|
281
272
|
}
|
|
282
273
|
static cosDeg(degrees) {
|
|
@@ -304,22 +295,13 @@ var spine = (() => {
|
|
|
304
295
|
static randomTriangularWith(min, max, mode) {
|
|
305
296
|
let u = Math.random();
|
|
306
297
|
let d = max - min;
|
|
307
|
-
if (u <= (mode - min) / d)
|
|
308
|
-
return min + Math.sqrt(u * d * (mode - min));
|
|
298
|
+
if (u <= (mode - min) / d) return min + Math.sqrt(u * d * (mode - min));
|
|
309
299
|
return max - Math.sqrt((1 - u) * d * (max - mode));
|
|
310
300
|
}
|
|
311
301
|
static isPowerOfTwo(value) {
|
|
312
302
|
return value && (value & value - 1) === 0;
|
|
313
303
|
}
|
|
314
304
|
};
|
|
315
|
-
var MathUtils = _MathUtils;
|
|
316
|
-
__publicField(MathUtils, "PI", 3.1415927);
|
|
317
|
-
__publicField(MathUtils, "PI2", _MathUtils.PI * 2);
|
|
318
|
-
__publicField(MathUtils, "invPI2", 1 / _MathUtils.PI2);
|
|
319
|
-
__publicField(MathUtils, "radiansToDegrees", 180 / _MathUtils.PI);
|
|
320
|
-
__publicField(MathUtils, "radDeg", _MathUtils.radiansToDegrees);
|
|
321
|
-
__publicField(MathUtils, "degreesToRadians", _MathUtils.PI / 180);
|
|
322
|
-
__publicField(MathUtils, "degRad", _MathUtils.degreesToRadians);
|
|
323
305
|
var Interpolation = class {
|
|
324
306
|
apply(start, end, a) {
|
|
325
307
|
return start + (end - start) * this.applyInternal(a);
|
|
@@ -332,8 +314,7 @@ var spine = (() => {
|
|
|
332
314
|
this.power = power;
|
|
333
315
|
}
|
|
334
316
|
applyInternal(a) {
|
|
335
|
-
if (a <= 0.5)
|
|
336
|
-
return Math.pow(a * 2, this.power) / 2;
|
|
317
|
+
if (a <= 0.5) return Math.pow(a * 2, this.power) / 2;
|
|
337
318
|
return Math.pow((a - 1) * 2, this.power) / (this.power % 2 == 0 ? -2 : 2) + 1;
|
|
338
319
|
}
|
|
339
320
|
};
|
|
@@ -345,7 +326,8 @@ var spine = (() => {
|
|
|
345
326
|
return Math.pow(a - 1, this.power) * (this.power % 2 == 0 ? -1 : 1) + 1;
|
|
346
327
|
}
|
|
347
328
|
};
|
|
348
|
-
var
|
|
329
|
+
var Utils = class _Utils {
|
|
330
|
+
static SUPPORTS_TYPED_ARRAYS = typeof Float32Array !== "undefined";
|
|
349
331
|
static arrayCopy(source, sourceStart, dest, destStart, numElements) {
|
|
350
332
|
for (let i = sourceStart, j = destStart; i < sourceStart + numElements; i++, j++) {
|
|
351
333
|
dest[j] = source[i];
|
|
@@ -357,24 +339,20 @@ var spine = (() => {
|
|
|
357
339
|
}
|
|
358
340
|
static setArraySize(array, size, value = 0) {
|
|
359
341
|
let oldSize = array.length;
|
|
360
|
-
if (oldSize == size)
|
|
361
|
-
return array;
|
|
342
|
+
if (oldSize == size) return array;
|
|
362
343
|
array.length = size;
|
|
363
344
|
if (oldSize < size) {
|
|
364
|
-
for (let i = oldSize; i < size; i++)
|
|
365
|
-
array[i] = value;
|
|
345
|
+
for (let i = oldSize; i < size; i++) array[i] = value;
|
|
366
346
|
}
|
|
367
347
|
return array;
|
|
368
348
|
}
|
|
369
349
|
static ensureArrayCapacity(array, size, value = 0) {
|
|
370
|
-
if (array.length >= size)
|
|
371
|
-
return array;
|
|
350
|
+
if (array.length >= size) return array;
|
|
372
351
|
return _Utils.setArraySize(array, size, value);
|
|
373
352
|
}
|
|
374
353
|
static newArray(size, defaultValue) {
|
|
375
354
|
let array = new Array(size);
|
|
376
|
-
for (let i = 0; i < size; i++)
|
|
377
|
-
array[i] = defaultValue;
|
|
355
|
+
for (let i = 0; i < size; i++) array[i] = defaultValue;
|
|
378
356
|
return array;
|
|
379
357
|
}
|
|
380
358
|
static newFloatArray(size) {
|
|
@@ -382,8 +360,7 @@ var spine = (() => {
|
|
|
382
360
|
return new Float32Array(size);
|
|
383
361
|
else {
|
|
384
362
|
let array = new Array(size);
|
|
385
|
-
for (let i = 0; i < array.length; i++)
|
|
386
|
-
array[i] = 0;
|
|
363
|
+
for (let i = 0; i < array.length; i++) array[i] = 0;
|
|
387
364
|
return array;
|
|
388
365
|
}
|
|
389
366
|
}
|
|
@@ -392,8 +369,7 @@ var spine = (() => {
|
|
|
392
369
|
return new Int16Array(size);
|
|
393
370
|
else {
|
|
394
371
|
let array = new Array(size);
|
|
395
|
-
for (let i = 0; i < array.length; i++)
|
|
396
|
-
array[i] = 0;
|
|
372
|
+
for (let i = 0; i < array.length; i++) array[i] = 0;
|
|
397
373
|
return array;
|
|
398
374
|
}
|
|
399
375
|
}
|
|
@@ -408,16 +384,13 @@ var spine = (() => {
|
|
|
408
384
|
}
|
|
409
385
|
static contains(array, element, identity = true) {
|
|
410
386
|
for (var i = 0; i < array.length; i++)
|
|
411
|
-
if (array[i] == element)
|
|
412
|
-
return true;
|
|
387
|
+
if (array[i] == element) return true;
|
|
413
388
|
return false;
|
|
414
389
|
}
|
|
415
390
|
static enumValue(type, name) {
|
|
416
391
|
return type[name[0].toUpperCase() + name.slice(1)];
|
|
417
392
|
}
|
|
418
393
|
};
|
|
419
|
-
var Utils = _Utils;
|
|
420
|
-
__publicField(Utils, "SUPPORTS_TYPED_ARRAYS", typeof Float32Array !== "undefined");
|
|
421
394
|
var DebugUtils = class {
|
|
422
395
|
static logBones(skeleton) {
|
|
423
396
|
for (let i = 0; i < skeleton.bones.length; i++) {
|
|
@@ -436,8 +409,7 @@ var spine = (() => {
|
|
|
436
409
|
return this.items.length > 0 ? this.items.pop() : this.instantiator();
|
|
437
410
|
}
|
|
438
411
|
free(item) {
|
|
439
|
-
if (item.reset)
|
|
440
|
-
item.reset();
|
|
412
|
+
if (item.reset) item.reset();
|
|
441
413
|
this.items.push(item);
|
|
442
414
|
}
|
|
443
415
|
freeAll(items) {
|
|
@@ -485,8 +457,7 @@ var spine = (() => {
|
|
|
485
457
|
this.delta = now - this.lastTime;
|
|
486
458
|
this.frameTime += this.delta;
|
|
487
459
|
this.totalTime += this.delta;
|
|
488
|
-
if (this.delta > this.maxDelta)
|
|
489
|
-
this.delta = this.maxDelta;
|
|
460
|
+
if (this.delta > this.maxDelta) this.delta = this.maxDelta;
|
|
490
461
|
this.lastTime = now;
|
|
491
462
|
this.frameCount++;
|
|
492
463
|
if (this.frameTime > 1) {
|
|
@@ -509,11 +480,9 @@ var spine = (() => {
|
|
|
509
480
|
return this.addedValues >= this.values.length;
|
|
510
481
|
}
|
|
511
482
|
addValue(value) {
|
|
512
|
-
if (this.addedValues < this.values.length)
|
|
513
|
-
this.addedValues++;
|
|
483
|
+
if (this.addedValues < this.values.length) this.addedValues++;
|
|
514
484
|
this.values[this.lastValue++] = value;
|
|
515
|
-
if (this.lastValue > this.values.length - 1)
|
|
516
|
-
this.lastValue = 0;
|
|
485
|
+
if (this.lastValue > this.values.length - 1) this.lastValue = 0;
|
|
517
486
|
this.dirty = true;
|
|
518
487
|
}
|
|
519
488
|
getMean() {
|
|
@@ -535,12 +504,12 @@ var spine = (() => {
|
|
|
535
504
|
var Attachment = class {
|
|
536
505
|
name;
|
|
537
506
|
constructor(name) {
|
|
538
|
-
if (!name)
|
|
539
|
-
throw new Error("name cannot be null.");
|
|
507
|
+
if (!name) throw new Error("name cannot be null.");
|
|
540
508
|
this.name = name;
|
|
541
509
|
}
|
|
542
510
|
};
|
|
543
|
-
var
|
|
511
|
+
var VertexAttachment = class _VertexAttachment extends Attachment {
|
|
512
|
+
static nextID = 0;
|
|
544
513
|
/** The unique ID for this attachment. */
|
|
545
514
|
id = _VertexAttachment.nextID++;
|
|
546
515
|
/** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting
|
|
@@ -578,8 +547,7 @@ var spine = (() => {
|
|
|
578
547
|
let vertices = this.vertices;
|
|
579
548
|
let bones = this.bones;
|
|
580
549
|
if (!bones) {
|
|
581
|
-
if (deformArray.length > 0)
|
|
582
|
-
vertices = deformArray;
|
|
550
|
+
if (deformArray.length > 0) vertices = deformArray;
|
|
583
551
|
let bone = slot.bone;
|
|
584
552
|
let x = bone.worldX;
|
|
585
553
|
let y = bone.worldY;
|
|
@@ -644,11 +612,10 @@ var spine = (() => {
|
|
|
644
612
|
attachment.timelineAttachment = this.timelineAttachment;
|
|
645
613
|
}
|
|
646
614
|
};
|
|
647
|
-
var VertexAttachment = _VertexAttachment;
|
|
648
|
-
__publicField(VertexAttachment, "nextID", 0);
|
|
649
615
|
|
|
650
616
|
// spine-core/src/attachments/Sequence.ts
|
|
651
|
-
var
|
|
617
|
+
var Sequence = class _Sequence {
|
|
618
|
+
static _nextID = 0;
|
|
652
619
|
id = _Sequence.nextID();
|
|
653
620
|
regions;
|
|
654
621
|
start = 0;
|
|
@@ -668,10 +635,8 @@ var spine = (() => {
|
|
|
668
635
|
}
|
|
669
636
|
apply(slot, attachment) {
|
|
670
637
|
let index = slot.sequenceIndex;
|
|
671
|
-
if (index == -1)
|
|
672
|
-
|
|
673
|
-
if (index >= this.regions.length)
|
|
674
|
-
index = this.regions.length - 1;
|
|
638
|
+
if (index == -1) index = this.setupIndex;
|
|
639
|
+
if (index >= this.regions.length) index = this.regions.length - 1;
|
|
675
640
|
let region = this.regions[index];
|
|
676
641
|
if (attachment.region != region) {
|
|
677
642
|
attachment.region = region;
|
|
@@ -690,8 +655,6 @@ var spine = (() => {
|
|
|
690
655
|
return _Sequence._nextID++;
|
|
691
656
|
}
|
|
692
657
|
};
|
|
693
|
-
var Sequence = _Sequence;
|
|
694
|
-
__publicField(Sequence, "_nextID", 0);
|
|
695
658
|
var SequenceMode = /* @__PURE__ */ ((SequenceMode2) => {
|
|
696
659
|
SequenceMode2[SequenceMode2["hold"] = 0] = "hold";
|
|
697
660
|
SequenceMode2[SequenceMode2["once"] = 1] = "once";
|
|
@@ -721,15 +684,13 @@ var spine = (() => {
|
|
|
721
684
|
/** The duration of the animation in seconds, which is the highest time of all keys in the timeline. */
|
|
722
685
|
duration;
|
|
723
686
|
constructor(name, timelines, duration) {
|
|
724
|
-
if (!name)
|
|
725
|
-
throw new Error("name cannot be null.");
|
|
687
|
+
if (!name) throw new Error("name cannot be null.");
|
|
726
688
|
this.name = name;
|
|
727
689
|
this.setTimelines(timelines);
|
|
728
690
|
this.duration = duration;
|
|
729
691
|
}
|
|
730
692
|
setTimelines(timelines) {
|
|
731
|
-
if (!timelines)
|
|
732
|
-
throw new Error("timelines cannot be null.");
|
|
693
|
+
if (!timelines) throw new Error("timelines cannot be null.");
|
|
733
694
|
this.timelines = timelines;
|
|
734
695
|
this.timelineIds.clear();
|
|
735
696
|
for (var i = 0; i < timelines.length; i++)
|
|
@@ -737,8 +698,7 @@ var spine = (() => {
|
|
|
737
698
|
}
|
|
738
699
|
hasTimeline(ids) {
|
|
739
700
|
for (let i = 0; i < ids.length; i++)
|
|
740
|
-
if (this.timelineIds.contains(ids[i]))
|
|
741
|
-
return true;
|
|
701
|
+
if (this.timelineIds.contains(ids[i])) return true;
|
|
742
702
|
return false;
|
|
743
703
|
}
|
|
744
704
|
/** Applies all the animation's timelines to the specified skeleton.
|
|
@@ -747,12 +707,10 @@ var spine = (() => {
|
|
|
747
707
|
* @param loop If true, the animation repeats after {@link #getDuration()}.
|
|
748
708
|
* @param events May be null to ignore fired events. */
|
|
749
709
|
apply(skeleton, lastTime, time, loop, events, alpha, blend, direction) {
|
|
750
|
-
if (!skeleton)
|
|
751
|
-
throw new Error("skeleton cannot be null.");
|
|
710
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
752
711
|
if (loop && this.duration != 0) {
|
|
753
712
|
time %= this.duration;
|
|
754
|
-
if (lastTime > 0)
|
|
755
|
-
lastTime %= this.duration;
|
|
713
|
+
if (lastTime > 0) lastTime %= this.duration;
|
|
756
714
|
}
|
|
757
715
|
let timelines = this.timelines;
|
|
758
716
|
for (let i = 0, n = timelines.length; i < n; i++)
|
|
@@ -824,15 +782,13 @@ var spine = (() => {
|
|
|
824
782
|
static search1(frames, time) {
|
|
825
783
|
let n = frames.length;
|
|
826
784
|
for (let i = 1; i < n; i++)
|
|
827
|
-
if (frames[i] > time)
|
|
828
|
-
return i - 1;
|
|
785
|
+
if (frames[i] > time) return i - 1;
|
|
829
786
|
return n - 1;
|
|
830
787
|
}
|
|
831
788
|
static search(frames, time, step) {
|
|
832
789
|
let n = frames.length;
|
|
833
790
|
for (let i = step; i < n; i += step)
|
|
834
|
-
if (frames[i] > time)
|
|
835
|
-
return i - step;
|
|
791
|
+
if (frames[i] > time) return i - step;
|
|
836
792
|
return n - step;
|
|
837
793
|
}
|
|
838
794
|
};
|
|
@@ -882,8 +838,7 @@ var spine = (() => {
|
|
|
882
838
|
setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) {
|
|
883
839
|
let curves = this.curves;
|
|
884
840
|
let i = this.getFrameCount() + bezier * 18;
|
|
885
|
-
if (value == 0)
|
|
886
|
-
curves[frame] = 2 + i;
|
|
841
|
+
if (value == 0) curves[frame] = 2 + i;
|
|
887
842
|
let tmpx = (time1 - cx1 * 2 + cx2) * 0.03, tmpy = (value1 - cy1 * 2 + cy2) * 0.03;
|
|
888
843
|
let dddx = ((cx1 - cx2) * 3 - time1 + time2) * 6e-3, dddy = ((cy1 - cy2) * 3 - value1 + value2) * 6e-3;
|
|
889
844
|
let ddx = tmpx * 2 + dddx, ddy = tmpy * 2 + dddy;
|
|
@@ -1009,8 +964,7 @@ var spine = (() => {
|
|
|
1009
964
|
return current;
|
|
1010
965
|
}
|
|
1011
966
|
let value = this.getCurveValue(time);
|
|
1012
|
-
if (blend == 0 /* setup */)
|
|
1013
|
-
return setup + (value - setup) * alpha;
|
|
967
|
+
if (blend == 0 /* setup */) return setup + (value - setup) * alpha;
|
|
1014
968
|
return current + (value - current) * alpha;
|
|
1015
969
|
}
|
|
1016
970
|
getAbsoluteValue2(time, alpha, blend, current, setup, value) {
|
|
@@ -1023,8 +977,7 @@ var spine = (() => {
|
|
|
1023
977
|
}
|
|
1024
978
|
return current;
|
|
1025
979
|
}
|
|
1026
|
-
if (blend == 0 /* setup */)
|
|
1027
|
-
return setup + (value - setup) * alpha;
|
|
980
|
+
if (blend == 0 /* setup */) return setup + (value - setup) * alpha;
|
|
1028
981
|
return current + (value - current) * alpha;
|
|
1029
982
|
}
|
|
1030
983
|
getScaleValue(time, alpha, blend, direction, current, setup) {
|
|
@@ -1040,8 +993,7 @@ var spine = (() => {
|
|
|
1040
993
|
}
|
|
1041
994
|
let value = this.getCurveValue(time) * setup;
|
|
1042
995
|
if (alpha == 1) {
|
|
1043
|
-
if (blend == 3 /* add */)
|
|
1044
|
-
return current + value - setup;
|
|
996
|
+
if (blend == 3 /* add */) return current + value - setup;
|
|
1045
997
|
return value;
|
|
1046
998
|
}
|
|
1047
999
|
if (direction == 1 /* mixOut */) {
|
|
@@ -1100,8 +1052,7 @@ var spine = (() => {
|
|
|
1100
1052
|
}
|
|
1101
1053
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1102
1054
|
let bone = skeleton.bones[this.boneIndex];
|
|
1103
|
-
if (bone.active)
|
|
1104
|
-
bone.rotation = this.getRelativeValue(time, alpha, blend, bone.rotation, bone.data.rotation);
|
|
1055
|
+
if (bone.active) bone.rotation = this.getRelativeValue(time, alpha, blend, bone.rotation, bone.data.rotation);
|
|
1105
1056
|
}
|
|
1106
1057
|
};
|
|
1107
1058
|
var TranslateTimeline = class extends CurveTimeline2 {
|
|
@@ -1117,8 +1068,7 @@ var spine = (() => {
|
|
|
1117
1068
|
}
|
|
1118
1069
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1119
1070
|
let bone = skeleton.bones[this.boneIndex];
|
|
1120
|
-
if (!bone.active)
|
|
1121
|
-
return;
|
|
1071
|
+
if (!bone.active) return;
|
|
1122
1072
|
let frames = this.frames;
|
|
1123
1073
|
if (time < frames[0]) {
|
|
1124
1074
|
switch (blend) {
|
|
@@ -1217,8 +1167,7 @@ var spine = (() => {
|
|
|
1217
1167
|
}
|
|
1218
1168
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1219
1169
|
let bone = skeleton.bones[this.boneIndex];
|
|
1220
|
-
if (bone.active)
|
|
1221
|
-
bone.x = this.getRelativeValue(time, alpha, blend, bone.x, bone.data.x);
|
|
1170
|
+
if (bone.active) bone.x = this.getRelativeValue(time, alpha, blend, bone.x, bone.data.x);
|
|
1222
1171
|
}
|
|
1223
1172
|
};
|
|
1224
1173
|
var TranslateYTimeline = class extends CurveTimeline1 {
|
|
@@ -1229,8 +1178,7 @@ var spine = (() => {
|
|
|
1229
1178
|
}
|
|
1230
1179
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1231
1180
|
let bone = skeleton.bones[this.boneIndex];
|
|
1232
|
-
if (bone.active)
|
|
1233
|
-
bone.y = this.getRelativeValue(time, alpha, blend, bone.y, bone.data.y);
|
|
1181
|
+
if (bone.active) bone.y = this.getRelativeValue(time, alpha, blend, bone.y, bone.data.y);
|
|
1234
1182
|
}
|
|
1235
1183
|
};
|
|
1236
1184
|
var ScaleTimeline = class extends CurveTimeline2 {
|
|
@@ -1246,8 +1194,7 @@ var spine = (() => {
|
|
|
1246
1194
|
}
|
|
1247
1195
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1248
1196
|
let bone = skeleton.bones[this.boneIndex];
|
|
1249
|
-
if (!bone.active)
|
|
1250
|
-
return;
|
|
1197
|
+
if (!bone.active) return;
|
|
1251
1198
|
let frames = this.frames;
|
|
1252
1199
|
if (time < frames[0]) {
|
|
1253
1200
|
switch (blend) {
|
|
@@ -1384,8 +1331,7 @@ var spine = (() => {
|
|
|
1384
1331
|
}
|
|
1385
1332
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1386
1333
|
let bone = skeleton.bones[this.boneIndex];
|
|
1387
|
-
if (bone.active)
|
|
1388
|
-
bone.scaleX = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleX);
|
|
1334
|
+
if (bone.active) bone.scaleX = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleX);
|
|
1389
1335
|
}
|
|
1390
1336
|
};
|
|
1391
1337
|
var ScaleYTimeline = class extends CurveTimeline1 {
|
|
@@ -1396,8 +1342,7 @@ var spine = (() => {
|
|
|
1396
1342
|
}
|
|
1397
1343
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1398
1344
|
let bone = skeleton.bones[this.boneIndex];
|
|
1399
|
-
if (bone.active)
|
|
1400
|
-
bone.scaleY = this.getScaleValue(time, alpha, blend, direction, bone.scaleY, bone.data.scaleY);
|
|
1345
|
+
if (bone.active) bone.scaleY = this.getScaleValue(time, alpha, blend, direction, bone.scaleY, bone.data.scaleY);
|
|
1401
1346
|
}
|
|
1402
1347
|
};
|
|
1403
1348
|
var ShearTimeline = class extends CurveTimeline2 {
|
|
@@ -1413,8 +1358,7 @@ var spine = (() => {
|
|
|
1413
1358
|
}
|
|
1414
1359
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1415
1360
|
let bone = skeleton.bones[this.boneIndex];
|
|
1416
|
-
if (!bone.active)
|
|
1417
|
-
return;
|
|
1361
|
+
if (!bone.active) return;
|
|
1418
1362
|
let frames = this.frames;
|
|
1419
1363
|
if (time < frames[0]) {
|
|
1420
1364
|
switch (blend) {
|
|
@@ -1513,8 +1457,7 @@ var spine = (() => {
|
|
|
1513
1457
|
}
|
|
1514
1458
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1515
1459
|
let bone = skeleton.bones[this.boneIndex];
|
|
1516
|
-
if (bone.active)
|
|
1517
|
-
bone.shearX = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearX);
|
|
1460
|
+
if (bone.active) bone.shearX = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearX);
|
|
1518
1461
|
}
|
|
1519
1462
|
};
|
|
1520
1463
|
var ShearYTimeline = class extends CurveTimeline1 {
|
|
@@ -1525,8 +1468,7 @@ var spine = (() => {
|
|
|
1525
1468
|
}
|
|
1526
1469
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1527
1470
|
let bone = skeleton.bones[this.boneIndex];
|
|
1528
|
-
if (bone.active)
|
|
1529
|
-
bone.shearY = this.getRelativeValue(time, alpha, blend, bone.shearY, bone.data.shearY);
|
|
1471
|
+
if (bone.active) bone.shearY = this.getRelativeValue(time, alpha, blend, bone.shearY, bone.data.shearY);
|
|
1530
1472
|
}
|
|
1531
1473
|
};
|
|
1532
1474
|
var InheritTimeline = class extends Timeline {
|
|
@@ -1551,17 +1493,14 @@ var spine = (() => {
|
|
|
1551
1493
|
}
|
|
1552
1494
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1553
1495
|
let bone = skeleton.bones[this.boneIndex];
|
|
1554
|
-
if (!bone.active)
|
|
1555
|
-
return;
|
|
1496
|
+
if (!bone.active) return;
|
|
1556
1497
|
if (direction == 1 /* mixOut */) {
|
|
1557
|
-
if (blend == 0 /* setup */)
|
|
1558
|
-
bone.inherit = bone.data.inherit;
|
|
1498
|
+
if (blend == 0 /* setup */) bone.inherit = bone.data.inherit;
|
|
1559
1499
|
return;
|
|
1560
1500
|
}
|
|
1561
1501
|
let frames = this.frames;
|
|
1562
1502
|
if (time < frames[0]) {
|
|
1563
|
-
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
1564
|
-
bone.inherit = bone.data.inherit;
|
|
1503
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */) bone.inherit = bone.data.inherit;
|
|
1565
1504
|
return;
|
|
1566
1505
|
}
|
|
1567
1506
|
bone.inherit = this.frames[
|
|
@@ -1610,8 +1549,7 @@ var spine = (() => {
|
|
|
1610
1549
|
}
|
|
1611
1550
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1612
1551
|
let slot = skeleton.slots[this.slotIndex];
|
|
1613
|
-
if (!slot.bone.active)
|
|
1614
|
-
return;
|
|
1552
|
+
if (!slot.bone.active) return;
|
|
1615
1553
|
let frames = this.frames;
|
|
1616
1554
|
let color = slot.color;
|
|
1617
1555
|
if (time < frames[0]) {
|
|
@@ -1732,8 +1670,7 @@ var spine = (() => {
|
|
|
1732
1670
|
if (alpha == 1)
|
|
1733
1671
|
color.set(r, g, b, a);
|
|
1734
1672
|
else {
|
|
1735
|
-
if (blend == 0 /* setup */)
|
|
1736
|
-
color.setFromColor(slot.data.color);
|
|
1673
|
+
if (blend == 0 /* setup */) color.setFromColor(slot.data.color);
|
|
1737
1674
|
color.add((r - color.r) * alpha, (g - color.g) * alpha, (b - color.b) * alpha, (a - color.a) * alpha);
|
|
1738
1675
|
}
|
|
1739
1676
|
}
|
|
@@ -1768,8 +1705,7 @@ var spine = (() => {
|
|
|
1768
1705
|
}
|
|
1769
1706
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1770
1707
|
let slot = skeleton.slots[this.slotIndex];
|
|
1771
|
-
if (!slot.bone.active)
|
|
1772
|
-
return;
|
|
1708
|
+
if (!slot.bone.active) return;
|
|
1773
1709
|
let frames = this.frames;
|
|
1774
1710
|
let color = slot.color;
|
|
1775
1711
|
if (time < frames[0]) {
|
|
@@ -1889,8 +1825,7 @@ var spine = (() => {
|
|
|
1889
1825
|
}
|
|
1890
1826
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1891
1827
|
let slot = skeleton.slots[this.slotIndex];
|
|
1892
|
-
if (!slot.bone.active)
|
|
1893
|
-
return;
|
|
1828
|
+
if (!slot.bone.active) return;
|
|
1894
1829
|
let color = slot.color;
|
|
1895
1830
|
if (time < this.frames[0]) {
|
|
1896
1831
|
let setup = slot.data.color;
|
|
@@ -1907,8 +1842,7 @@ var spine = (() => {
|
|
|
1907
1842
|
if (alpha == 1)
|
|
1908
1843
|
color.a = a;
|
|
1909
1844
|
else {
|
|
1910
|
-
if (blend == 0 /* setup */)
|
|
1911
|
-
color.a = slot.data.color.a;
|
|
1845
|
+
if (blend == 0 /* setup */) color.a = slot.data.color.a;
|
|
1912
1846
|
color.a += (a - color.a) * alpha;
|
|
1913
1847
|
}
|
|
1914
1848
|
}
|
|
@@ -1961,8 +1895,7 @@ var spine = (() => {
|
|
|
1961
1895
|
}
|
|
1962
1896
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1963
1897
|
let slot = skeleton.slots[this.slotIndex];
|
|
1964
|
-
if (!slot.bone.active)
|
|
1965
|
-
return;
|
|
1898
|
+
if (!slot.bone.active) return;
|
|
1966
1899
|
let frames = this.frames;
|
|
1967
1900
|
let light = slot.color, dark = slot.darkColor;
|
|
1968
1901
|
if (time < frames[0]) {
|
|
@@ -2203,8 +2136,7 @@ var spine = (() => {
|
|
|
2203
2136
|
}
|
|
2204
2137
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
2205
2138
|
let slot = skeleton.slots[this.slotIndex];
|
|
2206
|
-
if (!slot.bone.active)
|
|
2207
|
-
return;
|
|
2139
|
+
if (!slot.bone.active) return;
|
|
2208
2140
|
let frames = this.frames;
|
|
2209
2141
|
let light = slot.color, dark = slot.darkColor;
|
|
2210
2142
|
if (time < frames[0]) {
|
|
@@ -2412,16 +2344,13 @@ var spine = (() => {
|
|
|
2412
2344
|
}
|
|
2413
2345
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
2414
2346
|
let slot = skeleton.slots[this.slotIndex];
|
|
2415
|
-
if (!slot.bone.active)
|
|
2416
|
-
return;
|
|
2347
|
+
if (!slot.bone.active) return;
|
|
2417
2348
|
if (direction == 1 /* mixOut */) {
|
|
2418
|
-
if (blend == 0 /* setup */)
|
|
2419
|
-
this.setAttachment(skeleton, slot, slot.data.attachmentName);
|
|
2349
|
+
if (blend == 0 /* setup */) this.setAttachment(skeleton, slot, slot.data.attachmentName);
|
|
2420
2350
|
return;
|
|
2421
2351
|
}
|
|
2422
2352
|
if (time < this.frames[0]) {
|
|
2423
|
-
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
2424
|
-
this.setAttachment(skeleton, slot, slot.data.attachmentName);
|
|
2353
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */) this.setAttachment(skeleton, slot, slot.data.attachmentName);
|
|
2425
2354
|
return;
|
|
2426
2355
|
}
|
|
2427
2356
|
this.setAttachment(skeleton, slot, this.attachmentNames[Timeline.search1(this.frames, time)]);
|
|
@@ -2458,8 +2387,7 @@ var spine = (() => {
|
|
|
2458
2387
|
setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) {
|
|
2459
2388
|
let curves = this.curves;
|
|
2460
2389
|
let i = this.getFrameCount() + bezier * 18;
|
|
2461
|
-
if (value == 0)
|
|
2462
|
-
curves[frame] = 2 + i;
|
|
2390
|
+
if (value == 0) curves[frame] = 2 + i;
|
|
2463
2391
|
let tmpx = (time1 - cx1 * 2 + cx2) * 0.03, tmpy = cy2 * 0.03 - cy1 * 0.06;
|
|
2464
2392
|
let dddx = ((cx1 - cx2) * 3 - time1 + time2) * 6e-3, dddy = (cy1 - cy2 + 0.33333333) * 0.018;
|
|
2465
2393
|
let ddx = tmpx * 2 + dddx, ddy = tmpy * 2 + dddy;
|
|
@@ -2503,16 +2431,12 @@ var spine = (() => {
|
|
|
2503
2431
|
}
|
|
2504
2432
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2505
2433
|
let slot = skeleton.slots[this.slotIndex];
|
|
2506
|
-
if (!slot.bone.active)
|
|
2507
|
-
return;
|
|
2434
|
+
if (!slot.bone.active) return;
|
|
2508
2435
|
let slotAttachment = slot.getAttachment();
|
|
2509
|
-
if (!slotAttachment)
|
|
2510
|
-
|
|
2511
|
-
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != this.attachment)
|
|
2512
|
-
return;
|
|
2436
|
+
if (!slotAttachment) return;
|
|
2437
|
+
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != this.attachment) return;
|
|
2513
2438
|
let deform = slot.deform;
|
|
2514
|
-
if (deform.length == 0)
|
|
2515
|
-
blend = 0 /* setup */;
|
|
2439
|
+
if (deform.length == 0) blend = 0 /* setup */;
|
|
2516
2440
|
let vertices = this.vertices;
|
|
2517
2441
|
let vertexCount = vertices[0].length;
|
|
2518
2442
|
let frames = this.frames;
|
|
@@ -2659,7 +2583,8 @@ var spine = (() => {
|
|
|
2659
2583
|
}
|
|
2660
2584
|
}
|
|
2661
2585
|
};
|
|
2662
|
-
var
|
|
2586
|
+
var EventTimeline = class _EventTimeline extends Timeline {
|
|
2587
|
+
static propertyIds = ["" + Property.event];
|
|
2663
2588
|
/** The event for each key frame. */
|
|
2664
2589
|
events;
|
|
2665
2590
|
constructor(frameCount) {
|
|
@@ -2676,8 +2601,7 @@ var spine = (() => {
|
|
|
2676
2601
|
}
|
|
2677
2602
|
/** Fires events for frames > `lastTime` and <= `time`. */
|
|
2678
2603
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2679
|
-
if (!firedEvents)
|
|
2680
|
-
return;
|
|
2604
|
+
if (!firedEvents) return;
|
|
2681
2605
|
let frames = this.frames;
|
|
2682
2606
|
let frameCount = this.frames.length;
|
|
2683
2607
|
if (lastTime > time) {
|
|
@@ -2685,8 +2609,7 @@ var spine = (() => {
|
|
|
2685
2609
|
lastTime = -1;
|
|
2686
2610
|
} else if (lastTime >= frames[frameCount - 1])
|
|
2687
2611
|
return;
|
|
2688
|
-
if (time < frames[0])
|
|
2689
|
-
return;
|
|
2612
|
+
if (time < frames[0]) return;
|
|
2690
2613
|
let i = 0;
|
|
2691
2614
|
if (lastTime < frames[0])
|
|
2692
2615
|
i = 0;
|
|
@@ -2694,8 +2617,7 @@ var spine = (() => {
|
|
|
2694
2617
|
i = Timeline.search1(frames, lastTime) + 1;
|
|
2695
2618
|
let frameTime = frames[i];
|
|
2696
2619
|
while (i > 0) {
|
|
2697
|
-
if (frames[i - 1] != frameTime)
|
|
2698
|
-
break;
|
|
2620
|
+
if (frames[i - 1] != frameTime) break;
|
|
2699
2621
|
i--;
|
|
2700
2622
|
}
|
|
2701
2623
|
}
|
|
@@ -2703,9 +2625,8 @@ var spine = (() => {
|
|
|
2703
2625
|
firedEvents.push(this.events[i]);
|
|
2704
2626
|
}
|
|
2705
2627
|
};
|
|
2706
|
-
var
|
|
2707
|
-
|
|
2708
|
-
var _DrawOrderTimeline = class extends Timeline {
|
|
2628
|
+
var DrawOrderTimeline = class _DrawOrderTimeline extends Timeline {
|
|
2629
|
+
static propertyIds = ["" + Property.drawOrder];
|
|
2709
2630
|
/** The draw order for each key frame. See {@link #setFrame(int, float, int[])}. */
|
|
2710
2631
|
drawOrders;
|
|
2711
2632
|
constructor(frameCount) {
|
|
@@ -2724,13 +2645,11 @@ var spine = (() => {
|
|
|
2724
2645
|
}
|
|
2725
2646
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2726
2647
|
if (direction == 1 /* mixOut */) {
|
|
2727
|
-
if (blend == 0 /* setup */)
|
|
2728
|
-
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2648
|
+
if (blend == 0 /* setup */) Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2729
2649
|
return;
|
|
2730
2650
|
}
|
|
2731
2651
|
if (time < this.frames[0]) {
|
|
2732
|
-
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
2733
|
-
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2652
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */) Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2734
2653
|
return;
|
|
2735
2654
|
}
|
|
2736
2655
|
let idx = Timeline.search1(this.frames, time);
|
|
@@ -2745,8 +2664,6 @@ var spine = (() => {
|
|
|
2745
2664
|
}
|
|
2746
2665
|
}
|
|
2747
2666
|
};
|
|
2748
|
-
var DrawOrderTimeline = _DrawOrderTimeline;
|
|
2749
|
-
__publicField(DrawOrderTimeline, "propertyIds", ["" + Property.drawOrder]);
|
|
2750
2667
|
var IkConstraintTimeline = class extends CurveTimeline {
|
|
2751
2668
|
/** The index of the IK constraint in {@link Skeleton#getIkConstraints()} that will be changed when this timeline is applied */
|
|
2752
2669
|
constraintIndex = 0;
|
|
@@ -2786,8 +2703,7 @@ var spine = (() => {
|
|
|
2786
2703
|
}
|
|
2787
2704
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2788
2705
|
let constraint = skeleton.ikConstraints[this.constraintIndex];
|
|
2789
|
-
if (!constraint.active)
|
|
2790
|
-
return;
|
|
2706
|
+
if (!constraint.active) return;
|
|
2791
2707
|
let frames = this.frames;
|
|
2792
2708
|
if (time < frames[0]) {
|
|
2793
2709
|
switch (blend) {
|
|
@@ -2953,8 +2869,7 @@ var spine = (() => {
|
|
|
2953
2869
|
}
|
|
2954
2870
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2955
2871
|
let constraint = skeleton.transformConstraints[this.constraintIndex];
|
|
2956
|
-
if (!constraint.active)
|
|
2957
|
-
return;
|
|
2872
|
+
if (!constraint.active) return;
|
|
2958
2873
|
let frames = this.frames;
|
|
2959
2874
|
if (time < frames[0]) {
|
|
2960
2875
|
let data = constraint.data;
|
|
@@ -3192,8 +3107,7 @@ var spine = (() => {
|
|
|
3192
3107
|
}
|
|
3193
3108
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
3194
3109
|
let constraint = skeleton.pathConstraints[this.constraintIndex];
|
|
3195
|
-
if (!constraint.active)
|
|
3196
|
-
return;
|
|
3110
|
+
if (!constraint.active) return;
|
|
3197
3111
|
let frames = this.frames;
|
|
3198
3112
|
if (time < frames[0]) {
|
|
3199
3113
|
switch (blend) {
|
|
@@ -3317,8 +3231,7 @@ var spine = (() => {
|
|
|
3317
3231
|
}
|
|
3318
3232
|
} else {
|
|
3319
3233
|
constraint = skeleton.physicsConstraints[this.constraintIndex];
|
|
3320
|
-
if (constraint.active)
|
|
3321
|
-
this.set(constraint, this.getAbsoluteValue(time, alpha, blend, this.get(constraint), this.setup(constraint)));
|
|
3234
|
+
if (constraint.active) this.set(constraint, this.getAbsoluteValue(time, alpha, blend, this.get(constraint), this.setup(constraint)));
|
|
3322
3235
|
}
|
|
3323
3236
|
}
|
|
3324
3237
|
};
|
|
@@ -3441,7 +3354,8 @@ var spine = (() => {
|
|
|
3441
3354
|
return constraint.mixGlobal;
|
|
3442
3355
|
}
|
|
3443
3356
|
};
|
|
3444
|
-
var
|
|
3357
|
+
var PhysicsConstraintResetTimeline = class _PhysicsConstraintResetTimeline extends Timeline {
|
|
3358
|
+
static propertyIds = [Property.physicsConstraintReset.toString()];
|
|
3445
3359
|
/** The index of the physics constraint in {@link Skeleton#getPhysicsConstraints()} that will be reset when this timeline is
|
|
3446
3360
|
* applied, or -1 if all physics constraints in the skeleton will be reset. */
|
|
3447
3361
|
constraintIndex;
|
|
@@ -3463,8 +3377,7 @@ var spine = (() => {
|
|
|
3463
3377
|
let constraint;
|
|
3464
3378
|
if (this.constraintIndex != -1) {
|
|
3465
3379
|
constraint = skeleton.physicsConstraints[this.constraintIndex];
|
|
3466
|
-
if (!constraint.active)
|
|
3467
|
-
return;
|
|
3380
|
+
if (!constraint.active) return;
|
|
3468
3381
|
}
|
|
3469
3382
|
const frames = this.frames;
|
|
3470
3383
|
if (lastTime > time) {
|
|
@@ -3472,23 +3385,22 @@ var spine = (() => {
|
|
|
3472
3385
|
lastTime = -1;
|
|
3473
3386
|
} else if (lastTime >= frames[frames.length - 1])
|
|
3474
3387
|
return;
|
|
3475
|
-
if (time < frames[0])
|
|
3476
|
-
return;
|
|
3388
|
+
if (time < frames[0]) return;
|
|
3477
3389
|
if (lastTime < frames[0] || time >= frames[Timeline.search1(frames, lastTime) + 1]) {
|
|
3478
3390
|
if (constraint != null)
|
|
3479
3391
|
constraint.reset();
|
|
3480
3392
|
else {
|
|
3481
3393
|
for (const constraint2 of skeleton.physicsConstraints) {
|
|
3482
|
-
if (constraint2.active)
|
|
3483
|
-
constraint2.reset();
|
|
3394
|
+
if (constraint2.active) constraint2.reset();
|
|
3484
3395
|
}
|
|
3485
3396
|
}
|
|
3486
3397
|
}
|
|
3487
3398
|
}
|
|
3488
3399
|
};
|
|
3489
|
-
var
|
|
3490
|
-
|
|
3491
|
-
|
|
3400
|
+
var SequenceTimeline = class _SequenceTimeline extends Timeline {
|
|
3401
|
+
static ENTRIES = 3;
|
|
3402
|
+
static MODE = 1;
|
|
3403
|
+
static DELAY = 2;
|
|
3492
3404
|
slotIndex;
|
|
3493
3405
|
attachment;
|
|
3494
3406
|
constructor(frameCount, slotIndex, attachment) {
|
|
@@ -3519,31 +3431,26 @@ var spine = (() => {
|
|
|
3519
3431
|
}
|
|
3520
3432
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
3521
3433
|
let slot = skeleton.slots[this.slotIndex];
|
|
3522
|
-
if (!slot.bone.active)
|
|
3523
|
-
return;
|
|
3434
|
+
if (!slot.bone.active) return;
|
|
3524
3435
|
let slotAttachment = slot.attachment;
|
|
3525
3436
|
let attachment = this.attachment;
|
|
3526
3437
|
if (slotAttachment != attachment) {
|
|
3527
|
-
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != attachment)
|
|
3528
|
-
return;
|
|
3438
|
+
if (!(slotAttachment instanceof VertexAttachment) || slotAttachment.timelineAttachment != attachment) return;
|
|
3529
3439
|
}
|
|
3530
3440
|
if (direction == 1 /* mixOut */) {
|
|
3531
|
-
if (blend == 0 /* setup */)
|
|
3532
|
-
slot.sequenceIndex = -1;
|
|
3441
|
+
if (blend == 0 /* setup */) slot.sequenceIndex = -1;
|
|
3533
3442
|
return;
|
|
3534
3443
|
}
|
|
3535
3444
|
let frames = this.frames;
|
|
3536
3445
|
if (time < frames[0]) {
|
|
3537
|
-
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
3538
|
-
slot.sequenceIndex = -1;
|
|
3446
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */) slot.sequenceIndex = -1;
|
|
3539
3447
|
return;
|
|
3540
3448
|
}
|
|
3541
3449
|
let i = Timeline.search(frames, time, _SequenceTimeline.ENTRIES);
|
|
3542
3450
|
let before = frames[i];
|
|
3543
3451
|
let modeAndIndex = frames[i + _SequenceTimeline.MODE];
|
|
3544
3452
|
let delay = frames[i + _SequenceTimeline.DELAY];
|
|
3545
|
-
if (!this.attachment.sequence)
|
|
3546
|
-
return;
|
|
3453
|
+
if (!this.attachment.sequence) return;
|
|
3547
3454
|
let index = modeAndIndex >> 4, count = this.attachment.sequence.regions.length;
|
|
3548
3455
|
let mode = SequenceModeValues[modeAndIndex & 15];
|
|
3549
3456
|
if (mode != 0 /* hold */) {
|
|
@@ -3558,8 +3465,7 @@ var spine = (() => {
|
|
|
3558
3465
|
case 3 /* pingpong */: {
|
|
3559
3466
|
let n = (count << 1) - 2;
|
|
3560
3467
|
index = n == 0 ? 0 : index % n;
|
|
3561
|
-
if (index >= count)
|
|
3562
|
-
index = n - index;
|
|
3468
|
+
if (index >= count) index = n - index;
|
|
3563
3469
|
break;
|
|
3564
3470
|
}
|
|
3565
3471
|
case 4 /* onceReverse */:
|
|
@@ -3571,21 +3477,17 @@ var spine = (() => {
|
|
|
3571
3477
|
case 6 /* pingpongReverse */: {
|
|
3572
3478
|
let n = (count << 1) - 2;
|
|
3573
3479
|
index = n == 0 ? 0 : (index + count - 1) % n;
|
|
3574
|
-
if (index >= count)
|
|
3575
|
-
index = n - index;
|
|
3480
|
+
if (index >= count) index = n - index;
|
|
3576
3481
|
}
|
|
3577
3482
|
}
|
|
3578
3483
|
}
|
|
3579
3484
|
slot.sequenceIndex = index;
|
|
3580
3485
|
}
|
|
3581
3486
|
};
|
|
3582
|
-
var SequenceTimeline = _SequenceTimeline;
|
|
3583
|
-
__publicField(SequenceTimeline, "ENTRIES", 3);
|
|
3584
|
-
__publicField(SequenceTimeline, "MODE", 1);
|
|
3585
|
-
__publicField(SequenceTimeline, "DELAY", 2);
|
|
3586
3487
|
|
|
3587
3488
|
// spine-core/src/AnimationState.ts
|
|
3588
|
-
var
|
|
3489
|
+
var AnimationState = class _AnimationState {
|
|
3490
|
+
static _emptyAnimation = new Animation("<empty>", [], 0);
|
|
3589
3491
|
static emptyAnimation() {
|
|
3590
3492
|
return _AnimationState._emptyAnimation;
|
|
3591
3493
|
}
|
|
@@ -3614,15 +3516,13 @@ var spine = (() => {
|
|
|
3614
3516
|
let tracks = this.tracks;
|
|
3615
3517
|
for (let i = 0, n = tracks.length; i < n; i++) {
|
|
3616
3518
|
let current = tracks[i];
|
|
3617
|
-
if (!current)
|
|
3618
|
-
continue;
|
|
3519
|
+
if (!current) continue;
|
|
3619
3520
|
current.animationLast = current.nextAnimationLast;
|
|
3620
3521
|
current.trackLast = current.nextTrackLast;
|
|
3621
3522
|
let currentDelta = delta * current.timeScale;
|
|
3622
3523
|
if (current.delay > 0) {
|
|
3623
3524
|
current.delay -= currentDelta;
|
|
3624
|
-
if (current.delay > 0)
|
|
3625
|
-
continue;
|
|
3525
|
+
if (current.delay > 0) continue;
|
|
3626
3526
|
currentDelta = -current.delay;
|
|
3627
3527
|
current.delay = 0;
|
|
3628
3528
|
}
|
|
@@ -3649,8 +3549,7 @@ var spine = (() => {
|
|
|
3649
3549
|
if (current.mixingFrom && this.updateMixingFrom(current, delta)) {
|
|
3650
3550
|
let from = current.mixingFrom;
|
|
3651
3551
|
current.mixingFrom = null;
|
|
3652
|
-
if (from)
|
|
3653
|
-
from.mixingTo = null;
|
|
3552
|
+
if (from) from.mixingTo = null;
|
|
3654
3553
|
while (from) {
|
|
3655
3554
|
this.queue.end(from);
|
|
3656
3555
|
from = from.mixingFrom;
|
|
@@ -3663,16 +3562,14 @@ var spine = (() => {
|
|
|
3663
3562
|
/** Returns true when all mixing from entries are complete. */
|
|
3664
3563
|
updateMixingFrom(to, delta) {
|
|
3665
3564
|
let from = to.mixingFrom;
|
|
3666
|
-
if (!from)
|
|
3667
|
-
return true;
|
|
3565
|
+
if (!from) return true;
|
|
3668
3566
|
let finished = this.updateMixingFrom(from, delta);
|
|
3669
3567
|
from.animationLast = from.nextAnimationLast;
|
|
3670
3568
|
from.trackLast = from.nextTrackLast;
|
|
3671
3569
|
if (to.nextTrackLast != -1 && to.mixTime >= to.mixDuration) {
|
|
3672
3570
|
if (from.totalAlpha == 0 || to.mixDuration == 0) {
|
|
3673
3571
|
to.mixingFrom = from.mixingFrom;
|
|
3674
|
-
if (from.mixingFrom != null)
|
|
3675
|
-
from.mixingFrom.mixingTo = to;
|
|
3572
|
+
if (from.mixingFrom != null) from.mixingFrom.mixingTo = to;
|
|
3676
3573
|
to.interruptAlpha = from.interruptAlpha;
|
|
3677
3574
|
this.queue.end(from);
|
|
3678
3575
|
}
|
|
@@ -3686,17 +3583,14 @@ var spine = (() => {
|
|
|
3686
3583
|
* animation state can be applied to multiple skeletons to pose them identically.
|
|
3687
3584
|
* @returns True if any animations were applied. */
|
|
3688
3585
|
apply(skeleton) {
|
|
3689
|
-
if (!skeleton)
|
|
3690
|
-
|
|
3691
|
-
if (this.animationsChanged)
|
|
3692
|
-
this._animationsChanged();
|
|
3586
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
3587
|
+
if (this.animationsChanged) this._animationsChanged();
|
|
3693
3588
|
let events = this.events;
|
|
3694
3589
|
let tracks = this.tracks;
|
|
3695
3590
|
let applied = false;
|
|
3696
3591
|
for (let i2 = 0, n2 = tracks.length; i2 < n2; i2++) {
|
|
3697
3592
|
let current = tracks[i2];
|
|
3698
|
-
if (!current || current.delay > 0)
|
|
3699
|
-
continue;
|
|
3593
|
+
if (!current || current.delay > 0) continue;
|
|
3700
3594
|
applied = true;
|
|
3701
3595
|
let blend = i2 == 0 ? 1 /* first */ : current.mixBlend;
|
|
3702
3596
|
let alpha = current.alpha;
|
|
@@ -3714,8 +3608,7 @@ var spine = (() => {
|
|
|
3714
3608
|
let timelines = current.animation.timelines;
|
|
3715
3609
|
let timelineCount = timelines.length;
|
|
3716
3610
|
if (i2 == 0 && alpha == 1 || blend == 3 /* add */) {
|
|
3717
|
-
if (i2 == 0)
|
|
3718
|
-
attachments = true;
|
|
3611
|
+
if (i2 == 0) attachments = true;
|
|
3719
3612
|
for (let ii = 0; ii < timelineCount; ii++) {
|
|
3720
3613
|
Utils.webkit602BugfixHelper(alpha, blend);
|
|
3721
3614
|
var timeline = timelines[ii];
|
|
@@ -3728,8 +3621,7 @@ var spine = (() => {
|
|
|
3728
3621
|
let timelineMode = current.timelineMode;
|
|
3729
3622
|
let shortestRotation = current.shortestRotation;
|
|
3730
3623
|
let firstFrame = !shortestRotation && current.timelinesRotation.length != timelineCount << 1;
|
|
3731
|
-
if (firstFrame)
|
|
3732
|
-
current.timelinesRotation.length = timelineCount << 1;
|
|
3624
|
+
if (firstFrame) current.timelinesRotation.length = timelineCount << 1;
|
|
3733
3625
|
for (let ii = 0; ii < timelineCount; ii++) {
|
|
3734
3626
|
let timeline2 = timelines[ii];
|
|
3735
3627
|
let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend : 0 /* setup */;
|
|
@@ -3763,19 +3655,15 @@ var spine = (() => {
|
|
|
3763
3655
|
}
|
|
3764
3656
|
applyMixingFrom(to, skeleton, blend) {
|
|
3765
3657
|
let from = to.mixingFrom;
|
|
3766
|
-
if (from.mixingFrom)
|
|
3767
|
-
this.applyMixingFrom(from, skeleton, blend);
|
|
3658
|
+
if (from.mixingFrom) this.applyMixingFrom(from, skeleton, blend);
|
|
3768
3659
|
let mix = 0;
|
|
3769
3660
|
if (to.mixDuration == 0) {
|
|
3770
3661
|
mix = 1;
|
|
3771
|
-
if (blend == 1 /* first */)
|
|
3772
|
-
blend = 0 /* setup */;
|
|
3662
|
+
if (blend == 1 /* first */) blend = 0 /* setup */;
|
|
3773
3663
|
} else {
|
|
3774
3664
|
mix = to.mixTime / to.mixDuration;
|
|
3775
|
-
if (mix > 1)
|
|
3776
|
-
|
|
3777
|
-
if (blend != 1 /* first */)
|
|
3778
|
-
blend = from.mixBlend;
|
|
3665
|
+
if (mix > 1) mix = 1;
|
|
3666
|
+
if (blend != 1 /* first */) blend = from.mixBlend;
|
|
3779
3667
|
}
|
|
3780
3668
|
let attachments = mix < from.mixAttachmentThreshold, drawOrder = mix < from.mixDrawOrderThreshold;
|
|
3781
3669
|
let timelines = from.animation.timelines;
|
|
@@ -3795,8 +3683,7 @@ var spine = (() => {
|
|
|
3795
3683
|
let timelineHoldMix = from.timelineHoldMix;
|
|
3796
3684
|
let shortestRotation = from.shortestRotation;
|
|
3797
3685
|
let firstFrame = !shortestRotation && from.timelinesRotation.length != timelineCount << 1;
|
|
3798
|
-
if (firstFrame)
|
|
3799
|
-
from.timelinesRotation.length = timelineCount << 1;
|
|
3686
|
+
if (firstFrame) from.timelinesRotation.length = timelineCount << 1;
|
|
3800
3687
|
from.totalAlpha = 0;
|
|
3801
3688
|
for (let i = 0; i < timelineCount; i++) {
|
|
3802
3689
|
let timeline = timelines[i];
|
|
@@ -3805,8 +3692,7 @@ var spine = (() => {
|
|
|
3805
3692
|
let alpha = 0;
|
|
3806
3693
|
switch (timelineMode[i]) {
|
|
3807
3694
|
case SUBSEQUENT:
|
|
3808
|
-
if (!drawOrder && timeline instanceof DrawOrderTimeline)
|
|
3809
|
-
continue;
|
|
3695
|
+
if (!drawOrder && timeline instanceof DrawOrderTimeline) continue;
|
|
3810
3696
|
timelineBlend = blend;
|
|
3811
3697
|
alpha = alphaMix;
|
|
3812
3698
|
break;
|
|
@@ -3841,8 +3727,7 @@ var spine = (() => {
|
|
|
3841
3727
|
}
|
|
3842
3728
|
}
|
|
3843
3729
|
}
|
|
3844
|
-
if (to.mixDuration > 0)
|
|
3845
|
-
this.queueEvents(from, animationTime);
|
|
3730
|
+
if (to.mixDuration > 0) this.queueEvents(from, animationTime);
|
|
3846
3731
|
this.events.length = 0;
|
|
3847
3732
|
from.nextAnimationLast = animationTime;
|
|
3848
3733
|
from.nextTrackLast = from.trackTime;
|
|
@@ -3850,31 +3735,26 @@ var spine = (() => {
|
|
|
3850
3735
|
}
|
|
3851
3736
|
applyAttachmentTimeline(timeline, skeleton, time, blend, attachments) {
|
|
3852
3737
|
var slot = skeleton.slots[timeline.slotIndex];
|
|
3853
|
-
if (!slot.bone.active)
|
|
3854
|
-
return;
|
|
3738
|
+
if (!slot.bone.active) return;
|
|
3855
3739
|
if (time < timeline.frames[0]) {
|
|
3856
3740
|
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
3857
3741
|
this.setAttachment(skeleton, slot, slot.data.attachmentName, attachments);
|
|
3858
3742
|
} else
|
|
3859
3743
|
this.setAttachment(skeleton, slot, timeline.attachmentNames[Timeline.search1(timeline.frames, time)], attachments);
|
|
3860
|
-
if (slot.attachmentState <= this.unkeyedState)
|
|
3861
|
-
slot.attachmentState = this.unkeyedState + SETUP;
|
|
3744
|
+
if (slot.attachmentState <= this.unkeyedState) slot.attachmentState = this.unkeyedState + SETUP;
|
|
3862
3745
|
}
|
|
3863
3746
|
setAttachment(skeleton, slot, attachmentName, attachments) {
|
|
3864
3747
|
slot.setAttachment(!attachmentName ? null : skeleton.getAttachment(slot.data.index, attachmentName));
|
|
3865
|
-
if (attachments)
|
|
3866
|
-
slot.attachmentState = this.unkeyedState + CURRENT;
|
|
3748
|
+
if (attachments) slot.attachmentState = this.unkeyedState + CURRENT;
|
|
3867
3749
|
}
|
|
3868
3750
|
applyRotateTimeline(timeline, skeleton, time, alpha, blend, timelinesRotation, i, firstFrame) {
|
|
3869
|
-
if (firstFrame)
|
|
3870
|
-
timelinesRotation[i] = 0;
|
|
3751
|
+
if (firstFrame) timelinesRotation[i] = 0;
|
|
3871
3752
|
if (alpha == 1) {
|
|
3872
3753
|
timeline.apply(skeleton, 0, time, null, 1, blend, 0 /* mixIn */);
|
|
3873
3754
|
return;
|
|
3874
3755
|
}
|
|
3875
3756
|
let bone = skeleton.bones[timeline.boneIndex];
|
|
3876
|
-
if (!bone.active)
|
|
3877
|
-
return;
|
|
3757
|
+
if (!bone.active) return;
|
|
3878
3758
|
let frames = timeline.frames;
|
|
3879
3759
|
let r1 = 0, r2 = 0;
|
|
3880
3760
|
if (time < frames[0]) {
|
|
@@ -3916,8 +3796,7 @@ var spine = (() => {
|
|
|
3916
3796
|
else
|
|
3917
3797
|
dir = current;
|
|
3918
3798
|
}
|
|
3919
|
-
if (dir != current)
|
|
3920
|
-
total += 360 * MathUtils.signum(lastTotal);
|
|
3799
|
+
if (dir != current) total += 360 * MathUtils.signum(lastTotal);
|
|
3921
3800
|
timelinesRotation[i] = total;
|
|
3922
3801
|
}
|
|
3923
3802
|
timelinesRotation[i + 1] = diff;
|
|
@@ -3931,10 +3810,8 @@ var spine = (() => {
|
|
|
3931
3810
|
let i = 0, n = events.length;
|
|
3932
3811
|
for (; i < n; i++) {
|
|
3933
3812
|
let event = events[i];
|
|
3934
|
-
if (event.time < trackLastWrapped)
|
|
3935
|
-
|
|
3936
|
-
if (event.time > animationEnd)
|
|
3937
|
-
continue;
|
|
3813
|
+
if (event.time < trackLastWrapped) break;
|
|
3814
|
+
if (event.time > animationEnd) continue;
|
|
3938
3815
|
this.queue.event(entry, event);
|
|
3939
3816
|
}
|
|
3940
3817
|
let complete = false;
|
|
@@ -3947,12 +3824,10 @@ var spine = (() => {
|
|
|
3947
3824
|
}
|
|
3948
3825
|
} else
|
|
3949
3826
|
complete = animationTime >= animationEnd && entry.animationLast < animationEnd;
|
|
3950
|
-
if (complete)
|
|
3951
|
-
this.queue.complete(entry);
|
|
3827
|
+
if (complete) this.queue.complete(entry);
|
|
3952
3828
|
for (; i < n; i++) {
|
|
3953
3829
|
let event = events[i];
|
|
3954
|
-
if (event.time < animationStart)
|
|
3955
|
-
continue;
|
|
3830
|
+
if (event.time < animationStart) continue;
|
|
3956
3831
|
this.queue.event(entry, event);
|
|
3957
3832
|
}
|
|
3958
3833
|
}
|
|
@@ -3974,18 +3849,15 @@ var spine = (() => {
|
|
|
3974
3849
|
* It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
|
|
3975
3850
|
* rather than leaving them in their current pose. */
|
|
3976
3851
|
clearTrack(trackIndex) {
|
|
3977
|
-
if (trackIndex >= this.tracks.length)
|
|
3978
|
-
return;
|
|
3852
|
+
if (trackIndex >= this.tracks.length) return;
|
|
3979
3853
|
let current = this.tracks[trackIndex];
|
|
3980
|
-
if (!current)
|
|
3981
|
-
return;
|
|
3854
|
+
if (!current) return;
|
|
3982
3855
|
this.queue.end(current);
|
|
3983
3856
|
this.clearNext(current);
|
|
3984
3857
|
let entry = current;
|
|
3985
3858
|
while (true) {
|
|
3986
3859
|
let from = entry.mixingFrom;
|
|
3987
|
-
if (!from)
|
|
3988
|
-
break;
|
|
3860
|
+
if (!from) break;
|
|
3989
3861
|
this.queue.end(from);
|
|
3990
3862
|
entry.mixingFrom = null;
|
|
3991
3863
|
entry.mixingTo = null;
|
|
@@ -3999,8 +3871,7 @@ var spine = (() => {
|
|
|
3999
3871
|
this.tracks[index] = current;
|
|
4000
3872
|
current.previous = null;
|
|
4001
3873
|
if (from) {
|
|
4002
|
-
if (interrupt)
|
|
4003
|
-
this.queue.interrupt(from);
|
|
3874
|
+
if (interrupt) this.queue.interrupt(from);
|
|
4004
3875
|
current.mixingFrom = from;
|
|
4005
3876
|
from.mixingTo = current;
|
|
4006
3877
|
current.mixTime = 0;
|
|
@@ -4015,8 +3886,7 @@ var spine = (() => {
|
|
|
4015
3886
|
* See {@link #setAnimationWith()}. */
|
|
4016
3887
|
setAnimation(trackIndex, animationName, loop = false) {
|
|
4017
3888
|
let animation = this.data.skeletonData.findAnimation(animationName);
|
|
4018
|
-
if (!animation)
|
|
4019
|
-
throw new Error("Animation not found: " + animationName);
|
|
3889
|
+
if (!animation) throw new Error("Animation not found: " + animationName);
|
|
4020
3890
|
return this.setAnimationWith(trackIndex, animation, loop);
|
|
4021
3891
|
}
|
|
4022
3892
|
/** Sets the current animation for a track, discarding any queued animations. If the formerly current track entry was never
|
|
@@ -4026,8 +3896,7 @@ var spine = (() => {
|
|
|
4026
3896
|
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
4027
3897
|
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
4028
3898
|
setAnimationWith(trackIndex, animation, loop = false) {
|
|
4029
|
-
if (!animation)
|
|
4030
|
-
throw new Error("animation cannot be null.");
|
|
3899
|
+
if (!animation) throw new Error("animation cannot be null.");
|
|
4031
3900
|
let interrupt = true;
|
|
4032
3901
|
let current = this.expandToIndex(trackIndex);
|
|
4033
3902
|
if (current) {
|
|
@@ -4051,8 +3920,7 @@ var spine = (() => {
|
|
|
4051
3920
|
* See {@link #addAnimationWith()}. */
|
|
4052
3921
|
addAnimation(trackIndex, animationName, loop = false, delay = 0) {
|
|
4053
3922
|
let animation = this.data.skeletonData.findAnimation(animationName);
|
|
4054
|
-
if (!animation)
|
|
4055
|
-
throw new Error("Animation not found: " + animationName);
|
|
3923
|
+
if (!animation) throw new Error("Animation not found: " + animationName);
|
|
4056
3924
|
return this.addAnimationWith(trackIndex, animation, loop, delay);
|
|
4057
3925
|
}
|
|
4058
3926
|
/** Adds an animation to be played after the current or last queued animation for a track. If the track is empty, it is
|
|
@@ -4064,8 +3932,7 @@ var spine = (() => {
|
|
|
4064
3932
|
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
4065
3933
|
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
4066
3934
|
addAnimationWith(trackIndex, animation, loop = false, delay = 0) {
|
|
4067
|
-
if (!animation)
|
|
4068
|
-
throw new Error("animation cannot be null.");
|
|
3935
|
+
if (!animation) throw new Error("animation cannot be null.");
|
|
4069
3936
|
let last = this.expandToIndex(trackIndex);
|
|
4070
3937
|
if (last) {
|
|
4071
3938
|
while (last.next)
|
|
@@ -4075,11 +3942,11 @@ var spine = (() => {
|
|
|
4075
3942
|
if (!last) {
|
|
4076
3943
|
this.setCurrent(trackIndex, entry, true);
|
|
4077
3944
|
this.queue.drain();
|
|
3945
|
+
if (delay < 0) delay = 0;
|
|
4078
3946
|
} else {
|
|
4079
3947
|
last.next = entry;
|
|
4080
3948
|
entry.previous = last;
|
|
4081
|
-
if (delay <= 0)
|
|
4082
|
-
delay += last.getTrackComplete() - entry.mixDuration;
|
|
3949
|
+
if (delay <= 0) delay = Math.max(delay + last.getTrackComplete() - entry.mixDuration, 0);
|
|
4083
3950
|
}
|
|
4084
3951
|
entry.delay = delay;
|
|
4085
3952
|
return entry;
|
|
@@ -4117,8 +3984,7 @@ var spine = (() => {
|
|
|
4117
3984
|
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
4118
3985
|
addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
|
|
4119
3986
|
let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
|
|
4120
|
-
if (delay <= 0)
|
|
4121
|
-
entry.delay += entry.mixDuration - mixDuration;
|
|
3987
|
+
if (delay <= 0) entry.delay = Math.max(entry.delay + entry.mixDuration - mixDuration, 0);
|
|
4122
3988
|
entry.mixDuration = mixDuration;
|
|
4123
3989
|
entry.trackEnd = mixDuration;
|
|
4124
3990
|
return entry;
|
|
@@ -4130,15 +3996,13 @@ var spine = (() => {
|
|
|
4130
3996
|
this.queue.drainDisabled = true;
|
|
4131
3997
|
for (let i = 0, n = this.tracks.length; i < n; i++) {
|
|
4132
3998
|
let current = this.tracks[i];
|
|
4133
|
-
if (current)
|
|
4134
|
-
this.setEmptyAnimation(current.trackIndex, mixDuration);
|
|
3999
|
+
if (current) this.setEmptyAnimation(current.trackIndex, mixDuration);
|
|
4135
4000
|
}
|
|
4136
4001
|
this.queue.drainDisabled = oldDrainDisabled;
|
|
4137
4002
|
this.queue.drain();
|
|
4138
4003
|
}
|
|
4139
4004
|
expandToIndex(index) {
|
|
4140
|
-
if (index < this.tracks.length)
|
|
4141
|
-
return this.tracks[index];
|
|
4005
|
+
if (index < this.tracks.length) return this.tracks[index];
|
|
4142
4006
|
Utils.ensureArrayCapacity(this.tracks, index + 1, null);
|
|
4143
4007
|
this.tracks.length = index + 1;
|
|
4144
4008
|
return null;
|
|
@@ -4190,13 +4054,11 @@ var spine = (() => {
|
|
|
4190
4054
|
let tracks = this.tracks;
|
|
4191
4055
|
for (let i = 0, n = tracks.length; i < n; i++) {
|
|
4192
4056
|
let entry = tracks[i];
|
|
4193
|
-
if (!entry)
|
|
4194
|
-
continue;
|
|
4057
|
+
if (!entry) continue;
|
|
4195
4058
|
while (entry.mixingFrom)
|
|
4196
4059
|
entry = entry.mixingFrom;
|
|
4197
4060
|
do {
|
|
4198
|
-
if (!entry.mixingTo || entry.mixBlend != 3 /* add */)
|
|
4199
|
-
this.computeHold(entry);
|
|
4061
|
+
if (!entry.mixingTo || entry.mixBlend != 3 /* add */) this.computeHold(entry);
|
|
4200
4062
|
entry = entry.mixingTo;
|
|
4201
4063
|
} while (entry);
|
|
4202
4064
|
}
|
|
@@ -4225,8 +4087,7 @@ var spine = (() => {
|
|
|
4225
4087
|
timelineMode[i] = FIRST;
|
|
4226
4088
|
} else {
|
|
4227
4089
|
for (let next = to.mixingTo; next; next = next.mixingTo) {
|
|
4228
|
-
if (next.animation.hasTimeline(ids))
|
|
4229
|
-
continue;
|
|
4090
|
+
if (next.animation.hasTimeline(ids)) continue;
|
|
4230
4091
|
if (entry.mixDuration > 0) {
|
|
4231
4092
|
timelineMode[i] = HOLD_MIX;
|
|
4232
4093
|
timelineHoldMix[i] = next;
|
|
@@ -4240,21 +4101,18 @@ var spine = (() => {
|
|
|
4240
4101
|
}
|
|
4241
4102
|
/** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
|
|
4242
4103
|
getCurrent(trackIndex) {
|
|
4243
|
-
if (trackIndex >= this.tracks.length)
|
|
4244
|
-
return null;
|
|
4104
|
+
if (trackIndex >= this.tracks.length) return null;
|
|
4245
4105
|
return this.tracks[trackIndex];
|
|
4246
4106
|
}
|
|
4247
4107
|
/** Adds a listener to receive events for all track entries. */
|
|
4248
4108
|
addListener(listener) {
|
|
4249
|
-
if (!listener)
|
|
4250
|
-
throw new Error("listener cannot be null.");
|
|
4109
|
+
if (!listener) throw new Error("listener cannot be null.");
|
|
4251
4110
|
this.listeners.push(listener);
|
|
4252
4111
|
}
|
|
4253
4112
|
/** Removes the listener added with {@link #addListener()}. */
|
|
4254
4113
|
removeListener(listener) {
|
|
4255
4114
|
let index = this.listeners.indexOf(listener);
|
|
4256
|
-
if (index >= 0)
|
|
4257
|
-
this.listeners.splice(index, 1);
|
|
4115
|
+
if (index >= 0) this.listeners.splice(index, 1);
|
|
4258
4116
|
}
|
|
4259
4117
|
/** Removes all listeners added with {@link #addListener()}. */
|
|
4260
4118
|
clearListeners() {
|
|
@@ -4267,8 +4125,6 @@ var spine = (() => {
|
|
|
4267
4125
|
this.queue.clear();
|
|
4268
4126
|
}
|
|
4269
4127
|
};
|
|
4270
|
-
var AnimationState = _AnimationState;
|
|
4271
|
-
__publicField(AnimationState, "_emptyAnimation", new Animation("<empty>", [], 0));
|
|
4272
4128
|
var TrackEntry = class {
|
|
4273
4129
|
/** The animation to apply for this track entry. */
|
|
4274
4130
|
animation = null;
|
|
@@ -4402,8 +4258,12 @@ var spine = (() => {
|
|
|
4402
4258
|
}
|
|
4403
4259
|
setMixDurationWithDelay(mixDuration, delay) {
|
|
4404
4260
|
this._mixDuration = mixDuration;
|
|
4405
|
-
if (
|
|
4406
|
-
|
|
4261
|
+
if (delay <= 0) {
|
|
4262
|
+
if (this.previous != null)
|
|
4263
|
+
delay = Math.max(delay + this.previous.getTrackComplete() - mixDuration, 0);
|
|
4264
|
+
else
|
|
4265
|
+
delay = 0;
|
|
4266
|
+
}
|
|
4407
4267
|
this.delay = delay;
|
|
4408
4268
|
}
|
|
4409
4269
|
/** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
|
|
@@ -4433,8 +4293,7 @@ var spine = (() => {
|
|
|
4433
4293
|
getAnimationTime() {
|
|
4434
4294
|
if (this.loop) {
|
|
4435
4295
|
let duration = this.animationEnd - this.animationStart;
|
|
4436
|
-
if (duration == 0)
|
|
4437
|
-
return this.animationStart;
|
|
4296
|
+
if (duration == 0) return this.animationStart;
|
|
4438
4297
|
return this.trackTime % duration + this.animationStart;
|
|
4439
4298
|
}
|
|
4440
4299
|
return Math.min(this.trackTime + this.animationStart, this.animationEnd);
|
|
@@ -4462,10 +4321,8 @@ var spine = (() => {
|
|
|
4462
4321
|
getTrackComplete() {
|
|
4463
4322
|
let duration = this.animationEnd - this.animationStart;
|
|
4464
4323
|
if (duration != 0) {
|
|
4465
|
-
if (this.loop)
|
|
4466
|
-
|
|
4467
|
-
if (this.trackTime < duration)
|
|
4468
|
-
return duration;
|
|
4324
|
+
if (this.loop) return duration * (1 + (this.trackTime / duration | 0));
|
|
4325
|
+
if (this.trackTime < duration) return duration;
|
|
4469
4326
|
}
|
|
4470
4327
|
return this.trackTime;
|
|
4471
4328
|
}
|
|
@@ -4489,35 +4346,34 @@ var spine = (() => {
|
|
|
4489
4346
|
this.animState = animState;
|
|
4490
4347
|
}
|
|
4491
4348
|
start(entry) {
|
|
4492
|
-
this.objects.push(
|
|
4349
|
+
this.objects.push(0 /* start */);
|
|
4493
4350
|
this.objects.push(entry);
|
|
4494
4351
|
this.animState.animationsChanged = true;
|
|
4495
4352
|
}
|
|
4496
4353
|
interrupt(entry) {
|
|
4497
|
-
this.objects.push(
|
|
4354
|
+
this.objects.push(1 /* interrupt */);
|
|
4498
4355
|
this.objects.push(entry);
|
|
4499
4356
|
}
|
|
4500
4357
|
end(entry) {
|
|
4501
|
-
this.objects.push(
|
|
4358
|
+
this.objects.push(2 /* end */);
|
|
4502
4359
|
this.objects.push(entry);
|
|
4503
4360
|
this.animState.animationsChanged = true;
|
|
4504
4361
|
}
|
|
4505
4362
|
dispose(entry) {
|
|
4506
|
-
this.objects.push(
|
|
4363
|
+
this.objects.push(3 /* dispose */);
|
|
4507
4364
|
this.objects.push(entry);
|
|
4508
4365
|
}
|
|
4509
4366
|
complete(entry) {
|
|
4510
|
-
this.objects.push(
|
|
4367
|
+
this.objects.push(4 /* complete */);
|
|
4511
4368
|
this.objects.push(entry);
|
|
4512
4369
|
}
|
|
4513
4370
|
event(entry, event) {
|
|
4514
|
-
this.objects.push(
|
|
4371
|
+
this.objects.push(5 /* event */);
|
|
4515
4372
|
this.objects.push(entry);
|
|
4516
4373
|
this.objects.push(event);
|
|
4517
4374
|
}
|
|
4518
4375
|
drain() {
|
|
4519
|
-
if (this.drainDisabled)
|
|
4520
|
-
return;
|
|
4376
|
+
if (this.drainDisabled) return;
|
|
4521
4377
|
this.drainDisabled = true;
|
|
4522
4378
|
let objects = this.objects;
|
|
4523
4379
|
let listeners = this.animState.listeners;
|
|
@@ -4525,59 +4381,48 @@ var spine = (() => {
|
|
|
4525
4381
|
let type = objects[i];
|
|
4526
4382
|
let entry = objects[i + 1];
|
|
4527
4383
|
switch (type) {
|
|
4528
|
-
case
|
|
4529
|
-
if (entry.listener && entry.listener.start)
|
|
4530
|
-
entry.listener.start(entry);
|
|
4384
|
+
case 0 /* start */:
|
|
4385
|
+
if (entry.listener && entry.listener.start) entry.listener.start(entry);
|
|
4531
4386
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4532
4387
|
let listener = listeners[ii];
|
|
4533
|
-
if (listener.start)
|
|
4534
|
-
listener.start(entry);
|
|
4388
|
+
if (listener.start) listener.start(entry);
|
|
4535
4389
|
}
|
|
4536
4390
|
break;
|
|
4537
|
-
case
|
|
4538
|
-
if (entry.listener && entry.listener.interrupt)
|
|
4539
|
-
entry.listener.interrupt(entry);
|
|
4391
|
+
case 1 /* interrupt */:
|
|
4392
|
+
if (entry.listener && entry.listener.interrupt) entry.listener.interrupt(entry);
|
|
4540
4393
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4541
4394
|
let listener = listeners[ii];
|
|
4542
|
-
if (listener.interrupt)
|
|
4543
|
-
listener.interrupt(entry);
|
|
4395
|
+
if (listener.interrupt) listener.interrupt(entry);
|
|
4544
4396
|
}
|
|
4545
4397
|
break;
|
|
4546
|
-
case
|
|
4547
|
-
if (entry.listener && entry.listener.end)
|
|
4548
|
-
entry.listener.end(entry);
|
|
4398
|
+
case 2 /* end */:
|
|
4399
|
+
if (entry.listener && entry.listener.end) entry.listener.end(entry);
|
|
4549
4400
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4550
4401
|
let listener = listeners[ii];
|
|
4551
|
-
if (listener.end)
|
|
4552
|
-
listener.end(entry);
|
|
4402
|
+
if (listener.end) listener.end(entry);
|
|
4553
4403
|
}
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4404
|
+
// Fall through.
|
|
4405
|
+
case 3 /* dispose */:
|
|
4406
|
+
if (entry.listener && entry.listener.dispose) entry.listener.dispose(entry);
|
|
4557
4407
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4558
4408
|
let listener = listeners[ii];
|
|
4559
|
-
if (listener.dispose)
|
|
4560
|
-
listener.dispose(entry);
|
|
4409
|
+
if (listener.dispose) listener.dispose(entry);
|
|
4561
4410
|
}
|
|
4562
4411
|
this.animState.trackEntryPool.free(entry);
|
|
4563
4412
|
break;
|
|
4564
|
-
case
|
|
4565
|
-
if (entry.listener && entry.listener.complete)
|
|
4566
|
-
entry.listener.complete(entry);
|
|
4413
|
+
case 4 /* complete */:
|
|
4414
|
+
if (entry.listener && entry.listener.complete) entry.listener.complete(entry);
|
|
4567
4415
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4568
4416
|
let listener = listeners[ii];
|
|
4569
|
-
if (listener.complete)
|
|
4570
|
-
listener.complete(entry);
|
|
4417
|
+
if (listener.complete) listener.complete(entry);
|
|
4571
4418
|
}
|
|
4572
4419
|
break;
|
|
4573
|
-
case
|
|
4420
|
+
case 5 /* event */:
|
|
4574
4421
|
let event = objects[i++ + 2];
|
|
4575
|
-
if (entry.listener && entry.listener.event)
|
|
4576
|
-
entry.listener.event(entry, event);
|
|
4422
|
+
if (entry.listener && entry.listener.event) entry.listener.event(entry, event);
|
|
4577
4423
|
for (let ii = 0; ii < listeners.length; ii++) {
|
|
4578
4424
|
let listener = listeners[ii];
|
|
4579
|
-
if (listener.event)
|
|
4580
|
-
listener.event(entry, event);
|
|
4425
|
+
if (listener.event) listener.event(entry, event);
|
|
4581
4426
|
}
|
|
4582
4427
|
break;
|
|
4583
4428
|
}
|
|
@@ -4628,8 +4473,7 @@ var spine = (() => {
|
|
|
4628
4473
|
/** The mix duration to use when no mix duration has been defined between two animations. */
|
|
4629
4474
|
defaultMix = 0;
|
|
4630
4475
|
constructor(skeletonData) {
|
|
4631
|
-
if (!skeletonData)
|
|
4632
|
-
throw new Error("skeletonData cannot be null.");
|
|
4476
|
+
if (!skeletonData) throw new Error("skeletonData cannot be null.");
|
|
4633
4477
|
this.skeletonData = skeletonData;
|
|
4634
4478
|
}
|
|
4635
4479
|
/** Sets a mix duration by animation name.
|
|
@@ -4637,21 +4481,17 @@ var spine = (() => {
|
|
|
4637
4481
|
* See {@link #setMixWith()}. */
|
|
4638
4482
|
setMix(fromName, toName, duration) {
|
|
4639
4483
|
let from = this.skeletonData.findAnimation(fromName);
|
|
4640
|
-
if (!from)
|
|
4641
|
-
throw new Error("Animation not found: " + fromName);
|
|
4484
|
+
if (!from) throw new Error("Animation not found: " + fromName);
|
|
4642
4485
|
let to = this.skeletonData.findAnimation(toName);
|
|
4643
|
-
if (!to)
|
|
4644
|
-
throw new Error("Animation not found: " + toName);
|
|
4486
|
+
if (!to) throw new Error("Animation not found: " + toName);
|
|
4645
4487
|
this.setMixWith(from, to, duration);
|
|
4646
4488
|
}
|
|
4647
4489
|
/** Sets the mix duration when changing from the specified animation to the other.
|
|
4648
4490
|
*
|
|
4649
4491
|
* See {@link TrackEntry#mixDuration}. */
|
|
4650
4492
|
setMixWith(from, to, duration) {
|
|
4651
|
-
if (!from)
|
|
4652
|
-
|
|
4653
|
-
if (!to)
|
|
4654
|
-
throw new Error("to cannot be null.");
|
|
4493
|
+
if (!from) throw new Error("from cannot be null.");
|
|
4494
|
+
if (!to) throw new Error("to cannot be null.");
|
|
4655
4495
|
let key = from.name + "." + to.name;
|
|
4656
4496
|
this.animationToMixTime[key] = duration;
|
|
4657
4497
|
}
|
|
@@ -4665,13 +4505,13 @@ var spine = (() => {
|
|
|
4665
4505
|
};
|
|
4666
4506
|
|
|
4667
4507
|
// spine-core/src/attachments/BoundingBoxAttachment.ts
|
|
4668
|
-
var BoundingBoxAttachment = class extends VertexAttachment {
|
|
4508
|
+
var BoundingBoxAttachment = class _BoundingBoxAttachment extends VertexAttachment {
|
|
4669
4509
|
color = new Color(1, 1, 1, 1);
|
|
4670
4510
|
constructor(name) {
|
|
4671
4511
|
super(name);
|
|
4672
4512
|
}
|
|
4673
4513
|
copy() {
|
|
4674
|
-
let copy = new
|
|
4514
|
+
let copy = new _BoundingBoxAttachment(this.name);
|
|
4675
4515
|
this.copyTo(copy);
|
|
4676
4516
|
copy.color.setFromColor(this.color);
|
|
4677
4517
|
return copy;
|
|
@@ -4679,7 +4519,7 @@ var spine = (() => {
|
|
|
4679
4519
|
};
|
|
4680
4520
|
|
|
4681
4521
|
// spine-core/src/attachments/ClippingAttachment.ts
|
|
4682
|
-
var ClippingAttachment = class extends VertexAttachment {
|
|
4522
|
+
var ClippingAttachment = class _ClippingAttachment extends VertexAttachment {
|
|
4683
4523
|
/** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
|
|
4684
4524
|
* the skeleton's rendering. */
|
|
4685
4525
|
endSlot = null;
|
|
@@ -4692,7 +4532,7 @@ var spine = (() => {
|
|
|
4692
4532
|
super(name);
|
|
4693
4533
|
}
|
|
4694
4534
|
copy() {
|
|
4695
|
-
let copy = new
|
|
4535
|
+
let copy = new _ClippingAttachment(this.name);
|
|
4696
4536
|
this.copyTo(copy);
|
|
4697
4537
|
copy.endSlot = this.endSlot;
|
|
4698
4538
|
copy.color.setFromColor(this.color);
|
|
@@ -4768,10 +4608,8 @@ var spine = (() => {
|
|
|
4768
4608
|
page2.magFilter = Utils.enumValue(TextureFilter, entry[2]);
|
|
4769
4609
|
};
|
|
4770
4610
|
pageFields["repeat"] = (page2) => {
|
|
4771
|
-
if (entry[1].indexOf("x") != -1)
|
|
4772
|
-
|
|
4773
|
-
if (entry[1].indexOf("y") != -1)
|
|
4774
|
-
page2.vWrap = 10497 /* Repeat */;
|
|
4611
|
+
if (entry[1].indexOf("x") != -1) page2.uWrap = 10497 /* Repeat */;
|
|
4612
|
+
if (entry[1].indexOf("y") != -1) page2.vWrap = 10497 /* Repeat */;
|
|
4775
4613
|
};
|
|
4776
4614
|
pageFields["pma"] = (page2) => {
|
|
4777
4615
|
page2.pma = entry[1] == "true";
|
|
@@ -4819,45 +4657,37 @@ var spine = (() => {
|
|
|
4819
4657
|
while (line && line.trim().length == 0)
|
|
4820
4658
|
line = reader.readLine();
|
|
4821
4659
|
while (true) {
|
|
4822
|
-
if (!line || line.trim().length == 0)
|
|
4823
|
-
|
|
4824
|
-
if (reader.readEntry(entry, line) == 0)
|
|
4825
|
-
break;
|
|
4660
|
+
if (!line || line.trim().length == 0) break;
|
|
4661
|
+
if (reader.readEntry(entry, line) == 0) break;
|
|
4826
4662
|
line = reader.readLine();
|
|
4827
4663
|
}
|
|
4828
4664
|
let page = null;
|
|
4829
4665
|
let names = null;
|
|
4830
4666
|
let values = null;
|
|
4831
4667
|
while (true) {
|
|
4832
|
-
if (line === null)
|
|
4833
|
-
break;
|
|
4668
|
+
if (line === null) break;
|
|
4834
4669
|
if (line.trim().length == 0) {
|
|
4835
4670
|
page = null;
|
|
4836
4671
|
line = reader.readLine();
|
|
4837
4672
|
} else if (!page) {
|
|
4838
4673
|
page = new TextureAtlasPage(line.trim());
|
|
4839
4674
|
while (true) {
|
|
4840
|
-
if (reader.readEntry(entry, line = reader.readLine()) == 0)
|
|
4841
|
-
break;
|
|
4675
|
+
if (reader.readEntry(entry, line = reader.readLine()) == 0) break;
|
|
4842
4676
|
let field = pageFields[entry[0]];
|
|
4843
|
-
if (field)
|
|
4844
|
-
field(page);
|
|
4677
|
+
if (field) field(page);
|
|
4845
4678
|
}
|
|
4846
4679
|
this.pages.push(page);
|
|
4847
4680
|
} else {
|
|
4848
4681
|
let region = new TextureAtlasRegion(page, line);
|
|
4849
4682
|
while (true) {
|
|
4850
4683
|
let count = reader.readEntry(entry, line = reader.readLine());
|
|
4851
|
-
if (count == 0)
|
|
4852
|
-
break;
|
|
4684
|
+
if (count == 0) break;
|
|
4853
4685
|
let field = regionFields[entry[0]];
|
|
4854
4686
|
if (field)
|
|
4855
4687
|
field(region);
|
|
4856
4688
|
else {
|
|
4857
|
-
if (!names)
|
|
4858
|
-
|
|
4859
|
-
if (!values)
|
|
4860
|
-
values = [];
|
|
4689
|
+
if (!names) names = [];
|
|
4690
|
+
if (!values) values = [];
|
|
4861
4691
|
names.push(entry[0]);
|
|
4862
4692
|
let entryValues = [];
|
|
4863
4693
|
for (let i = 0; i < count; i++)
|
|
@@ -4918,14 +4748,11 @@ var spine = (() => {
|
|
|
4918
4748
|
return this.lines[this.index++];
|
|
4919
4749
|
}
|
|
4920
4750
|
readEntry(entry, line) {
|
|
4921
|
-
if (!line)
|
|
4922
|
-
return 0;
|
|
4751
|
+
if (!line) return 0;
|
|
4923
4752
|
line = line.trim();
|
|
4924
|
-
if (line.length == 0)
|
|
4925
|
-
return 0;
|
|
4753
|
+
if (line.length == 0) return 0;
|
|
4926
4754
|
let colon = line.indexOf(":");
|
|
4927
|
-
if (colon == -1)
|
|
4928
|
-
return 0;
|
|
4755
|
+
if (colon == -1) return 0;
|
|
4929
4756
|
entry[0] = line.substr(0, colon).trim();
|
|
4930
4757
|
for (let i = 1, lastMatch = colon + 1; ; i++) {
|
|
4931
4758
|
let comma = line.indexOf(",", lastMatch);
|
|
@@ -4935,8 +4762,7 @@ var spine = (() => {
|
|
|
4935
4762
|
}
|
|
4936
4763
|
entry[i] = line.substr(lastMatch, comma - lastMatch).trim();
|
|
4937
4764
|
lastMatch = comma + 1;
|
|
4938
|
-
if (i == 4)
|
|
4939
|
-
return 4;
|
|
4765
|
+
if (i == 4) return 4;
|
|
4940
4766
|
}
|
|
4941
4767
|
}
|
|
4942
4768
|
};
|
|
@@ -4984,7 +4810,7 @@ var spine = (() => {
|
|
|
4984
4810
|
};
|
|
4985
4811
|
|
|
4986
4812
|
// spine-core/src/attachments/MeshAttachment.ts
|
|
4987
|
-
var MeshAttachment = class extends VertexAttachment {
|
|
4813
|
+
var MeshAttachment = class _MeshAttachment extends VertexAttachment {
|
|
4988
4814
|
region = null;
|
|
4989
4815
|
/** The name of the texture region for this attachment. */
|
|
4990
4816
|
path;
|
|
@@ -5017,11 +4843,9 @@ var spine = (() => {
|
|
|
5017
4843
|
/** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or
|
|
5018
4844
|
* the {@link #regionUVs} are changed. */
|
|
5019
4845
|
updateRegion() {
|
|
5020
|
-
if (!this.region)
|
|
5021
|
-
throw new Error("Region not set.");
|
|
4846
|
+
if (!this.region) throw new Error("Region not set.");
|
|
5022
4847
|
let regionUVs = this.regionUVs;
|
|
5023
|
-
if (!this.uvs || this.uvs.length != regionUVs.length)
|
|
5024
|
-
this.uvs = Utils.newFloatArray(regionUVs.length);
|
|
4848
|
+
if (!this.uvs || this.uvs.length != regionUVs.length) this.uvs = Utils.newFloatArray(regionUVs.length);
|
|
5025
4849
|
let uvs = this.uvs;
|
|
5026
4850
|
let n = this.uvs.length;
|
|
5027
4851
|
let u = this.region.u, v = this.region.v, width = 0, height = 0;
|
|
@@ -5096,9 +4920,8 @@ var spine = (() => {
|
|
|
5096
4920
|
}
|
|
5097
4921
|
}
|
|
5098
4922
|
copy() {
|
|
5099
|
-
if (this.parentMesh)
|
|
5100
|
-
|
|
5101
|
-
let copy = new MeshAttachment(this.name, this.path);
|
|
4923
|
+
if (this.parentMesh) return this.newLinkedMesh();
|
|
4924
|
+
let copy = new _MeshAttachment(this.name, this.path);
|
|
5102
4925
|
copy.region = this.region;
|
|
5103
4926
|
copy.color.setFromColor(this.color);
|
|
5104
4927
|
this.copyTo(copy);
|
|
@@ -5119,25 +4942,23 @@ var spine = (() => {
|
|
|
5119
4942
|
return copy;
|
|
5120
4943
|
}
|
|
5121
4944
|
computeWorldVertices(slot, start, count, worldVertices2, offset, stride) {
|
|
5122
|
-
if (this.sequence != null)
|
|
5123
|
-
this.sequence.apply(slot, this);
|
|
4945
|
+
if (this.sequence != null) this.sequence.apply(slot, this);
|
|
5124
4946
|
super.computeWorldVertices(slot, start, count, worldVertices2, offset, stride);
|
|
5125
4947
|
}
|
|
5126
4948
|
/** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/
|
|
5127
4949
|
newLinkedMesh() {
|
|
5128
|
-
let copy = new
|
|
4950
|
+
let copy = new _MeshAttachment(this.name, this.path);
|
|
5129
4951
|
copy.region = this.region;
|
|
5130
4952
|
copy.color.setFromColor(this.color);
|
|
5131
4953
|
copy.timelineAttachment = this.timelineAttachment;
|
|
5132
4954
|
copy.setParentMesh(this.parentMesh ? this.parentMesh : this);
|
|
5133
|
-
if (copy.region != null)
|
|
5134
|
-
copy.updateRegion();
|
|
4955
|
+
if (copy.region != null) copy.updateRegion();
|
|
5135
4956
|
return copy;
|
|
5136
4957
|
}
|
|
5137
4958
|
};
|
|
5138
4959
|
|
|
5139
4960
|
// spine-core/src/attachments/PathAttachment.ts
|
|
5140
|
-
var PathAttachment = class extends VertexAttachment {
|
|
4961
|
+
var PathAttachment = class _PathAttachment extends VertexAttachment {
|
|
5141
4962
|
/** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
|
|
5142
4963
|
lengths = [];
|
|
5143
4964
|
/** If true, the start and end knots are connected. */
|
|
@@ -5152,7 +4973,7 @@ var spine = (() => {
|
|
|
5152
4973
|
super(name);
|
|
5153
4974
|
}
|
|
5154
4975
|
copy() {
|
|
5155
|
-
let copy = new
|
|
4976
|
+
let copy = new _PathAttachment(this.name);
|
|
5156
4977
|
this.copyTo(copy);
|
|
5157
4978
|
copy.lengths = new Array(this.lengths.length);
|
|
5158
4979
|
Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
|
|
@@ -5164,7 +4985,7 @@ var spine = (() => {
|
|
|
5164
4985
|
};
|
|
5165
4986
|
|
|
5166
4987
|
// spine-core/src/attachments/PointAttachment.ts
|
|
5167
|
-
var PointAttachment = class extends VertexAttachment {
|
|
4988
|
+
var PointAttachment = class _PointAttachment extends VertexAttachment {
|
|
5168
4989
|
x = 0;
|
|
5169
4990
|
y = 0;
|
|
5170
4991
|
rotation = 0;
|
|
@@ -5186,7 +5007,7 @@ var spine = (() => {
|
|
|
5186
5007
|
return MathUtils.atan2Deg(y, x);
|
|
5187
5008
|
}
|
|
5188
5009
|
copy() {
|
|
5189
|
-
let copy = new
|
|
5010
|
+
let copy = new _PointAttachment(this.name);
|
|
5190
5011
|
copy.x = this.x;
|
|
5191
5012
|
copy.y = this.y;
|
|
5192
5013
|
copy.rotation = this.rotation;
|
|
@@ -5196,7 +5017,7 @@ var spine = (() => {
|
|
|
5196
5017
|
};
|
|
5197
5018
|
|
|
5198
5019
|
// spine-core/src/attachments/RegionAttachment.ts
|
|
5199
|
-
var
|
|
5020
|
+
var RegionAttachment = class _RegionAttachment extends Attachment {
|
|
5200
5021
|
/** The local x translation. */
|
|
5201
5022
|
x = 0;
|
|
5202
5023
|
/** The local y translation. */
|
|
@@ -5229,8 +5050,7 @@ var spine = (() => {
|
|
|
5229
5050
|
}
|
|
5230
5051
|
/** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */
|
|
5231
5052
|
updateRegion() {
|
|
5232
|
-
if (!this.region)
|
|
5233
|
-
throw new Error("Region not set.");
|
|
5053
|
+
if (!this.region) throw new Error("Region not set.");
|
|
5234
5054
|
let region = this.region;
|
|
5235
5055
|
let uvs = this.uvs;
|
|
5236
5056
|
if (region == null) {
|
|
@@ -5343,40 +5163,39 @@ var spine = (() => {
|
|
|
5343
5163
|
copy.sequence = this.sequence != null ? this.sequence.copy() : null;
|
|
5344
5164
|
return copy;
|
|
5345
5165
|
}
|
|
5166
|
+
static X1 = 0;
|
|
5167
|
+
static Y1 = 1;
|
|
5168
|
+
static C1R = 2;
|
|
5169
|
+
static C1G = 3;
|
|
5170
|
+
static C1B = 4;
|
|
5171
|
+
static C1A = 5;
|
|
5172
|
+
static U1 = 6;
|
|
5173
|
+
static V1 = 7;
|
|
5174
|
+
static X2 = 8;
|
|
5175
|
+
static Y2 = 9;
|
|
5176
|
+
static C2R = 10;
|
|
5177
|
+
static C2G = 11;
|
|
5178
|
+
static C2B = 12;
|
|
5179
|
+
static C2A = 13;
|
|
5180
|
+
static U2 = 14;
|
|
5181
|
+
static V2 = 15;
|
|
5182
|
+
static X3 = 16;
|
|
5183
|
+
static Y3 = 17;
|
|
5184
|
+
static C3R = 18;
|
|
5185
|
+
static C3G = 19;
|
|
5186
|
+
static C3B = 20;
|
|
5187
|
+
static C3A = 21;
|
|
5188
|
+
static U3 = 22;
|
|
5189
|
+
static V3 = 23;
|
|
5190
|
+
static X4 = 24;
|
|
5191
|
+
static Y4 = 25;
|
|
5192
|
+
static C4R = 26;
|
|
5193
|
+
static C4G = 27;
|
|
5194
|
+
static C4B = 28;
|
|
5195
|
+
static C4A = 29;
|
|
5196
|
+
static U4 = 30;
|
|
5197
|
+
static V4 = 31;
|
|
5346
5198
|
};
|
|
5347
|
-
var RegionAttachment = _RegionAttachment;
|
|
5348
|
-
__publicField(RegionAttachment, "X1", 0);
|
|
5349
|
-
__publicField(RegionAttachment, "Y1", 1);
|
|
5350
|
-
__publicField(RegionAttachment, "C1R", 2);
|
|
5351
|
-
__publicField(RegionAttachment, "C1G", 3);
|
|
5352
|
-
__publicField(RegionAttachment, "C1B", 4);
|
|
5353
|
-
__publicField(RegionAttachment, "C1A", 5);
|
|
5354
|
-
__publicField(RegionAttachment, "U1", 6);
|
|
5355
|
-
__publicField(RegionAttachment, "V1", 7);
|
|
5356
|
-
__publicField(RegionAttachment, "X2", 8);
|
|
5357
|
-
__publicField(RegionAttachment, "Y2", 9);
|
|
5358
|
-
__publicField(RegionAttachment, "C2R", 10);
|
|
5359
|
-
__publicField(RegionAttachment, "C2G", 11);
|
|
5360
|
-
__publicField(RegionAttachment, "C2B", 12);
|
|
5361
|
-
__publicField(RegionAttachment, "C2A", 13);
|
|
5362
|
-
__publicField(RegionAttachment, "U2", 14);
|
|
5363
|
-
__publicField(RegionAttachment, "V2", 15);
|
|
5364
|
-
__publicField(RegionAttachment, "X3", 16);
|
|
5365
|
-
__publicField(RegionAttachment, "Y3", 17);
|
|
5366
|
-
__publicField(RegionAttachment, "C3R", 18);
|
|
5367
|
-
__publicField(RegionAttachment, "C3G", 19);
|
|
5368
|
-
__publicField(RegionAttachment, "C3B", 20);
|
|
5369
|
-
__publicField(RegionAttachment, "C3A", 21);
|
|
5370
|
-
__publicField(RegionAttachment, "U3", 22);
|
|
5371
|
-
__publicField(RegionAttachment, "V3", 23);
|
|
5372
|
-
__publicField(RegionAttachment, "X4", 24);
|
|
5373
|
-
__publicField(RegionAttachment, "Y4", 25);
|
|
5374
|
-
__publicField(RegionAttachment, "C4R", 26);
|
|
5375
|
-
__publicField(RegionAttachment, "C4G", 27);
|
|
5376
|
-
__publicField(RegionAttachment, "C4B", 28);
|
|
5377
|
-
__publicField(RegionAttachment, "C4A", 29);
|
|
5378
|
-
__publicField(RegionAttachment, "U4", 30);
|
|
5379
|
-
__publicField(RegionAttachment, "V4", 31);
|
|
5380
5199
|
|
|
5381
5200
|
// spine-core/src/AtlasAttachmentLoader.ts
|
|
5382
5201
|
var AtlasAttachmentLoader = class {
|
|
@@ -5389,8 +5208,7 @@ var spine = (() => {
|
|
|
5389
5208
|
for (let i = 0, n = regions.length; i < n; i++) {
|
|
5390
5209
|
let path = sequence.getPath(basePath, i);
|
|
5391
5210
|
let region = this.atlas.findRegion(path);
|
|
5392
|
-
if (region == null)
|
|
5393
|
-
throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
|
|
5211
|
+
if (region == null) throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
|
|
5394
5212
|
regions[i] = region;
|
|
5395
5213
|
}
|
|
5396
5214
|
}
|
|
@@ -5400,8 +5218,7 @@ var spine = (() => {
|
|
|
5400
5218
|
this.loadSequence(name, path, sequence);
|
|
5401
5219
|
} else {
|
|
5402
5220
|
let region = this.atlas.findRegion(path);
|
|
5403
|
-
if (!region)
|
|
5404
|
-
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
|
5221
|
+
if (!region) throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
|
5405
5222
|
attachment.region = region;
|
|
5406
5223
|
}
|
|
5407
5224
|
return attachment;
|
|
@@ -5412,8 +5229,7 @@ var spine = (() => {
|
|
|
5412
5229
|
this.loadSequence(name, path, sequence);
|
|
5413
5230
|
} else {
|
|
5414
5231
|
let region = this.atlas.findRegion(path);
|
|
5415
|
-
if (!region)
|
|
5416
|
-
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
|
5232
|
+
if (!region) throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
|
5417
5233
|
attachment.region = region;
|
|
5418
5234
|
}
|
|
5419
5235
|
return attachment;
|
|
@@ -5457,7 +5273,7 @@ var spine = (() => {
|
|
|
5457
5273
|
/** The local shearX. */
|
|
5458
5274
|
shearY = 0;
|
|
5459
5275
|
/** The transform mode for how parent world transforms affect this bone. */
|
|
5460
|
-
inherit =
|
|
5276
|
+
inherit = 0 /* Normal */;
|
|
5461
5277
|
/** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
|
|
5462
5278
|
* bone.
|
|
5463
5279
|
* @see Skin#bones */
|
|
@@ -5470,10 +5286,8 @@ var spine = (() => {
|
|
|
5470
5286
|
/** False if the bone was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
|
|
5471
5287
|
visible = false;
|
|
5472
5288
|
constructor(index, name, parent) {
|
|
5473
|
-
if (index < 0)
|
|
5474
|
-
|
|
5475
|
-
if (!name)
|
|
5476
|
-
throw new Error("name cannot be null.");
|
|
5289
|
+
if (index < 0) throw new Error("index must be >= 0.");
|
|
5290
|
+
if (!name) throw new Error("name cannot be null.");
|
|
5477
5291
|
this.index = index;
|
|
5478
5292
|
this.name = name;
|
|
5479
5293
|
this.parent = parent;
|
|
@@ -5543,10 +5357,8 @@ var spine = (() => {
|
|
|
5543
5357
|
active = false;
|
|
5544
5358
|
/** @param parent May be null. */
|
|
5545
5359
|
constructor(data, skeleton, parent) {
|
|
5546
|
-
if (!data)
|
|
5547
|
-
|
|
5548
|
-
if (!skeleton)
|
|
5549
|
-
throw new Error("skeleton cannot be null.");
|
|
5360
|
+
if (!data) throw new Error("data cannot be null.");
|
|
5361
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
5550
5362
|
this.data = data;
|
|
5551
5363
|
this.skeleton = skeleton;
|
|
5552
5364
|
this.parent = parent;
|
|
@@ -5655,13 +5467,11 @@ var spine = (() => {
|
|
|
5655
5467
|
let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
5656
5468
|
let zc = (pc * cos + pd * sin) / this.skeleton.scaleY;
|
|
5657
5469
|
let s = Math.sqrt(za * za + zc * zc);
|
|
5658
|
-
if (s > 1e-5)
|
|
5659
|
-
s = 1 / s;
|
|
5470
|
+
if (s > 1e-5) s = 1 / s;
|
|
5660
5471
|
za *= s;
|
|
5661
5472
|
zc *= s;
|
|
5662
5473
|
s = Math.sqrt(za * za + zc * zc);
|
|
5663
|
-
if (this.inherit == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
5664
|
-
s = -s;
|
|
5474
|
+
if (this.inherit == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) s = -s;
|
|
5665
5475
|
rotation = Math.PI / 2 + Math.atan2(zc, za);
|
|
5666
5476
|
const zb = Math.cos(rotation) * s;
|
|
5667
5477
|
const zd = Math.sin(rotation) * s;
|
|
@@ -5744,13 +5554,11 @@ var spine = (() => {
|
|
|
5744
5554
|
pa = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
5745
5555
|
pc = (pc * cos + pd * sin) / this.skeleton.scaleY;
|
|
5746
5556
|
let s = Math.sqrt(pa * pa + pc * pc);
|
|
5747
|
-
if (s > 1e-5)
|
|
5748
|
-
s = 1 / s;
|
|
5557
|
+
if (s > 1e-5) s = 1 / s;
|
|
5749
5558
|
pa *= s;
|
|
5750
5559
|
pc *= s;
|
|
5751
5560
|
s = Math.sqrt(pa * pa + pc * pc);
|
|
5752
|
-
if (this.inherit == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
5753
|
-
s = -s;
|
|
5561
|
+
if (this.inherit == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0)) s = -s;
|
|
5754
5562
|
let r = MathUtils.PI / 2 + Math.atan2(pc, pa);
|
|
5755
5563
|
pb = Math.cos(r) * s;
|
|
5756
5564
|
pd = Math.sin(r) * s;
|
|
@@ -5812,14 +5620,12 @@ var spine = (() => {
|
|
|
5812
5620
|
}
|
|
5813
5621
|
/** Transforms a point from world coordinates to the parent bone's local coordinates. */
|
|
5814
5622
|
worldToParent(world) {
|
|
5815
|
-
if (world == null)
|
|
5816
|
-
throw new Error("world cannot be null.");
|
|
5623
|
+
if (world == null) throw new Error("world cannot be null.");
|
|
5817
5624
|
return this.parent == null ? world : this.parent.worldToLocal(world);
|
|
5818
5625
|
}
|
|
5819
5626
|
/** Transforms a point from the parent bone's coordinates to world coordinates. */
|
|
5820
5627
|
parentToWorld(world) {
|
|
5821
|
-
if (world == null)
|
|
5822
|
-
throw new Error("world cannot be null.");
|
|
5628
|
+
if (world == null) throw new Error("world cannot be null.");
|
|
5823
5629
|
return this.parent == null ? world : this.parent.localToWorld(world);
|
|
5824
5630
|
}
|
|
5825
5631
|
/** Transforms a world rotation to a local rotation. */
|
|
@@ -5863,6 +5669,8 @@ var spine = (() => {
|
|
|
5863
5669
|
textureLoader;
|
|
5864
5670
|
downloader;
|
|
5865
5671
|
assets = {};
|
|
5672
|
+
assetsRefCount = {};
|
|
5673
|
+
assetsLoaded = {};
|
|
5866
5674
|
errors = {};
|
|
5867
5675
|
toLoad = 0;
|
|
5868
5676
|
loaded = 0;
|
|
@@ -5879,24 +5687,21 @@ var spine = (() => {
|
|
|
5879
5687
|
this.toLoad--;
|
|
5880
5688
|
this.loaded++;
|
|
5881
5689
|
this.assets[path] = asset;
|
|
5882
|
-
|
|
5883
|
-
|
|
5690
|
+
this.assetsRefCount[path] = (this.assetsRefCount[path] || 0) + 1;
|
|
5691
|
+
if (callback) callback(path, asset);
|
|
5884
5692
|
}
|
|
5885
5693
|
error(callback, path, message) {
|
|
5886
5694
|
this.toLoad--;
|
|
5887
5695
|
this.loaded++;
|
|
5888
5696
|
this.errors[path] = message;
|
|
5889
|
-
if (callback)
|
|
5890
|
-
callback(path, message);
|
|
5697
|
+
if (callback) callback(path, message);
|
|
5891
5698
|
}
|
|
5892
5699
|
loadAll() {
|
|
5893
5700
|
let promise = new Promise((resolve, reject) => {
|
|
5894
5701
|
let check = () => {
|
|
5895
5702
|
if (this.isLoadingComplete()) {
|
|
5896
|
-
if (this.hasErrors())
|
|
5897
|
-
|
|
5898
|
-
else
|
|
5899
|
-
resolve(this);
|
|
5703
|
+
if (this.hasErrors()) reject(this.errors);
|
|
5704
|
+
else resolve(this);
|
|
5900
5705
|
return;
|
|
5901
5706
|
}
|
|
5902
5707
|
requestAnimationFrame(check);
|
|
@@ -5912,10 +5717,16 @@ var spine = (() => {
|
|
|
5912
5717
|
}, error = () => {
|
|
5913
5718
|
}) {
|
|
5914
5719
|
path = this.start(path);
|
|
5915
|
-
this.
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5720
|
+
if (this.reuseAssets(path, success, error)) return;
|
|
5721
|
+
this.assetsLoaded[path] = new Promise((resolve, reject) => {
|
|
5722
|
+
this.downloader.downloadBinary(path, (data) => {
|
|
5723
|
+
this.success(success, path, data);
|
|
5724
|
+
resolve(data);
|
|
5725
|
+
}, (status, responseText) => {
|
|
5726
|
+
const errorMsg = `Couldn't load binary ${path}: status ${status}, ${responseText}`;
|
|
5727
|
+
this.error(error, path, errorMsg);
|
|
5728
|
+
reject(errorMsg);
|
|
5729
|
+
});
|
|
5919
5730
|
});
|
|
5920
5731
|
}
|
|
5921
5732
|
loadText(path, success = () => {
|
|
@@ -5932,43 +5743,69 @@ var spine = (() => {
|
|
|
5932
5743
|
}, error = () => {
|
|
5933
5744
|
}) {
|
|
5934
5745
|
path = this.start(path);
|
|
5935
|
-
this.
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5746
|
+
if (this.reuseAssets(path, success, error)) return;
|
|
5747
|
+
this.assetsLoaded[path] = new Promise((resolve, reject) => {
|
|
5748
|
+
this.downloader.downloadJson(path, (data) => {
|
|
5749
|
+
this.success(success, path, data);
|
|
5750
|
+
resolve(data);
|
|
5751
|
+
}, (status, responseText) => {
|
|
5752
|
+
const errorMsg = `Couldn't load JSON ${path}: status ${status}, ${responseText}`;
|
|
5753
|
+
this.error(error, path, errorMsg);
|
|
5754
|
+
reject(errorMsg);
|
|
5755
|
+
});
|
|
5939
5756
|
});
|
|
5940
5757
|
}
|
|
5758
|
+
reuseAssets(path, success = () => {
|
|
5759
|
+
}, error = () => {
|
|
5760
|
+
}) {
|
|
5761
|
+
const loadedStatus = this.assetsLoaded[path];
|
|
5762
|
+
const alreadyExistsOrLoading = loadedStatus !== void 0;
|
|
5763
|
+
if (alreadyExistsOrLoading) {
|
|
5764
|
+
loadedStatus.then((data) => this.success(success, path, data)).catch((errorMsg) => this.error(error, path, errorMsg));
|
|
5765
|
+
}
|
|
5766
|
+
return alreadyExistsOrLoading;
|
|
5767
|
+
}
|
|
5941
5768
|
loadTexture(path, success = () => {
|
|
5942
5769
|
}, error = () => {
|
|
5943
5770
|
}) {
|
|
5944
5771
|
path = this.start(path);
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5772
|
+
if (this.reuseAssets(path, success, error)) return;
|
|
5773
|
+
this.assetsLoaded[path] = new Promise((resolve, reject) => {
|
|
5774
|
+
let isBrowser = !!(typeof window !== "undefined" && typeof navigator !== "undefined" && window.document);
|
|
5775
|
+
let isWebWorker = !isBrowser;
|
|
5776
|
+
if (isWebWorker) {
|
|
5777
|
+
fetch(path, { mode: "cors" }).then((response) => {
|
|
5778
|
+
if (response.ok) return response.blob();
|
|
5779
|
+
const errorMsg = `Couldn't load image: ${path}`;
|
|
5780
|
+
this.error(error, path, `Couldn't load image: ${path}`);
|
|
5781
|
+
reject(errorMsg);
|
|
5782
|
+
}).then((blob) => {
|
|
5783
|
+
return blob ? createImageBitmap(blob, { premultiplyAlpha: "none", colorSpaceConversion: "none" }) : null;
|
|
5784
|
+
}).then((bitmap) => {
|
|
5785
|
+
if (bitmap) {
|
|
5786
|
+
const texture = this.textureLoader(bitmap);
|
|
5787
|
+
this.success(success, path, texture);
|
|
5788
|
+
resolve(texture);
|
|
5789
|
+
}
|
|
5790
|
+
;
|
|
5791
|
+
});
|
|
5792
|
+
} else {
|
|
5793
|
+
let image = new Image();
|
|
5794
|
+
image.crossOrigin = "anonymous";
|
|
5795
|
+
image.onload = () => {
|
|
5796
|
+
const texture = this.textureLoader(image);
|
|
5797
|
+
this.success(success, path, texture);
|
|
5798
|
+
resolve(texture);
|
|
5799
|
+
};
|
|
5800
|
+
image.onerror = () => {
|
|
5801
|
+
const errorMsg = `Couldn't load image: ${path}`;
|
|
5802
|
+
this.error(error, path, errorMsg);
|
|
5803
|
+
reject(errorMsg);
|
|
5804
|
+
};
|
|
5805
|
+
if (this.downloader.rawDataUris[path]) path = this.downloader.rawDataUris[path];
|
|
5806
|
+
image.src = path;
|
|
5807
|
+
}
|
|
5808
|
+
});
|
|
5972
5809
|
}
|
|
5973
5810
|
loadTextureAtlas(path, success = () => {
|
|
5974
5811
|
}, error = () => {
|
|
@@ -5976,32 +5813,113 @@ var spine = (() => {
|
|
|
5976
5813
|
let index = path.lastIndexOf("/");
|
|
5977
5814
|
let parent = index >= 0 ? path.substring(0, index + 1) : "";
|
|
5978
5815
|
path = this.start(path);
|
|
5979
|
-
this.
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
(
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
if (
|
|
5990
|
-
|
|
5816
|
+
if (this.reuseAssets(path, success, error)) return;
|
|
5817
|
+
this.assetsLoaded[path] = new Promise((resolve, reject) => {
|
|
5818
|
+
this.downloader.downloadText(path, (atlasText) => {
|
|
5819
|
+
try {
|
|
5820
|
+
let atlas = new TextureAtlas(atlasText);
|
|
5821
|
+
let toLoad = atlas.pages.length, abort = false;
|
|
5822
|
+
for (let page of atlas.pages) {
|
|
5823
|
+
this.loadTexture(
|
|
5824
|
+
!fileAlias ? parent + page.name : fileAlias[page.name],
|
|
5825
|
+
(imagePath, texture) => {
|
|
5826
|
+
if (!abort) {
|
|
5827
|
+
page.setTexture(texture);
|
|
5828
|
+
if (--toLoad == 0) {
|
|
5829
|
+
this.success(success, path, atlas);
|
|
5830
|
+
resolve(atlas);
|
|
5831
|
+
}
|
|
5832
|
+
}
|
|
5833
|
+
},
|
|
5834
|
+
(imagePath, message) => {
|
|
5835
|
+
if (!abort) {
|
|
5836
|
+
const errorMsg = `Couldn't load texture atlas ${path} page image: ${imagePath}`;
|
|
5837
|
+
this.error(error, path, errorMsg);
|
|
5838
|
+
reject(errorMsg);
|
|
5839
|
+
}
|
|
5840
|
+
abort = true;
|
|
5991
5841
|
}
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
);
|
|
5842
|
+
);
|
|
5843
|
+
}
|
|
5844
|
+
} catch (e) {
|
|
5845
|
+
const errorMsg = `Couldn't parse texture atlas ${path}: ${e.message}`;
|
|
5846
|
+
this.error(error, path, errorMsg);
|
|
5847
|
+
reject(errorMsg);
|
|
5999
5848
|
}
|
|
6000
|
-
}
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
5849
|
+
}, (status, responseText) => {
|
|
5850
|
+
const errorMsg = `Couldn't load texture atlas ${path}: status ${status}, ${responseText}`;
|
|
5851
|
+
this.error(error, path, errorMsg);
|
|
5852
|
+
reject(errorMsg);
|
|
5853
|
+
});
|
|
5854
|
+
});
|
|
5855
|
+
}
|
|
5856
|
+
loadTextureAtlasButNoTextures(path, success = () => {
|
|
5857
|
+
}, error = () => {
|
|
5858
|
+
}, fileAlias) {
|
|
5859
|
+
path = this.start(path);
|
|
5860
|
+
if (this.reuseAssets(path, success, error)) return;
|
|
5861
|
+
this.assetsLoaded[path] = new Promise((resolve, reject) => {
|
|
5862
|
+
this.downloader.downloadText(path, (atlasText) => {
|
|
5863
|
+
try {
|
|
5864
|
+
const atlas = new TextureAtlas(atlasText);
|
|
5865
|
+
this.success(success, path, atlas);
|
|
5866
|
+
resolve(atlas);
|
|
5867
|
+
} catch (e) {
|
|
5868
|
+
const errorMsg = `Couldn't parse texture atlas ${path}: ${e.message}`;
|
|
5869
|
+
this.error(error, path, errorMsg);
|
|
5870
|
+
reject(errorMsg);
|
|
5871
|
+
}
|
|
5872
|
+
}, (status, responseText) => {
|
|
5873
|
+
const errorMsg = `Couldn't load texture atlas ${path}: status ${status}, ${responseText}`;
|
|
5874
|
+
this.error(error, path, errorMsg);
|
|
5875
|
+
reject(errorMsg);
|
|
5876
|
+
});
|
|
5877
|
+
});
|
|
5878
|
+
}
|
|
5879
|
+
// Promisified versions of load function
|
|
5880
|
+
async loadBinaryAsync(path) {
|
|
5881
|
+
return new Promise((resolve, reject) => {
|
|
5882
|
+
this.loadBinary(
|
|
5883
|
+
path,
|
|
5884
|
+
(_, binary) => resolve(binary),
|
|
5885
|
+
(_, message) => reject(message)
|
|
5886
|
+
);
|
|
5887
|
+
});
|
|
5888
|
+
}
|
|
5889
|
+
async loadJsonAsync(path) {
|
|
5890
|
+
return new Promise((resolve, reject) => {
|
|
5891
|
+
this.loadJson(
|
|
5892
|
+
path,
|
|
5893
|
+
(_, object) => resolve(object),
|
|
5894
|
+
(_, message) => reject(message)
|
|
5895
|
+
);
|
|
5896
|
+
});
|
|
5897
|
+
}
|
|
5898
|
+
async loadTextureAsync(path) {
|
|
5899
|
+
return new Promise((resolve, reject) => {
|
|
5900
|
+
this.loadTexture(
|
|
5901
|
+
path,
|
|
5902
|
+
(_, texture) => resolve(texture),
|
|
5903
|
+
(_, message) => reject(message)
|
|
5904
|
+
);
|
|
5905
|
+
});
|
|
5906
|
+
}
|
|
5907
|
+
async loadTextureAtlasAsync(path) {
|
|
5908
|
+
return new Promise((resolve, reject) => {
|
|
5909
|
+
this.loadTextureAtlas(
|
|
5910
|
+
path,
|
|
5911
|
+
(_, atlas) => resolve(atlas),
|
|
5912
|
+
(_, message) => reject(message)
|
|
5913
|
+
);
|
|
5914
|
+
});
|
|
5915
|
+
}
|
|
5916
|
+
async loadTextureAtlasButNoTexturesAsync(path) {
|
|
5917
|
+
return new Promise((resolve, reject) => {
|
|
5918
|
+
this.loadTextureAtlasButNoTextures(
|
|
5919
|
+
path,
|
|
5920
|
+
(_, atlas) => resolve(atlas),
|
|
5921
|
+
(_, message) => reject(message)
|
|
5922
|
+
);
|
|
6005
5923
|
});
|
|
6006
5924
|
}
|
|
6007
5925
|
get(path) {
|
|
@@ -6010,26 +5928,27 @@ var spine = (() => {
|
|
|
6010
5928
|
require(path) {
|
|
6011
5929
|
path = this.pathPrefix + path;
|
|
6012
5930
|
let asset = this.assets[path];
|
|
6013
|
-
if (asset)
|
|
6014
|
-
return asset;
|
|
5931
|
+
if (asset) return asset;
|
|
6015
5932
|
let error = this.errors[path];
|
|
6016
5933
|
throw Error("Asset not found: " + path + (error ? "\n" + error : ""));
|
|
6017
5934
|
}
|
|
6018
5935
|
remove(path) {
|
|
6019
5936
|
path = this.pathPrefix + path;
|
|
6020
5937
|
let asset = this.assets[path];
|
|
6021
|
-
if (asset.dispose)
|
|
6022
|
-
asset.dispose();
|
|
5938
|
+
if (asset.dispose) asset.dispose();
|
|
6023
5939
|
delete this.assets[path];
|
|
5940
|
+
delete this.assetsRefCount[path];
|
|
5941
|
+
delete this.assetsLoaded[path];
|
|
6024
5942
|
return asset;
|
|
6025
5943
|
}
|
|
6026
5944
|
removeAll() {
|
|
6027
|
-
for (let
|
|
6028
|
-
let asset = this.assets[
|
|
6029
|
-
if (asset.dispose)
|
|
6030
|
-
asset.dispose();
|
|
5945
|
+
for (let path in this.assets) {
|
|
5946
|
+
let asset = this.assets[path];
|
|
5947
|
+
if (asset.dispose) asset.dispose();
|
|
6031
5948
|
}
|
|
6032
5949
|
this.assets = {};
|
|
5950
|
+
this.assetsLoaded = {};
|
|
5951
|
+
this.assetsRefCount = {};
|
|
6033
5952
|
}
|
|
6034
5953
|
isLoadingComplete() {
|
|
6035
5954
|
return this.toLoad == 0;
|
|
@@ -6043,6 +5962,12 @@ var spine = (() => {
|
|
|
6043
5962
|
dispose() {
|
|
6044
5963
|
this.removeAll();
|
|
6045
5964
|
}
|
|
5965
|
+
// dispose asset only if it's not used by others
|
|
5966
|
+
disposeAsset(path) {
|
|
5967
|
+
if (--this.assetsRefCount[path] === 0) {
|
|
5968
|
+
this.remove(path);
|
|
5969
|
+
}
|
|
5970
|
+
}
|
|
6046
5971
|
hasErrors() {
|
|
6047
5972
|
return Object.keys(this.errors).length > 0;
|
|
6048
5973
|
}
|
|
@@ -6079,18 +6004,16 @@ var spine = (() => {
|
|
|
6079
6004
|
throw new Error("Not a data URI.");
|
|
6080
6005
|
}
|
|
6081
6006
|
let base64Idx = dataUri.indexOf("base64,");
|
|
6082
|
-
if (base64Idx == -1)
|
|
6083
|
-
throw new Error("Not a binary data URI.");
|
|
6007
|
+
if (base64Idx == -1) throw new Error("Not a binary data URI.");
|
|
6084
6008
|
base64Idx += "base64,".length;
|
|
6085
6009
|
return this.base64ToUint8Array(dataUri.substr(base64Idx));
|
|
6086
6010
|
}
|
|
6087
6011
|
downloadText(url, success, error) {
|
|
6088
|
-
if (this.start(url, success, error))
|
|
6089
|
-
|
|
6090
|
-
if (
|
|
6012
|
+
if (this.start(url, success, error)) return;
|
|
6013
|
+
const rawDataUri = this.rawDataUris[url];
|
|
6014
|
+
if (rawDataUri && !rawDataUri.includes(".")) {
|
|
6091
6015
|
try {
|
|
6092
|
-
|
|
6093
|
-
this.finish(url, 200, this.dataUriToString(dataUri));
|
|
6016
|
+
this.finish(url, 200, this.dataUriToString(rawDataUri));
|
|
6094
6017
|
} catch (e) {
|
|
6095
6018
|
this.finish(url, 400, JSON.stringify(e));
|
|
6096
6019
|
}
|
|
@@ -6098,7 +6021,7 @@ var spine = (() => {
|
|
|
6098
6021
|
}
|
|
6099
6022
|
let request = new XMLHttpRequest();
|
|
6100
6023
|
request.overrideMimeType("text/html");
|
|
6101
|
-
request.open("GET", url, true);
|
|
6024
|
+
request.open("GET", rawDataUri ? rawDataUri : url, true);
|
|
6102
6025
|
let done = () => {
|
|
6103
6026
|
this.finish(url, request.status, request.responseText);
|
|
6104
6027
|
};
|
|
@@ -6112,19 +6035,18 @@ var spine = (() => {
|
|
|
6112
6035
|
}, error);
|
|
6113
6036
|
}
|
|
6114
6037
|
downloadBinary(url, success, error) {
|
|
6115
|
-
if (this.start(url, success, error))
|
|
6116
|
-
|
|
6117
|
-
if (
|
|
6038
|
+
if (this.start(url, success, error)) return;
|
|
6039
|
+
const rawDataUri = this.rawDataUris[url];
|
|
6040
|
+
if (rawDataUri && !rawDataUri.includes(".")) {
|
|
6118
6041
|
try {
|
|
6119
|
-
|
|
6120
|
-
this.finish(url, 200, this.dataUriToUint8Array(dataUri));
|
|
6042
|
+
this.finish(url, 200, this.dataUriToUint8Array(rawDataUri));
|
|
6121
6043
|
} catch (e) {
|
|
6122
6044
|
this.finish(url, 400, JSON.stringify(e));
|
|
6123
6045
|
}
|
|
6124
6046
|
return;
|
|
6125
6047
|
}
|
|
6126
6048
|
let request = new XMLHttpRequest();
|
|
6127
|
-
request.open("GET", url, true);
|
|
6049
|
+
request.open("GET", rawDataUri ? rawDataUri : url, true);
|
|
6128
6050
|
request.responseType = "arraybuffer";
|
|
6129
6051
|
let onerror = () => {
|
|
6130
6052
|
this.finish(url, request.status, request.response);
|
|
@@ -6141,8 +6063,7 @@ var spine = (() => {
|
|
|
6141
6063
|
start(url, success, error) {
|
|
6142
6064
|
let callbacks = this.callbacks[url];
|
|
6143
6065
|
try {
|
|
6144
|
-
if (callbacks)
|
|
6145
|
-
return true;
|
|
6066
|
+
if (callbacks) return true;
|
|
6146
6067
|
this.callbacks[url] = callbacks = [];
|
|
6147
6068
|
} finally {
|
|
6148
6069
|
callbacks.push(success, error);
|
|
@@ -6167,8 +6088,7 @@ var spine = (() => {
|
|
|
6167
6088
|
volume = 0;
|
|
6168
6089
|
balance = 0;
|
|
6169
6090
|
constructor(time, data) {
|
|
6170
|
-
if (!data)
|
|
6171
|
-
throw new Error("data cannot be null.");
|
|
6091
|
+
if (!data) throw new Error("data cannot be null.");
|
|
6172
6092
|
this.time = time;
|
|
6173
6093
|
this.data = data;
|
|
6174
6094
|
}
|
|
@@ -6209,21 +6129,17 @@ var spine = (() => {
|
|
|
6209
6129
|
softness = 0;
|
|
6210
6130
|
active = false;
|
|
6211
6131
|
constructor(data, skeleton) {
|
|
6212
|
-
if (!data)
|
|
6213
|
-
|
|
6214
|
-
if (!skeleton)
|
|
6215
|
-
throw new Error("skeleton cannot be null.");
|
|
6132
|
+
if (!data) throw new Error("data cannot be null.");
|
|
6133
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
6216
6134
|
this.data = data;
|
|
6217
6135
|
this.bones = new Array();
|
|
6218
6136
|
for (let i = 0; i < data.bones.length; i++) {
|
|
6219
6137
|
let bone = skeleton.findBone(data.bones[i].name);
|
|
6220
|
-
if (!bone)
|
|
6221
|
-
throw new Error(`Couldn't find bone ${data.bones[i].name}`);
|
|
6138
|
+
if (!bone) throw new Error(`Couldn't find bone ${data.bones[i].name}`);
|
|
6222
6139
|
this.bones.push(bone);
|
|
6223
6140
|
}
|
|
6224
6141
|
let target = skeleton.findBone(data.target.name);
|
|
6225
|
-
if (!target)
|
|
6226
|
-
throw new Error(`Couldn't find bone ${data.target.name}`);
|
|
6142
|
+
if (!target) throw new Error(`Couldn't find bone ${data.target.name}`);
|
|
6227
6143
|
this.target = target;
|
|
6228
6144
|
this.mix = data.mix;
|
|
6229
6145
|
this.softness = data.softness;
|
|
@@ -6243,8 +6159,7 @@ var spine = (() => {
|
|
|
6243
6159
|
this.stretch = data.stretch;
|
|
6244
6160
|
}
|
|
6245
6161
|
update(physics) {
|
|
6246
|
-
if (this.mix == 0)
|
|
6247
|
-
return;
|
|
6162
|
+
if (this.mix == 0) return;
|
|
6248
6163
|
let target = this.target;
|
|
6249
6164
|
let bones = this.bones;
|
|
6250
6165
|
switch (bones.length) {
|
|
@@ -6259,8 +6174,7 @@ var spine = (() => {
|
|
|
6259
6174
|
/** Applies 1 bone IK. The target is specified in the world coordinate system. */
|
|
6260
6175
|
apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
|
|
6261
6176
|
let p = bone.parent;
|
|
6262
|
-
if (!p)
|
|
6263
|
-
throw new Error("IK bone must have parent.");
|
|
6177
|
+
if (!p) throw new Error("IK bone must have parent.");
|
|
6264
6178
|
let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
|
|
6265
6179
|
let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
|
|
6266
6180
|
switch (bone.inherit) {
|
|
@@ -6275,6 +6189,7 @@ var spine = (() => {
|
|
|
6275
6189
|
pb = -sc * s * bone.skeleton.scaleX;
|
|
6276
6190
|
pd = sa * s * bone.skeleton.scaleY;
|
|
6277
6191
|
rotationIK += Math.atan2(sc, sa) * MathUtils.radDeg;
|
|
6192
|
+
// Fall through
|
|
6278
6193
|
default:
|
|
6279
6194
|
let x = targetX - p.worldX, y = targetY - p.worldY;
|
|
6280
6195
|
let d = pa * pd - pb * pc;
|
|
@@ -6287,8 +6202,7 @@ var spine = (() => {
|
|
|
6287
6202
|
}
|
|
6288
6203
|
}
|
|
6289
6204
|
rotationIK += Math.atan2(ty, tx) * MathUtils.radDeg;
|
|
6290
|
-
if (bone.ascaleX < 0)
|
|
6291
|
-
rotationIK += 180;
|
|
6205
|
+
if (bone.ascaleX < 0) rotationIK += 180;
|
|
6292
6206
|
if (rotationIK > 180)
|
|
6293
6207
|
rotationIK -= 360;
|
|
6294
6208
|
else if (rotationIK < -180)
|
|
@@ -6307,8 +6221,7 @@ var spine = (() => {
|
|
|
6307
6221
|
if (compress && dd < b * b || stretch && dd > b * b) {
|
|
6308
6222
|
const s = (Math.sqrt(dd) / b - 1) * alpha + 1;
|
|
6309
6223
|
sx *= s;
|
|
6310
|
-
if (uniform)
|
|
6311
|
-
sy *= s;
|
|
6224
|
+
if (uniform) sy *= s;
|
|
6312
6225
|
}
|
|
6313
6226
|
}
|
|
6314
6227
|
}
|
|
@@ -6325,8 +6238,7 @@ var spine = (() => {
|
|
|
6325
6238
|
/** Applies 2 bone IK. The target is specified in the world coordinate system.
|
|
6326
6239
|
* @param child A direct descendant of the parent bone. */
|
|
6327
6240
|
apply2(parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
|
|
6328
|
-
if (parent.inherit != 0 /* Normal */ || child.inherit != 0 /* Normal */)
|
|
6329
|
-
return;
|
|
6241
|
+
if (parent.inherit != 0 /* Normal */ || child.inherit != 0 /* Normal */) return;
|
|
6330
6242
|
let px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
|
|
6331
6243
|
let os1 = 0, os2 = 0, s2 = 0;
|
|
6332
6244
|
if (psx < 0) {
|
|
@@ -6358,8 +6270,7 @@ var spine = (() => {
|
|
|
6358
6270
|
cwy = c * cx + d * cy + parent.worldY;
|
|
6359
6271
|
}
|
|
6360
6272
|
let pp = parent.parent;
|
|
6361
|
-
if (!pp)
|
|
6362
|
-
throw new Error("IK parent must itself have a parent.");
|
|
6273
|
+
if (!pp) throw new Error("IK parent must itself have a parent.");
|
|
6363
6274
|
a = pp.a;
|
|
6364
6275
|
b = pp.b;
|
|
6365
6276
|
c = pp.c;
|
|
@@ -6401,8 +6312,7 @@ var spine = (() => {
|
|
|
6401
6312
|
if (stretch) {
|
|
6402
6313
|
a = (Math.sqrt(dd) / (l1 + l2) - 1) * alpha + 1;
|
|
6403
6314
|
sx *= a;
|
|
6404
|
-
if (uniform)
|
|
6405
|
-
sy *= a;
|
|
6315
|
+
if (uniform) sy *= a;
|
|
6406
6316
|
}
|
|
6407
6317
|
} else
|
|
6408
6318
|
a2 = Math.acos(cos) * bendDir;
|
|
@@ -6418,8 +6328,7 @@ var spine = (() => {
|
|
|
6418
6328
|
d = c1 * c1 - 4 * c2 * c;
|
|
6419
6329
|
if (d >= 0) {
|
|
6420
6330
|
let q = Math.sqrt(d);
|
|
6421
|
-
if (c1 < 0)
|
|
6422
|
-
q = -q;
|
|
6331
|
+
if (c1 < 0) q = -q;
|
|
6423
6332
|
q = -(c1 + q) * 0.5;
|
|
6424
6333
|
let r0 = q / c2, r1 = c / q;
|
|
6425
6334
|
let r = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
|
|
@@ -6488,10 +6397,8 @@ var spine = (() => {
|
|
|
6488
6397
|
this._target = boneData;
|
|
6489
6398
|
}
|
|
6490
6399
|
get target() {
|
|
6491
|
-
if (!this._target)
|
|
6492
|
-
|
|
6493
|
-
else
|
|
6494
|
-
return this._target;
|
|
6400
|
+
if (!this._target) throw new Error("BoneData not set.");
|
|
6401
|
+
else return this._target;
|
|
6495
6402
|
}
|
|
6496
6403
|
/** Controls the bend direction of the IK bones, either 1 or -1. */
|
|
6497
6404
|
bendDirection = 0;
|
|
@@ -6522,17 +6429,15 @@ var spine = (() => {
|
|
|
6522
6429
|
this._target = slotData;
|
|
6523
6430
|
}
|
|
6524
6431
|
get target() {
|
|
6525
|
-
if (!this._target)
|
|
6526
|
-
|
|
6527
|
-
else
|
|
6528
|
-
return this._target;
|
|
6432
|
+
if (!this._target) throw new Error("SlotData not set.");
|
|
6433
|
+
else return this._target;
|
|
6529
6434
|
}
|
|
6530
6435
|
/** The mode for positioning the first bone on the path. */
|
|
6531
|
-
positionMode =
|
|
6436
|
+
positionMode = 0 /* Fixed */;
|
|
6532
6437
|
/** The mode for positioning the bones after the first bone on the path. */
|
|
6533
|
-
spacingMode =
|
|
6438
|
+
spacingMode = 1 /* Fixed */;
|
|
6534
6439
|
/** The mode for adjusting the rotation of the bones. */
|
|
6535
|
-
rotateMode =
|
|
6440
|
+
rotateMode = 1 /* Chain */;
|
|
6536
6441
|
/** An offset added to the constrained bone rotation. */
|
|
6537
6442
|
offsetRotation = 0;
|
|
6538
6443
|
/** The position along the path. */
|
|
@@ -6566,7 +6471,11 @@ var spine = (() => {
|
|
|
6566
6471
|
})(RotateMode || {});
|
|
6567
6472
|
|
|
6568
6473
|
// spine-core/src/PathConstraint.ts
|
|
6569
|
-
var
|
|
6474
|
+
var PathConstraint = class _PathConstraint {
|
|
6475
|
+
static NONE = -1;
|
|
6476
|
+
static BEFORE = -2;
|
|
6477
|
+
static AFTER = -3;
|
|
6478
|
+
static epsilon = 1e-5;
|
|
6570
6479
|
/** The path constraint's setup pose data. */
|
|
6571
6480
|
data;
|
|
6572
6481
|
/** The bones that will be modified by this path constraint. */
|
|
@@ -6588,21 +6497,17 @@ var spine = (() => {
|
|
|
6588
6497
|
segments = new Array();
|
|
6589
6498
|
active = false;
|
|
6590
6499
|
constructor(data, skeleton) {
|
|
6591
|
-
if (!data)
|
|
6592
|
-
|
|
6593
|
-
if (!skeleton)
|
|
6594
|
-
throw new Error("skeleton cannot be null.");
|
|
6500
|
+
if (!data) throw new Error("data cannot be null.");
|
|
6501
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
6595
6502
|
this.data = data;
|
|
6596
6503
|
this.bones = new Array();
|
|
6597
6504
|
for (let i = 0, n = data.bones.length; i < n; i++) {
|
|
6598
6505
|
let bone = skeleton.findBone(data.bones[i].name);
|
|
6599
|
-
if (!bone)
|
|
6600
|
-
throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
6506
|
+
if (!bone) throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
6601
6507
|
this.bones.push(bone);
|
|
6602
6508
|
}
|
|
6603
6509
|
let target = skeleton.findSlot(data.target.name);
|
|
6604
|
-
if (!target)
|
|
6605
|
-
throw new Error(`Couldn't find target bone ${data.target.name}`);
|
|
6510
|
+
if (!target) throw new Error(`Couldn't find target bone ${data.target.name}`);
|
|
6606
6511
|
this.target = target;
|
|
6607
6512
|
this.position = data.position;
|
|
6608
6513
|
this.spacing = data.spacing;
|
|
@@ -6623,11 +6528,9 @@ var spine = (() => {
|
|
|
6623
6528
|
}
|
|
6624
6529
|
update(physics) {
|
|
6625
6530
|
let attachment = this.target.getAttachment();
|
|
6626
|
-
if (!(attachment instanceof PathAttachment))
|
|
6627
|
-
return;
|
|
6531
|
+
if (!(attachment instanceof PathAttachment)) return;
|
|
6628
6532
|
let mixRotate = this.mixRotate, mixX = this.mixX, mixY = this.mixY;
|
|
6629
|
-
if (mixRotate == 0 && mixX == 0 && mixY == 0)
|
|
6630
|
-
return;
|
|
6533
|
+
if (mixRotate == 0 && mixX == 0 && mixY == 0) return;
|
|
6631
6534
|
let data = this.data;
|
|
6632
6535
|
let tangents = data.rotateMode == 0 /* Tangent */, scale = data.rotateMode == 2 /* ChainScale */;
|
|
6633
6536
|
let bones = this.bones;
|
|
@@ -6652,14 +6555,12 @@ var spine = (() => {
|
|
|
6652
6555
|
let bone = bones[i];
|
|
6653
6556
|
let setupLength = bone.data.length;
|
|
6654
6557
|
if (setupLength < _PathConstraint.epsilon) {
|
|
6655
|
-
if (scale)
|
|
6656
|
-
lengths[i] = 0;
|
|
6558
|
+
if (scale) lengths[i] = 0;
|
|
6657
6559
|
spaces[++i] = spacing;
|
|
6658
6560
|
} else {
|
|
6659
6561
|
let x = setupLength * bone.a, y = setupLength * bone.c;
|
|
6660
6562
|
let length = Math.sqrt(x * x + y * y);
|
|
6661
|
-
if (scale)
|
|
6662
|
-
lengths[i] = length;
|
|
6563
|
+
if (scale) lengths[i] = length;
|
|
6663
6564
|
spaces[++i] = length;
|
|
6664
6565
|
sum += length;
|
|
6665
6566
|
}
|
|
@@ -6676,14 +6577,12 @@ var spine = (() => {
|
|
|
6676
6577
|
let bone = bones[i];
|
|
6677
6578
|
let setupLength = bone.data.length;
|
|
6678
6579
|
if (setupLength < _PathConstraint.epsilon) {
|
|
6679
|
-
if (scale)
|
|
6680
|
-
lengths[i] = 0;
|
|
6580
|
+
if (scale) lengths[i] = 0;
|
|
6681
6581
|
spaces[++i] = spacing;
|
|
6682
6582
|
} else {
|
|
6683
6583
|
let x = setupLength * bone.a, y = setupLength * bone.c;
|
|
6684
6584
|
let length = Math.sqrt(x * x + y * y);
|
|
6685
|
-
if (scale)
|
|
6686
|
-
lengths[i] = length;
|
|
6585
|
+
if (scale) lengths[i] = length;
|
|
6687
6586
|
spaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length / setupLength;
|
|
6688
6587
|
}
|
|
6689
6588
|
}
|
|
@@ -6756,8 +6655,7 @@ var spine = (() => {
|
|
|
6756
6655
|
let lengths = path.lengths;
|
|
6757
6656
|
curveCount -= closed2 ? 1 : 2;
|
|
6758
6657
|
let pathLength2 = lengths[curveCount];
|
|
6759
|
-
if (this.data.positionMode == 1 /* Percent */)
|
|
6760
|
-
position *= pathLength2;
|
|
6658
|
+
if (this.data.positionMode == 1 /* Percent */) position *= pathLength2;
|
|
6761
6659
|
let multiplier2;
|
|
6762
6660
|
switch (this.data.spacingMode) {
|
|
6763
6661
|
case 2 /* Percent */:
|
|
@@ -6776,8 +6674,7 @@ var spine = (() => {
|
|
|
6776
6674
|
let p = position;
|
|
6777
6675
|
if (closed2) {
|
|
6778
6676
|
p %= pathLength2;
|
|
6779
|
-
if (p < 0)
|
|
6780
|
-
p += pathLength2;
|
|
6677
|
+
if (p < 0) p += pathLength2;
|
|
6781
6678
|
curve = 0;
|
|
6782
6679
|
} else if (p < 0) {
|
|
6783
6680
|
if (prevCurve != _PathConstraint.BEFORE) {
|
|
@@ -6796,8 +6693,7 @@ var spine = (() => {
|
|
|
6796
6693
|
}
|
|
6797
6694
|
for (; ; curve++) {
|
|
6798
6695
|
let length = lengths[curve];
|
|
6799
|
-
if (p > length)
|
|
6800
|
-
continue;
|
|
6696
|
+
if (p > length) continue;
|
|
6801
6697
|
if (curve == 0)
|
|
6802
6698
|
p /= length;
|
|
6803
6699
|
else {
|
|
@@ -6879,8 +6775,7 @@ var spine = (() => {
|
|
|
6879
6775
|
x1 = x2;
|
|
6880
6776
|
y1 = y2;
|
|
6881
6777
|
}
|
|
6882
|
-
if (this.data.positionMode == 1 /* Percent */)
|
|
6883
|
-
position *= pathLength;
|
|
6778
|
+
if (this.data.positionMode == 1 /* Percent */) position *= pathLength;
|
|
6884
6779
|
let multiplier;
|
|
6885
6780
|
switch (this.data.spacingMode) {
|
|
6886
6781
|
case 2 /* Percent */:
|
|
@@ -6900,8 +6795,7 @@ var spine = (() => {
|
|
|
6900
6795
|
let p = position;
|
|
6901
6796
|
if (closed2) {
|
|
6902
6797
|
p %= pathLength;
|
|
6903
|
-
if (p < 0)
|
|
6904
|
-
p += pathLength;
|
|
6798
|
+
if (p < 0) p += pathLength;
|
|
6905
6799
|
curve = 0;
|
|
6906
6800
|
} else if (p < 0) {
|
|
6907
6801
|
this.addBeforePosition(p, world, 0, out, o);
|
|
@@ -6912,8 +6806,7 @@ var spine = (() => {
|
|
|
6912
6806
|
}
|
|
6913
6807
|
for (; ; curve++) {
|
|
6914
6808
|
let length = curves[curve];
|
|
6915
|
-
if (p > length)
|
|
6916
|
-
continue;
|
|
6809
|
+
if (p > length) continue;
|
|
6917
6810
|
if (curve == 0)
|
|
6918
6811
|
p /= length;
|
|
6919
6812
|
else {
|
|
@@ -6964,8 +6857,7 @@ var spine = (() => {
|
|
|
6964
6857
|
p *= curveLength;
|
|
6965
6858
|
for (; ; segment++) {
|
|
6966
6859
|
let length = segments[segment];
|
|
6967
|
-
if (p > length)
|
|
6968
|
-
continue;
|
|
6860
|
+
if (p > length) continue;
|
|
6969
6861
|
if (segment == 0)
|
|
6970
6862
|
p /= length;
|
|
6971
6863
|
else {
|
|
@@ -7010,11 +6902,6 @@ var spine = (() => {
|
|
|
7010
6902
|
}
|
|
7011
6903
|
}
|
|
7012
6904
|
};
|
|
7013
|
-
var PathConstraint = _PathConstraint;
|
|
7014
|
-
__publicField(PathConstraint, "NONE", -1);
|
|
7015
|
-
__publicField(PathConstraint, "BEFORE", -2);
|
|
7016
|
-
__publicField(PathConstraint, "AFTER", -3);
|
|
7017
|
-
__publicField(PathConstraint, "epsilon", 1e-5);
|
|
7018
6905
|
|
|
7019
6906
|
// spine-core/src/PhysicsConstraint.ts
|
|
7020
6907
|
var PhysicsConstraint = class {
|
|
@@ -7025,10 +6912,8 @@ var spine = (() => {
|
|
|
7025
6912
|
this._bone = bone;
|
|
7026
6913
|
}
|
|
7027
6914
|
get bone() {
|
|
7028
|
-
if (!this._bone)
|
|
7029
|
-
|
|
7030
|
-
else
|
|
7031
|
-
return this._bone;
|
|
6915
|
+
if (!this._bone) throw new Error("Bone not set.");
|
|
6916
|
+
else return this._bone;
|
|
7032
6917
|
}
|
|
7033
6918
|
inertia = 0;
|
|
7034
6919
|
strength = 0;
|
|
@@ -7097,8 +6982,7 @@ var spine = (() => {
|
|
|
7097
6982
|
/** Applies the constraint to the constrained bones. */
|
|
7098
6983
|
update(physics) {
|
|
7099
6984
|
const mix = this.mix;
|
|
7100
|
-
if (mix == 0)
|
|
7101
|
-
return;
|
|
6985
|
+
if (mix == 0) return;
|
|
7102
6986
|
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;
|
|
7103
6987
|
const bone = this.bone;
|
|
7104
6988
|
const l = bone.data.length;
|
|
@@ -7107,6 +6991,7 @@ var spine = (() => {
|
|
|
7107
6991
|
return;
|
|
7108
6992
|
case 1 /* reset */:
|
|
7109
6993
|
this.reset();
|
|
6994
|
+
// Fall through.
|
|
7110
6995
|
case 2 /* update */:
|
|
7111
6996
|
const skeleton = this.skeleton;
|
|
7112
6997
|
const delta = Math.max(this.skeleton.time - this.lastTime, 0);
|
|
@@ -7149,10 +7034,8 @@ var spine = (() => {
|
|
|
7149
7034
|
a -= t;
|
|
7150
7035
|
} while (a >= t);
|
|
7151
7036
|
}
|
|
7152
|
-
if (x)
|
|
7153
|
-
|
|
7154
|
-
if (y)
|
|
7155
|
-
bone.worldY += this.yOffset * mix * this.data.y;
|
|
7037
|
+
if (x) bone.worldX += this.xOffset * mix * this.data.x;
|
|
7038
|
+
if (y) bone.worldY += this.yOffset * mix * this.data.y;
|
|
7156
7039
|
}
|
|
7157
7040
|
if (rotateOrShearX || scaleX) {
|
|
7158
7041
|
let ca = Math.atan2(bone.c, bone.a), c = 0, s = 0, mr = 0;
|
|
@@ -7174,20 +7057,17 @@ var spine = (() => {
|
|
|
7174
7057
|
s = Math.sin(r);
|
|
7175
7058
|
if (scaleX) {
|
|
7176
7059
|
r = l * bone.getWorldScaleX();
|
|
7177
|
-
if (r > 0)
|
|
7178
|
-
this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
7060
|
+
if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
7179
7061
|
}
|
|
7180
7062
|
} else {
|
|
7181
7063
|
c = Math.cos(ca);
|
|
7182
7064
|
s = Math.sin(ca);
|
|
7183
7065
|
const r = l * bone.getWorldScaleX();
|
|
7184
|
-
if (r > 0)
|
|
7185
|
-
this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
7066
|
+
if (r > 0) this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
7186
7067
|
}
|
|
7187
7068
|
a = this.remaining;
|
|
7188
7069
|
if (a >= t) {
|
|
7189
|
-
if (d == -1)
|
|
7190
|
-
d = Math.pow(this.damping, 60 * t);
|
|
7070
|
+
if (d == -1) d = Math.pow(this.damping, 60 * t);
|
|
7191
7071
|
const m = this.massInverse * t, e = this.strength, w = this.wind, g = Skeleton.yDown ? -this.gravity : this.gravity, h = l / f;
|
|
7192
7072
|
while (true) {
|
|
7193
7073
|
a -= t;
|
|
@@ -7200,8 +7080,7 @@ var spine = (() => {
|
|
|
7200
7080
|
this.rotateVelocity -= ((w * s + g * c) * h + this.rotateOffset * e) * m;
|
|
7201
7081
|
this.rotateOffset += this.rotateVelocity * t;
|
|
7202
7082
|
this.rotateVelocity *= d;
|
|
7203
|
-
if (a < t)
|
|
7204
|
-
break;
|
|
7083
|
+
if (a < t) break;
|
|
7205
7084
|
const r = this.rotateOffset * mr + ca;
|
|
7206
7085
|
c = Math.cos(r);
|
|
7207
7086
|
s = Math.sin(r);
|
|
@@ -7216,10 +7095,8 @@ var spine = (() => {
|
|
|
7216
7095
|
this.cy = bone.worldY;
|
|
7217
7096
|
break;
|
|
7218
7097
|
case 3 /* pose */:
|
|
7219
|
-
if (x)
|
|
7220
|
-
|
|
7221
|
-
if (y)
|
|
7222
|
-
bone.worldY += this.yOffset * mix * this.data.y;
|
|
7098
|
+
if (x) bone.worldX += this.xOffset * mix * this.data.x;
|
|
7099
|
+
if (y) bone.worldY += this.yOffset * mix * this.data.y;
|
|
7223
7100
|
}
|
|
7224
7101
|
if (rotateOrShearX) {
|
|
7225
7102
|
let o = this.rotateOffset * mix, s = 0, c = 0, a = 0;
|
|
@@ -7302,10 +7179,8 @@ var spine = (() => {
|
|
|
7302
7179
|
* See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
|
|
7303
7180
|
deform = new Array();
|
|
7304
7181
|
constructor(data, bone) {
|
|
7305
|
-
if (!data)
|
|
7306
|
-
|
|
7307
|
-
if (!bone)
|
|
7308
|
-
throw new Error("bone cannot be null.");
|
|
7182
|
+
if (!data) throw new Error("data cannot be null.");
|
|
7183
|
+
if (!bone) throw new Error("bone cannot be null.");
|
|
7309
7184
|
this.data = data;
|
|
7310
7185
|
this.bone = bone;
|
|
7311
7186
|
this.color = new Color();
|
|
@@ -7324,8 +7199,7 @@ var spine = (() => {
|
|
|
7324
7199
|
* The deform is not cleared if the old attachment has the same {@link VertexAttachment#getTimelineAttachment()} as the
|
|
7325
7200
|
* specified attachment. */
|
|
7326
7201
|
setAttachment(attachment) {
|
|
7327
|
-
if (this.attachment == attachment)
|
|
7328
|
-
return;
|
|
7202
|
+
if (this.attachment == attachment) return;
|
|
7329
7203
|
if (!(attachment instanceof VertexAttachment) || !(this.attachment instanceof VertexAttachment) || attachment.timelineAttachment != this.attachment.timelineAttachment) {
|
|
7330
7204
|
this.deform.length = 0;
|
|
7331
7205
|
}
|
|
@@ -7335,8 +7209,7 @@ var spine = (() => {
|
|
|
7335
7209
|
/** Sets this slot to the setup pose. */
|
|
7336
7210
|
setToSetupPose() {
|
|
7337
7211
|
this.color.setFromColor(this.data.color);
|
|
7338
|
-
if (this.darkColor)
|
|
7339
|
-
this.darkColor.setFromColor(this.data.darkColor);
|
|
7212
|
+
if (this.darkColor) this.darkColor.setFromColor(this.data.darkColor);
|
|
7340
7213
|
if (!this.data.attachmentName)
|
|
7341
7214
|
this.attachment = null;
|
|
7342
7215
|
else {
|
|
@@ -7363,21 +7236,17 @@ var spine = (() => {
|
|
|
7363
7236
|
temp = new Vector2();
|
|
7364
7237
|
active = false;
|
|
7365
7238
|
constructor(data, skeleton) {
|
|
7366
|
-
if (!data)
|
|
7367
|
-
|
|
7368
|
-
if (!skeleton)
|
|
7369
|
-
throw new Error("skeleton cannot be null.");
|
|
7239
|
+
if (!data) throw new Error("data cannot be null.");
|
|
7240
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
7370
7241
|
this.data = data;
|
|
7371
7242
|
this.bones = new Array();
|
|
7372
7243
|
for (let i = 0; i < data.bones.length; i++) {
|
|
7373
7244
|
let bone = skeleton.findBone(data.bones[i].name);
|
|
7374
|
-
if (!bone)
|
|
7375
|
-
throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
7245
|
+
if (!bone) throw new Error(`Couldn't find bone ${data.bones[i].name}.`);
|
|
7376
7246
|
this.bones.push(bone);
|
|
7377
7247
|
}
|
|
7378
7248
|
let target = skeleton.findBone(data.target.name);
|
|
7379
|
-
if (!target)
|
|
7380
|
-
throw new Error(`Couldn't find target bone ${data.target.name}.`);
|
|
7249
|
+
if (!target) throw new Error(`Couldn't find target bone ${data.target.name}.`);
|
|
7381
7250
|
this.target = target;
|
|
7382
7251
|
this.mixRotate = data.mixRotate;
|
|
7383
7252
|
this.mixX = data.mixX;
|
|
@@ -7399,8 +7268,7 @@ var spine = (() => {
|
|
|
7399
7268
|
this.mixShearY = data.mixShearY;
|
|
7400
7269
|
}
|
|
7401
7270
|
update(physics) {
|
|
7402
|
-
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
|
|
7403
|
-
return;
|
|
7271
|
+
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0) return;
|
|
7404
7272
|
if (this.data.local) {
|
|
7405
7273
|
if (this.data.relative)
|
|
7406
7274
|
this.applyRelativeLocal();
|
|
@@ -7446,15 +7314,13 @@ var spine = (() => {
|
|
|
7446
7314
|
}
|
|
7447
7315
|
if (mixScaleX != 0) {
|
|
7448
7316
|
let s = Math.sqrt(bone.a * bone.a + bone.c * bone.c);
|
|
7449
|
-
if (s != 0)
|
|
7450
|
-
s = (s + (Math.sqrt(ta * ta + tc * tc) - s + this.data.offsetScaleX) * mixScaleX) / s;
|
|
7317
|
+
if (s != 0) s = (s + (Math.sqrt(ta * ta + tc * tc) - s + this.data.offsetScaleX) * mixScaleX) / s;
|
|
7451
7318
|
bone.a *= s;
|
|
7452
7319
|
bone.c *= s;
|
|
7453
7320
|
}
|
|
7454
7321
|
if (mixScaleY != 0) {
|
|
7455
7322
|
let s = Math.sqrt(bone.b * bone.b + bone.d * bone.d);
|
|
7456
|
-
if (s != 0)
|
|
7457
|
-
s = (s + (Math.sqrt(tb * tb + td * td) - s + this.data.offsetScaleY) * mixScaleY) / s;
|
|
7323
|
+
if (s != 0) s = (s + (Math.sqrt(tb * tb + td * td) - s + this.data.offsetScaleY) * mixScaleY) / s;
|
|
7458
7324
|
bone.b *= s;
|
|
7459
7325
|
bone.d *= s;
|
|
7460
7326
|
}
|
|
@@ -7536,8 +7402,7 @@ var spine = (() => {
|
|
|
7536
7402
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7537
7403
|
let bone = bones[i];
|
|
7538
7404
|
let rotation = bone.arotation;
|
|
7539
|
-
if (mixRotate != 0)
|
|
7540
|
-
rotation += (target.arotation - rotation + this.data.offsetRotation) * mixRotate;
|
|
7405
|
+
if (mixRotate != 0) rotation += (target.arotation - rotation + this.data.offsetRotation) * mixRotate;
|
|
7541
7406
|
let x = bone.ax, y = bone.ay;
|
|
7542
7407
|
x += (target.ax - x + this.data.offsetX) * mixX;
|
|
7543
7408
|
y += (target.ay - y + this.data.offsetY) * mixY;
|
|
@@ -7547,8 +7412,7 @@ var spine = (() => {
|
|
|
7547
7412
|
if (mixScaleY != 0 && scaleY != 0)
|
|
7548
7413
|
scaleY = (scaleY + (target.ascaleY - scaleY + this.data.offsetScaleY) * mixScaleY) / scaleY;
|
|
7549
7414
|
let shearY = bone.ashearY;
|
|
7550
|
-
if (mixShearY != 0)
|
|
7551
|
-
shearY += (target.ashearY - shearY + this.data.offsetShearY) * mixShearY;
|
|
7415
|
+
if (mixShearY != 0) shearY += (target.ashearY - shearY + this.data.offsetShearY) * mixShearY;
|
|
7552
7416
|
bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
|
|
7553
7417
|
}
|
|
7554
7418
|
}
|
|
@@ -7570,7 +7434,9 @@ var spine = (() => {
|
|
|
7570
7434
|
};
|
|
7571
7435
|
|
|
7572
7436
|
// spine-core/src/Skeleton.ts
|
|
7573
|
-
var
|
|
7437
|
+
var Skeleton = class _Skeleton {
|
|
7438
|
+
static quadTriangles = [0, 1, 2, 2, 3, 0];
|
|
7439
|
+
static yDown = false;
|
|
7574
7440
|
/** The skeleton's setup pose data. */
|
|
7575
7441
|
data;
|
|
7576
7442
|
/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
|
|
@@ -7614,8 +7480,7 @@ var spine = (() => {
|
|
|
7614
7480
|
* See {@link #update(float)}. */
|
|
7615
7481
|
time = 0;
|
|
7616
7482
|
constructor(data) {
|
|
7617
|
-
if (!data)
|
|
7618
|
-
throw new Error("data cannot be null.");
|
|
7483
|
+
if (!data) throw new Error("data cannot be null.");
|
|
7619
7484
|
this.data = data;
|
|
7620
7485
|
this.bones = new Array();
|
|
7621
7486
|
for (let i = 0; i < data.bones.length; i++) {
|
|
@@ -7726,8 +7591,7 @@ var spine = (() => {
|
|
|
7726
7591
|
}
|
|
7727
7592
|
sortIkConstraint(constraint) {
|
|
7728
7593
|
constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
|
|
7729
|
-
if (!constraint.active)
|
|
7730
|
-
return;
|
|
7594
|
+
if (!constraint.active) return;
|
|
7731
7595
|
let target = constraint.target;
|
|
7732
7596
|
this.sortBone(target);
|
|
7733
7597
|
let constrained = constraint.bones;
|
|
@@ -7746,20 +7610,17 @@ var spine = (() => {
|
|
|
7746
7610
|
}
|
|
7747
7611
|
sortPathConstraint(constraint) {
|
|
7748
7612
|
constraint.active = constraint.target.bone.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
|
|
7749
|
-
if (!constraint.active)
|
|
7750
|
-
return;
|
|
7613
|
+
if (!constraint.active) return;
|
|
7751
7614
|
let slot = constraint.target;
|
|
7752
7615
|
let slotIndex = slot.data.index;
|
|
7753
7616
|
let slotBone = slot.bone;
|
|
7754
|
-
if (this.skin)
|
|
7755
|
-
this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);
|
|
7617
|
+
if (this.skin) this.sortPathConstraintAttachment(this.skin, slotIndex, slotBone);
|
|
7756
7618
|
if (this.data.defaultSkin && this.data.defaultSkin != this.skin)
|
|
7757
7619
|
this.sortPathConstraintAttachment(this.data.defaultSkin, slotIndex, slotBone);
|
|
7758
7620
|
for (let i = 0, n = this.data.skins.length; i < n; i++)
|
|
7759
7621
|
this.sortPathConstraintAttachment(this.data.skins[i], slotIndex, slotBone);
|
|
7760
7622
|
let attachment = slot.getAttachment();
|
|
7761
|
-
if (attachment instanceof PathAttachment)
|
|
7762
|
-
this.sortPathConstraintAttachmentWith(attachment, slotBone);
|
|
7623
|
+
if (attachment instanceof PathAttachment) this.sortPathConstraintAttachmentWith(attachment, slotBone);
|
|
7763
7624
|
let constrained = constraint.bones;
|
|
7764
7625
|
let boneCount = constrained.length;
|
|
7765
7626
|
for (let i = 0; i < boneCount; i++)
|
|
@@ -7772,8 +7633,7 @@ var spine = (() => {
|
|
|
7772
7633
|
}
|
|
7773
7634
|
sortTransformConstraint(constraint) {
|
|
7774
7635
|
constraint.active = constraint.target.isActive() && (!constraint.data.skinRequired || this.skin && Utils.contains(this.skin.constraints, constraint.data, true));
|
|
7775
|
-
if (!constraint.active)
|
|
7776
|
-
return;
|
|
7636
|
+
if (!constraint.active) return;
|
|
7777
7637
|
this.sortBone(constraint.target);
|
|
7778
7638
|
let constrained = constraint.bones;
|
|
7779
7639
|
let boneCount = constrained.length;
|
|
@@ -7796,15 +7656,13 @@ var spine = (() => {
|
|
|
7796
7656
|
}
|
|
7797
7657
|
sortPathConstraintAttachment(skin, slotIndex, slotBone) {
|
|
7798
7658
|
let attachments = skin.attachments[slotIndex];
|
|
7799
|
-
if (!attachments)
|
|
7800
|
-
return;
|
|
7659
|
+
if (!attachments) return;
|
|
7801
7660
|
for (let key in attachments) {
|
|
7802
7661
|
this.sortPathConstraintAttachmentWith(attachments[key], slotBone);
|
|
7803
7662
|
}
|
|
7804
7663
|
}
|
|
7805
7664
|
sortPathConstraintAttachmentWith(attachment, slotBone) {
|
|
7806
|
-
if (!(attachment instanceof PathAttachment))
|
|
7807
|
-
return;
|
|
7665
|
+
if (!(attachment instanceof PathAttachment)) return;
|
|
7808
7666
|
let pathBones = attachment.bones;
|
|
7809
7667
|
if (!pathBones)
|
|
7810
7668
|
this.sortBone(slotBone);
|
|
@@ -7821,31 +7679,25 @@ var spine = (() => {
|
|
|
7821
7679
|
sortPhysicsConstraint(constraint) {
|
|
7822
7680
|
const bone = constraint.bone;
|
|
7823
7681
|
constraint.active = bone.active && (!constraint.data.skinRequired || this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true));
|
|
7824
|
-
if (!constraint.active)
|
|
7825
|
-
return;
|
|
7682
|
+
if (!constraint.active) return;
|
|
7826
7683
|
this.sortBone(bone);
|
|
7827
7684
|
this._updateCache.push(constraint);
|
|
7828
7685
|
this.sortReset(bone.children);
|
|
7829
7686
|
bone.sorted = true;
|
|
7830
7687
|
}
|
|
7831
7688
|
sortBone(bone) {
|
|
7832
|
-
if (!bone)
|
|
7833
|
-
|
|
7834
|
-
if (bone.sorted)
|
|
7835
|
-
return;
|
|
7689
|
+
if (!bone) return;
|
|
7690
|
+
if (bone.sorted) return;
|
|
7836
7691
|
let parent = bone.parent;
|
|
7837
|
-
if (parent)
|
|
7838
|
-
this.sortBone(parent);
|
|
7692
|
+
if (parent) this.sortBone(parent);
|
|
7839
7693
|
bone.sorted = true;
|
|
7840
7694
|
this._updateCache.push(bone);
|
|
7841
7695
|
}
|
|
7842
7696
|
sortReset(bones) {
|
|
7843
7697
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7844
7698
|
let bone = bones[i];
|
|
7845
|
-
if (!bone.active)
|
|
7846
|
-
|
|
7847
|
-
if (bone.sorted)
|
|
7848
|
-
this.sortReset(bone.children);
|
|
7699
|
+
if (!bone.active) continue;
|
|
7700
|
+
if (bone.sorted) this.sortReset(bone.children);
|
|
7849
7701
|
bone.sorted = false;
|
|
7850
7702
|
}
|
|
7851
7703
|
}
|
|
@@ -7854,8 +7706,7 @@ var spine = (() => {
|
|
|
7854
7706
|
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
|
7855
7707
|
* Runtimes Guide. */
|
|
7856
7708
|
updateWorldTransform(physics) {
|
|
7857
|
-
if (physics === void 0 || physics === null)
|
|
7858
|
-
throw new Error("physics is undefined");
|
|
7709
|
+
if (physics === void 0 || physics === null) throw new Error("physics is undefined");
|
|
7859
7710
|
let bones = this.bones;
|
|
7860
7711
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7861
7712
|
let bone = bones[i];
|
|
@@ -7872,8 +7723,7 @@ var spine = (() => {
|
|
|
7872
7723
|
updateCache[i].update(physics);
|
|
7873
7724
|
}
|
|
7874
7725
|
updateWorldTransformWith(physics, parent) {
|
|
7875
|
-
if (!parent)
|
|
7876
|
-
throw new Error("parent cannot be null.");
|
|
7726
|
+
if (!parent) throw new Error("parent cannot be null.");
|
|
7877
7727
|
let bones = this.bones;
|
|
7878
7728
|
for (let i = 1, n = bones.length; i < n; i++) {
|
|
7879
7729
|
let bone = bones[i];
|
|
@@ -7886,8 +7736,7 @@ var spine = (() => {
|
|
|
7886
7736
|
bone.ashearY = bone.shearY;
|
|
7887
7737
|
}
|
|
7888
7738
|
let rootBone = this.getRootBone();
|
|
7889
|
-
if (!rootBone)
|
|
7890
|
-
throw new Error("Root bone must not be null.");
|
|
7739
|
+
if (!rootBone) throw new Error("Root bone must not be null.");
|
|
7891
7740
|
let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
|
|
7892
7741
|
rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
|
|
7893
7742
|
rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
|
|
@@ -7904,8 +7753,7 @@ var spine = (() => {
|
|
|
7904
7753
|
let updateCache = this._updateCache;
|
|
7905
7754
|
for (let i = 0, n = updateCache.length; i < n; i++) {
|
|
7906
7755
|
let updatable = updateCache[i];
|
|
7907
|
-
if (updatable != rootBone)
|
|
7908
|
-
updatable.update(physics);
|
|
7756
|
+
if (updatable != rootBone) updatable.update(physics);
|
|
7909
7757
|
}
|
|
7910
7758
|
}
|
|
7911
7759
|
/** Sets the bones, constraints, and slots to their setup pose values. */
|
|
@@ -7915,16 +7763,11 @@ var spine = (() => {
|
|
|
7915
7763
|
}
|
|
7916
7764
|
/** Sets the bones and constraints to their setup pose values. */
|
|
7917
7765
|
setBonesToSetupPose() {
|
|
7918
|
-
for (const bone of this.bones)
|
|
7919
|
-
|
|
7920
|
-
for (const constraint of this.
|
|
7921
|
-
|
|
7922
|
-
for (const constraint of this.
|
|
7923
|
-
constraint.setToSetupPose();
|
|
7924
|
-
for (const constraint of this.pathConstraints)
|
|
7925
|
-
constraint.setToSetupPose();
|
|
7926
|
-
for (const constraint of this.physicsConstraints)
|
|
7927
|
-
constraint.setToSetupPose();
|
|
7766
|
+
for (const bone of this.bones) bone.setToSetupPose();
|
|
7767
|
+
for (const constraint of this.ikConstraints) constraint.setToSetupPose();
|
|
7768
|
+
for (const constraint of this.transformConstraints) constraint.setToSetupPose();
|
|
7769
|
+
for (const constraint of this.pathConstraints) constraint.setToSetupPose();
|
|
7770
|
+
for (const constraint of this.physicsConstraints) constraint.setToSetupPose();
|
|
7928
7771
|
}
|
|
7929
7772
|
/** Sets the slots and draw order to their setup pose values. */
|
|
7930
7773
|
setSlotsToSetupPose() {
|
|
@@ -7935,19 +7778,16 @@ var spine = (() => {
|
|
|
7935
7778
|
}
|
|
7936
7779
|
/** @returns May return null. */
|
|
7937
7780
|
getRootBone() {
|
|
7938
|
-
if (this.bones.length == 0)
|
|
7939
|
-
return null;
|
|
7781
|
+
if (this.bones.length == 0) return null;
|
|
7940
7782
|
return this.bones[0];
|
|
7941
7783
|
}
|
|
7942
7784
|
/** @returns May be null. */
|
|
7943
7785
|
findBone(boneName) {
|
|
7944
|
-
if (!boneName)
|
|
7945
|
-
throw new Error("boneName cannot be null.");
|
|
7786
|
+
if (!boneName) throw new Error("boneName cannot be null.");
|
|
7946
7787
|
let bones = this.bones;
|
|
7947
7788
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7948
7789
|
let bone = bones[i];
|
|
7949
|
-
if (bone.data.name == boneName)
|
|
7950
|
-
return bone;
|
|
7790
|
+
if (bone.data.name == boneName) return bone;
|
|
7951
7791
|
}
|
|
7952
7792
|
return null;
|
|
7953
7793
|
}
|
|
@@ -7955,13 +7795,11 @@ var spine = (() => {
|
|
|
7955
7795
|
* repeatedly.
|
|
7956
7796
|
* @returns May be null. */
|
|
7957
7797
|
findSlot(slotName) {
|
|
7958
|
-
if (!slotName)
|
|
7959
|
-
throw new Error("slotName cannot be null.");
|
|
7798
|
+
if (!slotName) throw new Error("slotName cannot be null.");
|
|
7960
7799
|
let slots = this.slots;
|
|
7961
7800
|
for (let i = 0, n = slots.length; i < n; i++) {
|
|
7962
7801
|
let slot = slots[i];
|
|
7963
|
-
if (slot.data.name == slotName)
|
|
7964
|
-
return slot;
|
|
7802
|
+
if (slot.data.name == slotName) return slot;
|
|
7965
7803
|
}
|
|
7966
7804
|
return null;
|
|
7967
7805
|
}
|
|
@@ -7970,8 +7808,7 @@ var spine = (() => {
|
|
|
7970
7808
|
* See {@link #setSkin()}. */
|
|
7971
7809
|
setSkinByName(skinName) {
|
|
7972
7810
|
let skin = this.data.findSkin(skinName);
|
|
7973
|
-
if (!skin)
|
|
7974
|
-
throw new Error("Skin not found: " + skinName);
|
|
7811
|
+
if (!skin) throw new Error("Skin not found: " + skinName);
|
|
7975
7812
|
this.setSkin(skin);
|
|
7976
7813
|
}
|
|
7977
7814
|
/** Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the
|
|
@@ -7985,8 +7822,7 @@ var spine = (() => {
|
|
|
7985
7822
|
* skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.
|
|
7986
7823
|
* @param newSkin May be null. */
|
|
7987
7824
|
setSkin(newSkin) {
|
|
7988
|
-
if (newSkin == this.skin)
|
|
7989
|
-
return;
|
|
7825
|
+
if (newSkin == this.skin) return;
|
|
7990
7826
|
if (newSkin) {
|
|
7991
7827
|
if (this.skin)
|
|
7992
7828
|
newSkin.attachAll(this, this.skin);
|
|
@@ -7997,8 +7833,7 @@ var spine = (() => {
|
|
|
7997
7833
|
let name = slot.data.attachmentName;
|
|
7998
7834
|
if (name) {
|
|
7999
7835
|
let attachment = newSkin.getAttachment(i, name);
|
|
8000
|
-
if (attachment)
|
|
8001
|
-
slot.setAttachment(attachment);
|
|
7836
|
+
if (attachment) slot.setAttachment(attachment);
|
|
8002
7837
|
}
|
|
8003
7838
|
}
|
|
8004
7839
|
}
|
|
@@ -8013,8 +7848,7 @@ var spine = (() => {
|
|
|
8013
7848
|
* @returns May be null. */
|
|
8014
7849
|
getAttachmentByName(slotName, attachmentName) {
|
|
8015
7850
|
let slot = this.data.findSlot(slotName);
|
|
8016
|
-
if (!slot)
|
|
8017
|
-
throw new Error(`Can't find slot with name ${slotName}`);
|
|
7851
|
+
if (!slot) throw new Error(`Can't find slot with name ${slotName}`);
|
|
8018
7852
|
return this.getAttachment(slot.index, attachmentName);
|
|
8019
7853
|
}
|
|
8020
7854
|
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
|
|
@@ -8023,23 +7857,19 @@ var spine = (() => {
|
|
|
8023
7857
|
* See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.
|
|
8024
7858
|
* @returns May be null. */
|
|
8025
7859
|
getAttachment(slotIndex, attachmentName) {
|
|
8026
|
-
if (!attachmentName)
|
|
8027
|
-
throw new Error("attachmentName cannot be null.");
|
|
7860
|
+
if (!attachmentName) throw new Error("attachmentName cannot be null.");
|
|
8028
7861
|
if (this.skin) {
|
|
8029
7862
|
let attachment = this.skin.getAttachment(slotIndex, attachmentName);
|
|
8030
|
-
if (attachment)
|
|
8031
|
-
return attachment;
|
|
7863
|
+
if (attachment) return attachment;
|
|
8032
7864
|
}
|
|
8033
|
-
if (this.data.defaultSkin)
|
|
8034
|
-
return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
|
|
7865
|
+
if (this.data.defaultSkin) return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
|
|
8035
7866
|
return null;
|
|
8036
7867
|
}
|
|
8037
7868
|
/** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with
|
|
8038
7869
|
* {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.
|
|
8039
7870
|
* @param attachmentName May be null to clear the slot's attachment. */
|
|
8040
7871
|
setAttachment(slotName, attachmentName) {
|
|
8041
|
-
if (!slotName)
|
|
8042
|
-
throw new Error("slotName cannot be null.");
|
|
7872
|
+
if (!slotName) throw new Error("slotName cannot be null.");
|
|
8043
7873
|
let slots = this.slots;
|
|
8044
7874
|
for (let i = 0, n = slots.length; i < n; i++) {
|
|
8045
7875
|
let slot = slots[i];
|
|
@@ -8047,8 +7877,7 @@ var spine = (() => {
|
|
|
8047
7877
|
let attachment = null;
|
|
8048
7878
|
if (attachmentName) {
|
|
8049
7879
|
attachment = this.getAttachment(i, attachmentName);
|
|
8050
|
-
if (!attachment)
|
|
8051
|
-
throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName);
|
|
7880
|
+
if (!attachment) throw new Error("Attachment not found: " + attachmentName + ", for slot: " + slotName);
|
|
8052
7881
|
}
|
|
8053
7882
|
slot.setAttachment(attachment);
|
|
8054
7883
|
return;
|
|
@@ -8060,31 +7889,27 @@ var spine = (() => {
|
|
|
8060
7889
|
* than to call it repeatedly.
|
|
8061
7890
|
* @return May be null. */
|
|
8062
7891
|
findIkConstraint(constraintName) {
|
|
8063
|
-
if (!constraintName)
|
|
8064
|
-
throw new Error("constraintName cannot be null.");
|
|
7892
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8065
7893
|
return this.ikConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
8066
7894
|
}
|
|
8067
7895
|
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
|
|
8068
7896
|
* this method than to call it repeatedly.
|
|
8069
7897
|
* @return May be null. */
|
|
8070
7898
|
findTransformConstraint(constraintName) {
|
|
8071
|
-
if (!constraintName)
|
|
8072
|
-
throw new Error("constraintName cannot be null.");
|
|
7899
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8073
7900
|
return this.transformConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
8074
7901
|
}
|
|
8075
7902
|
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
|
|
8076
7903
|
* than to call it repeatedly.
|
|
8077
7904
|
* @return May be null. */
|
|
8078
7905
|
findPathConstraint(constraintName) {
|
|
8079
|
-
if (!constraintName)
|
|
8080
|
-
throw new Error("constraintName cannot be null.");
|
|
7906
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8081
7907
|
return this.pathConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
8082
7908
|
}
|
|
8083
7909
|
/** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this
|
|
8084
7910
|
* method than to call it repeatedly. */
|
|
8085
7911
|
findPhysicsConstraint(constraintName) {
|
|
8086
|
-
if (constraintName == null)
|
|
8087
|
-
throw new Error("constraintName cannot be null.");
|
|
7912
|
+
if (constraintName == null) throw new Error("constraintName cannot be null.");
|
|
8088
7913
|
return this.physicsConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
8089
7914
|
}
|
|
8090
7915
|
/** 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 }`.
|
|
@@ -8101,16 +7926,13 @@ var spine = (() => {
|
|
|
8101
7926
|
* @param temp Working memory to temporarily store attachments' computed world vertices.
|
|
8102
7927
|
* @param clipper {@link SkeletonClipping} to use. If <code>null</code>, no clipping is applied. */
|
|
8103
7928
|
getBounds(offset, size, temp = new Array(2), clipper = null) {
|
|
8104
|
-
if (!offset)
|
|
8105
|
-
|
|
8106
|
-
if (!size)
|
|
8107
|
-
throw new Error("size cannot be null.");
|
|
7929
|
+
if (!offset) throw new Error("offset cannot be null.");
|
|
7930
|
+
if (!size) throw new Error("size cannot be null.");
|
|
8108
7931
|
let drawOrder = this.drawOrder;
|
|
8109
7932
|
let minX = Number.POSITIVE_INFINITY, minY = Number.POSITIVE_INFINITY, maxX = Number.NEGATIVE_INFINITY, maxY = Number.NEGATIVE_INFINITY;
|
|
8110
7933
|
for (let i = 0, n = drawOrder.length; i < n; i++) {
|
|
8111
7934
|
let slot = drawOrder[i];
|
|
8112
|
-
if (!slot.bone.active)
|
|
8113
|
-
continue;
|
|
7935
|
+
if (!slot.bone.active) continue;
|
|
8114
7936
|
let verticesLength = 0;
|
|
8115
7937
|
let vertices = null;
|
|
8116
7938
|
let triangles = null;
|
|
@@ -8144,11 +7966,9 @@ var spine = (() => {
|
|
|
8144
7966
|
maxY = Math.max(maxY, y);
|
|
8145
7967
|
}
|
|
8146
7968
|
}
|
|
8147
|
-
if (clipper != null)
|
|
8148
|
-
clipper.clipEndWithSlot(slot);
|
|
7969
|
+
if (clipper != null) clipper.clipEndWithSlot(slot);
|
|
8149
7970
|
}
|
|
8150
|
-
if (clipper != null)
|
|
8151
|
-
clipper.clipEnd();
|
|
7971
|
+
if (clipper != null) clipper.clipEnd();
|
|
8152
7972
|
offset.set(minX, minY);
|
|
8153
7973
|
size.set(maxX - minX, maxY - minY);
|
|
8154
7974
|
}
|
|
@@ -8168,9 +7988,6 @@ var spine = (() => {
|
|
|
8168
7988
|
physicsConstraints[i].rotate(x, y, degrees);
|
|
8169
7989
|
}
|
|
8170
7990
|
};
|
|
8171
|
-
var Skeleton = _Skeleton;
|
|
8172
|
-
__publicField(Skeleton, "quadTriangles", [0, 1, 2, 2, 3, 0]);
|
|
8173
|
-
__publicField(Skeleton, "yDown", false);
|
|
8174
7991
|
var Physics = /* @__PURE__ */ ((Physics2) => {
|
|
8175
7992
|
Physics2[Physics2["none"] = 0] = "none";
|
|
8176
7993
|
Physics2[Physics2["reset"] = 1] = "reset";
|
|
@@ -8187,10 +8004,8 @@ var spine = (() => {
|
|
|
8187
8004
|
this._bone = boneData;
|
|
8188
8005
|
}
|
|
8189
8006
|
get bone() {
|
|
8190
|
-
if (!this._bone)
|
|
8191
|
-
|
|
8192
|
-
else
|
|
8193
|
-
return this._bone;
|
|
8007
|
+
if (!this._bone) throw new Error("BoneData not set.");
|
|
8008
|
+
else return this._bone;
|
|
8194
8009
|
}
|
|
8195
8010
|
x = 0;
|
|
8196
8011
|
y = 0;
|
|
@@ -8273,13 +8088,11 @@ var spine = (() => {
|
|
|
8273
8088
|
* multiple times.
|
|
8274
8089
|
* @returns May be null. */
|
|
8275
8090
|
findBone(boneName) {
|
|
8276
|
-
if (!boneName)
|
|
8277
|
-
throw new Error("boneName cannot be null.");
|
|
8091
|
+
if (!boneName) throw new Error("boneName cannot be null.");
|
|
8278
8092
|
let bones = this.bones;
|
|
8279
8093
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
8280
8094
|
let bone = bones[i];
|
|
8281
|
-
if (bone.name == boneName)
|
|
8282
|
-
return bone;
|
|
8095
|
+
if (bone.name == boneName) return bone;
|
|
8283
8096
|
}
|
|
8284
8097
|
return null;
|
|
8285
8098
|
}
|
|
@@ -8287,13 +8100,11 @@ var spine = (() => {
|
|
|
8287
8100
|
* multiple times.
|
|
8288
8101
|
* @returns May be null. */
|
|
8289
8102
|
findSlot(slotName) {
|
|
8290
|
-
if (!slotName)
|
|
8291
|
-
throw new Error("slotName cannot be null.");
|
|
8103
|
+
if (!slotName) throw new Error("slotName cannot be null.");
|
|
8292
8104
|
let slots = this.slots;
|
|
8293
8105
|
for (let i = 0, n = slots.length; i < n; i++) {
|
|
8294
8106
|
let slot = slots[i];
|
|
8295
|
-
if (slot.name == slotName)
|
|
8296
|
-
return slot;
|
|
8107
|
+
if (slot.name == slotName) return slot;
|
|
8297
8108
|
}
|
|
8298
8109
|
return null;
|
|
8299
8110
|
}
|
|
@@ -8301,13 +8112,11 @@ var spine = (() => {
|
|
|
8301
8112
|
* multiple times.
|
|
8302
8113
|
* @returns May be null. */
|
|
8303
8114
|
findSkin(skinName) {
|
|
8304
|
-
if (!skinName)
|
|
8305
|
-
throw new Error("skinName cannot be null.");
|
|
8115
|
+
if (!skinName) throw new Error("skinName cannot be null.");
|
|
8306
8116
|
let skins = this.skins;
|
|
8307
8117
|
for (let i = 0, n = skins.length; i < n; i++) {
|
|
8308
8118
|
let skin = skins[i];
|
|
8309
|
-
if (skin.name == skinName)
|
|
8310
|
-
return skin;
|
|
8119
|
+
if (skin.name == skinName) return skin;
|
|
8311
8120
|
}
|
|
8312
8121
|
return null;
|
|
8313
8122
|
}
|
|
@@ -8315,13 +8124,11 @@ var spine = (() => {
|
|
|
8315
8124
|
* multiple times.
|
|
8316
8125
|
* @returns May be null. */
|
|
8317
8126
|
findEvent(eventDataName) {
|
|
8318
|
-
if (!eventDataName)
|
|
8319
|
-
throw new Error("eventDataName cannot be null.");
|
|
8127
|
+
if (!eventDataName) throw new Error("eventDataName cannot be null.");
|
|
8320
8128
|
let events = this.events;
|
|
8321
8129
|
for (let i = 0, n = events.length; i < n; i++) {
|
|
8322
8130
|
let event = events[i];
|
|
8323
|
-
if (event.name == eventDataName)
|
|
8324
|
-
return event;
|
|
8131
|
+
if (event.name == eventDataName) return event;
|
|
8325
8132
|
}
|
|
8326
8133
|
return null;
|
|
8327
8134
|
}
|
|
@@ -8329,13 +8136,11 @@ var spine = (() => {
|
|
|
8329
8136
|
* call it multiple times.
|
|
8330
8137
|
* @returns May be null. */
|
|
8331
8138
|
findAnimation(animationName) {
|
|
8332
|
-
if (!animationName)
|
|
8333
|
-
throw new Error("animationName cannot be null.");
|
|
8139
|
+
if (!animationName) throw new Error("animationName cannot be null.");
|
|
8334
8140
|
let animations = this.animations;
|
|
8335
8141
|
for (let i = 0, n = animations.length; i < n; i++) {
|
|
8336
8142
|
let animation = animations[i];
|
|
8337
|
-
if (animation.name == animationName)
|
|
8338
|
-
return animation;
|
|
8143
|
+
if (animation.name == animationName) return animation;
|
|
8339
8144
|
}
|
|
8340
8145
|
return null;
|
|
8341
8146
|
}
|
|
@@ -8343,13 +8148,11 @@ var spine = (() => {
|
|
|
8343
8148
|
* than to call it multiple times.
|
|
8344
8149
|
* @return May be null. */
|
|
8345
8150
|
findIkConstraint(constraintName) {
|
|
8346
|
-
if (!constraintName)
|
|
8347
|
-
throw new Error("constraintName cannot be null.");
|
|
8151
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8348
8152
|
const ikConstraints = this.ikConstraints;
|
|
8349
8153
|
for (let i = 0, n = ikConstraints.length; i < n; i++) {
|
|
8350
8154
|
const constraint = ikConstraints[i];
|
|
8351
|
-
if (constraint.name == constraintName)
|
|
8352
|
-
return constraint;
|
|
8155
|
+
if (constraint.name == constraintName) return constraint;
|
|
8353
8156
|
}
|
|
8354
8157
|
return null;
|
|
8355
8158
|
}
|
|
@@ -8357,13 +8160,11 @@ var spine = (() => {
|
|
|
8357
8160
|
* this method than to call it multiple times.
|
|
8358
8161
|
* @return May be null. */
|
|
8359
8162
|
findTransformConstraint(constraintName) {
|
|
8360
|
-
if (!constraintName)
|
|
8361
|
-
throw new Error("constraintName cannot be null.");
|
|
8163
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8362
8164
|
const transformConstraints = this.transformConstraints;
|
|
8363
8165
|
for (let i = 0, n = transformConstraints.length; i < n; i++) {
|
|
8364
8166
|
const constraint = transformConstraints[i];
|
|
8365
|
-
if (constraint.name == constraintName)
|
|
8366
|
-
return constraint;
|
|
8167
|
+
if (constraint.name == constraintName) return constraint;
|
|
8367
8168
|
}
|
|
8368
8169
|
return null;
|
|
8369
8170
|
}
|
|
@@ -8371,13 +8172,11 @@ var spine = (() => {
|
|
|
8371
8172
|
* than to call it multiple times.
|
|
8372
8173
|
* @return May be null. */
|
|
8373
8174
|
findPathConstraint(constraintName) {
|
|
8374
|
-
if (!constraintName)
|
|
8375
|
-
throw new Error("constraintName cannot be null.");
|
|
8175
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8376
8176
|
const pathConstraints = this.pathConstraints;
|
|
8377
8177
|
for (let i = 0, n = pathConstraints.length; i < n; i++) {
|
|
8378
8178
|
const constraint = pathConstraints[i];
|
|
8379
|
-
if (constraint.name == constraintName)
|
|
8380
|
-
return constraint;
|
|
8179
|
+
if (constraint.name == constraintName) return constraint;
|
|
8381
8180
|
}
|
|
8382
8181
|
return null;
|
|
8383
8182
|
}
|
|
@@ -8385,13 +8184,11 @@ var spine = (() => {
|
|
|
8385
8184
|
* than to call it multiple times.
|
|
8386
8185
|
* @return May be null. */
|
|
8387
8186
|
findPhysicsConstraint(constraintName) {
|
|
8388
|
-
if (!constraintName)
|
|
8389
|
-
throw new Error("constraintName cannot be null.");
|
|
8187
|
+
if (!constraintName) throw new Error("constraintName cannot be null.");
|
|
8390
8188
|
const physicsConstraints = this.physicsConstraints;
|
|
8391
8189
|
for (let i = 0, n = physicsConstraints.length; i < n; i++) {
|
|
8392
8190
|
const constraint = physicsConstraints[i];
|
|
8393
|
-
if (constraint.name == constraintName)
|
|
8394
|
-
return constraint;
|
|
8191
|
+
if (constraint.name == constraintName) return constraint;
|
|
8395
8192
|
}
|
|
8396
8193
|
return null;
|
|
8397
8194
|
}
|
|
@@ -8415,19 +8212,15 @@ var spine = (() => {
|
|
|
8415
8212
|
color = new Color(0.99607843, 0.61960787, 0.30980393, 1);
|
|
8416
8213
|
// fe9e4fff
|
|
8417
8214
|
constructor(name) {
|
|
8418
|
-
if (!name)
|
|
8419
|
-
throw new Error("name cannot be null.");
|
|
8215
|
+
if (!name) throw new Error("name cannot be null.");
|
|
8420
8216
|
this.name = name;
|
|
8421
8217
|
}
|
|
8422
8218
|
/** Adds an attachment to the skin for the specified slot index and name. */
|
|
8423
8219
|
setAttachment(slotIndex, name, attachment) {
|
|
8424
|
-
if (!attachment)
|
|
8425
|
-
throw new Error("attachment cannot be null.");
|
|
8220
|
+
if (!attachment) throw new Error("attachment cannot be null.");
|
|
8426
8221
|
let attachments = this.attachments;
|
|
8427
|
-
if (slotIndex >= attachments.length)
|
|
8428
|
-
|
|
8429
|
-
if (!attachments[slotIndex])
|
|
8430
|
-
attachments[slotIndex] = {};
|
|
8222
|
+
if (slotIndex >= attachments.length) attachments.length = slotIndex + 1;
|
|
8223
|
+
if (!attachments[slotIndex]) attachments[slotIndex] = {};
|
|
8431
8224
|
attachments[slotIndex][name] = attachment;
|
|
8432
8225
|
}
|
|
8433
8226
|
/** Adds all attachments, bones, and constraints from the specified skin to this skin. */
|
|
@@ -8441,8 +8234,7 @@ var spine = (() => {
|
|
|
8441
8234
|
break;
|
|
8442
8235
|
}
|
|
8443
8236
|
}
|
|
8444
|
-
if (!contained)
|
|
8445
|
-
this.bones.push(bone);
|
|
8237
|
+
if (!contained) this.bones.push(bone);
|
|
8446
8238
|
}
|
|
8447
8239
|
for (let i = 0; i < skin.constraints.length; i++) {
|
|
8448
8240
|
let constraint = skin.constraints[i];
|
|
@@ -8453,8 +8245,7 @@ var spine = (() => {
|
|
|
8453
8245
|
break;
|
|
8454
8246
|
}
|
|
8455
8247
|
}
|
|
8456
|
-
if (!contained)
|
|
8457
|
-
this.constraints.push(constraint);
|
|
8248
|
+
if (!contained) this.constraints.push(constraint);
|
|
8458
8249
|
}
|
|
8459
8250
|
let attachments = skin.getAttachments();
|
|
8460
8251
|
for (let i = 0; i < attachments.length; i++) {
|
|
@@ -8474,8 +8265,7 @@ var spine = (() => {
|
|
|
8474
8265
|
break;
|
|
8475
8266
|
}
|
|
8476
8267
|
}
|
|
8477
|
-
if (!contained)
|
|
8478
|
-
this.bones.push(bone);
|
|
8268
|
+
if (!contained) this.bones.push(bone);
|
|
8479
8269
|
}
|
|
8480
8270
|
for (let i = 0; i < skin.constraints.length; i++) {
|
|
8481
8271
|
let constraint = skin.constraints[i];
|
|
@@ -8486,14 +8276,12 @@ var spine = (() => {
|
|
|
8486
8276
|
break;
|
|
8487
8277
|
}
|
|
8488
8278
|
}
|
|
8489
|
-
if (!contained)
|
|
8490
|
-
this.constraints.push(constraint);
|
|
8279
|
+
if (!contained) this.constraints.push(constraint);
|
|
8491
8280
|
}
|
|
8492
8281
|
let attachments = skin.getAttachments();
|
|
8493
8282
|
for (let i = 0; i < attachments.length; i++) {
|
|
8494
8283
|
var attachment = attachments[i];
|
|
8495
|
-
if (!attachment.attachment)
|
|
8496
|
-
continue;
|
|
8284
|
+
if (!attachment.attachment) continue;
|
|
8497
8285
|
if (attachment.attachment instanceof MeshAttachment) {
|
|
8498
8286
|
attachment.attachment = attachment.attachment.newLinkedMesh();
|
|
8499
8287
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
|
@@ -8511,8 +8299,7 @@ var spine = (() => {
|
|
|
8511
8299
|
/** Removes the attachment in the skin for the specified slot index and name, if any. */
|
|
8512
8300
|
removeAttachment(slotIndex, name) {
|
|
8513
8301
|
let dictionary = this.attachments[slotIndex];
|
|
8514
|
-
if (dictionary)
|
|
8515
|
-
delete dictionary[name];
|
|
8302
|
+
if (dictionary) delete dictionary[name];
|
|
8516
8303
|
}
|
|
8517
8304
|
/** Returns all attachments in this skin. */
|
|
8518
8305
|
getAttachments() {
|
|
@@ -8522,8 +8309,7 @@ var spine = (() => {
|
|
|
8522
8309
|
if (slotAttachments) {
|
|
8523
8310
|
for (let name in slotAttachments) {
|
|
8524
8311
|
let attachment = slotAttachments[name];
|
|
8525
|
-
if (attachment)
|
|
8526
|
-
entries.push(new SkinEntry(i, name, attachment));
|
|
8312
|
+
if (attachment) entries.push(new SkinEntry(i, name, attachment));
|
|
8527
8313
|
}
|
|
8528
8314
|
}
|
|
8529
8315
|
}
|
|
@@ -8535,8 +8321,7 @@ var spine = (() => {
|
|
|
8535
8321
|
if (slotAttachments) {
|
|
8536
8322
|
for (let name in slotAttachments) {
|
|
8537
8323
|
let attachment = slotAttachments[name];
|
|
8538
|
-
if (attachment)
|
|
8539
|
-
attachments.push(new SkinEntry(slotIndex, name, attachment));
|
|
8324
|
+
if (attachment) attachments.push(new SkinEntry(slotIndex, name, attachment));
|
|
8540
8325
|
}
|
|
8541
8326
|
}
|
|
8542
8327
|
}
|
|
@@ -8558,8 +8343,7 @@ var spine = (() => {
|
|
|
8558
8343
|
let skinAttachment = dictionary[key];
|
|
8559
8344
|
if (slotAttachment == skinAttachment) {
|
|
8560
8345
|
let attachment = this.getAttachment(slotIndex, key);
|
|
8561
|
-
if (attachment)
|
|
8562
|
-
slot.setAttachment(attachment);
|
|
8346
|
+
if (attachment) slot.setAttachment(attachment);
|
|
8563
8347
|
break;
|
|
8564
8348
|
}
|
|
8565
8349
|
}
|
|
@@ -8586,16 +8370,13 @@ var spine = (() => {
|
|
|
8586
8370
|
/** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
|
|
8587
8371
|
attachmentName = null;
|
|
8588
8372
|
/** The blend mode for drawing the slot's attachment. */
|
|
8589
|
-
blendMode =
|
|
8373
|
+
blendMode = 0 /* Normal */;
|
|
8590
8374
|
/** False if the slot was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
|
|
8591
8375
|
visible = true;
|
|
8592
8376
|
constructor(index, name, boneData) {
|
|
8593
|
-
if (index < 0)
|
|
8594
|
-
|
|
8595
|
-
if (!
|
|
8596
|
-
throw new Error("name cannot be null.");
|
|
8597
|
-
if (!boneData)
|
|
8598
|
-
throw new Error("boneData cannot be null.");
|
|
8377
|
+
if (index < 0) throw new Error("index must be >= 0.");
|
|
8378
|
+
if (!name) throw new Error("name cannot be null.");
|
|
8379
|
+
if (!boneData) throw new Error("boneData cannot be null.");
|
|
8599
8380
|
this.index = index;
|
|
8600
8381
|
this.name = name;
|
|
8601
8382
|
this.boneData = boneData;
|
|
@@ -8619,10 +8400,8 @@ var spine = (() => {
|
|
|
8619
8400
|
this._target = boneData;
|
|
8620
8401
|
}
|
|
8621
8402
|
get target() {
|
|
8622
|
-
if (!this._target)
|
|
8623
|
-
|
|
8624
|
-
else
|
|
8625
|
-
return this._target;
|
|
8403
|
+
if (!this._target) throw new Error("BoneData not set.");
|
|
8404
|
+
else return this._target;
|
|
8626
8405
|
}
|
|
8627
8406
|
mixRotate = 0;
|
|
8628
8407
|
mixX = 0;
|
|
@@ -8685,15 +8464,13 @@ var spine = (() => {
|
|
|
8685
8464
|
n = input.readInt(true);
|
|
8686
8465
|
for (let i = 0; i < n; i++) {
|
|
8687
8466
|
let str = input.readString();
|
|
8688
|
-
if (!str)
|
|
8689
|
-
throw new Error("String in string table must not be null.");
|
|
8467
|
+
if (!str) throw new Error("String in string table must not be null.");
|
|
8690
8468
|
input.strings.push(str);
|
|
8691
8469
|
}
|
|
8692
8470
|
n = input.readInt(true);
|
|
8693
8471
|
for (let i = 0; i < n; i++) {
|
|
8694
8472
|
let name = input.readString();
|
|
8695
|
-
if (!name)
|
|
8696
|
-
throw new Error("Bone name must not be null.");
|
|
8473
|
+
if (!name) throw new Error("Bone name must not be null.");
|
|
8697
8474
|
let parent = i == 0 ? null : skeletonData.bones[input.readInt(true)];
|
|
8698
8475
|
let data = new BoneData(i, name, parent);
|
|
8699
8476
|
data.rotation = input.readFloat();
|
|
@@ -8716,25 +8493,21 @@ var spine = (() => {
|
|
|
8716
8493
|
n = input.readInt(true);
|
|
8717
8494
|
for (let i = 0; i < n; i++) {
|
|
8718
8495
|
let slotName = input.readString();
|
|
8719
|
-
if (!slotName)
|
|
8720
|
-
throw new Error("Slot name must not be null.");
|
|
8496
|
+
if (!slotName) throw new Error("Slot name must not be null.");
|
|
8721
8497
|
let boneData = skeletonData.bones[input.readInt(true)];
|
|
8722
8498
|
let data = new SlotData(i, slotName, boneData);
|
|
8723
8499
|
Color.rgba8888ToColor(data.color, input.readInt32());
|
|
8724
8500
|
let darkColor = input.readInt32();
|
|
8725
|
-
if (darkColor != -1)
|
|
8726
|
-
Color.rgb888ToColor(data.darkColor = new Color(), darkColor);
|
|
8501
|
+
if (darkColor != -1) Color.rgb888ToColor(data.darkColor = new Color(), darkColor);
|
|
8727
8502
|
data.attachmentName = input.readStringRef();
|
|
8728
8503
|
data.blendMode = input.readInt(true);
|
|
8729
|
-
if (nonessential)
|
|
8730
|
-
data.visible = input.readBoolean();
|
|
8504
|
+
if (nonessential) data.visible = input.readBoolean();
|
|
8731
8505
|
skeletonData.slots.push(data);
|
|
8732
8506
|
}
|
|
8733
8507
|
n = input.readInt(true);
|
|
8734
8508
|
for (let i = 0, nn; i < n; i++) {
|
|
8735
8509
|
let name = input.readString();
|
|
8736
|
-
if (!name)
|
|
8737
|
-
throw new Error("IK constraint data name must not be null.");
|
|
8510
|
+
if (!name) throw new Error("IK constraint data name must not be null.");
|
|
8738
8511
|
let data = new IkConstraintData(name);
|
|
8739
8512
|
data.order = input.readInt(true);
|
|
8740
8513
|
nn = input.readInt(true);
|
|
@@ -8747,17 +8520,14 @@ var spine = (() => {
|
|
|
8747
8520
|
data.compress = (flags & 4) != 0;
|
|
8748
8521
|
data.stretch = (flags & 8) != 0;
|
|
8749
8522
|
data.uniform = (flags & 16) != 0;
|
|
8750
|
-
if ((flags & 32) != 0)
|
|
8751
|
-
|
|
8752
|
-
if ((flags & 128) != 0)
|
|
8753
|
-
data.softness = input.readFloat() * scale;
|
|
8523
|
+
if ((flags & 32) != 0) data.mix = (flags & 64) != 0 ? input.readFloat() : 1;
|
|
8524
|
+
if ((flags & 128) != 0) data.softness = input.readFloat() * scale;
|
|
8754
8525
|
skeletonData.ikConstraints.push(data);
|
|
8755
8526
|
}
|
|
8756
8527
|
n = input.readInt(true);
|
|
8757
8528
|
for (let i = 0, nn; i < n; i++) {
|
|
8758
8529
|
let name = input.readString();
|
|
8759
|
-
if (!name)
|
|
8760
|
-
throw new Error("Transform constraint data name must not be null.");
|
|
8530
|
+
if (!name) throw new Error("Transform constraint data name must not be null.");
|
|
8761
8531
|
let data = new TransformConstraintData(name);
|
|
8762
8532
|
data.order = input.readInt(true);
|
|
8763
8533
|
nn = input.readInt(true);
|
|
@@ -8768,38 +8538,25 @@ var spine = (() => {
|
|
|
8768
8538
|
data.skinRequired = (flags & 1) != 0;
|
|
8769
8539
|
data.local = (flags & 2) != 0;
|
|
8770
8540
|
data.relative = (flags & 4) != 0;
|
|
8771
|
-
if ((flags & 8) != 0)
|
|
8772
|
-
|
|
8773
|
-
if ((flags &
|
|
8774
|
-
|
|
8775
|
-
if ((flags &
|
|
8776
|
-
data.offsetY = input.readFloat() * scale;
|
|
8777
|
-
if ((flags & 64) != 0)
|
|
8778
|
-
data.offsetScaleX = input.readFloat();
|
|
8779
|
-
if ((flags & 128) != 0)
|
|
8780
|
-
data.offsetScaleY = input.readFloat();
|
|
8541
|
+
if ((flags & 8) != 0) data.offsetRotation = input.readFloat();
|
|
8542
|
+
if ((flags & 16) != 0) data.offsetX = input.readFloat() * scale;
|
|
8543
|
+
if ((flags & 32) != 0) data.offsetY = input.readFloat() * scale;
|
|
8544
|
+
if ((flags & 64) != 0) data.offsetScaleX = input.readFloat();
|
|
8545
|
+
if ((flags & 128) != 0) data.offsetScaleY = input.readFloat();
|
|
8781
8546
|
flags = input.readByte();
|
|
8782
|
-
if ((flags & 1) != 0)
|
|
8783
|
-
|
|
8784
|
-
if ((flags &
|
|
8785
|
-
|
|
8786
|
-
if ((flags &
|
|
8787
|
-
|
|
8788
|
-
if ((flags &
|
|
8789
|
-
data.mixY = input.readFloat();
|
|
8790
|
-
if ((flags & 16) != 0)
|
|
8791
|
-
data.mixScaleX = input.readFloat();
|
|
8792
|
-
if ((flags & 32) != 0)
|
|
8793
|
-
data.mixScaleY = input.readFloat();
|
|
8794
|
-
if ((flags & 64) != 0)
|
|
8795
|
-
data.mixShearY = input.readFloat();
|
|
8547
|
+
if ((flags & 1) != 0) data.offsetShearY = input.readFloat();
|
|
8548
|
+
if ((flags & 2) != 0) data.mixRotate = input.readFloat();
|
|
8549
|
+
if ((flags & 4) != 0) data.mixX = input.readFloat();
|
|
8550
|
+
if ((flags & 8) != 0) data.mixY = input.readFloat();
|
|
8551
|
+
if ((flags & 16) != 0) data.mixScaleX = input.readFloat();
|
|
8552
|
+
if ((flags & 32) != 0) data.mixScaleY = input.readFloat();
|
|
8553
|
+
if ((flags & 64) != 0) data.mixShearY = input.readFloat();
|
|
8796
8554
|
skeletonData.transformConstraints.push(data);
|
|
8797
8555
|
}
|
|
8798
8556
|
n = input.readInt(true);
|
|
8799
8557
|
for (let i = 0, nn; i < n; i++) {
|
|
8800
8558
|
let name = input.readString();
|
|
8801
|
-
if (!name)
|
|
8802
|
-
throw new Error("Path constraint data name must not be null.");
|
|
8559
|
+
if (!name) throw new Error("Path constraint data name must not be null.");
|
|
8803
8560
|
let data = new PathConstraintData(name);
|
|
8804
8561
|
data.order = input.readInt(true);
|
|
8805
8562
|
data.skinRequired = input.readBoolean();
|
|
@@ -8811,14 +8568,11 @@ var spine = (() => {
|
|
|
8811
8568
|
data.positionMode = flags & 1;
|
|
8812
8569
|
data.spacingMode = flags >> 1 & 3;
|
|
8813
8570
|
data.rotateMode = flags >> 3 & 3;
|
|
8814
|
-
if ((flags & 128) != 0)
|
|
8815
|
-
data.offsetRotation = input.readFloat();
|
|
8571
|
+
if ((flags & 128) != 0) data.offsetRotation = input.readFloat();
|
|
8816
8572
|
data.position = input.readFloat();
|
|
8817
|
-
if (data.positionMode == 0 /* Fixed */)
|
|
8818
|
-
data.position *= scale;
|
|
8573
|
+
if (data.positionMode == 0 /* Fixed */) data.position *= scale;
|
|
8819
8574
|
data.spacing = input.readFloat();
|
|
8820
|
-
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
|
|
8821
|
-
data.spacing *= scale;
|
|
8575
|
+
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */) data.spacing *= scale;
|
|
8822
8576
|
data.mixRotate = input.readFloat();
|
|
8823
8577
|
data.mixX = input.readFloat();
|
|
8824
8578
|
data.mixY = input.readFloat();
|
|
@@ -8827,23 +8581,17 @@ var spine = (() => {
|
|
|
8827
8581
|
n = input.readInt(true);
|
|
8828
8582
|
for (let i = 0, nn; i < n; i++) {
|
|
8829
8583
|
const name = input.readString();
|
|
8830
|
-
if (!name)
|
|
8831
|
-
throw new Error("Physics constraint data name must not be null.");
|
|
8584
|
+
if (!name) throw new Error("Physics constraint data name must not be null.");
|
|
8832
8585
|
const data = new PhysicsConstraintData(name);
|
|
8833
8586
|
data.order = input.readInt(true);
|
|
8834
8587
|
data.bone = skeletonData.bones[input.readInt(true)];
|
|
8835
8588
|
let flags = input.readByte();
|
|
8836
8589
|
data.skinRequired = (flags & 1) != 0;
|
|
8837
|
-
if ((flags & 2) != 0)
|
|
8838
|
-
|
|
8839
|
-
if ((flags &
|
|
8840
|
-
|
|
8841
|
-
if ((flags &
|
|
8842
|
-
data.rotate = input.readFloat();
|
|
8843
|
-
if ((flags & 16) != 0)
|
|
8844
|
-
data.scaleX = input.readFloat();
|
|
8845
|
-
if ((flags & 32) != 0)
|
|
8846
|
-
data.shearX = input.readFloat();
|
|
8590
|
+
if ((flags & 2) != 0) data.x = input.readFloat();
|
|
8591
|
+
if ((flags & 4) != 0) data.y = input.readFloat();
|
|
8592
|
+
if ((flags & 8) != 0) data.rotate = input.readFloat();
|
|
8593
|
+
if ((flags & 16) != 0) data.scaleX = input.readFloat();
|
|
8594
|
+
if ((flags & 32) != 0) data.shearX = input.readFloat();
|
|
8847
8595
|
data.limit = ((flags & 64) != 0 ? input.readFloat() : 5e3) * scale;
|
|
8848
8596
|
data.step = 1 / input.readUnsignedByte();
|
|
8849
8597
|
data.inertia = input.readFloat();
|
|
@@ -8853,20 +8601,13 @@ var spine = (() => {
|
|
|
8853
8601
|
data.wind = input.readFloat();
|
|
8854
8602
|
data.gravity = input.readFloat();
|
|
8855
8603
|
flags = input.readByte();
|
|
8856
|
-
if ((flags & 1) != 0)
|
|
8857
|
-
|
|
8858
|
-
if ((flags &
|
|
8859
|
-
|
|
8860
|
-
if ((flags &
|
|
8861
|
-
|
|
8862
|
-
if ((flags &
|
|
8863
|
-
data.massGlobal = true;
|
|
8864
|
-
if ((flags & 16) != 0)
|
|
8865
|
-
data.windGlobal = true;
|
|
8866
|
-
if ((flags & 32) != 0)
|
|
8867
|
-
data.gravityGlobal = true;
|
|
8868
|
-
if ((flags & 64) != 0)
|
|
8869
|
-
data.mixGlobal = true;
|
|
8604
|
+
if ((flags & 1) != 0) data.inertiaGlobal = true;
|
|
8605
|
+
if ((flags & 2) != 0) data.strengthGlobal = true;
|
|
8606
|
+
if ((flags & 4) != 0) data.dampingGlobal = true;
|
|
8607
|
+
if ((flags & 8) != 0) data.massGlobal = true;
|
|
8608
|
+
if ((flags & 16) != 0) data.windGlobal = true;
|
|
8609
|
+
if ((flags & 32) != 0) data.gravityGlobal = true;
|
|
8610
|
+
if ((flags & 64) != 0) data.mixGlobal = true;
|
|
8870
8611
|
data.mix = (flags & 128) != 0 ? input.readFloat() : 1;
|
|
8871
8612
|
skeletonData.physicsConstraints.push(data);
|
|
8872
8613
|
}
|
|
@@ -8880,8 +8621,7 @@ var spine = (() => {
|
|
|
8880
8621
|
Utils.setArraySize(skeletonData.skins, n = i + input.readInt(true));
|
|
8881
8622
|
for (; i < n; i++) {
|
|
8882
8623
|
let skin = this.readSkin(input, skeletonData, false, nonessential);
|
|
8883
|
-
if (!skin)
|
|
8884
|
-
throw new Error("readSkin() should not have returned null.");
|
|
8624
|
+
if (!skin) throw new Error("readSkin() should not have returned null.");
|
|
8885
8625
|
skeletonData.skins[i] = skin;
|
|
8886
8626
|
}
|
|
8887
8627
|
}
|
|
@@ -8889,22 +8629,18 @@ var spine = (() => {
|
|
|
8889
8629
|
for (let i = 0; i < n; i++) {
|
|
8890
8630
|
let linkedMesh = this.linkedMeshes[i];
|
|
8891
8631
|
const skin = skeletonData.skins[linkedMesh.skinIndex];
|
|
8892
|
-
if (!linkedMesh.parent)
|
|
8893
|
-
throw new Error("Linked mesh parent must not be null");
|
|
8632
|
+
if (!linkedMesh.parent) throw new Error("Linked mesh parent must not be null");
|
|
8894
8633
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
8895
|
-
if (!parent)
|
|
8896
|
-
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
8634
|
+
if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
8897
8635
|
linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
8898
8636
|
linkedMesh.mesh.setParentMesh(parent);
|
|
8899
|
-
if (linkedMesh.mesh.region != null)
|
|
8900
|
-
linkedMesh.mesh.updateRegion();
|
|
8637
|
+
if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion();
|
|
8901
8638
|
}
|
|
8902
8639
|
this.linkedMeshes.length = 0;
|
|
8903
8640
|
n = input.readInt(true);
|
|
8904
8641
|
for (let i = 0; i < n; i++) {
|
|
8905
8642
|
let eventName = input.readString();
|
|
8906
|
-
if (!eventName)
|
|
8907
|
-
throw new Error("Event data name must not be null");
|
|
8643
|
+
if (!eventName) throw new Error("Event data name must not be null");
|
|
8908
8644
|
let data = new EventData(eventName);
|
|
8909
8645
|
data.intValue = input.readInt(false);
|
|
8910
8646
|
data.floatValue = input.readFloat();
|
|
@@ -8919,8 +8655,7 @@ var spine = (() => {
|
|
|
8919
8655
|
n = input.readInt(true);
|
|
8920
8656
|
for (let i = 0; i < n; i++) {
|
|
8921
8657
|
let animationName = input.readString();
|
|
8922
|
-
if (!animationName)
|
|
8923
|
-
throw new Error("Animatio name must not be null.");
|
|
8658
|
+
if (!animationName) throw new Error("Animatio name must not be null.");
|
|
8924
8659
|
skeletonData.animations.push(this.readAnimation(input, animationName, skeletonData));
|
|
8925
8660
|
}
|
|
8926
8661
|
return skeletonData;
|
|
@@ -8930,16 +8665,13 @@ var spine = (() => {
|
|
|
8930
8665
|
let slotCount = 0;
|
|
8931
8666
|
if (defaultSkin) {
|
|
8932
8667
|
slotCount = input.readInt(true);
|
|
8933
|
-
if (slotCount == 0)
|
|
8934
|
-
return null;
|
|
8668
|
+
if (slotCount == 0) return null;
|
|
8935
8669
|
skin = new Skin("default");
|
|
8936
8670
|
} else {
|
|
8937
8671
|
let skinName = input.readString();
|
|
8938
|
-
if (!skinName)
|
|
8939
|
-
throw new Error("Skin name must not be null.");
|
|
8672
|
+
if (!skinName) throw new Error("Skin name must not be null.");
|
|
8940
8673
|
skin = new Skin(skinName);
|
|
8941
|
-
if (nonessential)
|
|
8942
|
-
Color.rgba8888ToColor(skin.color, input.readInt32());
|
|
8674
|
+
if (nonessential) Color.rgba8888ToColor(skin.color, input.readInt32());
|
|
8943
8675
|
skin.bones.length = input.readInt(true);
|
|
8944
8676
|
for (let i = 0, n = skin.bones.length; i < n; i++)
|
|
8945
8677
|
skin.bones[i] = skeletonData.bones[input.readInt(true)];
|
|
@@ -8960,8 +8692,7 @@ var spine = (() => {
|
|
|
8960
8692
|
if (!name)
|
|
8961
8693
|
throw new Error("Attachment name must not be null");
|
|
8962
8694
|
let attachment = this.readAttachment(input, skeletonData, skin, slotIndex, name, nonessential);
|
|
8963
|
-
if (attachment)
|
|
8964
|
-
skin.setAttachment(slotIndex, name, attachment);
|
|
8695
|
+
if (attachment) skin.setAttachment(slotIndex, name, attachment);
|
|
8965
8696
|
}
|
|
8966
8697
|
}
|
|
8967
8698
|
return skin;
|
|
@@ -8970,10 +8701,10 @@ var spine = (() => {
|
|
|
8970
8701
|
let scale = this.scale;
|
|
8971
8702
|
let flags = input.readByte();
|
|
8972
8703
|
const name = (flags & 8) != 0 ? input.readStringRef() : attachmentName;
|
|
8973
|
-
if (!name)
|
|
8974
|
-
throw new Error("Attachment name must not be null");
|
|
8704
|
+
if (!name) throw new Error("Attachment name must not be null");
|
|
8975
8705
|
switch (flags & 7) {
|
|
8976
|
-
|
|
8706
|
+
// BUG?
|
|
8707
|
+
case 0 /* Region */: {
|
|
8977
8708
|
let path = (flags & 16) != 0 ? input.readStringRef() : null;
|
|
8978
8709
|
const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
|
|
8979
8710
|
const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
|
|
@@ -8984,11 +8715,9 @@ var spine = (() => {
|
|
|
8984
8715
|
let scaleY = input.readFloat();
|
|
8985
8716
|
let width = input.readFloat();
|
|
8986
8717
|
let height = input.readFloat();
|
|
8987
|
-
if (!path)
|
|
8988
|
-
path = name;
|
|
8718
|
+
if (!path) path = name;
|
|
8989
8719
|
let region = this.attachmentLoader.newRegionAttachment(skin, name, path, sequence);
|
|
8990
|
-
if (!region)
|
|
8991
|
-
return null;
|
|
8720
|
+
if (!region) return null;
|
|
8992
8721
|
region.path = path;
|
|
8993
8722
|
region.x = x * scale;
|
|
8994
8723
|
region.y = y * scale;
|
|
@@ -8999,24 +8728,21 @@ var spine = (() => {
|
|
|
8999
8728
|
region.height = height * scale;
|
|
9000
8729
|
Color.rgba8888ToColor(region.color, color);
|
|
9001
8730
|
region.sequence = sequence;
|
|
9002
|
-
if (sequence == null)
|
|
9003
|
-
region.updateRegion();
|
|
8731
|
+
if (sequence == null) region.updateRegion();
|
|
9004
8732
|
return region;
|
|
9005
8733
|
}
|
|
9006
|
-
case
|
|
8734
|
+
case 1 /* BoundingBox */: {
|
|
9007
8735
|
let vertices = this.readVertices(input, (flags & 16) != 0);
|
|
9008
8736
|
let color = nonessential ? input.readInt32() : 0;
|
|
9009
8737
|
let box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);
|
|
9010
|
-
if (!box)
|
|
9011
|
-
return null;
|
|
8738
|
+
if (!box) return null;
|
|
9012
8739
|
box.worldVerticesLength = vertices.length;
|
|
9013
8740
|
box.vertices = vertices.vertices;
|
|
9014
8741
|
box.bones = vertices.bones;
|
|
9015
|
-
if (nonessential)
|
|
9016
|
-
Color.rgba8888ToColor(box.color, color);
|
|
8742
|
+
if (nonessential) Color.rgba8888ToColor(box.color, color);
|
|
9017
8743
|
return box;
|
|
9018
8744
|
}
|
|
9019
|
-
case
|
|
8745
|
+
case 2 /* Mesh */: {
|
|
9020
8746
|
let path = (flags & 16) != 0 ? input.readStringRef() : name;
|
|
9021
8747
|
const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
|
|
9022
8748
|
const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
|
|
@@ -9031,11 +8757,9 @@ var spine = (() => {
|
|
|
9031
8757
|
width = input.readFloat();
|
|
9032
8758
|
height = input.readFloat();
|
|
9033
8759
|
}
|
|
9034
|
-
if (!path)
|
|
9035
|
-
path = name;
|
|
8760
|
+
if (!path) path = name;
|
|
9036
8761
|
let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
|
|
9037
|
-
if (!mesh)
|
|
9038
|
-
return null;
|
|
8762
|
+
if (!mesh) return null;
|
|
9039
8763
|
mesh.path = path;
|
|
9040
8764
|
Color.rgba8888ToColor(mesh.color, color);
|
|
9041
8765
|
mesh.bones = vertices.bones;
|
|
@@ -9043,8 +8767,7 @@ var spine = (() => {
|
|
|
9043
8767
|
mesh.worldVerticesLength = vertices.length;
|
|
9044
8768
|
mesh.triangles = triangles;
|
|
9045
8769
|
mesh.regionUVs = uvs;
|
|
9046
|
-
if (sequence == null)
|
|
9047
|
-
mesh.updateRegion();
|
|
8770
|
+
if (sequence == null) mesh.updateRegion();
|
|
9048
8771
|
mesh.hullLength = hullLength << 1;
|
|
9049
8772
|
mesh.sequence = sequence;
|
|
9050
8773
|
if (nonessential) {
|
|
@@ -9054,10 +8777,9 @@ var spine = (() => {
|
|
|
9054
8777
|
}
|
|
9055
8778
|
return mesh;
|
|
9056
8779
|
}
|
|
9057
|
-
case
|
|
8780
|
+
case 3 /* LinkedMesh */: {
|
|
9058
8781
|
const path = (flags & 16) != 0 ? input.readStringRef() : name;
|
|
9059
|
-
if (path == null)
|
|
9060
|
-
throw new Error("Path of linked mesh must not be null");
|
|
8782
|
+
if (path == null) throw new Error("Path of linked mesh must not be null");
|
|
9061
8783
|
const color = (flags & 32) != 0 ? input.readInt32() : 4294967295;
|
|
9062
8784
|
const sequence = (flags & 64) != 0 ? this.readSequence(input) : null;
|
|
9063
8785
|
const inheritTimelines = (flags & 128) != 0;
|
|
@@ -9069,8 +8791,7 @@ var spine = (() => {
|
|
|
9069
8791
|
height = input.readFloat();
|
|
9070
8792
|
}
|
|
9071
8793
|
let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
|
|
9072
|
-
if (!mesh)
|
|
9073
|
-
return null;
|
|
8794
|
+
if (!mesh) return null;
|
|
9074
8795
|
mesh.path = path;
|
|
9075
8796
|
Color.rgba8888ToColor(mesh.color, color);
|
|
9076
8797
|
mesh.sequence = sequence;
|
|
@@ -9081,7 +8802,7 @@ var spine = (() => {
|
|
|
9081
8802
|
this.linkedMeshes.push(new LinkedMesh(mesh, skinIndex, slotIndex, parent, inheritTimelines));
|
|
9082
8803
|
return mesh;
|
|
9083
8804
|
}
|
|
9084
|
-
case
|
|
8805
|
+
case 4 /* Path */: {
|
|
9085
8806
|
const closed2 = (flags & 16) != 0;
|
|
9086
8807
|
const constantSpeed = (flags & 32) != 0;
|
|
9087
8808
|
const vertices = this.readVertices(input, (flags & 64) != 0);
|
|
@@ -9090,46 +8811,40 @@ var spine = (() => {
|
|
|
9090
8811
|
lengths[i] = input.readFloat() * scale;
|
|
9091
8812
|
const color = nonessential ? input.readInt32() : 0;
|
|
9092
8813
|
const path = this.attachmentLoader.newPathAttachment(skin, name);
|
|
9093
|
-
if (!path)
|
|
9094
|
-
return null;
|
|
8814
|
+
if (!path) return null;
|
|
9095
8815
|
path.closed = closed2;
|
|
9096
8816
|
path.constantSpeed = constantSpeed;
|
|
9097
8817
|
path.worldVerticesLength = vertices.length;
|
|
9098
8818
|
path.vertices = vertices.vertices;
|
|
9099
8819
|
path.bones = vertices.bones;
|
|
9100
8820
|
path.lengths = lengths;
|
|
9101
|
-
if (nonessential)
|
|
9102
|
-
Color.rgba8888ToColor(path.color, color);
|
|
8821
|
+
if (nonessential) Color.rgba8888ToColor(path.color, color);
|
|
9103
8822
|
return path;
|
|
9104
8823
|
}
|
|
9105
|
-
case
|
|
8824
|
+
case 5 /* Point */: {
|
|
9106
8825
|
const rotation = input.readFloat();
|
|
9107
8826
|
const x = input.readFloat();
|
|
9108
8827
|
const y = input.readFloat();
|
|
9109
8828
|
const color = nonessential ? input.readInt32() : 0;
|
|
9110
8829
|
const point = this.attachmentLoader.newPointAttachment(skin, name);
|
|
9111
|
-
if (!point)
|
|
9112
|
-
return null;
|
|
8830
|
+
if (!point) return null;
|
|
9113
8831
|
point.x = x * scale;
|
|
9114
8832
|
point.y = y * scale;
|
|
9115
8833
|
point.rotation = rotation;
|
|
9116
|
-
if (nonessential)
|
|
9117
|
-
Color.rgba8888ToColor(point.color, color);
|
|
8834
|
+
if (nonessential) Color.rgba8888ToColor(point.color, color);
|
|
9118
8835
|
return point;
|
|
9119
8836
|
}
|
|
9120
|
-
case
|
|
8837
|
+
case 6 /* Clipping */: {
|
|
9121
8838
|
const endSlotIndex = input.readInt(true);
|
|
9122
8839
|
const vertices = this.readVertices(input, (flags & 16) != 0);
|
|
9123
8840
|
let color = nonessential ? input.readInt32() : 0;
|
|
9124
8841
|
let clip = this.attachmentLoader.newClippingAttachment(skin, name);
|
|
9125
|
-
if (!clip)
|
|
9126
|
-
return null;
|
|
8842
|
+
if (!clip) return null;
|
|
9127
8843
|
clip.endSlot = skeletonData.slots[endSlotIndex];
|
|
9128
8844
|
clip.worldVerticesLength = vertices.length;
|
|
9129
8845
|
clip.vertices = vertices.vertices;
|
|
9130
8846
|
clip.bones = vertices.bones;
|
|
9131
|
-
if (nonessential)
|
|
9132
|
-
Color.rgba8888ToColor(clip.color, color);
|
|
8847
|
+
if (nonessential) Color.rgba8888ToColor(clip.color, color);
|
|
9133
8848
|
return clip;
|
|
9134
8849
|
}
|
|
9135
8850
|
}
|
|
@@ -9212,8 +8927,7 @@ var spine = (() => {
|
|
|
9212
8927
|
let a = input.readUnsignedByte() / 255;
|
|
9213
8928
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9214
8929
|
timeline.setFrame(frame, time, r, g, b, a);
|
|
9215
|
-
if (frame == frameLast)
|
|
9216
|
-
break;
|
|
8930
|
+
if (frame == frameLast) break;
|
|
9217
8931
|
let time2 = input.readFloat();
|
|
9218
8932
|
let r2 = input.readUnsignedByte() / 255;
|
|
9219
8933
|
let g2 = input.readUnsignedByte() / 255;
|
|
@@ -9247,8 +8961,7 @@ var spine = (() => {
|
|
|
9247
8961
|
let b = input.readUnsignedByte() / 255;
|
|
9248
8962
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9249
8963
|
timeline.setFrame(frame, time, r, g, b);
|
|
9250
|
-
if (frame == frameLast)
|
|
9251
|
-
break;
|
|
8964
|
+
if (frame == frameLast) break;
|
|
9252
8965
|
let time2 = input.readFloat();
|
|
9253
8966
|
let r2 = input.readUnsignedByte() / 255;
|
|
9254
8967
|
let g2 = input.readUnsignedByte() / 255;
|
|
@@ -9283,8 +8996,7 @@ var spine = (() => {
|
|
|
9283
8996
|
let b2 = input.readUnsignedByte() / 255;
|
|
9284
8997
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9285
8998
|
timeline.setFrame(frame, time, r, g, b, a, r2, g2, b2);
|
|
9286
|
-
if (frame == frameLast)
|
|
9287
|
-
break;
|
|
8999
|
+
if (frame == frameLast) break;
|
|
9288
9000
|
let time2 = input.readFloat();
|
|
9289
9001
|
let nr = input.readUnsignedByte() / 255;
|
|
9290
9002
|
let ng = input.readUnsignedByte() / 255;
|
|
@@ -9330,8 +9042,7 @@ var spine = (() => {
|
|
|
9330
9042
|
let b2 = input.readUnsignedByte() / 255;
|
|
9331
9043
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9332
9044
|
timeline.setFrame(frame, time, r, g, b, r2, g2, b2);
|
|
9333
|
-
if (frame == frameLast)
|
|
9334
|
-
break;
|
|
9045
|
+
if (frame == frameLast) break;
|
|
9335
9046
|
let time2 = input.readFloat();
|
|
9336
9047
|
let nr = input.readUnsignedByte() / 255;
|
|
9337
9048
|
let ng = input.readUnsignedByte() / 255;
|
|
@@ -9367,8 +9078,7 @@ var spine = (() => {
|
|
|
9367
9078
|
let time = input.readFloat(), a = input.readUnsignedByte() / 255;
|
|
9368
9079
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9369
9080
|
timeline.setFrame(frame, time, a);
|
|
9370
|
-
if (frame == frameLast)
|
|
9371
|
-
break;
|
|
9081
|
+
if (frame == frameLast) break;
|
|
9372
9082
|
let time2 = input.readFloat();
|
|
9373
9083
|
let a2 = input.readUnsignedByte() / 255;
|
|
9374
9084
|
switch (input.readByte()) {
|
|
@@ -9440,8 +9150,7 @@ var spine = (() => {
|
|
|
9440
9150
|
let softness = (flags & 4) != 0 ? input.readFloat() * scale : 0;
|
|
9441
9151
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9442
9152
|
timeline.setFrame(frame, time, mix, softness, (flags & 8) != 0 ? 1 : -1, (flags & 16) != 0, (flags & 32) != 0);
|
|
9443
|
-
if (frame == frameLast)
|
|
9444
|
-
break;
|
|
9153
|
+
if (frame == frameLast) break;
|
|
9445
9154
|
flags = input.readByte();
|
|
9446
9155
|
const time2 = input.readFloat(), mix2 = (flags & 1) != 0 ? (flags & 2) != 0 ? input.readFloat() : 1 : 0;
|
|
9447
9156
|
const softness2 = (flags & 4) != 0 ? input.readFloat() * scale : 0;
|
|
@@ -9463,8 +9172,7 @@ var spine = (() => {
|
|
|
9463
9172
|
let time = input.readFloat(), mixRotate = input.readFloat(), mixX = input.readFloat(), mixY = input.readFloat(), mixScaleX = input.readFloat(), mixScaleY = input.readFloat(), mixShearY = input.readFloat();
|
|
9464
9173
|
for (let frame = 0, bezier = 0; ; frame++) {
|
|
9465
9174
|
timeline.setFrame(frame, time, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY);
|
|
9466
|
-
if (frame == frameLast)
|
|
9467
|
-
break;
|
|
9175
|
+
if (frame == frameLast) break;
|
|
9468
9176
|
let time2 = input.readFloat(), mixRotate2 = input.readFloat(), mixX2 = input.readFloat(), mixY2 = input.readFloat(), mixScaleX2 = input.readFloat(), mixScaleY2 = input.readFloat(), mixShearY2 = input.readFloat();
|
|
9469
9177
|
switch (input.readByte()) {
|
|
9470
9178
|
case CURVE_STEPPED:
|
|
@@ -9513,8 +9221,7 @@ var spine = (() => {
|
|
|
9513
9221
|
let time = input.readFloat(), mixRotate = input.readFloat(), mixX = input.readFloat(), mixY = input.readFloat();
|
|
9514
9222
|
for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
|
|
9515
9223
|
timeline.setFrame(frame, time, mixRotate, mixX, mixY);
|
|
9516
|
-
if (frame == frameLast)
|
|
9517
|
-
break;
|
|
9224
|
+
if (frame == frameLast) break;
|
|
9518
9225
|
let time2 = input.readFloat(), mixRotate2 = input.readFloat(), mixX2 = input.readFloat(), mixY2 = input.readFloat();
|
|
9519
9226
|
switch (input.readByte()) {
|
|
9520
9227
|
case CURVE_STEPPED:
|
|
@@ -9576,8 +9283,7 @@ var spine = (() => {
|
|
|
9576
9283
|
let slotIndex = input.readInt(true);
|
|
9577
9284
|
for (let iii = 0, nnn = input.readInt(true); iii < nnn; iii++) {
|
|
9578
9285
|
let attachmentName = input.readStringRef();
|
|
9579
|
-
if (!attachmentName)
|
|
9580
|
-
throw new Error("attachmentName must not be null.");
|
|
9286
|
+
if (!attachmentName) throw new Error("attachmentName must not be null.");
|
|
9581
9287
|
let attachment = skin.getAttachment(slotIndex, attachmentName);
|
|
9582
9288
|
let timelineType = input.readByte();
|
|
9583
9289
|
let frameCount = input.readInt(true);
|
|
@@ -9613,8 +9319,7 @@ var spine = (() => {
|
|
|
9613
9319
|
}
|
|
9614
9320
|
}
|
|
9615
9321
|
timeline.setFrame(frame, time, deform);
|
|
9616
|
-
if (frame == frameLast)
|
|
9617
|
-
break;
|
|
9322
|
+
if (frame == frameLast) break;
|
|
9618
9323
|
let time2 = input.readFloat();
|
|
9619
9324
|
switch (input.readByte()) {
|
|
9620
9325
|
case CURVE_STEPPED:
|
|
@@ -9669,8 +9374,7 @@ var spine = (() => {
|
|
|
9669
9374
|
while (originalIndex < slotCount)
|
|
9670
9375
|
unchanged[unchangedIndex++] = originalIndex++;
|
|
9671
9376
|
for (let ii = slotCount - 1; ii >= 0; ii--)
|
|
9672
|
-
if (drawOrder[ii] == -1)
|
|
9673
|
-
drawOrder[ii] = unchanged[--unchangedIndex];
|
|
9377
|
+
if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];
|
|
9674
9378
|
timeline.setFrame(i, time, drawOrder);
|
|
9675
9379
|
}
|
|
9676
9380
|
timelines.push(timeline);
|
|
@@ -9685,8 +9389,7 @@ var spine = (() => {
|
|
|
9685
9389
|
event.intValue = input.readInt(false);
|
|
9686
9390
|
event.floatValue = input.readFloat();
|
|
9687
9391
|
event.stringValue = input.readString();
|
|
9688
|
-
if (event.stringValue == null)
|
|
9689
|
-
event.stringValue = eventData.stringValue;
|
|
9392
|
+
if (event.stringValue == null) event.stringValue = eventData.stringValue;
|
|
9690
9393
|
if (event.data.audioPath) {
|
|
9691
9394
|
event.volume = input.readFloat();
|
|
9692
9395
|
event.balance = input.readFloat();
|
|
@@ -9808,22 +9511,11 @@ var spine = (() => {
|
|
|
9808
9511
|
this.length = length;
|
|
9809
9512
|
}
|
|
9810
9513
|
};
|
|
9811
|
-
var AttachmentType = /* @__PURE__ */ ((AttachmentType2) => {
|
|
9812
|
-
AttachmentType2[AttachmentType2["Region"] = 0] = "Region";
|
|
9813
|
-
AttachmentType2[AttachmentType2["BoundingBox"] = 1] = "BoundingBox";
|
|
9814
|
-
AttachmentType2[AttachmentType2["Mesh"] = 2] = "Mesh";
|
|
9815
|
-
AttachmentType2[AttachmentType2["LinkedMesh"] = 3] = "LinkedMesh";
|
|
9816
|
-
AttachmentType2[AttachmentType2["Path"] = 4] = "Path";
|
|
9817
|
-
AttachmentType2[AttachmentType2["Point"] = 5] = "Point";
|
|
9818
|
-
AttachmentType2[AttachmentType2["Clipping"] = 6] = "Clipping";
|
|
9819
|
-
return AttachmentType2;
|
|
9820
|
-
})(AttachmentType || {});
|
|
9821
9514
|
function readTimeline1(input, timeline, scale) {
|
|
9822
9515
|
let time = input.readFloat(), value = input.readFloat() * scale;
|
|
9823
9516
|
for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
|
|
9824
9517
|
timeline.setFrame(frame, time, value);
|
|
9825
|
-
if (frame == frameLast)
|
|
9826
|
-
break;
|
|
9518
|
+
if (frame == frameLast) break;
|
|
9827
9519
|
let time2 = input.readFloat(), value2 = input.readFloat() * scale;
|
|
9828
9520
|
switch (input.readByte()) {
|
|
9829
9521
|
case CURVE_STEPPED:
|
|
@@ -9841,8 +9533,7 @@ var spine = (() => {
|
|
|
9841
9533
|
let time = input.readFloat(), value1 = input.readFloat() * scale, value2 = input.readFloat() * scale;
|
|
9842
9534
|
for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
|
|
9843
9535
|
timeline.setFrame(frame, time, value1, value2);
|
|
9844
|
-
if (frame == frameLast)
|
|
9845
|
-
break;
|
|
9536
|
+
if (frame == frameLast) break;
|
|
9846
9537
|
let time2 = input.readFloat(), nvalue1 = input.readFloat() * scale, nvalue2 = input.readFloat() * scale;
|
|
9847
9538
|
switch (input.readByte()) {
|
|
9848
9539
|
case CURVE_STEPPED:
|
|
@@ -9916,8 +9607,7 @@ var spine = (() => {
|
|
|
9916
9607
|
* @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the
|
|
9917
9608
|
* SkeletonBounds AABB methods will always return true. */
|
|
9918
9609
|
update(skeleton, updateAabb) {
|
|
9919
|
-
if (!skeleton)
|
|
9920
|
-
throw new Error("skeleton cannot be null.");
|
|
9610
|
+
if (!skeleton) throw new Error("skeleton cannot be null.");
|
|
9921
9611
|
let boundingBoxes = this.boundingBoxes;
|
|
9922
9612
|
let polygons = this.polygons;
|
|
9923
9613
|
let polygonPool = this.polygonPool;
|
|
@@ -9928,8 +9618,7 @@ var spine = (() => {
|
|
|
9928
9618
|
polygons.length = 0;
|
|
9929
9619
|
for (let i = 0; i < slotCount; i++) {
|
|
9930
9620
|
let slot = slots[i];
|
|
9931
|
-
if (!slot.bone.active)
|
|
9932
|
-
continue;
|
|
9621
|
+
if (!slot.bone.active) continue;
|
|
9933
9622
|
let attachment = slot.getAttachment();
|
|
9934
9623
|
if (attachment instanceof BoundingBoxAttachment) {
|
|
9935
9624
|
let boundingBox = attachment;
|
|
@@ -9985,17 +9674,13 @@ var spine = (() => {
|
|
|
9985
9674
|
return false;
|
|
9986
9675
|
let m = (y2 - y1) / (x2 - x1);
|
|
9987
9676
|
let y = m * (minX - x1) + y1;
|
|
9988
|
-
if (y > minY && y < maxY)
|
|
9989
|
-
return true;
|
|
9677
|
+
if (y > minY && y < maxY) return true;
|
|
9990
9678
|
y = m * (maxX - x1) + y1;
|
|
9991
|
-
if (y > minY && y < maxY)
|
|
9992
|
-
return true;
|
|
9679
|
+
if (y > minY && y < maxY) return true;
|
|
9993
9680
|
let x = (minY - y1) / m + x1;
|
|
9994
|
-
if (x > minX && x < maxX)
|
|
9995
|
-
return true;
|
|
9681
|
+
if (x > minX && x < maxX) return true;
|
|
9996
9682
|
x = (maxY - y1) / m + x1;
|
|
9997
|
-
if (x > minX && x < maxX)
|
|
9998
|
-
return true;
|
|
9683
|
+
if (x > minX && x < maxX) return true;
|
|
9999
9684
|
return false;
|
|
10000
9685
|
}
|
|
10001
9686
|
/** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
|
|
@@ -10007,8 +9692,7 @@ var spine = (() => {
|
|
|
10007
9692
|
containsPoint(x, y) {
|
|
10008
9693
|
let polygons = this.polygons;
|
|
10009
9694
|
for (let i = 0, n = polygons.length; i < n; i++)
|
|
10010
|
-
if (this.containsPointPolygon(polygons[i], x, y))
|
|
10011
|
-
return this.boundingBoxes[i];
|
|
9695
|
+
if (this.containsPointPolygon(polygons[i], x, y)) return this.boundingBoxes[i];
|
|
10012
9696
|
return null;
|
|
10013
9697
|
}
|
|
10014
9698
|
/** Returns true if the polygon contains the point. */
|
|
@@ -10022,8 +9706,7 @@ var spine = (() => {
|
|
|
10022
9706
|
let prevY = vertices[prevIndex + 1];
|
|
10023
9707
|
if (vertexY < y && prevY >= y || prevY < y && vertexY >= y) {
|
|
10024
9708
|
let vertexX = vertices[ii];
|
|
10025
|
-
if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x)
|
|
10026
|
-
inside = !inside;
|
|
9709
|
+
if (vertexX + (y - vertexY) / (prevY - vertexY) * (vertices[prevIndex] - vertexX) < x) inside = !inside;
|
|
10027
9710
|
}
|
|
10028
9711
|
prevIndex = ii;
|
|
10029
9712
|
}
|
|
@@ -10035,8 +9718,7 @@ var spine = (() => {
|
|
|
10035
9718
|
intersectsSegment(x1, y1, x2, y2) {
|
|
10036
9719
|
let polygons = this.polygons;
|
|
10037
9720
|
for (let i = 0, n = polygons.length; i < n; i++)
|
|
10038
|
-
if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2))
|
|
10039
|
-
return this.boundingBoxes[i];
|
|
9721
|
+
if (this.intersectsSegmentPolygon(polygons[i], x1, y1, x2, y2)) return this.boundingBoxes[i];
|
|
10040
9722
|
return null;
|
|
10041
9723
|
}
|
|
10042
9724
|
/** Returns true if the polygon contains any part of the line segment. */
|
|
@@ -10054,8 +9736,7 @@ var spine = (() => {
|
|
|
10054
9736
|
let x = (det1 * width34 - width12 * det2) / det3;
|
|
10055
9737
|
if ((x >= x3 && x <= x4 || x >= x4 && x <= x3) && (x >= x1 && x <= x2 || x >= x2 && x <= x1)) {
|
|
10056
9738
|
let y = (det1 * height34 - height12 * det2) / det3;
|
|
10057
|
-
if ((y >= y3 && y <= y4 || y >= y4 && y <= y3) && (y >= y1 && y <= y2 || y >= y2 && y <= y1))
|
|
10058
|
-
return true;
|
|
9739
|
+
if ((y >= y3 && y <= y4 || y >= y4 && y <= y3) && (y >= y1 && y <= y2 || y >= y2 && y <= y1)) return true;
|
|
10059
9740
|
}
|
|
10060
9741
|
x3 = x4;
|
|
10061
9742
|
y3 = y4;
|
|
@@ -10064,8 +9745,7 @@ var spine = (() => {
|
|
|
10064
9745
|
}
|
|
10065
9746
|
/** Returns the polygon for the specified bounding box, or null. */
|
|
10066
9747
|
getPolygon(boundingBox) {
|
|
10067
|
-
if (!boundingBox)
|
|
10068
|
-
throw new Error("boundingBox cannot be null.");
|
|
9748
|
+
if (!boundingBox) throw new Error("boundingBox cannot be null.");
|
|
10069
9749
|
let index = this.boundingBoxes.indexOf(boundingBox);
|
|
10070
9750
|
return index == -1 ? null : this.polygons[index];
|
|
10071
9751
|
}
|
|
@@ -10080,7 +9760,7 @@ var spine = (() => {
|
|
|
10080
9760
|
};
|
|
10081
9761
|
|
|
10082
9762
|
// spine-core/src/Triangulator.ts
|
|
10083
|
-
var Triangulator = class {
|
|
9763
|
+
var Triangulator = class _Triangulator {
|
|
10084
9764
|
convexPolygons = new Array();
|
|
10085
9765
|
convexPolygonsIndices = new Array();
|
|
10086
9766
|
indicesArray = new Array();
|
|
@@ -10102,7 +9782,7 @@ var spine = (() => {
|
|
|
10102
9782
|
let isConcave = this.isConcaveArray;
|
|
10103
9783
|
isConcave.length = 0;
|
|
10104
9784
|
for (let i = 0, n = vertexCount; i < n; ++i)
|
|
10105
|
-
isConcave[i] =
|
|
9785
|
+
isConcave[i] = _Triangulator.isConcave(i, vertexCount, vertices, indices);
|
|
10106
9786
|
let triangles = this.triangles;
|
|
10107
9787
|
triangles.length = 0;
|
|
10108
9788
|
while (vertexCount > 3) {
|
|
@@ -10115,14 +9795,12 @@ var spine = (() => {
|
|
|
10115
9795
|
let p2x = vertices[p2], p2y = vertices[p2 + 1];
|
|
10116
9796
|
let p3x = vertices[p3], p3y = vertices[p3 + 1];
|
|
10117
9797
|
for (let ii = (next + 1) % vertexCount; ii != previous; ii = (ii + 1) % vertexCount) {
|
|
10118
|
-
if (!isConcave[ii])
|
|
10119
|
-
continue;
|
|
9798
|
+
if (!isConcave[ii]) continue;
|
|
10120
9799
|
let v = indices[ii] << 1;
|
|
10121
9800
|
let vx = vertices[v], vy = vertices[v + 1];
|
|
10122
|
-
if (
|
|
10123
|
-
if (
|
|
10124
|
-
if (
|
|
10125
|
-
break outer;
|
|
9801
|
+
if (_Triangulator.positiveArea(p3x, p3y, p1x, p1y, vx, vy)) {
|
|
9802
|
+
if (_Triangulator.positiveArea(p1x, p1y, p2x, p2y, vx, vy)) {
|
|
9803
|
+
if (_Triangulator.positiveArea(p2x, p2y, p3x, p3y, vx, vy)) break outer;
|
|
10126
9804
|
}
|
|
10127
9805
|
}
|
|
10128
9806
|
}
|
|
@@ -10130,8 +9808,7 @@ var spine = (() => {
|
|
|
10130
9808
|
}
|
|
10131
9809
|
if (next == 0) {
|
|
10132
9810
|
do {
|
|
10133
|
-
if (!isConcave[i])
|
|
10134
|
-
break;
|
|
9811
|
+
if (!isConcave[i]) break;
|
|
10135
9812
|
i--;
|
|
10136
9813
|
} while (i > 0);
|
|
10137
9814
|
break;
|
|
@@ -10148,8 +9825,8 @@ var spine = (() => {
|
|
|
10148
9825
|
vertexCount--;
|
|
10149
9826
|
let previousIndex = (vertexCount + i - 1) % vertexCount;
|
|
10150
9827
|
let nextIndex = i == vertexCount ? 0 : i;
|
|
10151
|
-
isConcave[previousIndex] =
|
|
10152
|
-
isConcave[nextIndex] =
|
|
9828
|
+
isConcave[previousIndex] = _Triangulator.isConcave(previousIndex, vertexCount, vertices, indices);
|
|
9829
|
+
isConcave[nextIndex] = _Triangulator.isConcave(nextIndex, vertexCount, vertices, indices);
|
|
10153
9830
|
}
|
|
10154
9831
|
if (vertexCount == 3) {
|
|
10155
9832
|
triangles.push(indices[2]);
|
|
@@ -10179,8 +9856,8 @@ var spine = (() => {
|
|
|
10179
9856
|
let merged = false;
|
|
10180
9857
|
if (fanBaseIndex == t1) {
|
|
10181
9858
|
let o = polygon.length - 4;
|
|
10182
|
-
let winding1 =
|
|
10183
|
-
let winding2 =
|
|
9859
|
+
let winding1 = _Triangulator.winding(polygon[o], polygon[o + 1], polygon[o + 2], polygon[o + 3], x3, y3);
|
|
9860
|
+
let winding2 = _Triangulator.winding(x3, y3, polygon[0], polygon[1], polygon[2], polygon[3]);
|
|
10184
9861
|
if (winding1 == lastWinding && winding2 == lastWinding) {
|
|
10185
9862
|
polygon.push(x3);
|
|
10186
9863
|
polygon.push(y3);
|
|
@@ -10209,7 +9886,7 @@ var spine = (() => {
|
|
|
10209
9886
|
polygonIndices.push(t1);
|
|
10210
9887
|
polygonIndices.push(t2);
|
|
10211
9888
|
polygonIndices.push(t3);
|
|
10212
|
-
lastWinding =
|
|
9889
|
+
lastWinding = _Triangulator.winding(x1, y1, x2, y2, x3, y3);
|
|
10213
9890
|
fanBaseIndex = t1;
|
|
10214
9891
|
}
|
|
10215
9892
|
}
|
|
@@ -10219,8 +9896,7 @@ var spine = (() => {
|
|
|
10219
9896
|
}
|
|
10220
9897
|
for (let i = 0, n = convexPolygons.length; i < n; i++) {
|
|
10221
9898
|
polygonIndices = convexPolygonsIndices[i];
|
|
10222
|
-
if (polygonIndices.length == 0)
|
|
10223
|
-
continue;
|
|
9899
|
+
if (polygonIndices.length == 0) continue;
|
|
10224
9900
|
let firstIndex = polygonIndices[0];
|
|
10225
9901
|
let lastIndex = polygonIndices[polygonIndices.length - 1];
|
|
10226
9902
|
polygon = convexPolygons[i];
|
|
@@ -10229,22 +9905,19 @@ var spine = (() => {
|
|
|
10229
9905
|
let prevX = polygon[o + 2], prevY = polygon[o + 3];
|
|
10230
9906
|
let firstX = polygon[0], firstY = polygon[1];
|
|
10231
9907
|
let secondX = polygon[2], secondY = polygon[3];
|
|
10232
|
-
let winding =
|
|
9908
|
+
let winding = _Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, firstX, firstY);
|
|
10233
9909
|
for (let ii = 0; ii < n; ii++) {
|
|
10234
|
-
if (ii == i)
|
|
10235
|
-
continue;
|
|
9910
|
+
if (ii == i) continue;
|
|
10236
9911
|
let otherIndices = convexPolygonsIndices[ii];
|
|
10237
|
-
if (otherIndices.length != 3)
|
|
10238
|
-
continue;
|
|
9912
|
+
if (otherIndices.length != 3) continue;
|
|
10239
9913
|
let otherFirstIndex = otherIndices[0];
|
|
10240
9914
|
let otherSecondIndex = otherIndices[1];
|
|
10241
9915
|
let otherLastIndex = otherIndices[2];
|
|
10242
9916
|
let otherPoly = convexPolygons[ii];
|
|
10243
9917
|
let x3 = otherPoly[otherPoly.length - 2], y3 = otherPoly[otherPoly.length - 1];
|
|
10244
|
-
if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex)
|
|
10245
|
-
|
|
10246
|
-
let
|
|
10247
|
-
let winding2 = Triangulator.winding(x3, y3, firstX, firstY, secondX, secondY);
|
|
9918
|
+
if (otherFirstIndex != firstIndex || otherSecondIndex != lastIndex) continue;
|
|
9919
|
+
let winding1 = _Triangulator.winding(prevPrevX, prevPrevY, prevX, prevY, x3, y3);
|
|
9920
|
+
let winding2 = _Triangulator.winding(x3, y3, firstX, firstY, secondX, secondY);
|
|
10248
9921
|
if (winding1 == winding && winding2 == winding) {
|
|
10249
9922
|
otherPoly.length = 0;
|
|
10250
9923
|
otherIndices.length = 0;
|
|
@@ -10294,7 +9967,7 @@ var spine = (() => {
|
|
|
10294
9967
|
};
|
|
10295
9968
|
|
|
10296
9969
|
// spine-core/src/SkeletonClipping.ts
|
|
10297
|
-
var SkeletonClipping = class {
|
|
9970
|
+
var SkeletonClipping = class _SkeletonClipping {
|
|
10298
9971
|
triangulator = new Triangulator();
|
|
10299
9972
|
clippingPolygon = new Array();
|
|
10300
9973
|
clipOutput = new Array();
|
|
@@ -10305,30 +9978,27 @@ var spine = (() => {
|
|
|
10305
9978
|
clipAttachment = null;
|
|
10306
9979
|
clippingPolygons = null;
|
|
10307
9980
|
clipStart(slot, clip) {
|
|
10308
|
-
if (this.clipAttachment)
|
|
10309
|
-
return 0;
|
|
9981
|
+
if (this.clipAttachment) return 0;
|
|
10310
9982
|
this.clipAttachment = clip;
|
|
10311
9983
|
let n = clip.worldVerticesLength;
|
|
10312
9984
|
let vertices = Utils.setArraySize(this.clippingPolygon, n);
|
|
10313
9985
|
clip.computeWorldVertices(slot, 0, n, vertices, 0, 2);
|
|
10314
9986
|
let clippingPolygon = this.clippingPolygon;
|
|
10315
|
-
|
|
9987
|
+
_SkeletonClipping.makeClockwise(clippingPolygon);
|
|
10316
9988
|
let clippingPolygons = this.clippingPolygons = this.triangulator.decompose(clippingPolygon, this.triangulator.triangulate(clippingPolygon));
|
|
10317
9989
|
for (let i = 0, n2 = clippingPolygons.length; i < n2; i++) {
|
|
10318
9990
|
let polygon = clippingPolygons[i];
|
|
10319
|
-
|
|
9991
|
+
_SkeletonClipping.makeClockwise(polygon);
|
|
10320
9992
|
polygon.push(polygon[0]);
|
|
10321
9993
|
polygon.push(polygon[1]);
|
|
10322
9994
|
}
|
|
10323
9995
|
return clippingPolygons.length;
|
|
10324
9996
|
}
|
|
10325
9997
|
clipEndWithSlot(slot) {
|
|
10326
|
-
if (this.clipAttachment && this.clipAttachment.endSlot == slot.data)
|
|
10327
|
-
this.clipEnd();
|
|
9998
|
+
if (this.clipAttachment && this.clipAttachment.endSlot == slot.data) this.clipEnd();
|
|
10328
9999
|
}
|
|
10329
10000
|
clipEnd() {
|
|
10330
|
-
if (!this.clipAttachment)
|
|
10331
|
-
return;
|
|
10001
|
+
if (!this.clipAttachment) return;
|
|
10332
10002
|
this.clipAttachment = null;
|
|
10333
10003
|
this.clippingPolygons = null;
|
|
10334
10004
|
this.clippedVertices.length = 0;
|
|
@@ -10384,8 +10054,7 @@ var spine = (() => {
|
|
|
10384
10054
|
let s = clippedVertices.length;
|
|
10385
10055
|
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
|
|
10386
10056
|
let clipOutputLength = clipOutput.length;
|
|
10387
|
-
if (clipOutputLength == 0)
|
|
10388
|
-
continue;
|
|
10057
|
+
if (clipOutputLength == 0) continue;
|
|
10389
10058
|
let clipOutputCount = clipOutputLength >> 1;
|
|
10390
10059
|
let clipOutputItems = this.clipOutput;
|
|
10391
10060
|
let clippedVerticesItems = Utils.setArraySize(clippedVertices, s + clipOutputCount * 2);
|
|
@@ -10445,8 +10114,7 @@ var spine = (() => {
|
|
|
10445
10114
|
let s = clippedVertices.length;
|
|
10446
10115
|
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
|
|
10447
10116
|
let clipOutputLength = clipOutput.length;
|
|
10448
|
-
if (clipOutputLength == 0)
|
|
10449
|
-
continue;
|
|
10117
|
+
if (clipOutputLength == 0) continue;
|
|
10450
10118
|
let d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
|
|
10451
10119
|
let d = 1 / (d0 * d2 + d1 * (y1 - y3));
|
|
10452
10120
|
let clipOutputCount = clipOutputLength >> 1;
|
|
@@ -10575,8 +10243,7 @@ var spine = (() => {
|
|
|
10575
10243
|
let s = clippedVertices.length;
|
|
10576
10244
|
if (this.clip(x1, y1, x2, y2, x3, y3, polygons[p], clipOutput)) {
|
|
10577
10245
|
let clipOutputLength = clipOutput.length;
|
|
10578
|
-
if (clipOutputLength == 0)
|
|
10579
|
-
continue;
|
|
10246
|
+
if (clipOutputLength == 0) continue;
|
|
10580
10247
|
let d0 = y2 - y3, d1 = x3 - x2, d2 = x1 - x3, d4 = y3 - y1;
|
|
10581
10248
|
let d = 1 / (d0 * d2 + d1 * (y1 - y3));
|
|
10582
10249
|
let clipOutputCount = clipOutputLength >> 1;
|
|
@@ -10699,8 +10366,7 @@ var spine = (() => {
|
|
|
10699
10366
|
}
|
|
10700
10367
|
output.push(output[0]);
|
|
10701
10368
|
output.push(output[1]);
|
|
10702
|
-
if (i == clippingVerticesLast)
|
|
10703
|
-
break;
|
|
10369
|
+
if (i == clippingVerticesLast) break;
|
|
10704
10370
|
let temp = output;
|
|
10705
10371
|
output = input;
|
|
10706
10372
|
output.length = 0;
|
|
@@ -10725,8 +10391,7 @@ var spine = (() => {
|
|
|
10725
10391
|
p2y = vertices[i + 3];
|
|
10726
10392
|
area += p1x * p2y - p2x * p1y;
|
|
10727
10393
|
}
|
|
10728
|
-
if (area < 0)
|
|
10729
|
-
return;
|
|
10394
|
+
if (area < 0) return;
|
|
10730
10395
|
for (let i = 0, lastX = verticeslength - 2, n = verticeslength >> 1; i < n; i += 2) {
|
|
10731
10396
|
let x = vertices[i], y = vertices[i + 1];
|
|
10732
10397
|
let other = lastX - i;
|
|
@@ -10772,8 +10437,7 @@ var spine = (() => {
|
|
|
10772
10437
|
let boneMap = root.bones[i];
|
|
10773
10438
|
let parent = null;
|
|
10774
10439
|
let parentName = getValue(boneMap, "parent", null);
|
|
10775
|
-
if (parentName)
|
|
10776
|
-
parent = skeletonData.findBone(parentName);
|
|
10440
|
+
if (parentName) parent = skeletonData.findBone(parentName);
|
|
10777
10441
|
let data = new BoneData(skeletonData.bones.length, boneMap.name, parent);
|
|
10778
10442
|
data.length = getValue(boneMap, "length", 0) * scale;
|
|
10779
10443
|
data.x = getValue(boneMap, "x", 0) * scale;
|
|
@@ -10786,8 +10450,7 @@ var spine = (() => {
|
|
|
10786
10450
|
data.inherit = Utils.enumValue(Inherit, getValue(boneMap, "inherit", "Normal"));
|
|
10787
10451
|
data.skinRequired = getValue(boneMap, "skin", false);
|
|
10788
10452
|
let color = getValue(boneMap, "color", null);
|
|
10789
|
-
if (color)
|
|
10790
|
-
data.color.setFromString(color);
|
|
10453
|
+
if (color) data.color.setFromString(color);
|
|
10791
10454
|
skeletonData.bones.push(data);
|
|
10792
10455
|
}
|
|
10793
10456
|
}
|
|
@@ -10796,15 +10459,12 @@ var spine = (() => {
|
|
|
10796
10459
|
let slotMap = root.slots[i];
|
|
10797
10460
|
let slotName = slotMap.name;
|
|
10798
10461
|
let boneData = skeletonData.findBone(slotMap.bone);
|
|
10799
|
-
if (!boneData)
|
|
10800
|
-
throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotName}`);
|
|
10462
|
+
if (!boneData) throw new Error(`Couldn't find bone ${slotMap.bone} for slot ${slotName}`);
|
|
10801
10463
|
let data = new SlotData(skeletonData.slots.length, slotName, boneData);
|
|
10802
10464
|
let color = getValue(slotMap, "color", null);
|
|
10803
|
-
if (color)
|
|
10804
|
-
data.color.setFromString(color);
|
|
10465
|
+
if (color) data.color.setFromString(color);
|
|
10805
10466
|
let dark = getValue(slotMap, "dark", null);
|
|
10806
|
-
if (dark)
|
|
10807
|
-
data.darkColor = Color.fromString(dark);
|
|
10467
|
+
if (dark) data.darkColor = Color.fromString(dark);
|
|
10808
10468
|
data.attachmentName = getValue(slotMap, "attachment", null);
|
|
10809
10469
|
data.blendMode = Utils.enumValue(BlendMode, getValue(slotMap, "blend", "normal"));
|
|
10810
10470
|
data.visible = getValue(slotMap, "visible", true);
|
|
@@ -10819,14 +10479,12 @@ var spine = (() => {
|
|
|
10819
10479
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
10820
10480
|
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
10821
10481
|
let bone = skeletonData.findBone(constraintMap.bones[ii]);
|
|
10822
|
-
if (!bone)
|
|
10823
|
-
throw new Error(`Couldn't find bone ${constraintMap.bones[ii]} for IK constraint ${constraintMap.name}.`);
|
|
10482
|
+
if (!bone) throw new Error(`Couldn't find bone ${constraintMap.bones[ii]} for IK constraint ${constraintMap.name}.`);
|
|
10824
10483
|
data.bones.push(bone);
|
|
10825
10484
|
}
|
|
10826
10485
|
let target = skeletonData.findBone(constraintMap.target);
|
|
10827
10486
|
;
|
|
10828
|
-
if (!target)
|
|
10829
|
-
throw new Error(`Couldn't find target bone ${constraintMap.target} for IK constraint ${constraintMap.name}.`);
|
|
10487
|
+
if (!target) throw new Error(`Couldn't find target bone ${constraintMap.target} for IK constraint ${constraintMap.name}.`);
|
|
10830
10488
|
data.target = target;
|
|
10831
10489
|
data.mix = getValue(constraintMap, "mix", 1);
|
|
10832
10490
|
data.softness = getValue(constraintMap, "softness", 0) * scale;
|
|
@@ -10846,14 +10504,12 @@ var spine = (() => {
|
|
|
10846
10504
|
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
10847
10505
|
let boneName = constraintMap.bones[ii];
|
|
10848
10506
|
let bone = skeletonData.findBone(boneName);
|
|
10849
|
-
if (!bone)
|
|
10850
|
-
throw new Error(`Couldn't find bone ${boneName} for transform constraint ${constraintMap.name}.`);
|
|
10507
|
+
if (!bone) throw new Error(`Couldn't find bone ${boneName} for transform constraint ${constraintMap.name}.`);
|
|
10851
10508
|
data.bones.push(bone);
|
|
10852
10509
|
}
|
|
10853
10510
|
let targetName = constraintMap.target;
|
|
10854
10511
|
let target = skeletonData.findBone(targetName);
|
|
10855
|
-
if (!target)
|
|
10856
|
-
throw new Error(`Couldn't find target bone ${targetName} for transform constraint ${constraintMap.name}.`);
|
|
10512
|
+
if (!target) throw new Error(`Couldn't find target bone ${targetName} for transform constraint ${constraintMap.name}.`);
|
|
10857
10513
|
data.target = target;
|
|
10858
10514
|
data.local = getValue(constraintMap, "local", false);
|
|
10859
10515
|
data.relative = getValue(constraintMap, "relative", false);
|
|
@@ -10881,25 +10537,21 @@ var spine = (() => {
|
|
|
10881
10537
|
for (let ii = 0; ii < constraintMap.bones.length; ii++) {
|
|
10882
10538
|
let boneName = constraintMap.bones[ii];
|
|
10883
10539
|
let bone = skeletonData.findBone(boneName);
|
|
10884
|
-
if (!bone)
|
|
10885
|
-
throw new Error(`Couldn't find bone ${boneName} for path constraint ${constraintMap.name}.`);
|
|
10540
|
+
if (!bone) throw new Error(`Couldn't find bone ${boneName} for path constraint ${constraintMap.name}.`);
|
|
10886
10541
|
data.bones.push(bone);
|
|
10887
10542
|
}
|
|
10888
10543
|
let targetName = constraintMap.target;
|
|
10889
10544
|
let target = skeletonData.findSlot(targetName);
|
|
10890
|
-
if (!target)
|
|
10891
|
-
throw new Error(`Couldn't find target slot ${targetName} for path constraint ${constraintMap.name}.`);
|
|
10545
|
+
if (!target) throw new Error(`Couldn't find target slot ${targetName} for path constraint ${constraintMap.name}.`);
|
|
10892
10546
|
data.target = target;
|
|
10893
10547
|
data.positionMode = Utils.enumValue(PositionMode, getValue(constraintMap, "positionMode", "Percent"));
|
|
10894
10548
|
data.spacingMode = Utils.enumValue(SpacingMode, getValue(constraintMap, "spacingMode", "Length"));
|
|
10895
10549
|
data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
|
|
10896
10550
|
data.offsetRotation = getValue(constraintMap, "rotation", 0);
|
|
10897
10551
|
data.position = getValue(constraintMap, "position", 0);
|
|
10898
|
-
if (data.positionMode == 0 /* Fixed */)
|
|
10899
|
-
data.position *= scale;
|
|
10552
|
+
if (data.positionMode == 0 /* Fixed */) data.position *= scale;
|
|
10900
10553
|
data.spacing = getValue(constraintMap, "spacing", 0);
|
|
10901
|
-
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
|
|
10902
|
-
data.spacing *= scale;
|
|
10554
|
+
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */) data.spacing *= scale;
|
|
10903
10555
|
data.mixRotate = getValue(constraintMap, "mixRotate", 1);
|
|
10904
10556
|
data.mixX = getValue(constraintMap, "mixX", 1);
|
|
10905
10557
|
data.mixY = getValue(constraintMap, "mixY", data.mixX);
|
|
@@ -10914,8 +10566,7 @@ var spine = (() => {
|
|
|
10914
10566
|
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
10915
10567
|
const boneName = constraintMap.bone;
|
|
10916
10568
|
const bone = skeletonData.findBone(boneName);
|
|
10917
|
-
if (bone == null)
|
|
10918
|
-
throw new Error("Physics bone not found: " + boneName);
|
|
10569
|
+
if (bone == null) throw new Error("Physics bone not found: " + boneName);
|
|
10919
10570
|
data.bone = bone;
|
|
10920
10571
|
data.x = getValue(constraintMap, "x", 0);
|
|
10921
10572
|
data.y = getValue(constraintMap, "y", 0);
|
|
@@ -10949,8 +10600,7 @@ var spine = (() => {
|
|
|
10949
10600
|
for (let ii = 0; ii < skinMap.bones.length; ii++) {
|
|
10950
10601
|
let boneName = skinMap.bones[ii];
|
|
10951
10602
|
let bone = skeletonData.findBone(boneName);
|
|
10952
|
-
if (!bone)
|
|
10953
|
-
throw new Error(`Couldn't find bone ${boneName} for skin ${skinMap.name}.`);
|
|
10603
|
+
if (!bone) throw new Error(`Couldn't find bone ${boneName} for skin ${skinMap.name}.`);
|
|
10954
10604
|
skin.bones.push(bone);
|
|
10955
10605
|
}
|
|
10956
10606
|
}
|
|
@@ -10958,8 +10608,7 @@ var spine = (() => {
|
|
|
10958
10608
|
for (let ii = 0; ii < skinMap.ik.length; ii++) {
|
|
10959
10609
|
let constraintName = skinMap.ik[ii];
|
|
10960
10610
|
let constraint = skeletonData.findIkConstraint(constraintName);
|
|
10961
|
-
if (!constraint)
|
|
10962
|
-
throw new Error(`Couldn't find IK constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10611
|
+
if (!constraint) throw new Error(`Couldn't find IK constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10963
10612
|
skin.constraints.push(constraint);
|
|
10964
10613
|
}
|
|
10965
10614
|
}
|
|
@@ -10967,8 +10616,7 @@ var spine = (() => {
|
|
|
10967
10616
|
for (let ii = 0; ii < skinMap.transform.length; ii++) {
|
|
10968
10617
|
let constraintName = skinMap.transform[ii];
|
|
10969
10618
|
let constraint = skeletonData.findTransformConstraint(constraintName);
|
|
10970
|
-
if (!constraint)
|
|
10971
|
-
throw new Error(`Couldn't find transform constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10619
|
+
if (!constraint) throw new Error(`Couldn't find transform constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10972
10620
|
skin.constraints.push(constraint);
|
|
10973
10621
|
}
|
|
10974
10622
|
}
|
|
@@ -10976,8 +10624,7 @@ var spine = (() => {
|
|
|
10976
10624
|
for (let ii = 0; ii < skinMap.path.length; ii++) {
|
|
10977
10625
|
let constraintName = skinMap.path[ii];
|
|
10978
10626
|
let constraint = skeletonData.findPathConstraint(constraintName);
|
|
10979
|
-
if (!constraint)
|
|
10980
|
-
throw new Error(`Couldn't find path constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10627
|
+
if (!constraint) throw new Error(`Couldn't find path constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10981
10628
|
skin.constraints.push(constraint);
|
|
10982
10629
|
}
|
|
10983
10630
|
}
|
|
@@ -10985,39 +10632,32 @@ var spine = (() => {
|
|
|
10985
10632
|
for (let ii = 0; ii < skinMap.physics.length; ii++) {
|
|
10986
10633
|
let constraintName = skinMap.physics[ii];
|
|
10987
10634
|
let constraint = skeletonData.findPhysicsConstraint(constraintName);
|
|
10988
|
-
if (!constraint)
|
|
10989
|
-
throw new Error(`Couldn't find physics constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10635
|
+
if (!constraint) throw new Error(`Couldn't find physics constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10990
10636
|
skin.constraints.push(constraint);
|
|
10991
10637
|
}
|
|
10992
10638
|
}
|
|
10993
10639
|
for (let slotName in skinMap.attachments) {
|
|
10994
10640
|
let slot = skeletonData.findSlot(slotName);
|
|
10995
|
-
if (!slot)
|
|
10996
|
-
throw new Error(`Couldn't find slot ${slotName} for skin ${skinMap.name}.`);
|
|
10641
|
+
if (!slot) throw new Error(`Couldn't find slot ${slotName} for skin ${skinMap.name}.`);
|
|
10997
10642
|
let slotMap = skinMap.attachments[slotName];
|
|
10998
10643
|
for (let entryName in slotMap) {
|
|
10999
10644
|
let attachment = this.readAttachment(slotMap[entryName], skin, slot.index, entryName, skeletonData);
|
|
11000
|
-
if (attachment)
|
|
11001
|
-
skin.setAttachment(slot.index, entryName, attachment);
|
|
10645
|
+
if (attachment) skin.setAttachment(slot.index, entryName, attachment);
|
|
11002
10646
|
}
|
|
11003
10647
|
}
|
|
11004
10648
|
skeletonData.skins.push(skin);
|
|
11005
|
-
if (skin.name == "default")
|
|
11006
|
-
skeletonData.defaultSkin = skin;
|
|
10649
|
+
if (skin.name == "default") skeletonData.defaultSkin = skin;
|
|
11007
10650
|
}
|
|
11008
10651
|
}
|
|
11009
10652
|
for (let i = 0, n = this.linkedMeshes.length; i < n; i++) {
|
|
11010
10653
|
let linkedMesh = this.linkedMeshes[i];
|
|
11011
10654
|
let skin = !linkedMesh.skin ? skeletonData.defaultSkin : skeletonData.findSkin(linkedMesh.skin);
|
|
11012
|
-
if (!skin)
|
|
11013
|
-
throw new Error(`Skin not found: ${linkedMesh.skin}`);
|
|
10655
|
+
if (!skin) throw new Error(`Skin not found: ${linkedMesh.skin}`);
|
|
11014
10656
|
let parent = skin.getAttachment(linkedMesh.slotIndex, linkedMesh.parent);
|
|
11015
|
-
if (!parent)
|
|
11016
|
-
throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
10657
|
+
if (!parent) throw new Error(`Parent mesh not found: ${linkedMesh.parent}`);
|
|
11017
10658
|
linkedMesh.mesh.timelineAttachment = linkedMesh.inheritTimeline ? parent : linkedMesh.mesh;
|
|
11018
10659
|
linkedMesh.mesh.setParentMesh(parent);
|
|
11019
|
-
if (linkedMesh.mesh.region != null)
|
|
11020
|
-
linkedMesh.mesh.updateRegion();
|
|
10660
|
+
if (linkedMesh.mesh.region != null) linkedMesh.mesh.updateRegion();
|
|
11021
10661
|
}
|
|
11022
10662
|
this.linkedMeshes.length = 0;
|
|
11023
10663
|
if (root.events) {
|
|
@@ -11051,8 +10691,7 @@ var spine = (() => {
|
|
|
11051
10691
|
let path = getValue(map, "path", name);
|
|
11052
10692
|
let sequence = this.readSequence(getValue(map, "sequence", null));
|
|
11053
10693
|
let region = this.attachmentLoader.newRegionAttachment(skin, name, path, sequence);
|
|
11054
|
-
if (!region)
|
|
11055
|
-
return null;
|
|
10694
|
+
if (!region) return null;
|
|
11056
10695
|
region.path = path;
|
|
11057
10696
|
region.x = getValue(map, "x", 0) * scale;
|
|
11058
10697
|
region.y = getValue(map, "y", 0) * scale;
|
|
@@ -11063,20 +10702,16 @@ var spine = (() => {
|
|
|
11063
10702
|
region.height = map.height * scale;
|
|
11064
10703
|
region.sequence = sequence;
|
|
11065
10704
|
let color = getValue(map, "color", null);
|
|
11066
|
-
if (color)
|
|
11067
|
-
|
|
11068
|
-
if (region.region != null)
|
|
11069
|
-
region.updateRegion();
|
|
10705
|
+
if (color) region.color.setFromString(color);
|
|
10706
|
+
if (region.region != null) region.updateRegion();
|
|
11070
10707
|
return region;
|
|
11071
10708
|
}
|
|
11072
10709
|
case "boundingbox": {
|
|
11073
10710
|
let box = this.attachmentLoader.newBoundingBoxAttachment(skin, name);
|
|
11074
|
-
if (!box)
|
|
11075
|
-
return null;
|
|
10711
|
+
if (!box) return null;
|
|
11076
10712
|
this.readVertices(map, box, map.vertexCount << 1);
|
|
11077
10713
|
let color = getValue(map, "color", null);
|
|
11078
|
-
if (color)
|
|
11079
|
-
box.color.setFromString(color);
|
|
10714
|
+
if (color) box.color.setFromString(color);
|
|
11080
10715
|
return box;
|
|
11081
10716
|
}
|
|
11082
10717
|
case "mesh":
|
|
@@ -11084,12 +10719,10 @@ var spine = (() => {
|
|
|
11084
10719
|
let path = getValue(map, "path", name);
|
|
11085
10720
|
let sequence = this.readSequence(getValue(map, "sequence", null));
|
|
11086
10721
|
let mesh = this.attachmentLoader.newMeshAttachment(skin, name, path, sequence);
|
|
11087
|
-
if (!mesh)
|
|
11088
|
-
return null;
|
|
10722
|
+
if (!mesh) return null;
|
|
11089
10723
|
mesh.path = path;
|
|
11090
10724
|
let color = getValue(map, "color", null);
|
|
11091
|
-
if (color)
|
|
11092
|
-
mesh.color.setFromString(color);
|
|
10725
|
+
if (color) mesh.color.setFromString(color);
|
|
11093
10726
|
mesh.width = getValue(map, "width", 0) * scale;
|
|
11094
10727
|
mesh.height = getValue(map, "height", 0) * scale;
|
|
11095
10728
|
mesh.sequence = sequence;
|
|
@@ -11102,16 +10735,14 @@ var spine = (() => {
|
|
|
11102
10735
|
this.readVertices(map, mesh, uvs.length);
|
|
11103
10736
|
mesh.triangles = map.triangles;
|
|
11104
10737
|
mesh.regionUVs = uvs;
|
|
11105
|
-
if (mesh.region != null)
|
|
11106
|
-
mesh.updateRegion();
|
|
10738
|
+
if (mesh.region != null) mesh.updateRegion();
|
|
11107
10739
|
mesh.edges = getValue(map, "edges", null);
|
|
11108
10740
|
mesh.hullLength = getValue(map, "hull", 0) * 2;
|
|
11109
10741
|
return mesh;
|
|
11110
10742
|
}
|
|
11111
10743
|
case "path": {
|
|
11112
10744
|
let path = this.attachmentLoader.newPathAttachment(skin, name);
|
|
11113
|
-
if (!path)
|
|
11114
|
-
return null;
|
|
10745
|
+
if (!path) return null;
|
|
11115
10746
|
path.closed = getValue(map, "closed", false);
|
|
11116
10747
|
path.constantSpeed = getValue(map, "constantSpeed", true);
|
|
11117
10748
|
let vertexCount = map.vertexCount;
|
|
@@ -11121,42 +10752,35 @@ var spine = (() => {
|
|
|
11121
10752
|
lengths[i] = map.lengths[i] * scale;
|
|
11122
10753
|
path.lengths = lengths;
|
|
11123
10754
|
let color = getValue(map, "color", null);
|
|
11124
|
-
if (color)
|
|
11125
|
-
path.color.setFromString(color);
|
|
10755
|
+
if (color) path.color.setFromString(color);
|
|
11126
10756
|
return path;
|
|
11127
10757
|
}
|
|
11128
10758
|
case "point": {
|
|
11129
10759
|
let point = this.attachmentLoader.newPointAttachment(skin, name);
|
|
11130
|
-
if (!point)
|
|
11131
|
-
return null;
|
|
10760
|
+
if (!point) return null;
|
|
11132
10761
|
point.x = getValue(map, "x", 0) * scale;
|
|
11133
10762
|
point.y = getValue(map, "y", 0) * scale;
|
|
11134
10763
|
point.rotation = getValue(map, "rotation", 0);
|
|
11135
10764
|
let color = getValue(map, "color", null);
|
|
11136
|
-
if (color)
|
|
11137
|
-
point.color.setFromString(color);
|
|
10765
|
+
if (color) point.color.setFromString(color);
|
|
11138
10766
|
return point;
|
|
11139
10767
|
}
|
|
11140
10768
|
case "clipping": {
|
|
11141
10769
|
let clip = this.attachmentLoader.newClippingAttachment(skin, name);
|
|
11142
|
-
if (!clip)
|
|
11143
|
-
return null;
|
|
10770
|
+
if (!clip) return null;
|
|
11144
10771
|
let end = getValue(map, "end", null);
|
|
11145
|
-
if (end)
|
|
11146
|
-
clip.endSlot = skeletonData.findSlot(end);
|
|
10772
|
+
if (end) clip.endSlot = skeletonData.findSlot(end);
|
|
11147
10773
|
let vertexCount = map.vertexCount;
|
|
11148
10774
|
this.readVertices(map, clip, vertexCount << 1);
|
|
11149
10775
|
let color = getValue(map, "color", null);
|
|
11150
|
-
if (color)
|
|
11151
|
-
clip.color.setFromString(color);
|
|
10776
|
+
if (color) clip.color.setFromString(color);
|
|
11152
10777
|
return clip;
|
|
11153
10778
|
}
|
|
11154
10779
|
}
|
|
11155
10780
|
return null;
|
|
11156
10781
|
}
|
|
11157
10782
|
readSequence(map) {
|
|
11158
|
-
if (map == null)
|
|
11159
|
-
return null;
|
|
10783
|
+
if (map == null) return null;
|
|
11160
10784
|
let sequence = new Sequence(getValue(map, "count", 0));
|
|
11161
10785
|
sequence.start = getValue(map, "start", 1);
|
|
11162
10786
|
sequence.digits = getValue(map, "digits", 0);
|
|
@@ -11198,13 +10822,11 @@ var spine = (() => {
|
|
|
11198
10822
|
for (let slotName in map.slots) {
|
|
11199
10823
|
let slotMap = map.slots[slotName];
|
|
11200
10824
|
let slot = skeletonData.findSlot(slotName);
|
|
11201
|
-
if (!slot)
|
|
11202
|
-
throw new Error("Slot not found: " + slotName);
|
|
10825
|
+
if (!slot) throw new Error("Slot not found: " + slotName);
|
|
11203
10826
|
let slotIndex = slot.index;
|
|
11204
10827
|
for (let timelineName in slotMap) {
|
|
11205
10828
|
let timelineMap = slotMap[timelineName];
|
|
11206
|
-
if (!timelineMap)
|
|
11207
|
-
continue;
|
|
10829
|
+
if (!timelineMap) continue;
|
|
11208
10830
|
let frames = timelineMap.length;
|
|
11209
10831
|
if (timelineName == "attachment") {
|
|
11210
10832
|
let timeline = new AttachmentTimeline(frames, slotIndex);
|
|
@@ -11337,14 +10959,12 @@ var spine = (() => {
|
|
|
11337
10959
|
for (let boneName in map.bones) {
|
|
11338
10960
|
let boneMap = map.bones[boneName];
|
|
11339
10961
|
let bone = skeletonData.findBone(boneName);
|
|
11340
|
-
if (!bone)
|
|
11341
|
-
throw new Error("Bone not found: " + boneName);
|
|
10962
|
+
if (!bone) throw new Error("Bone not found: " + boneName);
|
|
11342
10963
|
let boneIndex = bone.index;
|
|
11343
10964
|
for (let timelineName in boneMap) {
|
|
11344
10965
|
let timelineMap = boneMap[timelineName];
|
|
11345
10966
|
let frames = timelineMap.length;
|
|
11346
|
-
if (frames == 0)
|
|
11347
|
-
continue;
|
|
10967
|
+
if (frames == 0) continue;
|
|
11348
10968
|
if (timelineName === "rotate") {
|
|
11349
10969
|
timelines.push(readTimeline12(timelineMap, new RotateTimeline(frames, frames, boneIndex), 0, 1));
|
|
11350
10970
|
} else if (timelineName === "translate") {
|
|
@@ -11389,11 +11009,9 @@ var spine = (() => {
|
|
|
11389
11009
|
for (let constraintName in map.ik) {
|
|
11390
11010
|
let constraintMap = map.ik[constraintName];
|
|
11391
11011
|
let keyMap = constraintMap[0];
|
|
11392
|
-
if (!keyMap)
|
|
11393
|
-
continue;
|
|
11012
|
+
if (!keyMap) continue;
|
|
11394
11013
|
let constraint = skeletonData.findIkConstraint(constraintName);
|
|
11395
|
-
if (!constraint)
|
|
11396
|
-
throw new Error("IK Constraint not found: " + constraintName);
|
|
11014
|
+
if (!constraint) throw new Error("IK Constraint not found: " + constraintName);
|
|
11397
11015
|
let constraintIndex = skeletonData.ikConstraints.indexOf(constraint);
|
|
11398
11016
|
let timeline = new IkConstraintTimeline(constraintMap.length, constraintMap.length << 1, constraintIndex);
|
|
11399
11017
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -11426,11 +11044,9 @@ var spine = (() => {
|
|
|
11426
11044
|
for (let constraintName in map.transform) {
|
|
11427
11045
|
let timelineMap = map.transform[constraintName];
|
|
11428
11046
|
let keyMap = timelineMap[0];
|
|
11429
|
-
if (!keyMap)
|
|
11430
|
-
continue;
|
|
11047
|
+
if (!keyMap) continue;
|
|
11431
11048
|
let constraint = skeletonData.findTransformConstraint(constraintName);
|
|
11432
|
-
if (!constraint)
|
|
11433
|
-
throw new Error("Transform constraint not found: " + constraintName);
|
|
11049
|
+
if (!constraint) throw new Error("Transform constraint not found: " + constraintName);
|
|
11434
11050
|
let constraintIndex = skeletonData.transformConstraints.indexOf(constraint);
|
|
11435
11051
|
let timeline = new TransformConstraintTimeline(timelineMap.length, timelineMap.length * 6, constraintIndex);
|
|
11436
11052
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -11479,14 +11095,12 @@ var spine = (() => {
|
|
|
11479
11095
|
for (let constraintName in map.path) {
|
|
11480
11096
|
let constraintMap = map.path[constraintName];
|
|
11481
11097
|
let constraint = skeletonData.findPathConstraint(constraintName);
|
|
11482
|
-
if (!constraint)
|
|
11483
|
-
throw new Error("Path constraint not found: " + constraintName);
|
|
11098
|
+
if (!constraint) throw new Error("Path constraint not found: " + constraintName);
|
|
11484
11099
|
let constraintIndex = skeletonData.pathConstraints.indexOf(constraint);
|
|
11485
11100
|
for (let timelineName in constraintMap) {
|
|
11486
11101
|
let timelineMap = constraintMap[timelineName];
|
|
11487
11102
|
let keyMap = timelineMap[0];
|
|
11488
|
-
if (!keyMap)
|
|
11489
|
-
continue;
|
|
11103
|
+
if (!keyMap) continue;
|
|
11490
11104
|
let frames = timelineMap.length;
|
|
11491
11105
|
if (timelineName === "position") {
|
|
11492
11106
|
let timeline = new PathConstraintPositionTimeline(frames, frames, constraintIndex);
|
|
@@ -11534,15 +11148,13 @@ var spine = (() => {
|
|
|
11534
11148
|
let constraintIndex = -1;
|
|
11535
11149
|
if (constraintName.length > 0) {
|
|
11536
11150
|
let constraint = skeletonData.findPhysicsConstraint(constraintName);
|
|
11537
|
-
if (!constraint)
|
|
11538
|
-
throw new Error("Physics constraint not found: " + constraintName);
|
|
11151
|
+
if (!constraint) throw new Error("Physics constraint not found: " + constraintName);
|
|
11539
11152
|
constraintIndex = skeletonData.physicsConstraints.indexOf(constraint);
|
|
11540
11153
|
}
|
|
11541
11154
|
for (let timelineName in constraintMap) {
|
|
11542
11155
|
let timelineMap = constraintMap[timelineName];
|
|
11543
11156
|
let keyMap = timelineMap[0];
|
|
11544
|
-
if (!keyMap)
|
|
11545
|
-
continue;
|
|
11157
|
+
if (!keyMap) continue;
|
|
11546
11158
|
let frames = timelineMap.length;
|
|
11547
11159
|
if (timelineName == "reset") {
|
|
11548
11160
|
const timeline2 = new PhysicsConstraintResetTimeline(frames, constraintIndex);
|
|
@@ -11576,13 +11188,11 @@ var spine = (() => {
|
|
|
11576
11188
|
for (let attachmentsName in map.attachments) {
|
|
11577
11189
|
let attachmentsMap = map.attachments[attachmentsName];
|
|
11578
11190
|
let skin = skeletonData.findSkin(attachmentsName);
|
|
11579
|
-
if (!skin)
|
|
11580
|
-
throw new Error("Skin not found: " + attachmentsName);
|
|
11191
|
+
if (!skin) throw new Error("Skin not found: " + attachmentsName);
|
|
11581
11192
|
for (let slotMapName in attachmentsMap) {
|
|
11582
11193
|
let slotMap = attachmentsMap[slotMapName];
|
|
11583
11194
|
let slot = skeletonData.findSlot(slotMapName);
|
|
11584
|
-
if (!slot)
|
|
11585
|
-
throw new Error("Slot not found: " + slotMapName);
|
|
11195
|
+
if (!slot) throw new Error("Slot not found: " + slotMapName);
|
|
11586
11196
|
let slotIndex = slot.index;
|
|
11587
11197
|
for (let attachmentMapName in slotMap) {
|
|
11588
11198
|
let attachmentMap = slotMap[attachmentMapName];
|
|
@@ -11590,8 +11200,7 @@ var spine = (() => {
|
|
|
11590
11200
|
for (let timelineMapName in attachmentMap) {
|
|
11591
11201
|
let timelineMap = attachmentMap[timelineMapName];
|
|
11592
11202
|
let keyMap = timelineMap[0];
|
|
11593
|
-
if (!keyMap)
|
|
11594
|
-
continue;
|
|
11203
|
+
if (!keyMap) continue;
|
|
11595
11204
|
if (timelineMapName == "deform") {
|
|
11596
11205
|
let weighted = attachment.bones;
|
|
11597
11206
|
let vertices = attachment.vertices;
|
|
@@ -11624,8 +11233,7 @@ var spine = (() => {
|
|
|
11624
11233
|
}
|
|
11625
11234
|
let time2 = getValue(nextMap, "time", 0);
|
|
11626
11235
|
let curve = keyMap.curve;
|
|
11627
|
-
if (curve)
|
|
11628
|
-
bezier = readCurve(curve, timeline, bezier, frame, 0, time, time2, 0, 1, 1);
|
|
11236
|
+
if (curve) bezier = readCurve(curve, timeline, bezier, frame, 0, time, time2, 0, 1, 1);
|
|
11629
11237
|
time = time2;
|
|
11630
11238
|
keyMap = nextMap;
|
|
11631
11239
|
}
|
|
@@ -11664,8 +11272,7 @@ var spine = (() => {
|
|
|
11664
11272
|
for (let ii = 0; ii < offsets.length; ii++) {
|
|
11665
11273
|
let offsetMap = offsets[ii];
|
|
11666
11274
|
let slot = skeletonData.findSlot(offsetMap.slot);
|
|
11667
|
-
if (!slot)
|
|
11668
|
-
throw new Error("Slot not found: " + slot);
|
|
11275
|
+
if (!slot) throw new Error("Slot not found: " + slot);
|
|
11669
11276
|
let slotIndex = slot.index;
|
|
11670
11277
|
while (originalIndex != slotIndex)
|
|
11671
11278
|
unchanged[unchangedIndex++] = originalIndex++;
|
|
@@ -11674,8 +11281,7 @@ var spine = (() => {
|
|
|
11674
11281
|
while (originalIndex < slotCount)
|
|
11675
11282
|
unchanged[unchangedIndex++] = originalIndex++;
|
|
11676
11283
|
for (let ii = slotCount - 1; ii >= 0; ii--)
|
|
11677
|
-
if (drawOrder[ii] == -1)
|
|
11678
|
-
drawOrder[ii] = unchanged[--unchangedIndex];
|
|
11284
|
+
if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];
|
|
11679
11285
|
}
|
|
11680
11286
|
timeline.setFrame(frame, getValue(drawOrderMap, "time", 0), drawOrder);
|
|
11681
11287
|
}
|
|
@@ -11687,8 +11293,7 @@ var spine = (() => {
|
|
|
11687
11293
|
for (let i = 0; i < map.events.length; i++, frame++) {
|
|
11688
11294
|
let eventMap = map.events[i];
|
|
11689
11295
|
let eventData = skeletonData.findEvent(eventMap.name);
|
|
11690
|
-
if (!eventData)
|
|
11691
|
-
throw new Error("Event not found: " + eventMap.name);
|
|
11296
|
+
if (!eventData) throw new Error("Event not found: " + eventMap.name);
|
|
11692
11297
|
let event = new Event(Utils.toSinglePrecision(getValue(eventMap, "time", 0)), eventData);
|
|
11693
11298
|
event.intValue = getValue(eventMap, "int", eventData.intValue);
|
|
11694
11299
|
event.floatValue = getValue(eventMap, "float", eventData.floatValue);
|
|
@@ -11735,8 +11340,7 @@ var spine = (() => {
|
|
|
11735
11340
|
}
|
|
11736
11341
|
let time2 = getValue(nextMap, "time", 0);
|
|
11737
11342
|
let value2 = getValue(nextMap, "value", defaultValue) * scale;
|
|
11738
|
-
if (keyMap.curve)
|
|
11739
|
-
bezier = readCurve(keyMap.curve, timeline, bezier, frame, 0, time, time2, value, value2, scale);
|
|
11343
|
+
if (keyMap.curve) bezier = readCurve(keyMap.curve, timeline, bezier, frame, 0, time, time2, value, value2, scale);
|
|
11740
11344
|
time = time2;
|
|
11741
11345
|
value = value2;
|
|
11742
11346
|
keyMap = nextMap;
|
|
@@ -11789,7 +11393,7 @@ var spine = (() => {
|
|
|
11789
11393
|
// spine-core/src/polyfills.ts
|
|
11790
11394
|
(() => {
|
|
11791
11395
|
if (typeof Math.fround === "undefined") {
|
|
11792
|
-
Math.fround = function(array) {
|
|
11396
|
+
Math.fround = /* @__PURE__ */ function(array) {
|
|
11793
11397
|
return function(x) {
|
|
11794
11398
|
return array[0] = x, array[0];
|
|
11795
11399
|
};
|
|
@@ -11821,7 +11425,9 @@ var spine = (() => {
|
|
|
11821
11425
|
|
|
11822
11426
|
// spine-canvas/src/SkeletonRenderer.ts
|
|
11823
11427
|
var worldVertices = Utils.newFloatArray(8);
|
|
11824
|
-
var
|
|
11428
|
+
var SkeletonRenderer = class _SkeletonRenderer {
|
|
11429
|
+
static QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0];
|
|
11430
|
+
static VERTEX_SIZE = 2 + 2 + 4;
|
|
11825
11431
|
ctx;
|
|
11826
11432
|
triangleRendering = false;
|
|
11827
11433
|
debugRendering = false;
|
|
@@ -11831,26 +11437,21 @@ var spine = (() => {
|
|
|
11831
11437
|
this.ctx = context;
|
|
11832
11438
|
}
|
|
11833
11439
|
draw(skeleton) {
|
|
11834
|
-
if (this.triangleRendering)
|
|
11835
|
-
|
|
11836
|
-
else
|
|
11837
|
-
this.drawImages(skeleton);
|
|
11440
|
+
if (this.triangleRendering) this.drawTriangles(skeleton);
|
|
11441
|
+
else this.drawImages(skeleton);
|
|
11838
11442
|
}
|
|
11839
11443
|
drawImages(skeleton) {
|
|
11840
11444
|
let ctx = this.ctx;
|
|
11841
11445
|
let color = this.tempColor;
|
|
11842
11446
|
let skeletonColor = skeleton.color;
|
|
11843
11447
|
let drawOrder = skeleton.drawOrder;
|
|
11844
|
-
if (this.debugRendering)
|
|
11845
|
-
ctx.strokeStyle = "green";
|
|
11448
|
+
if (this.debugRendering) ctx.strokeStyle = "green";
|
|
11846
11449
|
for (let i = 0, n = drawOrder.length; i < n; i++) {
|
|
11847
11450
|
let slot = drawOrder[i];
|
|
11848
11451
|
let bone = slot.bone;
|
|
11849
|
-
if (!bone.active)
|
|
11850
|
-
continue;
|
|
11452
|
+
if (!bone.active) continue;
|
|
11851
11453
|
let attachment = slot.getAttachment();
|
|
11852
|
-
if (!(attachment instanceof RegionAttachment))
|
|
11853
|
-
continue;
|
|
11454
|
+
if (!(attachment instanceof RegionAttachment)) continue;
|
|
11854
11455
|
attachment.computeWorldVertices(slot, worldVertices, 0, 2);
|
|
11855
11456
|
let region = attachment.region;
|
|
11856
11457
|
let image = region.texture.getImage();
|
|
@@ -11880,8 +11481,7 @@ var spine = (() => {
|
|
|
11880
11481
|
ctx.translate(-w / 2, -h / 2);
|
|
11881
11482
|
ctx.globalAlpha = color.a;
|
|
11882
11483
|
ctx.drawImage(image, image.width * region.u, image.height * region.v, w, h, 0, 0, w, h);
|
|
11883
|
-
if (this.debugRendering)
|
|
11884
|
-
ctx.strokeRect(0, 0, w, h);
|
|
11484
|
+
if (this.debugRendering) ctx.strokeRect(0, 0, w, h);
|
|
11885
11485
|
ctx.restore();
|
|
11886
11486
|
}
|
|
11887
11487
|
}
|
|
@@ -11911,8 +11511,7 @@ var spine = (() => {
|
|
|
11911
11511
|
} else
|
|
11912
11512
|
continue;
|
|
11913
11513
|
if (texture) {
|
|
11914
|
-
if (slot.data.blendMode != blendMode)
|
|
11915
|
-
blendMode = slot.data.blendMode;
|
|
11514
|
+
if (slot.data.blendMode != blendMode) blendMode = slot.data.blendMode;
|
|
11916
11515
|
let slotColor = slot.color;
|
|
11917
11516
|
let attachmentColor = attachment.color;
|
|
11918
11517
|
color.set(
|
|
@@ -11968,8 +11567,7 @@ var spine = (() => {
|
|
|
11968
11567
|
u2 -= u0;
|
|
11969
11568
|
v2 -= v0;
|
|
11970
11569
|
let det = u1 * v2 - u2 * v1;
|
|
11971
|
-
if (det == 0)
|
|
11972
|
-
return;
|
|
11570
|
+
if (det == 0) return;
|
|
11973
11571
|
det = 1 / det;
|
|
11974
11572
|
const a = (v2 * x1 - v1 * x2) * det;
|
|
11975
11573
|
const b = (v2 * y1 - v1 * y2) * det;
|
|
@@ -12040,8 +11638,7 @@ var spine = (() => {
|
|
|
12040
11638
|
);
|
|
12041
11639
|
let vertexCount = mesh.worldVerticesLength / 2;
|
|
12042
11640
|
let vertices = this.vertices;
|
|
12043
|
-
if (vertices.length < mesh.worldVerticesLength)
|
|
12044
|
-
this.vertices = vertices = Utils.newFloatArray(mesh.worldVerticesLength);
|
|
11641
|
+
if (vertices.length < mesh.worldVerticesLength) this.vertices = vertices = Utils.newFloatArray(mesh.worldVerticesLength);
|
|
12045
11642
|
mesh.computeWorldVertices(slot, 0, mesh.worldVerticesLength, vertices, 0, _SkeletonRenderer.VERTEX_SIZE);
|
|
12046
11643
|
let uvs = mesh.uvs;
|
|
12047
11644
|
for (let i = 0, u = 0, v = 2; i < vertexCount; i++) {
|
|
@@ -12056,9 +11653,6 @@ var spine = (() => {
|
|
|
12056
11653
|
return vertices;
|
|
12057
11654
|
}
|
|
12058
11655
|
};
|
|
12059
|
-
|
|
12060
|
-
__publicField(SkeletonRenderer, "QUAD_TRIANGLES", [0, 1, 2, 2, 3, 0]);
|
|
12061
|
-
__publicField(SkeletonRenderer, "VERTEX_SIZE", 2 + 2 + 4);
|
|
12062
|
-
return __toCommonJS(src_exports);
|
|
11656
|
+
return __toCommonJS(index_exports);
|
|
12063
11657
|
})();
|
|
12064
11658
|
//# sourceMappingURL=spine-canvas.js.map
|