@esotericsoftware/spine-canvas 4.2.10 → 4.2.14
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.
- package/README.md +1 -1
- package/dist/SkeletonRenderer.js +5 -7
- package/dist/iife/spine-canvas.js +2053 -517
- package/dist/iife/spine-canvas.js.map +3 -3
- package/dist/iife/spine-canvas.min.js +2 -2
- package/package.json +2 -2
|
@@ -1,11 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var spine = (() => {
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
7
|
var __export = (target, all) => {
|
|
5
|
-
__markAsModule(target);
|
|
6
8
|
for (var name in all)
|
|
7
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
10
|
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
9
20
|
|
|
10
21
|
// spine-canvas/src/index.ts
|
|
11
22
|
var src_exports = {};
|
|
@@ -372,6 +383,7 @@ var spine = (() => {
|
|
|
372
383
|
static toSinglePrecision(value) {
|
|
373
384
|
return _Utils.SUPPORTS_TYPED_ARRAYS ? Math.fround(value) : value;
|
|
374
385
|
}
|
|
386
|
+
// This function is used to fix WebKit 602 specific issue described at http://esotericsoftware.com/forum/iOS-10-disappearing-graphics-10109
|
|
375
387
|
static webkit602BugfixHelper(alpha, blend) {
|
|
376
388
|
}
|
|
377
389
|
static contains(array, element, identity = true) {
|
|
@@ -510,12 +522,34 @@ var spine = (() => {
|
|
|
510
522
|
var _VertexAttachment = class extends Attachment {
|
|
511
523
|
constructor(name) {
|
|
512
524
|
super(name);
|
|
525
|
+
/** The unique ID for this attachment. */
|
|
513
526
|
this.id = _VertexAttachment.nextID++;
|
|
527
|
+
/** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting
|
|
528
|
+
* the vertex followed by that many bone indices, which is the index of the bone in {@link Skeleton#bones}. Will be null
|
|
529
|
+
* if this attachment has no weights. */
|
|
514
530
|
this.bones = null;
|
|
531
|
+
/** The vertex positions in the bone's coordinate system. For a non-weighted attachment, the values are `x,y`
|
|
532
|
+
* entries for each vertex. For a weighted attachment, the values are `x,y,weight` entries for each bone affecting
|
|
533
|
+
* each vertex. */
|
|
515
534
|
this.vertices = [];
|
|
535
|
+
/** The maximum number of world vertex values that can be output by
|
|
536
|
+
* {@link #computeWorldVertices()} using the `count` parameter. */
|
|
516
537
|
this.worldVerticesLength = 0;
|
|
538
|
+
/** Timelines for the timeline attachment are also applied to this attachment.
|
|
539
|
+
* May be null if no attachment-specific timelines should be applied. */
|
|
517
540
|
this.timelineAttachment = this;
|
|
518
541
|
}
|
|
542
|
+
/** Transforms the attachment's local {@link #vertices} to world coordinates. If the slot's {@link Slot#deform} is
|
|
543
|
+
* not empty, it is used to deform the vertices.
|
|
544
|
+
*
|
|
545
|
+
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
|
546
|
+
* Runtimes Guide.
|
|
547
|
+
* @param start The index of the first {@link #vertices} value to transform. Each vertex has 2 values, x and y.
|
|
548
|
+
* @param count The number of world vertex values to output. Must be <= {@link #worldVerticesLength} - `start`.
|
|
549
|
+
* @param worldVertices The output world vertices. Must have a length >= `offset` + `count` *
|
|
550
|
+
* `stride` / 2.
|
|
551
|
+
* @param offset The `worldVertices` index to begin writing values.
|
|
552
|
+
* @param stride The number of `worldVertices` entries between the value pairs written. */
|
|
519
553
|
computeWorldVertices(slot, start, count, worldVertices2, offset, stride) {
|
|
520
554
|
count = offset + (count >> 1) * stride;
|
|
521
555
|
let skeleton = slot.bone.skeleton;
|
|
@@ -574,6 +608,7 @@ var spine = (() => {
|
|
|
574
608
|
}
|
|
575
609
|
}
|
|
576
610
|
}
|
|
611
|
+
/** Does not copy id (generated) or name (set on construction). **/
|
|
577
612
|
copyTo(attachment) {
|
|
578
613
|
if (this.bones) {
|
|
579
614
|
attachment.bones = new Array(this.bones.length);
|
|
@@ -597,6 +632,7 @@ var spine = (() => {
|
|
|
597
632
|
this.id = _Sequence.nextID();
|
|
598
633
|
this.start = 0;
|
|
599
634
|
this.digits = 0;
|
|
635
|
+
/** The index of the region to show for the setup pose. */
|
|
600
636
|
this.setupIndex = 0;
|
|
601
637
|
this.regions = new Array(count);
|
|
602
638
|
}
|
|
@@ -634,8 +670,7 @@ var spine = (() => {
|
|
|
634
670
|
};
|
|
635
671
|
var Sequence = _Sequence;
|
|
636
672
|
Sequence._nextID = 0;
|
|
637
|
-
var SequenceMode
|
|
638
|
-
(function(SequenceMode2) {
|
|
673
|
+
var SequenceMode = /* @__PURE__ */ ((SequenceMode2) => {
|
|
639
674
|
SequenceMode2[SequenceMode2["hold"] = 0] = "hold";
|
|
640
675
|
SequenceMode2[SequenceMode2["once"] = 1] = "once";
|
|
641
676
|
SequenceMode2[SequenceMode2["loop"] = 2] = "loop";
|
|
@@ -643,15 +678,16 @@ var spine = (() => {
|
|
|
643
678
|
SequenceMode2[SequenceMode2["onceReverse"] = 4] = "onceReverse";
|
|
644
679
|
SequenceMode2[SequenceMode2["loopReverse"] = 5] = "loopReverse";
|
|
645
680
|
SequenceMode2[SequenceMode2["pingpongReverse"] = 6] = "pingpongReverse";
|
|
646
|
-
|
|
681
|
+
return SequenceMode2;
|
|
682
|
+
})(SequenceMode || {});
|
|
647
683
|
var SequenceModeValues = [
|
|
648
|
-
0
|
|
649
|
-
1
|
|
650
|
-
2
|
|
651
|
-
3
|
|
652
|
-
4
|
|
653
|
-
5
|
|
654
|
-
6
|
|
684
|
+
0 /* hold */,
|
|
685
|
+
1 /* once */,
|
|
686
|
+
2 /* loop */,
|
|
687
|
+
3 /* pingpong */,
|
|
688
|
+
4 /* onceReverse */,
|
|
689
|
+
5 /* loopReverse */,
|
|
690
|
+
6 /* pingpongReverse */
|
|
655
691
|
];
|
|
656
692
|
|
|
657
693
|
// spine-core/src/Animation.ts
|
|
@@ -679,6 +715,11 @@ var spine = (() => {
|
|
|
679
715
|
return true;
|
|
680
716
|
return false;
|
|
681
717
|
}
|
|
718
|
+
/** Applies all the animation's timelines to the specified skeleton.
|
|
719
|
+
*
|
|
720
|
+
* See Timeline {@link Timeline#apply(Skeleton, float, float, Array, float, MixBlend, MixDirection)}.
|
|
721
|
+
* @param loop If true, the animation repeats after {@link #getDuration()}.
|
|
722
|
+
* @param events May be null to ignore fired events. */
|
|
682
723
|
apply(skeleton, lastTime, time, loop, events, alpha, blend, direction) {
|
|
683
724
|
if (!skeleton)
|
|
684
725
|
throw new Error("skeleton cannot be null.");
|
|
@@ -692,18 +733,18 @@ var spine = (() => {
|
|
|
692
733
|
timelines[i].apply(skeleton, lastTime, time, events, alpha, blend, direction);
|
|
693
734
|
}
|
|
694
735
|
};
|
|
695
|
-
var MixBlend
|
|
696
|
-
(function(MixBlend2) {
|
|
736
|
+
var MixBlend = /* @__PURE__ */ ((MixBlend2) => {
|
|
697
737
|
MixBlend2[MixBlend2["setup"] = 0] = "setup";
|
|
698
738
|
MixBlend2[MixBlend2["first"] = 1] = "first";
|
|
699
739
|
MixBlend2[MixBlend2["replace"] = 2] = "replace";
|
|
700
740
|
MixBlend2[MixBlend2["add"] = 3] = "add";
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
(
|
|
741
|
+
return MixBlend2;
|
|
742
|
+
})(MixBlend || {});
|
|
743
|
+
var MixDirection = /* @__PURE__ */ ((MixDirection2) => {
|
|
704
744
|
MixDirection2[MixDirection2["mixIn"] = 0] = "mixIn";
|
|
705
745
|
MixDirection2[MixDirection2["mixOut"] = 1] = "mixOut";
|
|
706
|
-
|
|
746
|
+
return MixDirection2;
|
|
747
|
+
})(MixDirection || {});
|
|
707
748
|
var Property = {
|
|
708
749
|
rotate: 0,
|
|
709
750
|
x: 1,
|
|
@@ -759,17 +800,25 @@ var spine = (() => {
|
|
|
759
800
|
}
|
|
760
801
|
};
|
|
761
802
|
var CurveTimeline = class extends Timeline {
|
|
803
|
+
// type, x, y, ...
|
|
762
804
|
constructor(frameCount, bezierCount, propertyIds) {
|
|
763
805
|
super(frameCount, propertyIds);
|
|
764
|
-
this.curves = Utils.newFloatArray(
|
|
806
|
+
this.curves = Utils.newFloatArray(
|
|
807
|
+
frameCount + bezierCount * 18
|
|
808
|
+
/*BEZIER_SIZE*/
|
|
809
|
+
);
|
|
765
810
|
this.curves[frameCount - 1] = 1;
|
|
766
811
|
}
|
|
812
|
+
/** Sets the specified key frame to linear interpolation. */
|
|
767
813
|
setLinear(frame) {
|
|
768
814
|
this.curves[frame] = 0;
|
|
769
815
|
}
|
|
816
|
+
/** Sets the specified key frame to stepped interpolation. */
|
|
770
817
|
setStepped(frame) {
|
|
771
818
|
this.curves[frame] = 1;
|
|
772
819
|
}
|
|
820
|
+
/** Shrinks the storage for Bezier curves, for use when <code>bezierCount</code> (specified in the constructor) was larger
|
|
821
|
+
* than the actual number of Bezier curves. */
|
|
773
822
|
shrink(bezierCount) {
|
|
774
823
|
let size = this.getFrameCount() + bezierCount * 18;
|
|
775
824
|
if (this.curves.length > size) {
|
|
@@ -778,6 +827,20 @@ var spine = (() => {
|
|
|
778
827
|
this.curves = newCurves;
|
|
779
828
|
}
|
|
780
829
|
}
|
|
830
|
+
/** Stores the segments for the specified Bezier curve. For timelines that modify multiple values, there may be more than
|
|
831
|
+
* one curve per frame.
|
|
832
|
+
* @param bezier The ordinal of this Bezier curve for this timeline, between 0 and <code>bezierCount - 1</code> (specified
|
|
833
|
+
* in the constructor), inclusive.
|
|
834
|
+
* @param frame Between 0 and <code>frameCount - 1</code>, inclusive.
|
|
835
|
+
* @param value The index of the value for this frame that this curve is used for.
|
|
836
|
+
* @param time1 The time for the first key.
|
|
837
|
+
* @param value1 The value for the first key.
|
|
838
|
+
* @param cx1 The time for the first Bezier handle.
|
|
839
|
+
* @param cy1 The value for the first Bezier handle.
|
|
840
|
+
* @param cx2 The time of the second Bezier handle.
|
|
841
|
+
* @param cy2 The value for the second Bezier handle.
|
|
842
|
+
* @param time2 The time for the second key.
|
|
843
|
+
* @param value2 The value for the second key. */
|
|
781
844
|
setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) {
|
|
782
845
|
let curves = this.curves;
|
|
783
846
|
let i = this.getFrameCount() + bezier * 18;
|
|
@@ -799,6 +862,10 @@ var spine = (() => {
|
|
|
799
862
|
y += dy;
|
|
800
863
|
}
|
|
801
864
|
}
|
|
865
|
+
/** Returns the Bezier interpolated value for the specified time.
|
|
866
|
+
* @param frameIndex The index into {@link #getFrames()} for the values of the frame before <code>time</code>.
|
|
867
|
+
* @param valueOffset The offset from <code>frameIndex</code> to the value this curve is used for.
|
|
868
|
+
* @param i The index of the Bezier segments. See {@link #getCurveType(int)}. */
|
|
802
869
|
getBezierValue(time, frameIndex, valueOffset, i) {
|
|
803
870
|
let curves = this.curves;
|
|
804
871
|
if (curves[i] > time) {
|
|
@@ -824,11 +891,18 @@ var spine = (() => {
|
|
|
824
891
|
getFrameEntries() {
|
|
825
892
|
return 2;
|
|
826
893
|
}
|
|
894
|
+
/** Sets the time and value for the specified frame.
|
|
895
|
+
* @param frame Between 0 and <code>frameCount</code>, inclusive.
|
|
896
|
+
* @param time The frame time in seconds. */
|
|
827
897
|
setFrame(frame, time, value) {
|
|
828
898
|
frame <<= 1;
|
|
829
899
|
this.frames[frame] = time;
|
|
830
|
-
this.frames[
|
|
900
|
+
this.frames[
|
|
901
|
+
frame + 1
|
|
902
|
+
/*VALUE*/
|
|
903
|
+
] = value;
|
|
831
904
|
}
|
|
905
|
+
/** Returns the interpolated value for the specified time. */
|
|
832
906
|
getCurveValue(time) {
|
|
833
907
|
let frames = this.frames;
|
|
834
908
|
let i = frames.length - 2;
|
|
@@ -841,26 +915,55 @@ var spine = (() => {
|
|
|
841
915
|
let curveType = this.curves[i >> 1];
|
|
842
916
|
switch (curveType) {
|
|
843
917
|
case 0:
|
|
844
|
-
let before = frames[i], value = frames[
|
|
845
|
-
|
|
918
|
+
let before = frames[i], value = frames[
|
|
919
|
+
i + 1
|
|
920
|
+
/*VALUE*/
|
|
921
|
+
];
|
|
922
|
+
return value + (time - before) / (frames[
|
|
923
|
+
i + 2
|
|
924
|
+
/*ENTRIES*/
|
|
925
|
+
] - before) * (frames[
|
|
926
|
+
i + 2 + 1
|
|
927
|
+
/*VALUE*/
|
|
928
|
+
] - value);
|
|
846
929
|
case 1:
|
|
847
|
-
return frames[
|
|
848
|
-
|
|
849
|
-
|
|
930
|
+
return frames[
|
|
931
|
+
i + 1
|
|
932
|
+
/*VALUE*/
|
|
933
|
+
];
|
|
934
|
+
}
|
|
935
|
+
return this.getBezierValue(
|
|
936
|
+
time,
|
|
937
|
+
i,
|
|
938
|
+
1,
|
|
939
|
+
curveType - 2
|
|
940
|
+
/*BEZIER*/
|
|
941
|
+
);
|
|
850
942
|
}
|
|
851
943
|
};
|
|
852
944
|
var CurveTimeline2 = class extends CurveTimeline {
|
|
945
|
+
/** @param bezierCount The maximum number of Bezier curves. See {@link #shrink(int)}.
|
|
946
|
+
* @param propertyIds Unique identifiers for the properties the timeline modifies. */
|
|
853
947
|
constructor(frameCount, bezierCount, propertyId1, propertyId2) {
|
|
854
948
|
super(frameCount, bezierCount, [propertyId1, propertyId2]);
|
|
855
949
|
}
|
|
856
950
|
getFrameEntries() {
|
|
857
951
|
return 3;
|
|
858
952
|
}
|
|
953
|
+
/** Sets the time and values for the specified frame.
|
|
954
|
+
* @param frame Between 0 and <code>frameCount</code>, inclusive.
|
|
955
|
+
* @param time The frame time in seconds. */
|
|
859
956
|
setFrame(frame, time, value1, value2) {
|
|
860
957
|
frame *= 3;
|
|
861
958
|
this.frames[frame] = time;
|
|
862
|
-
this.frames[
|
|
863
|
-
|
|
959
|
+
this.frames[
|
|
960
|
+
frame + 1
|
|
961
|
+
/*VALUE1*/
|
|
962
|
+
] = value1;
|
|
963
|
+
this.frames[
|
|
964
|
+
frame + 2
|
|
965
|
+
/*VALUE2*/
|
|
966
|
+
] = value2;
|
|
864
967
|
}
|
|
865
968
|
};
|
|
866
969
|
var RotateTimeline = class extends CurveTimeline1 {
|
|
@@ -876,30 +979,35 @@ var spine = (() => {
|
|
|
876
979
|
let frames = this.frames;
|
|
877
980
|
if (time < frames[0]) {
|
|
878
981
|
switch (blend) {
|
|
879
|
-
case 0
|
|
982
|
+
case 0 /* setup */:
|
|
880
983
|
bone.rotation = bone.data.rotation;
|
|
881
984
|
return;
|
|
882
|
-
case 1
|
|
985
|
+
case 1 /* first */:
|
|
883
986
|
bone.rotation += (bone.data.rotation - bone.rotation) * alpha;
|
|
884
987
|
}
|
|
885
988
|
return;
|
|
886
989
|
}
|
|
887
990
|
let r = this.getCurveValue(time);
|
|
888
991
|
switch (blend) {
|
|
889
|
-
case 0
|
|
992
|
+
case 0 /* setup */:
|
|
890
993
|
bone.rotation = bone.data.rotation + r * alpha;
|
|
891
994
|
break;
|
|
892
|
-
case 1
|
|
893
|
-
case 2
|
|
995
|
+
case 1 /* first */:
|
|
996
|
+
case 2 /* replace */:
|
|
894
997
|
r += bone.data.rotation - bone.rotation;
|
|
895
|
-
case 3
|
|
998
|
+
case 3 /* add */:
|
|
896
999
|
bone.rotation += r * alpha;
|
|
897
1000
|
}
|
|
898
1001
|
}
|
|
899
1002
|
};
|
|
900
1003
|
var TranslateTimeline = class extends CurveTimeline2 {
|
|
901
1004
|
constructor(frameCount, bezierCount, boneIndex) {
|
|
902
|
-
super(
|
|
1005
|
+
super(
|
|
1006
|
+
frameCount,
|
|
1007
|
+
bezierCount,
|
|
1008
|
+
Property.x + "|" + boneIndex,
|
|
1009
|
+
Property.y + "|" + boneIndex
|
|
1010
|
+
);
|
|
903
1011
|
this.boneIndex = 0;
|
|
904
1012
|
this.boneIndex = boneIndex;
|
|
905
1013
|
}
|
|
@@ -910,47 +1018,88 @@ var spine = (() => {
|
|
|
910
1018
|
let frames = this.frames;
|
|
911
1019
|
if (time < frames[0]) {
|
|
912
1020
|
switch (blend) {
|
|
913
|
-
case 0
|
|
1021
|
+
case 0 /* setup */:
|
|
914
1022
|
bone.x = bone.data.x;
|
|
915
1023
|
bone.y = bone.data.y;
|
|
916
1024
|
return;
|
|
917
|
-
case 1
|
|
1025
|
+
case 1 /* first */:
|
|
918
1026
|
bone.x += (bone.data.x - bone.x) * alpha;
|
|
919
1027
|
bone.y += (bone.data.y - bone.y) * alpha;
|
|
920
1028
|
}
|
|
921
1029
|
return;
|
|
922
1030
|
}
|
|
923
1031
|
let x = 0, y = 0;
|
|
924
|
-
let i = Timeline.search(
|
|
925
|
-
|
|
1032
|
+
let i = Timeline.search(
|
|
1033
|
+
frames,
|
|
1034
|
+
time,
|
|
1035
|
+
3
|
|
1036
|
+
/*ENTRIES*/
|
|
1037
|
+
);
|
|
1038
|
+
let curveType = this.curves[
|
|
1039
|
+
i / 3
|
|
1040
|
+
/*ENTRIES*/
|
|
1041
|
+
];
|
|
926
1042
|
switch (curveType) {
|
|
927
1043
|
case 0:
|
|
928
1044
|
let before = frames[i];
|
|
929
|
-
x = frames[
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
y
|
|
1045
|
+
x = frames[
|
|
1046
|
+
i + 1
|
|
1047
|
+
/*VALUE1*/
|
|
1048
|
+
];
|
|
1049
|
+
y = frames[
|
|
1050
|
+
i + 2
|
|
1051
|
+
/*VALUE2*/
|
|
1052
|
+
];
|
|
1053
|
+
let t = (time - before) / (frames[
|
|
1054
|
+
i + 3
|
|
1055
|
+
/*ENTRIES*/
|
|
1056
|
+
] - before);
|
|
1057
|
+
x += (frames[
|
|
1058
|
+
i + 3 + 1
|
|
1059
|
+
/*VALUE1*/
|
|
1060
|
+
] - x) * t;
|
|
1061
|
+
y += (frames[
|
|
1062
|
+
i + 3 + 2
|
|
1063
|
+
/*VALUE2*/
|
|
1064
|
+
] - y) * t;
|
|
934
1065
|
break;
|
|
935
1066
|
case 1:
|
|
936
|
-
x = frames[
|
|
937
|
-
|
|
1067
|
+
x = frames[
|
|
1068
|
+
i + 1
|
|
1069
|
+
/*VALUE1*/
|
|
1070
|
+
];
|
|
1071
|
+
y = frames[
|
|
1072
|
+
i + 2
|
|
1073
|
+
/*VALUE2*/
|
|
1074
|
+
];
|
|
938
1075
|
break;
|
|
939
1076
|
default:
|
|
940
|
-
x = this.getBezierValue(
|
|
941
|
-
|
|
1077
|
+
x = this.getBezierValue(
|
|
1078
|
+
time,
|
|
1079
|
+
i,
|
|
1080
|
+
1,
|
|
1081
|
+
curveType - 2
|
|
1082
|
+
/*BEZIER*/
|
|
1083
|
+
);
|
|
1084
|
+
y = this.getBezierValue(
|
|
1085
|
+
time,
|
|
1086
|
+
i,
|
|
1087
|
+
2,
|
|
1088
|
+
curveType + 18 - 2
|
|
1089
|
+
/*BEZIER*/
|
|
1090
|
+
);
|
|
942
1091
|
}
|
|
943
1092
|
switch (blend) {
|
|
944
|
-
case 0
|
|
1093
|
+
case 0 /* setup */:
|
|
945
1094
|
bone.x = bone.data.x + x * alpha;
|
|
946
1095
|
bone.y = bone.data.y + y * alpha;
|
|
947
1096
|
break;
|
|
948
|
-
case 1
|
|
949
|
-
case 2
|
|
1097
|
+
case 1 /* first */:
|
|
1098
|
+
case 2 /* replace */:
|
|
950
1099
|
bone.x += (bone.data.x + x - bone.x) * alpha;
|
|
951
1100
|
bone.y += (bone.data.y + y - bone.y) * alpha;
|
|
952
1101
|
break;
|
|
953
|
-
case 3
|
|
1102
|
+
case 3 /* add */:
|
|
954
1103
|
bone.x += x * alpha;
|
|
955
1104
|
bone.y += y * alpha;
|
|
956
1105
|
}
|
|
@@ -969,24 +1118,24 @@ var spine = (() => {
|
|
|
969
1118
|
let frames = this.frames;
|
|
970
1119
|
if (time < frames[0]) {
|
|
971
1120
|
switch (blend) {
|
|
972
|
-
case 0
|
|
1121
|
+
case 0 /* setup */:
|
|
973
1122
|
bone.x = bone.data.x;
|
|
974
1123
|
return;
|
|
975
|
-
case 1
|
|
1124
|
+
case 1 /* first */:
|
|
976
1125
|
bone.x += (bone.data.x - bone.x) * alpha;
|
|
977
1126
|
}
|
|
978
1127
|
return;
|
|
979
1128
|
}
|
|
980
1129
|
let x = this.getCurveValue(time);
|
|
981
1130
|
switch (blend) {
|
|
982
|
-
case 0
|
|
1131
|
+
case 0 /* setup */:
|
|
983
1132
|
bone.x = bone.data.x + x * alpha;
|
|
984
1133
|
break;
|
|
985
|
-
case 1
|
|
986
|
-
case 2
|
|
1134
|
+
case 1 /* first */:
|
|
1135
|
+
case 2 /* replace */:
|
|
987
1136
|
bone.x += (bone.data.x + x - bone.x) * alpha;
|
|
988
1137
|
break;
|
|
989
|
-
case 3
|
|
1138
|
+
case 3 /* add */:
|
|
990
1139
|
bone.x += x * alpha;
|
|
991
1140
|
}
|
|
992
1141
|
}
|
|
@@ -1004,31 +1153,36 @@ var spine = (() => {
|
|
|
1004
1153
|
let frames = this.frames;
|
|
1005
1154
|
if (time < frames[0]) {
|
|
1006
1155
|
switch (blend) {
|
|
1007
|
-
case 0
|
|
1156
|
+
case 0 /* setup */:
|
|
1008
1157
|
bone.y = bone.data.y;
|
|
1009
1158
|
return;
|
|
1010
|
-
case 1
|
|
1159
|
+
case 1 /* first */:
|
|
1011
1160
|
bone.y += (bone.data.y - bone.y) * alpha;
|
|
1012
1161
|
}
|
|
1013
1162
|
return;
|
|
1014
1163
|
}
|
|
1015
1164
|
let y = this.getCurveValue(time);
|
|
1016
1165
|
switch (blend) {
|
|
1017
|
-
case 0
|
|
1166
|
+
case 0 /* setup */:
|
|
1018
1167
|
bone.y = bone.data.y + y * alpha;
|
|
1019
1168
|
break;
|
|
1020
|
-
case 1
|
|
1021
|
-
case 2
|
|
1169
|
+
case 1 /* first */:
|
|
1170
|
+
case 2 /* replace */:
|
|
1022
1171
|
bone.y += (bone.data.y + y - bone.y) * alpha;
|
|
1023
1172
|
break;
|
|
1024
|
-
case 3
|
|
1173
|
+
case 3 /* add */:
|
|
1025
1174
|
bone.y += y * alpha;
|
|
1026
1175
|
}
|
|
1027
1176
|
}
|
|
1028
1177
|
};
|
|
1029
1178
|
var ScaleTimeline = class extends CurveTimeline2 {
|
|
1030
1179
|
constructor(frameCount, bezierCount, boneIndex) {
|
|
1031
|
-
super(
|
|
1180
|
+
super(
|
|
1181
|
+
frameCount,
|
|
1182
|
+
bezierCount,
|
|
1183
|
+
Property.scaleX + "|" + boneIndex,
|
|
1184
|
+
Property.scaleY + "|" + boneIndex
|
|
1185
|
+
);
|
|
1032
1186
|
this.boneIndex = 0;
|
|
1033
1187
|
this.boneIndex = boneIndex;
|
|
1034
1188
|
}
|
|
@@ -1039,40 +1193,81 @@ var spine = (() => {
|
|
|
1039
1193
|
let frames = this.frames;
|
|
1040
1194
|
if (time < frames[0]) {
|
|
1041
1195
|
switch (blend) {
|
|
1042
|
-
case 0
|
|
1196
|
+
case 0 /* setup */:
|
|
1043
1197
|
bone.scaleX = bone.data.scaleX;
|
|
1044
1198
|
bone.scaleY = bone.data.scaleY;
|
|
1045
1199
|
return;
|
|
1046
|
-
case 1
|
|
1200
|
+
case 1 /* first */:
|
|
1047
1201
|
bone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha;
|
|
1048
1202
|
bone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha;
|
|
1049
1203
|
}
|
|
1050
1204
|
return;
|
|
1051
1205
|
}
|
|
1052
1206
|
let x, y;
|
|
1053
|
-
let i = Timeline.search(
|
|
1054
|
-
|
|
1207
|
+
let i = Timeline.search(
|
|
1208
|
+
frames,
|
|
1209
|
+
time,
|
|
1210
|
+
3
|
|
1211
|
+
/*ENTRIES*/
|
|
1212
|
+
);
|
|
1213
|
+
let curveType = this.curves[
|
|
1214
|
+
i / 3
|
|
1215
|
+
/*ENTRIES*/
|
|
1216
|
+
];
|
|
1055
1217
|
switch (curveType) {
|
|
1056
1218
|
case 0:
|
|
1057
1219
|
let before = frames[i];
|
|
1058
|
-
x = frames[
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
y
|
|
1220
|
+
x = frames[
|
|
1221
|
+
i + 1
|
|
1222
|
+
/*VALUE1*/
|
|
1223
|
+
];
|
|
1224
|
+
y = frames[
|
|
1225
|
+
i + 2
|
|
1226
|
+
/*VALUE2*/
|
|
1227
|
+
];
|
|
1228
|
+
let t = (time - before) / (frames[
|
|
1229
|
+
i + 3
|
|
1230
|
+
/*ENTRIES*/
|
|
1231
|
+
] - before);
|
|
1232
|
+
x += (frames[
|
|
1233
|
+
i + 3 + 1
|
|
1234
|
+
/*VALUE1*/
|
|
1235
|
+
] - x) * t;
|
|
1236
|
+
y += (frames[
|
|
1237
|
+
i + 3 + 2
|
|
1238
|
+
/*VALUE2*/
|
|
1239
|
+
] - y) * t;
|
|
1063
1240
|
break;
|
|
1064
1241
|
case 1:
|
|
1065
|
-
x = frames[
|
|
1066
|
-
|
|
1242
|
+
x = frames[
|
|
1243
|
+
i + 1
|
|
1244
|
+
/*VALUE1*/
|
|
1245
|
+
];
|
|
1246
|
+
y = frames[
|
|
1247
|
+
i + 2
|
|
1248
|
+
/*VALUE2*/
|
|
1249
|
+
];
|
|
1067
1250
|
break;
|
|
1068
1251
|
default:
|
|
1069
|
-
x = this.getBezierValue(
|
|
1070
|
-
|
|
1252
|
+
x = this.getBezierValue(
|
|
1253
|
+
time,
|
|
1254
|
+
i,
|
|
1255
|
+
1,
|
|
1256
|
+
curveType - 2
|
|
1257
|
+
/*BEZIER*/
|
|
1258
|
+
);
|
|
1259
|
+
y = this.getBezierValue(
|
|
1260
|
+
time,
|
|
1261
|
+
i,
|
|
1262
|
+
2,
|
|
1263
|
+
curveType + 18 - 2
|
|
1264
|
+
/*BEZIER*/
|
|
1265
|
+
);
|
|
1071
1266
|
}
|
|
1072
1267
|
x *= bone.data.scaleX;
|
|
1073
1268
|
y *= bone.data.scaleY;
|
|
1074
1269
|
if (alpha == 1) {
|
|
1075
|
-
if (blend == 3) {
|
|
1270
|
+
if (blend == 3 /* add */) {
|
|
1076
1271
|
bone.scaleX += x - bone.data.scaleX;
|
|
1077
1272
|
bone.scaleY += y - bone.data.scaleY;
|
|
1078
1273
|
} else {
|
|
@@ -1081,41 +1276,41 @@ var spine = (() => {
|
|
|
1081
1276
|
}
|
|
1082
1277
|
} else {
|
|
1083
1278
|
let bx = 0, by = 0;
|
|
1084
|
-
if (direction == 1) {
|
|
1279
|
+
if (direction == 1 /* mixOut */) {
|
|
1085
1280
|
switch (blend) {
|
|
1086
|
-
case 0
|
|
1281
|
+
case 0 /* setup */:
|
|
1087
1282
|
bx = bone.data.scaleX;
|
|
1088
1283
|
by = bone.data.scaleY;
|
|
1089
1284
|
bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
|
|
1090
1285
|
bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
|
|
1091
1286
|
break;
|
|
1092
|
-
case 1
|
|
1093
|
-
case 2
|
|
1287
|
+
case 1 /* first */:
|
|
1288
|
+
case 2 /* replace */:
|
|
1094
1289
|
bx = bone.scaleX;
|
|
1095
1290
|
by = bone.scaleY;
|
|
1096
1291
|
bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
|
|
1097
1292
|
bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
|
|
1098
1293
|
break;
|
|
1099
|
-
case 3
|
|
1294
|
+
case 3 /* add */:
|
|
1100
1295
|
bone.scaleX += (x - bone.data.scaleX) * alpha;
|
|
1101
1296
|
bone.scaleY += (y - bone.data.scaleY) * alpha;
|
|
1102
1297
|
}
|
|
1103
1298
|
} else {
|
|
1104
1299
|
switch (blend) {
|
|
1105
|
-
case 0
|
|
1300
|
+
case 0 /* setup */:
|
|
1106
1301
|
bx = Math.abs(bone.data.scaleX) * MathUtils.signum(x);
|
|
1107
1302
|
by = Math.abs(bone.data.scaleY) * MathUtils.signum(y);
|
|
1108
1303
|
bone.scaleX = bx + (x - bx) * alpha;
|
|
1109
1304
|
bone.scaleY = by + (y - by) * alpha;
|
|
1110
1305
|
break;
|
|
1111
|
-
case 1
|
|
1112
|
-
case 2
|
|
1306
|
+
case 1 /* first */:
|
|
1307
|
+
case 2 /* replace */:
|
|
1113
1308
|
bx = Math.abs(bone.scaleX) * MathUtils.signum(x);
|
|
1114
1309
|
by = Math.abs(bone.scaleY) * MathUtils.signum(y);
|
|
1115
1310
|
bone.scaleX = bx + (x - bx) * alpha;
|
|
1116
1311
|
bone.scaleY = by + (y - by) * alpha;
|
|
1117
1312
|
break;
|
|
1118
|
-
case 3
|
|
1313
|
+
case 3 /* add */:
|
|
1119
1314
|
bone.scaleX += (x - bone.data.scaleX) * alpha;
|
|
1120
1315
|
bone.scaleY += (y - bone.data.scaleY) * alpha;
|
|
1121
1316
|
}
|
|
@@ -1136,48 +1331,48 @@ var spine = (() => {
|
|
|
1136
1331
|
let frames = this.frames;
|
|
1137
1332
|
if (time < frames[0]) {
|
|
1138
1333
|
switch (blend) {
|
|
1139
|
-
case 0
|
|
1334
|
+
case 0 /* setup */:
|
|
1140
1335
|
bone.scaleX = bone.data.scaleX;
|
|
1141
1336
|
return;
|
|
1142
|
-
case 1
|
|
1337
|
+
case 1 /* first */:
|
|
1143
1338
|
bone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha;
|
|
1144
1339
|
}
|
|
1145
1340
|
return;
|
|
1146
1341
|
}
|
|
1147
1342
|
let x = this.getCurveValue(time) * bone.data.scaleX;
|
|
1148
1343
|
if (alpha == 1) {
|
|
1149
|
-
if (blend == 3)
|
|
1344
|
+
if (blend == 3 /* add */)
|
|
1150
1345
|
bone.scaleX += x - bone.data.scaleX;
|
|
1151
1346
|
else
|
|
1152
1347
|
bone.scaleX = x;
|
|
1153
1348
|
} else {
|
|
1154
1349
|
let bx = 0;
|
|
1155
|
-
if (direction == 1) {
|
|
1350
|
+
if (direction == 1 /* mixOut */) {
|
|
1156
1351
|
switch (blend) {
|
|
1157
|
-
case 0
|
|
1352
|
+
case 0 /* setup */:
|
|
1158
1353
|
bx = bone.data.scaleX;
|
|
1159
1354
|
bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
|
|
1160
1355
|
break;
|
|
1161
|
-
case 1
|
|
1162
|
-
case 2
|
|
1356
|
+
case 1 /* first */:
|
|
1357
|
+
case 2 /* replace */:
|
|
1163
1358
|
bx = bone.scaleX;
|
|
1164
1359
|
bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
|
|
1165
1360
|
break;
|
|
1166
|
-
case 3
|
|
1361
|
+
case 3 /* add */:
|
|
1167
1362
|
bone.scaleX += (x - bone.data.scaleX) * alpha;
|
|
1168
1363
|
}
|
|
1169
1364
|
} else {
|
|
1170
1365
|
switch (blend) {
|
|
1171
|
-
case 0
|
|
1366
|
+
case 0 /* setup */:
|
|
1172
1367
|
bx = Math.abs(bone.data.scaleX) * MathUtils.signum(x);
|
|
1173
1368
|
bone.scaleX = bx + (x - bx) * alpha;
|
|
1174
1369
|
break;
|
|
1175
|
-
case 1
|
|
1176
|
-
case 2
|
|
1370
|
+
case 1 /* first */:
|
|
1371
|
+
case 2 /* replace */:
|
|
1177
1372
|
bx = Math.abs(bone.scaleX) * MathUtils.signum(x);
|
|
1178
1373
|
bone.scaleX = bx + (x - bx) * alpha;
|
|
1179
1374
|
break;
|
|
1180
|
-
case 3
|
|
1375
|
+
case 3 /* add */:
|
|
1181
1376
|
bone.scaleX += (x - bone.data.scaleX) * alpha;
|
|
1182
1377
|
}
|
|
1183
1378
|
}
|
|
@@ -1197,48 +1392,48 @@ var spine = (() => {
|
|
|
1197
1392
|
let frames = this.frames;
|
|
1198
1393
|
if (time < frames[0]) {
|
|
1199
1394
|
switch (blend) {
|
|
1200
|
-
case 0
|
|
1395
|
+
case 0 /* setup */:
|
|
1201
1396
|
bone.scaleY = bone.data.scaleY;
|
|
1202
1397
|
return;
|
|
1203
|
-
case 1
|
|
1398
|
+
case 1 /* first */:
|
|
1204
1399
|
bone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha;
|
|
1205
1400
|
}
|
|
1206
1401
|
return;
|
|
1207
1402
|
}
|
|
1208
1403
|
let y = this.getCurveValue(time) * bone.data.scaleY;
|
|
1209
1404
|
if (alpha == 1) {
|
|
1210
|
-
if (blend == 3)
|
|
1405
|
+
if (blend == 3 /* add */)
|
|
1211
1406
|
bone.scaleY += y - bone.data.scaleY;
|
|
1212
1407
|
else
|
|
1213
1408
|
bone.scaleY = y;
|
|
1214
1409
|
} else {
|
|
1215
1410
|
let by = 0;
|
|
1216
|
-
if (direction == 1) {
|
|
1411
|
+
if (direction == 1 /* mixOut */) {
|
|
1217
1412
|
switch (blend) {
|
|
1218
|
-
case 0
|
|
1413
|
+
case 0 /* setup */:
|
|
1219
1414
|
by = bone.data.scaleY;
|
|
1220
1415
|
bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
|
|
1221
1416
|
break;
|
|
1222
|
-
case 1
|
|
1223
|
-
case 2
|
|
1417
|
+
case 1 /* first */:
|
|
1418
|
+
case 2 /* replace */:
|
|
1224
1419
|
by = bone.scaleY;
|
|
1225
1420
|
bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
|
|
1226
1421
|
break;
|
|
1227
|
-
case 3
|
|
1422
|
+
case 3 /* add */:
|
|
1228
1423
|
bone.scaleY += (y - bone.data.scaleY) * alpha;
|
|
1229
1424
|
}
|
|
1230
1425
|
} else {
|
|
1231
1426
|
switch (blend) {
|
|
1232
|
-
case 0
|
|
1427
|
+
case 0 /* setup */:
|
|
1233
1428
|
by = Math.abs(bone.data.scaleY) * MathUtils.signum(y);
|
|
1234
1429
|
bone.scaleY = by + (y - by) * alpha;
|
|
1235
1430
|
break;
|
|
1236
|
-
case 1
|
|
1237
|
-
case 2
|
|
1431
|
+
case 1 /* first */:
|
|
1432
|
+
case 2 /* replace */:
|
|
1238
1433
|
by = Math.abs(bone.scaleY) * MathUtils.signum(y);
|
|
1239
1434
|
bone.scaleY = by + (y - by) * alpha;
|
|
1240
1435
|
break;
|
|
1241
|
-
case 3
|
|
1436
|
+
case 3 /* add */:
|
|
1242
1437
|
bone.scaleY += (y - bone.data.scaleY) * alpha;
|
|
1243
1438
|
}
|
|
1244
1439
|
}
|
|
@@ -1247,7 +1442,12 @@ var spine = (() => {
|
|
|
1247
1442
|
};
|
|
1248
1443
|
var ShearTimeline = class extends CurveTimeline2 {
|
|
1249
1444
|
constructor(frameCount, bezierCount, boneIndex) {
|
|
1250
|
-
super(
|
|
1445
|
+
super(
|
|
1446
|
+
frameCount,
|
|
1447
|
+
bezierCount,
|
|
1448
|
+
Property.shearX + "|" + boneIndex,
|
|
1449
|
+
Property.shearY + "|" + boneIndex
|
|
1450
|
+
);
|
|
1251
1451
|
this.boneIndex = 0;
|
|
1252
1452
|
this.boneIndex = boneIndex;
|
|
1253
1453
|
}
|
|
@@ -1258,47 +1458,88 @@ var spine = (() => {
|
|
|
1258
1458
|
let frames = this.frames;
|
|
1259
1459
|
if (time < frames[0]) {
|
|
1260
1460
|
switch (blend) {
|
|
1261
|
-
case 0
|
|
1461
|
+
case 0 /* setup */:
|
|
1262
1462
|
bone.shearX = bone.data.shearX;
|
|
1263
1463
|
bone.shearY = bone.data.shearY;
|
|
1264
1464
|
return;
|
|
1265
|
-
case 1
|
|
1465
|
+
case 1 /* first */:
|
|
1266
1466
|
bone.shearX += (bone.data.shearX - bone.shearX) * alpha;
|
|
1267
1467
|
bone.shearY += (bone.data.shearY - bone.shearY) * alpha;
|
|
1268
1468
|
}
|
|
1269
1469
|
return;
|
|
1270
1470
|
}
|
|
1271
1471
|
let x = 0, y = 0;
|
|
1272
|
-
let i = Timeline.search(
|
|
1273
|
-
|
|
1472
|
+
let i = Timeline.search(
|
|
1473
|
+
frames,
|
|
1474
|
+
time,
|
|
1475
|
+
3
|
|
1476
|
+
/*ENTRIES*/
|
|
1477
|
+
);
|
|
1478
|
+
let curveType = this.curves[
|
|
1479
|
+
i / 3
|
|
1480
|
+
/*ENTRIES*/
|
|
1481
|
+
];
|
|
1274
1482
|
switch (curveType) {
|
|
1275
1483
|
case 0:
|
|
1276
1484
|
let before = frames[i];
|
|
1277
|
-
x = frames[
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
y
|
|
1485
|
+
x = frames[
|
|
1486
|
+
i + 1
|
|
1487
|
+
/*VALUE1*/
|
|
1488
|
+
];
|
|
1489
|
+
y = frames[
|
|
1490
|
+
i + 2
|
|
1491
|
+
/*VALUE2*/
|
|
1492
|
+
];
|
|
1493
|
+
let t = (time - before) / (frames[
|
|
1494
|
+
i + 3
|
|
1495
|
+
/*ENTRIES*/
|
|
1496
|
+
] - before);
|
|
1497
|
+
x += (frames[
|
|
1498
|
+
i + 3 + 1
|
|
1499
|
+
/*VALUE1*/
|
|
1500
|
+
] - x) * t;
|
|
1501
|
+
y += (frames[
|
|
1502
|
+
i + 3 + 2
|
|
1503
|
+
/*VALUE2*/
|
|
1504
|
+
] - y) * t;
|
|
1282
1505
|
break;
|
|
1283
1506
|
case 1:
|
|
1284
|
-
x = frames[
|
|
1285
|
-
|
|
1507
|
+
x = frames[
|
|
1508
|
+
i + 1
|
|
1509
|
+
/*VALUE1*/
|
|
1510
|
+
];
|
|
1511
|
+
y = frames[
|
|
1512
|
+
i + 2
|
|
1513
|
+
/*VALUE2*/
|
|
1514
|
+
];
|
|
1286
1515
|
break;
|
|
1287
1516
|
default:
|
|
1288
|
-
x = this.getBezierValue(
|
|
1289
|
-
|
|
1517
|
+
x = this.getBezierValue(
|
|
1518
|
+
time,
|
|
1519
|
+
i,
|
|
1520
|
+
1,
|
|
1521
|
+
curveType - 2
|
|
1522
|
+
/*BEZIER*/
|
|
1523
|
+
);
|
|
1524
|
+
y = this.getBezierValue(
|
|
1525
|
+
time,
|
|
1526
|
+
i,
|
|
1527
|
+
2,
|
|
1528
|
+
curveType + 18 - 2
|
|
1529
|
+
/*BEZIER*/
|
|
1530
|
+
);
|
|
1290
1531
|
}
|
|
1291
1532
|
switch (blend) {
|
|
1292
|
-
case 0
|
|
1533
|
+
case 0 /* setup */:
|
|
1293
1534
|
bone.shearX = bone.data.shearX + x * alpha;
|
|
1294
1535
|
bone.shearY = bone.data.shearY + y * alpha;
|
|
1295
1536
|
break;
|
|
1296
|
-
case 1
|
|
1297
|
-
case 2
|
|
1537
|
+
case 1 /* first */:
|
|
1538
|
+
case 2 /* replace */:
|
|
1298
1539
|
bone.shearX += (bone.data.shearX + x - bone.shearX) * alpha;
|
|
1299
1540
|
bone.shearY += (bone.data.shearY + y - bone.shearY) * alpha;
|
|
1300
1541
|
break;
|
|
1301
|
-
case 3
|
|
1542
|
+
case 3 /* add */:
|
|
1302
1543
|
bone.shearX += x * alpha;
|
|
1303
1544
|
bone.shearY += y * alpha;
|
|
1304
1545
|
}
|
|
@@ -1317,24 +1558,24 @@ var spine = (() => {
|
|
|
1317
1558
|
let frames = this.frames;
|
|
1318
1559
|
if (time < frames[0]) {
|
|
1319
1560
|
switch (blend) {
|
|
1320
|
-
case 0
|
|
1561
|
+
case 0 /* setup */:
|
|
1321
1562
|
bone.shearX = bone.data.shearX;
|
|
1322
1563
|
return;
|
|
1323
|
-
case 1
|
|
1564
|
+
case 1 /* first */:
|
|
1324
1565
|
bone.shearX += (bone.data.shearX - bone.shearX) * alpha;
|
|
1325
1566
|
}
|
|
1326
1567
|
return;
|
|
1327
1568
|
}
|
|
1328
1569
|
let x = this.getCurveValue(time);
|
|
1329
1570
|
switch (blend) {
|
|
1330
|
-
case 0
|
|
1571
|
+
case 0 /* setup */:
|
|
1331
1572
|
bone.shearX = bone.data.shearX + x * alpha;
|
|
1332
1573
|
break;
|
|
1333
|
-
case 1
|
|
1334
|
-
case 2
|
|
1574
|
+
case 1 /* first */:
|
|
1575
|
+
case 2 /* replace */:
|
|
1335
1576
|
bone.shearX += (bone.data.shearX + x - bone.shearX) * alpha;
|
|
1336
1577
|
break;
|
|
1337
|
-
case 3
|
|
1578
|
+
case 3 /* add */:
|
|
1338
1579
|
bone.shearX += x * alpha;
|
|
1339
1580
|
}
|
|
1340
1581
|
}
|
|
@@ -1352,24 +1593,24 @@ var spine = (() => {
|
|
|
1352
1593
|
let frames = this.frames;
|
|
1353
1594
|
if (time < frames[0]) {
|
|
1354
1595
|
switch (blend) {
|
|
1355
|
-
case 0
|
|
1596
|
+
case 0 /* setup */:
|
|
1356
1597
|
bone.shearY = bone.data.shearY;
|
|
1357
1598
|
return;
|
|
1358
|
-
case 1
|
|
1599
|
+
case 1 /* first */:
|
|
1359
1600
|
bone.shearY += (bone.data.shearY - bone.shearY) * alpha;
|
|
1360
1601
|
}
|
|
1361
1602
|
return;
|
|
1362
1603
|
}
|
|
1363
1604
|
let y = this.getCurveValue(time);
|
|
1364
1605
|
switch (blend) {
|
|
1365
|
-
case 0
|
|
1606
|
+
case 0 /* setup */:
|
|
1366
1607
|
bone.shearY = bone.data.shearY + y * alpha;
|
|
1367
1608
|
break;
|
|
1368
|
-
case 1
|
|
1369
|
-
case 2
|
|
1609
|
+
case 1 /* first */:
|
|
1610
|
+
case 2 /* replace */:
|
|
1370
1611
|
bone.shearY += (bone.data.shearY + y - bone.shearY) * alpha;
|
|
1371
1612
|
break;
|
|
1372
|
-
case 3
|
|
1613
|
+
case 3 /* add */:
|
|
1373
1614
|
bone.shearY += y * alpha;
|
|
1374
1615
|
}
|
|
1375
1616
|
}
|
|
@@ -1386,13 +1627,26 @@ var spine = (() => {
|
|
|
1386
1627
|
getFrameEntries() {
|
|
1387
1628
|
return 5;
|
|
1388
1629
|
}
|
|
1630
|
+
/** Sets the time in seconds, red, green, blue, and alpha for the specified key frame. */
|
|
1389
1631
|
setFrame(frame, time, r, g, b, a) {
|
|
1390
1632
|
frame *= 5;
|
|
1391
1633
|
this.frames[frame] = time;
|
|
1392
|
-
this.frames[
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1634
|
+
this.frames[
|
|
1635
|
+
frame + 1
|
|
1636
|
+
/*R*/
|
|
1637
|
+
] = r;
|
|
1638
|
+
this.frames[
|
|
1639
|
+
frame + 2
|
|
1640
|
+
/*G*/
|
|
1641
|
+
] = g;
|
|
1642
|
+
this.frames[
|
|
1643
|
+
frame + 3
|
|
1644
|
+
/*B*/
|
|
1645
|
+
] = b;
|
|
1646
|
+
this.frames[
|
|
1647
|
+
frame + 4
|
|
1648
|
+
/*A*/
|
|
1649
|
+
] = a;
|
|
1396
1650
|
}
|
|
1397
1651
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1398
1652
|
let slot = skeleton.slots[this.slotIndex];
|
|
@@ -1403,46 +1657,122 @@ var spine = (() => {
|
|
|
1403
1657
|
if (time < frames[0]) {
|
|
1404
1658
|
let setup = slot.data.color;
|
|
1405
1659
|
switch (blend) {
|
|
1406
|
-
case 0
|
|
1660
|
+
case 0 /* setup */:
|
|
1407
1661
|
color.setFromColor(setup);
|
|
1408
1662
|
return;
|
|
1409
|
-
case 1
|
|
1410
|
-
color.add(
|
|
1663
|
+
case 1 /* first */:
|
|
1664
|
+
color.add(
|
|
1665
|
+
(setup.r - color.r) * alpha,
|
|
1666
|
+
(setup.g - color.g) * alpha,
|
|
1667
|
+
(setup.b - color.b) * alpha,
|
|
1668
|
+
(setup.a - color.a) * alpha
|
|
1669
|
+
);
|
|
1411
1670
|
}
|
|
1412
1671
|
return;
|
|
1413
1672
|
}
|
|
1414
1673
|
let r = 0, g = 0, b = 0, a = 0;
|
|
1415
|
-
let i = Timeline.search(
|
|
1416
|
-
|
|
1674
|
+
let i = Timeline.search(
|
|
1675
|
+
frames,
|
|
1676
|
+
time,
|
|
1677
|
+
5
|
|
1678
|
+
/*ENTRIES*/
|
|
1679
|
+
);
|
|
1680
|
+
let curveType = this.curves[
|
|
1681
|
+
i / 5
|
|
1682
|
+
/*ENTRIES*/
|
|
1683
|
+
];
|
|
1417
1684
|
switch (curveType) {
|
|
1418
1685
|
case 0:
|
|
1419
1686
|
let before = frames[i];
|
|
1420
|
-
r = frames[
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1687
|
+
r = frames[
|
|
1688
|
+
i + 1
|
|
1689
|
+
/*R*/
|
|
1690
|
+
];
|
|
1691
|
+
g = frames[
|
|
1692
|
+
i + 2
|
|
1693
|
+
/*G*/
|
|
1694
|
+
];
|
|
1695
|
+
b = frames[
|
|
1696
|
+
i + 3
|
|
1697
|
+
/*B*/
|
|
1698
|
+
];
|
|
1699
|
+
a = frames[
|
|
1700
|
+
i + 4
|
|
1701
|
+
/*A*/
|
|
1702
|
+
];
|
|
1703
|
+
let t = (time - before) / (frames[
|
|
1704
|
+
i + 5
|
|
1705
|
+
/*ENTRIES*/
|
|
1706
|
+
] - before);
|
|
1707
|
+
r += (frames[
|
|
1708
|
+
i + 5 + 1
|
|
1709
|
+
/*R*/
|
|
1710
|
+
] - r) * t;
|
|
1711
|
+
g += (frames[
|
|
1712
|
+
i + 5 + 2
|
|
1713
|
+
/*G*/
|
|
1714
|
+
] - g) * t;
|
|
1715
|
+
b += (frames[
|
|
1716
|
+
i + 5 + 3
|
|
1717
|
+
/*B*/
|
|
1718
|
+
] - b) * t;
|
|
1719
|
+
a += (frames[
|
|
1720
|
+
i + 5 + 4
|
|
1721
|
+
/*A*/
|
|
1722
|
+
] - a) * t;
|
|
1429
1723
|
break;
|
|
1430
1724
|
case 1:
|
|
1431
|
-
r = frames[
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1725
|
+
r = frames[
|
|
1726
|
+
i + 1
|
|
1727
|
+
/*R*/
|
|
1728
|
+
];
|
|
1729
|
+
g = frames[
|
|
1730
|
+
i + 2
|
|
1731
|
+
/*G*/
|
|
1732
|
+
];
|
|
1733
|
+
b = frames[
|
|
1734
|
+
i + 3
|
|
1735
|
+
/*B*/
|
|
1736
|
+
];
|
|
1737
|
+
a = frames[
|
|
1738
|
+
i + 4
|
|
1739
|
+
/*A*/
|
|
1740
|
+
];
|
|
1435
1741
|
break;
|
|
1436
1742
|
default:
|
|
1437
|
-
r = this.getBezierValue(
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1743
|
+
r = this.getBezierValue(
|
|
1744
|
+
time,
|
|
1745
|
+
i,
|
|
1746
|
+
1,
|
|
1747
|
+
curveType - 2
|
|
1748
|
+
/*BEZIER*/
|
|
1749
|
+
);
|
|
1750
|
+
g = this.getBezierValue(
|
|
1751
|
+
time,
|
|
1752
|
+
i,
|
|
1753
|
+
2,
|
|
1754
|
+
curveType + 18 - 2
|
|
1755
|
+
/*BEZIER*/
|
|
1756
|
+
);
|
|
1757
|
+
b = this.getBezierValue(
|
|
1758
|
+
time,
|
|
1759
|
+
i,
|
|
1760
|
+
3,
|
|
1761
|
+
curveType + 18 * 2 - 2
|
|
1762
|
+
/*BEZIER*/
|
|
1763
|
+
);
|
|
1764
|
+
a = this.getBezierValue(
|
|
1765
|
+
time,
|
|
1766
|
+
i,
|
|
1767
|
+
4,
|
|
1768
|
+
curveType + 18 * 3 - 2
|
|
1769
|
+
/*BEZIER*/
|
|
1770
|
+
);
|
|
1441
1771
|
}
|
|
1442
1772
|
if (alpha == 1)
|
|
1443
1773
|
color.set(r, g, b, a);
|
|
1444
1774
|
else {
|
|
1445
|
-
if (blend == 0)
|
|
1775
|
+
if (blend == 0 /* setup */)
|
|
1446
1776
|
color.setFromColor(slot.data.color);
|
|
1447
1777
|
color.add((r - color.r) * alpha, (g - color.g) * alpha, (b - color.b) * alpha, (a - color.a) * alpha);
|
|
1448
1778
|
}
|
|
@@ -1459,12 +1789,22 @@ var spine = (() => {
|
|
|
1459
1789
|
getFrameEntries() {
|
|
1460
1790
|
return 4;
|
|
1461
1791
|
}
|
|
1792
|
+
/** Sets the time in seconds, red, green, blue, and alpha for the specified key frame. */
|
|
1462
1793
|
setFrame(frame, time, r, g, b) {
|
|
1463
1794
|
frame <<= 2;
|
|
1464
1795
|
this.frames[frame] = time;
|
|
1465
|
-
this.frames[
|
|
1466
|
-
|
|
1467
|
-
|
|
1796
|
+
this.frames[
|
|
1797
|
+
frame + 1
|
|
1798
|
+
/*R*/
|
|
1799
|
+
] = r;
|
|
1800
|
+
this.frames[
|
|
1801
|
+
frame + 2
|
|
1802
|
+
/*G*/
|
|
1803
|
+
] = g;
|
|
1804
|
+
this.frames[
|
|
1805
|
+
frame + 3
|
|
1806
|
+
/*B*/
|
|
1807
|
+
] = b;
|
|
1468
1808
|
}
|
|
1469
1809
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1470
1810
|
let slot = skeleton.slots[this.slotIndex];
|
|
@@ -1475,12 +1815,12 @@ var spine = (() => {
|
|
|
1475
1815
|
if (time < frames[0]) {
|
|
1476
1816
|
let setup = slot.data.color;
|
|
1477
1817
|
switch (blend) {
|
|
1478
|
-
case 0
|
|
1818
|
+
case 0 /* setup */:
|
|
1479
1819
|
color.r = setup.r;
|
|
1480
1820
|
color.g = setup.g;
|
|
1481
1821
|
color.b = setup.b;
|
|
1482
1822
|
return;
|
|
1483
|
-
case 1
|
|
1823
|
+
case 1 /* first */:
|
|
1484
1824
|
color.r += (setup.r - color.r) * alpha;
|
|
1485
1825
|
color.g += (setup.g - color.g) * alpha;
|
|
1486
1826
|
color.b += (setup.b - color.b) * alpha;
|
|
@@ -1488,35 +1828,88 @@ var spine = (() => {
|
|
|
1488
1828
|
return;
|
|
1489
1829
|
}
|
|
1490
1830
|
let r = 0, g = 0, b = 0;
|
|
1491
|
-
let i = Timeline.search(
|
|
1831
|
+
let i = Timeline.search(
|
|
1832
|
+
frames,
|
|
1833
|
+
time,
|
|
1834
|
+
4
|
|
1835
|
+
/*ENTRIES*/
|
|
1836
|
+
);
|
|
1492
1837
|
let curveType = this.curves[i >> 2];
|
|
1493
1838
|
switch (curveType) {
|
|
1494
1839
|
case 0:
|
|
1495
1840
|
let before = frames[i];
|
|
1496
|
-
r = frames[
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1841
|
+
r = frames[
|
|
1842
|
+
i + 1
|
|
1843
|
+
/*R*/
|
|
1844
|
+
];
|
|
1845
|
+
g = frames[
|
|
1846
|
+
i + 2
|
|
1847
|
+
/*G*/
|
|
1848
|
+
];
|
|
1849
|
+
b = frames[
|
|
1850
|
+
i + 3
|
|
1851
|
+
/*B*/
|
|
1852
|
+
];
|
|
1853
|
+
let t = (time - before) / (frames[
|
|
1854
|
+
i + 4
|
|
1855
|
+
/*ENTRIES*/
|
|
1856
|
+
] - before);
|
|
1857
|
+
r += (frames[
|
|
1858
|
+
i + 4 + 1
|
|
1859
|
+
/*R*/
|
|
1860
|
+
] - r) * t;
|
|
1861
|
+
g += (frames[
|
|
1862
|
+
i + 4 + 2
|
|
1863
|
+
/*G*/
|
|
1864
|
+
] - g) * t;
|
|
1865
|
+
b += (frames[
|
|
1866
|
+
i + 4 + 3
|
|
1867
|
+
/*B*/
|
|
1868
|
+
] - b) * t;
|
|
1503
1869
|
break;
|
|
1504
1870
|
case 1:
|
|
1505
|
-
r = frames[
|
|
1506
|
-
|
|
1507
|
-
|
|
1871
|
+
r = frames[
|
|
1872
|
+
i + 1
|
|
1873
|
+
/*R*/
|
|
1874
|
+
];
|
|
1875
|
+
g = frames[
|
|
1876
|
+
i + 2
|
|
1877
|
+
/*G*/
|
|
1878
|
+
];
|
|
1879
|
+
b = frames[
|
|
1880
|
+
i + 3
|
|
1881
|
+
/*B*/
|
|
1882
|
+
];
|
|
1508
1883
|
break;
|
|
1509
1884
|
default:
|
|
1510
|
-
r = this.getBezierValue(
|
|
1511
|
-
|
|
1512
|
-
|
|
1885
|
+
r = this.getBezierValue(
|
|
1886
|
+
time,
|
|
1887
|
+
i,
|
|
1888
|
+
1,
|
|
1889
|
+
curveType - 2
|
|
1890
|
+
/*BEZIER*/
|
|
1891
|
+
);
|
|
1892
|
+
g = this.getBezierValue(
|
|
1893
|
+
time,
|
|
1894
|
+
i,
|
|
1895
|
+
2,
|
|
1896
|
+
curveType + 18 - 2
|
|
1897
|
+
/*BEZIER*/
|
|
1898
|
+
);
|
|
1899
|
+
b = this.getBezierValue(
|
|
1900
|
+
time,
|
|
1901
|
+
i,
|
|
1902
|
+
3,
|
|
1903
|
+
curveType + 18 * 2 - 2
|
|
1904
|
+
/*BEZIER*/
|
|
1905
|
+
);
|
|
1513
1906
|
}
|
|
1514
1907
|
if (alpha == 1) {
|
|
1515
1908
|
color.r = r;
|
|
1516
1909
|
color.g = g;
|
|
1517
1910
|
color.b = b;
|
|
1518
1911
|
} else {
|
|
1519
|
-
if (blend == 0) {
|
|
1912
|
+
if (blend == 0 /* setup */) {
|
|
1520
1913
|
let setup = slot.data.color;
|
|
1521
1914
|
color.r = setup.r;
|
|
1522
1915
|
color.g = setup.g;
|
|
@@ -1542,10 +1935,10 @@ var spine = (() => {
|
|
|
1542
1935
|
if (time < this.frames[0]) {
|
|
1543
1936
|
let setup = slot.data.color;
|
|
1544
1937
|
switch (blend) {
|
|
1545
|
-
case 0
|
|
1938
|
+
case 0 /* setup */:
|
|
1546
1939
|
color.a = setup.a;
|
|
1547
1940
|
return;
|
|
1548
|
-
case 1
|
|
1941
|
+
case 1 /* first */:
|
|
1549
1942
|
color.a += (setup.a - color.a) * alpha;
|
|
1550
1943
|
}
|
|
1551
1944
|
return;
|
|
@@ -1554,7 +1947,7 @@ var spine = (() => {
|
|
|
1554
1947
|
if (alpha == 1)
|
|
1555
1948
|
color.a = a;
|
|
1556
1949
|
else {
|
|
1557
|
-
if (blend == 0)
|
|
1950
|
+
if (blend == 0 /* setup */)
|
|
1558
1951
|
color.a = slot.data.color.a;
|
|
1559
1952
|
color.a += (a - color.a) * alpha;
|
|
1560
1953
|
}
|
|
@@ -1573,16 +1966,38 @@ var spine = (() => {
|
|
|
1573
1966
|
getFrameEntries() {
|
|
1574
1967
|
return 8;
|
|
1575
1968
|
}
|
|
1969
|
+
/** Sets the time in seconds, light, and dark colors for the specified key frame. */
|
|
1576
1970
|
setFrame(frame, time, r, g, b, a, r2, g2, b2) {
|
|
1577
1971
|
frame <<= 3;
|
|
1578
1972
|
this.frames[frame] = time;
|
|
1579
|
-
this.frames[
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
this.frames[
|
|
1584
|
-
|
|
1585
|
-
|
|
1973
|
+
this.frames[
|
|
1974
|
+
frame + 1
|
|
1975
|
+
/*R*/
|
|
1976
|
+
] = r;
|
|
1977
|
+
this.frames[
|
|
1978
|
+
frame + 2
|
|
1979
|
+
/*G*/
|
|
1980
|
+
] = g;
|
|
1981
|
+
this.frames[
|
|
1982
|
+
frame + 3
|
|
1983
|
+
/*B*/
|
|
1984
|
+
] = b;
|
|
1985
|
+
this.frames[
|
|
1986
|
+
frame + 4
|
|
1987
|
+
/*A*/
|
|
1988
|
+
] = a;
|
|
1989
|
+
this.frames[
|
|
1990
|
+
frame + 5
|
|
1991
|
+
/*R2*/
|
|
1992
|
+
] = r2;
|
|
1993
|
+
this.frames[
|
|
1994
|
+
frame + 6
|
|
1995
|
+
/*G2*/
|
|
1996
|
+
] = g2;
|
|
1997
|
+
this.frames[
|
|
1998
|
+
frame + 7
|
|
1999
|
+
/*B2*/
|
|
2000
|
+
] = b2;
|
|
1586
2001
|
}
|
|
1587
2002
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1588
2003
|
let slot = skeleton.slots[this.slotIndex];
|
|
@@ -1593,14 +2008,19 @@ var spine = (() => {
|
|
|
1593
2008
|
if (time < frames[0]) {
|
|
1594
2009
|
let setupLight = slot.data.color, setupDark = slot.data.darkColor;
|
|
1595
2010
|
switch (blend) {
|
|
1596
|
-
case 0
|
|
2011
|
+
case 0 /* setup */:
|
|
1597
2012
|
light.setFromColor(setupLight);
|
|
1598
2013
|
dark.r = setupDark.r;
|
|
1599
2014
|
dark.g = setupDark.g;
|
|
1600
2015
|
dark.b = setupDark.b;
|
|
1601
2016
|
return;
|
|
1602
|
-
case 1
|
|
1603
|
-
light.add(
|
|
2017
|
+
case 1 /* first */:
|
|
2018
|
+
light.add(
|
|
2019
|
+
(setupLight.r - light.r) * alpha,
|
|
2020
|
+
(setupLight.g - light.g) * alpha,
|
|
2021
|
+
(setupLight.b - light.b) * alpha,
|
|
2022
|
+
(setupLight.a - light.a) * alpha
|
|
2023
|
+
);
|
|
1604
2024
|
dark.r += (setupDark.r - dark.r) * alpha;
|
|
1605
2025
|
dark.g += (setupDark.g - dark.g) * alpha;
|
|
1606
2026
|
dark.b += (setupDark.b - dark.b) * alpha;
|
|
@@ -1608,44 +2028,157 @@ var spine = (() => {
|
|
|
1608
2028
|
return;
|
|
1609
2029
|
}
|
|
1610
2030
|
let r = 0, g = 0, b = 0, a = 0, r2 = 0, g2 = 0, b2 = 0;
|
|
1611
|
-
let i = Timeline.search(
|
|
2031
|
+
let i = Timeline.search(
|
|
2032
|
+
frames,
|
|
2033
|
+
time,
|
|
2034
|
+
8
|
|
2035
|
+
/*ENTRIES*/
|
|
2036
|
+
);
|
|
1612
2037
|
let curveType = this.curves[i >> 3];
|
|
1613
2038
|
switch (curveType) {
|
|
1614
2039
|
case 0:
|
|
1615
2040
|
let before = frames[i];
|
|
1616
|
-
r = frames[
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
2041
|
+
r = frames[
|
|
2042
|
+
i + 1
|
|
2043
|
+
/*R*/
|
|
2044
|
+
];
|
|
2045
|
+
g = frames[
|
|
2046
|
+
i + 2
|
|
2047
|
+
/*G*/
|
|
2048
|
+
];
|
|
2049
|
+
b = frames[
|
|
2050
|
+
i + 3
|
|
2051
|
+
/*B*/
|
|
2052
|
+
];
|
|
2053
|
+
a = frames[
|
|
2054
|
+
i + 4
|
|
2055
|
+
/*A*/
|
|
2056
|
+
];
|
|
2057
|
+
r2 = frames[
|
|
2058
|
+
i + 5
|
|
2059
|
+
/*R2*/
|
|
2060
|
+
];
|
|
2061
|
+
g2 = frames[
|
|
2062
|
+
i + 6
|
|
2063
|
+
/*G2*/
|
|
2064
|
+
];
|
|
2065
|
+
b2 = frames[
|
|
2066
|
+
i + 7
|
|
2067
|
+
/*B2*/
|
|
2068
|
+
];
|
|
2069
|
+
let t = (time - before) / (frames[
|
|
2070
|
+
i + 8
|
|
2071
|
+
/*ENTRIES*/
|
|
2072
|
+
] - before);
|
|
2073
|
+
r += (frames[
|
|
2074
|
+
i + 8 + 1
|
|
2075
|
+
/*R*/
|
|
2076
|
+
] - r) * t;
|
|
2077
|
+
g += (frames[
|
|
2078
|
+
i + 8 + 2
|
|
2079
|
+
/*G*/
|
|
2080
|
+
] - g) * t;
|
|
2081
|
+
b += (frames[
|
|
2082
|
+
i + 8 + 3
|
|
2083
|
+
/*B*/
|
|
2084
|
+
] - b) * t;
|
|
2085
|
+
a += (frames[
|
|
2086
|
+
i + 8 + 4
|
|
2087
|
+
/*A*/
|
|
2088
|
+
] - a) * t;
|
|
2089
|
+
r2 += (frames[
|
|
2090
|
+
i + 8 + 5
|
|
2091
|
+
/*R2*/
|
|
2092
|
+
] - r2) * t;
|
|
2093
|
+
g2 += (frames[
|
|
2094
|
+
i + 8 + 6
|
|
2095
|
+
/*G2*/
|
|
2096
|
+
] - g2) * t;
|
|
2097
|
+
b2 += (frames[
|
|
2098
|
+
i + 8 + 7
|
|
2099
|
+
/*B2*/
|
|
2100
|
+
] - b2) * t;
|
|
1631
2101
|
break;
|
|
1632
2102
|
case 1:
|
|
1633
|
-
r = frames[
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
2103
|
+
r = frames[
|
|
2104
|
+
i + 1
|
|
2105
|
+
/*R*/
|
|
2106
|
+
];
|
|
2107
|
+
g = frames[
|
|
2108
|
+
i + 2
|
|
2109
|
+
/*G*/
|
|
2110
|
+
];
|
|
2111
|
+
b = frames[
|
|
2112
|
+
i + 3
|
|
2113
|
+
/*B*/
|
|
2114
|
+
];
|
|
2115
|
+
a = frames[
|
|
2116
|
+
i + 4
|
|
2117
|
+
/*A*/
|
|
2118
|
+
];
|
|
2119
|
+
r2 = frames[
|
|
2120
|
+
i + 5
|
|
2121
|
+
/*R2*/
|
|
2122
|
+
];
|
|
2123
|
+
g2 = frames[
|
|
2124
|
+
i + 6
|
|
2125
|
+
/*G2*/
|
|
2126
|
+
];
|
|
2127
|
+
b2 = frames[
|
|
2128
|
+
i + 7
|
|
2129
|
+
/*B2*/
|
|
2130
|
+
];
|
|
1640
2131
|
break;
|
|
1641
2132
|
default:
|
|
1642
|
-
r = this.getBezierValue(
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
2133
|
+
r = this.getBezierValue(
|
|
2134
|
+
time,
|
|
2135
|
+
i,
|
|
2136
|
+
1,
|
|
2137
|
+
curveType - 2
|
|
2138
|
+
/*BEZIER*/
|
|
2139
|
+
);
|
|
2140
|
+
g = this.getBezierValue(
|
|
2141
|
+
time,
|
|
2142
|
+
i,
|
|
2143
|
+
2,
|
|
2144
|
+
curveType + 18 - 2
|
|
2145
|
+
/*BEZIER*/
|
|
2146
|
+
);
|
|
2147
|
+
b = this.getBezierValue(
|
|
2148
|
+
time,
|
|
2149
|
+
i,
|
|
2150
|
+
3,
|
|
2151
|
+
curveType + 18 * 2 - 2
|
|
2152
|
+
/*BEZIER*/
|
|
2153
|
+
);
|
|
2154
|
+
a = this.getBezierValue(
|
|
2155
|
+
time,
|
|
2156
|
+
i,
|
|
2157
|
+
4,
|
|
2158
|
+
curveType + 18 * 3 - 2
|
|
2159
|
+
/*BEZIER*/
|
|
2160
|
+
);
|
|
2161
|
+
r2 = this.getBezierValue(
|
|
2162
|
+
time,
|
|
2163
|
+
i,
|
|
2164
|
+
5,
|
|
2165
|
+
curveType + 18 * 4 - 2
|
|
2166
|
+
/*BEZIER*/
|
|
2167
|
+
);
|
|
2168
|
+
g2 = this.getBezierValue(
|
|
2169
|
+
time,
|
|
2170
|
+
i,
|
|
2171
|
+
6,
|
|
2172
|
+
curveType + 18 * 5 - 2
|
|
2173
|
+
/*BEZIER*/
|
|
2174
|
+
);
|
|
2175
|
+
b2 = this.getBezierValue(
|
|
2176
|
+
time,
|
|
2177
|
+
i,
|
|
2178
|
+
7,
|
|
2179
|
+
curveType + 18 * 6 - 2
|
|
2180
|
+
/*BEZIER*/
|
|
2181
|
+
);
|
|
1649
2182
|
}
|
|
1650
2183
|
if (alpha == 1) {
|
|
1651
2184
|
light.set(r, g, b, a);
|
|
@@ -1653,7 +2186,7 @@ var spine = (() => {
|
|
|
1653
2186
|
dark.g = g2;
|
|
1654
2187
|
dark.b = b2;
|
|
1655
2188
|
} else {
|
|
1656
|
-
if (blend == 0) {
|
|
2189
|
+
if (blend == 0 /* setup */) {
|
|
1657
2190
|
light.setFromColor(slot.data.color);
|
|
1658
2191
|
let setupDark = slot.data.darkColor;
|
|
1659
2192
|
dark.r = setupDark.r;
|
|
@@ -1679,15 +2212,34 @@ var spine = (() => {
|
|
|
1679
2212
|
getFrameEntries() {
|
|
1680
2213
|
return 7;
|
|
1681
2214
|
}
|
|
2215
|
+
/** Sets the time in seconds, light, and dark colors for the specified key frame. */
|
|
1682
2216
|
setFrame(frame, time, r, g, b, r2, g2, b2) {
|
|
1683
2217
|
frame *= 7;
|
|
1684
2218
|
this.frames[frame] = time;
|
|
1685
|
-
this.frames[
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
this.frames[
|
|
1690
|
-
|
|
2219
|
+
this.frames[
|
|
2220
|
+
frame + 1
|
|
2221
|
+
/*R*/
|
|
2222
|
+
] = r;
|
|
2223
|
+
this.frames[
|
|
2224
|
+
frame + 2
|
|
2225
|
+
/*G*/
|
|
2226
|
+
] = g;
|
|
2227
|
+
this.frames[
|
|
2228
|
+
frame + 3
|
|
2229
|
+
/*B*/
|
|
2230
|
+
] = b;
|
|
2231
|
+
this.frames[
|
|
2232
|
+
frame + 4
|
|
2233
|
+
/*R2*/
|
|
2234
|
+
] = r2;
|
|
2235
|
+
this.frames[
|
|
2236
|
+
frame + 5
|
|
2237
|
+
/*G2*/
|
|
2238
|
+
] = g2;
|
|
2239
|
+
this.frames[
|
|
2240
|
+
frame + 6
|
|
2241
|
+
/*B2*/
|
|
2242
|
+
] = b2;
|
|
1691
2243
|
}
|
|
1692
2244
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1693
2245
|
let slot = skeleton.slots[this.slotIndex];
|
|
@@ -1698,7 +2250,7 @@ var spine = (() => {
|
|
|
1698
2250
|
if (time < frames[0]) {
|
|
1699
2251
|
let setupLight = slot.data.color, setupDark = slot.data.darkColor;
|
|
1700
2252
|
switch (blend) {
|
|
1701
|
-
case 0
|
|
2253
|
+
case 0 /* setup */:
|
|
1702
2254
|
light.r = setupLight.r;
|
|
1703
2255
|
light.g = setupLight.g;
|
|
1704
2256
|
light.b = setupLight.b;
|
|
@@ -1706,7 +2258,7 @@ var spine = (() => {
|
|
|
1706
2258
|
dark.g = setupDark.g;
|
|
1707
2259
|
dark.b = setupDark.b;
|
|
1708
2260
|
return;
|
|
1709
|
-
case 1
|
|
2261
|
+
case 1 /* first */:
|
|
1710
2262
|
light.r += (setupLight.r - light.r) * alpha;
|
|
1711
2263
|
light.g += (setupLight.g - light.g) * alpha;
|
|
1712
2264
|
light.b += (setupLight.b - light.b) * alpha;
|
|
@@ -1717,40 +2269,141 @@ var spine = (() => {
|
|
|
1717
2269
|
return;
|
|
1718
2270
|
}
|
|
1719
2271
|
let r = 0, g = 0, b = 0, a = 0, r2 = 0, g2 = 0, b2 = 0;
|
|
1720
|
-
let i = Timeline.search(
|
|
1721
|
-
|
|
2272
|
+
let i = Timeline.search(
|
|
2273
|
+
frames,
|
|
2274
|
+
time,
|
|
2275
|
+
7
|
|
2276
|
+
/*ENTRIES*/
|
|
2277
|
+
);
|
|
2278
|
+
let curveType = this.curves[
|
|
2279
|
+
i / 7
|
|
2280
|
+
/*ENTRIES*/
|
|
2281
|
+
];
|
|
1722
2282
|
switch (curveType) {
|
|
1723
2283
|
case 0:
|
|
1724
2284
|
let before = frames[i];
|
|
1725
|
-
r = frames[
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
2285
|
+
r = frames[
|
|
2286
|
+
i + 1
|
|
2287
|
+
/*R*/
|
|
2288
|
+
];
|
|
2289
|
+
g = frames[
|
|
2290
|
+
i + 2
|
|
2291
|
+
/*G*/
|
|
2292
|
+
];
|
|
2293
|
+
b = frames[
|
|
2294
|
+
i + 3
|
|
2295
|
+
/*B*/
|
|
2296
|
+
];
|
|
2297
|
+
r2 = frames[
|
|
2298
|
+
i + 4
|
|
2299
|
+
/*R2*/
|
|
2300
|
+
];
|
|
2301
|
+
g2 = frames[
|
|
2302
|
+
i + 5
|
|
2303
|
+
/*G2*/
|
|
2304
|
+
];
|
|
2305
|
+
b2 = frames[
|
|
2306
|
+
i + 6
|
|
2307
|
+
/*B2*/
|
|
2308
|
+
];
|
|
2309
|
+
let t = (time - before) / (frames[
|
|
2310
|
+
i + 7
|
|
2311
|
+
/*ENTRIES*/
|
|
2312
|
+
] - before);
|
|
2313
|
+
r += (frames[
|
|
2314
|
+
i + 7 + 1
|
|
2315
|
+
/*R*/
|
|
2316
|
+
] - r) * t;
|
|
2317
|
+
g += (frames[
|
|
2318
|
+
i + 7 + 2
|
|
2319
|
+
/*G*/
|
|
2320
|
+
] - g) * t;
|
|
2321
|
+
b += (frames[
|
|
2322
|
+
i + 7 + 3
|
|
2323
|
+
/*B*/
|
|
2324
|
+
] - b) * t;
|
|
2325
|
+
r2 += (frames[
|
|
2326
|
+
i + 7 + 4
|
|
2327
|
+
/*R2*/
|
|
2328
|
+
] - r2) * t;
|
|
2329
|
+
g2 += (frames[
|
|
2330
|
+
i + 7 + 5
|
|
2331
|
+
/*G2*/
|
|
2332
|
+
] - g2) * t;
|
|
2333
|
+
b2 += (frames[
|
|
2334
|
+
i + 7 + 6
|
|
2335
|
+
/*B2*/
|
|
2336
|
+
] - b2) * t;
|
|
1738
2337
|
break;
|
|
1739
2338
|
case 1:
|
|
1740
|
-
r = frames[
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
2339
|
+
r = frames[
|
|
2340
|
+
i + 1
|
|
2341
|
+
/*R*/
|
|
2342
|
+
];
|
|
2343
|
+
g = frames[
|
|
2344
|
+
i + 2
|
|
2345
|
+
/*G*/
|
|
2346
|
+
];
|
|
2347
|
+
b = frames[
|
|
2348
|
+
i + 3
|
|
2349
|
+
/*B*/
|
|
2350
|
+
];
|
|
2351
|
+
r2 = frames[
|
|
2352
|
+
i + 4
|
|
2353
|
+
/*R2*/
|
|
2354
|
+
];
|
|
2355
|
+
g2 = frames[
|
|
2356
|
+
i + 5
|
|
2357
|
+
/*G2*/
|
|
2358
|
+
];
|
|
2359
|
+
b2 = frames[
|
|
2360
|
+
i + 6
|
|
2361
|
+
/*B2*/
|
|
2362
|
+
];
|
|
1746
2363
|
break;
|
|
1747
2364
|
default:
|
|
1748
|
-
r = this.getBezierValue(
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
2365
|
+
r = this.getBezierValue(
|
|
2366
|
+
time,
|
|
2367
|
+
i,
|
|
2368
|
+
1,
|
|
2369
|
+
curveType - 2
|
|
2370
|
+
/*BEZIER*/
|
|
2371
|
+
);
|
|
2372
|
+
g = this.getBezierValue(
|
|
2373
|
+
time,
|
|
2374
|
+
i,
|
|
2375
|
+
2,
|
|
2376
|
+
curveType + 18 - 2
|
|
2377
|
+
/*BEZIER*/
|
|
2378
|
+
);
|
|
2379
|
+
b = this.getBezierValue(
|
|
2380
|
+
time,
|
|
2381
|
+
i,
|
|
2382
|
+
3,
|
|
2383
|
+
curveType + 18 * 2 - 2
|
|
2384
|
+
/*BEZIER*/
|
|
2385
|
+
);
|
|
2386
|
+
r2 = this.getBezierValue(
|
|
2387
|
+
time,
|
|
2388
|
+
i,
|
|
2389
|
+
4,
|
|
2390
|
+
curveType + 18 * 3 - 2
|
|
2391
|
+
/*BEZIER*/
|
|
2392
|
+
);
|
|
2393
|
+
g2 = this.getBezierValue(
|
|
2394
|
+
time,
|
|
2395
|
+
i,
|
|
2396
|
+
5,
|
|
2397
|
+
curveType + 18 * 4 - 2
|
|
2398
|
+
/*BEZIER*/
|
|
2399
|
+
);
|
|
2400
|
+
b2 = this.getBezierValue(
|
|
2401
|
+
time,
|
|
2402
|
+
i,
|
|
2403
|
+
6,
|
|
2404
|
+
curveType + 18 * 5 - 2
|
|
2405
|
+
/*BEZIER*/
|
|
2406
|
+
);
|
|
1754
2407
|
}
|
|
1755
2408
|
if (alpha == 1) {
|
|
1756
2409
|
light.r = r;
|
|
@@ -1760,7 +2413,7 @@ var spine = (() => {
|
|
|
1760
2413
|
dark.g = g2;
|
|
1761
2414
|
dark.b = b2;
|
|
1762
2415
|
} else {
|
|
1763
|
-
if (blend == 0) {
|
|
2416
|
+
if (blend == 0 /* setup */) {
|
|
1764
2417
|
let setupLight = slot.data.color, setupDark = slot.data.darkColor;
|
|
1765
2418
|
light.r = setupLight.r;
|
|
1766
2419
|
light.g = setupLight.g;
|
|
@@ -1790,6 +2443,7 @@ var spine = (() => {
|
|
|
1790
2443
|
getFrameCount() {
|
|
1791
2444
|
return this.frames.length;
|
|
1792
2445
|
}
|
|
2446
|
+
/** Sets the time in seconds and the attachment name for the specified key frame. */
|
|
1793
2447
|
setFrame(frame, time, attachmentName) {
|
|
1794
2448
|
this.frames[frame] = time;
|
|
1795
2449
|
this.attachmentNames[frame] = attachmentName;
|
|
@@ -1798,13 +2452,13 @@ var spine = (() => {
|
|
|
1798
2452
|
let slot = skeleton.slots[this.slotIndex];
|
|
1799
2453
|
if (!slot.bone.active)
|
|
1800
2454
|
return;
|
|
1801
|
-
if (direction == 1) {
|
|
1802
|
-
if (blend == 0)
|
|
2455
|
+
if (direction == 1 /* mixOut */) {
|
|
2456
|
+
if (blend == 0 /* setup */)
|
|
1803
2457
|
this.setAttachment(skeleton, slot, slot.data.attachmentName);
|
|
1804
2458
|
return;
|
|
1805
2459
|
}
|
|
1806
2460
|
if (time < this.frames[0]) {
|
|
1807
|
-
if (blend == 0 || blend == 1)
|
|
2461
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
1808
2462
|
this.setAttachment(skeleton, slot, slot.data.attachmentName);
|
|
1809
2463
|
return;
|
|
1810
2464
|
}
|
|
@@ -1827,10 +2481,14 @@ var spine = (() => {
|
|
|
1827
2481
|
getFrameCount() {
|
|
1828
2482
|
return this.frames.length;
|
|
1829
2483
|
}
|
|
2484
|
+
/** Sets the time in seconds and the vertices for the specified key frame.
|
|
2485
|
+
* @param vertices Vertex positions for an unweighted VertexAttachment, or deform offsets if it has weights. */
|
|
1830
2486
|
setFrame(frame, time, vertices) {
|
|
1831
2487
|
this.frames[frame] = time;
|
|
1832
2488
|
this.vertices[frame] = vertices;
|
|
1833
2489
|
}
|
|
2490
|
+
/** @param value1 Ignored (0 is used for a deform timeline).
|
|
2491
|
+
* @param value2 Ignored (1 is used for a deform timeline). */
|
|
1834
2492
|
setBezier(bezier, frame, value, time1, value1, cx1, cy1, cx2, cy2, time2, value2) {
|
|
1835
2493
|
let curves = this.curves;
|
|
1836
2494
|
let i = this.getFrameCount() + bezier * 18;
|
|
@@ -1888,16 +2546,16 @@ var spine = (() => {
|
|
|
1888
2546
|
return;
|
|
1889
2547
|
let deform = slot.deform;
|
|
1890
2548
|
if (deform.length == 0)
|
|
1891
|
-
blend = 0
|
|
2549
|
+
blend = 0 /* setup */;
|
|
1892
2550
|
let vertices = this.vertices;
|
|
1893
2551
|
let vertexCount = vertices[0].length;
|
|
1894
2552
|
let frames = this.frames;
|
|
1895
2553
|
if (time < frames[0]) {
|
|
1896
2554
|
switch (blend) {
|
|
1897
|
-
case 0
|
|
2555
|
+
case 0 /* setup */:
|
|
1898
2556
|
deform.length = 0;
|
|
1899
2557
|
return;
|
|
1900
|
-
case 1
|
|
2558
|
+
case 1 /* first */:
|
|
1901
2559
|
if (alpha == 1) {
|
|
1902
2560
|
deform.length = 0;
|
|
1903
2561
|
return;
|
|
@@ -1920,7 +2578,7 @@ var spine = (() => {
|
|
|
1920
2578
|
if (time >= frames[frames.length - 1]) {
|
|
1921
2579
|
let lastVertices = vertices[frames.length - 1];
|
|
1922
2580
|
if (alpha == 1) {
|
|
1923
|
-
if (blend == 3) {
|
|
2581
|
+
if (blend == 3 /* add */) {
|
|
1924
2582
|
let vertexAttachment = slotAttachment;
|
|
1925
2583
|
if (!vertexAttachment.bones) {
|
|
1926
2584
|
let setupVertices = vertexAttachment.vertices;
|
|
@@ -1934,7 +2592,7 @@ var spine = (() => {
|
|
|
1934
2592
|
Utils.arrayCopy(lastVertices, 0, deform, 0, vertexCount);
|
|
1935
2593
|
} else {
|
|
1936
2594
|
switch (blend) {
|
|
1937
|
-
case 0
|
|
2595
|
+
case 0 /* setup */: {
|
|
1938
2596
|
let vertexAttachment2 = slotAttachment;
|
|
1939
2597
|
if (!vertexAttachment2.bones) {
|
|
1940
2598
|
let setupVertices = vertexAttachment2.vertices;
|
|
@@ -1948,12 +2606,12 @@ var spine = (() => {
|
|
|
1948
2606
|
}
|
|
1949
2607
|
break;
|
|
1950
2608
|
}
|
|
1951
|
-
case 1
|
|
1952
|
-
case 2
|
|
2609
|
+
case 1 /* first */:
|
|
2610
|
+
case 2 /* replace */:
|
|
1953
2611
|
for (let i2 = 0; i2 < vertexCount; i2++)
|
|
1954
2612
|
deform[i2] += (lastVertices[i2] - deform[i2]) * alpha;
|
|
1955
2613
|
break;
|
|
1956
|
-
case 3
|
|
2614
|
+
case 3 /* add */:
|
|
1957
2615
|
let vertexAttachment = slotAttachment;
|
|
1958
2616
|
if (!vertexAttachment.bones) {
|
|
1959
2617
|
let setupVertices = vertexAttachment.vertices;
|
|
@@ -1972,7 +2630,7 @@ var spine = (() => {
|
|
|
1972
2630
|
let prevVertices = vertices[frame];
|
|
1973
2631
|
let nextVertices = vertices[frame + 1];
|
|
1974
2632
|
if (alpha == 1) {
|
|
1975
|
-
if (blend == 3) {
|
|
2633
|
+
if (blend == 3 /* add */) {
|
|
1976
2634
|
let vertexAttachment = slotAttachment;
|
|
1977
2635
|
if (!vertexAttachment.bones) {
|
|
1978
2636
|
let setupVertices = vertexAttachment.vertices;
|
|
@@ -1994,7 +2652,7 @@ var spine = (() => {
|
|
|
1994
2652
|
}
|
|
1995
2653
|
} else {
|
|
1996
2654
|
switch (blend) {
|
|
1997
|
-
case 0
|
|
2655
|
+
case 0 /* setup */: {
|
|
1998
2656
|
let vertexAttachment2 = slotAttachment;
|
|
1999
2657
|
if (!vertexAttachment2.bones) {
|
|
2000
2658
|
let setupVertices = vertexAttachment2.vertices;
|
|
@@ -2010,14 +2668,14 @@ var spine = (() => {
|
|
|
2010
2668
|
}
|
|
2011
2669
|
break;
|
|
2012
2670
|
}
|
|
2013
|
-
case 1
|
|
2014
|
-
case 2
|
|
2671
|
+
case 1 /* first */:
|
|
2672
|
+
case 2 /* replace */:
|
|
2015
2673
|
for (let i2 = 0; i2 < vertexCount; i2++) {
|
|
2016
2674
|
let prev = prevVertices[i2];
|
|
2017
2675
|
deform[i2] += (prev + (nextVertices[i2] - prev) * percent - deform[i2]) * alpha;
|
|
2018
2676
|
}
|
|
2019
2677
|
break;
|
|
2020
|
-
case 3
|
|
2678
|
+
case 3 /* add */:
|
|
2021
2679
|
let vertexAttachment = slotAttachment;
|
|
2022
2680
|
if (!vertexAttachment.bones) {
|
|
2023
2681
|
let setupVertices = vertexAttachment.vertices;
|
|
@@ -2043,10 +2701,12 @@ var spine = (() => {
|
|
|
2043
2701
|
getFrameCount() {
|
|
2044
2702
|
return this.frames.length;
|
|
2045
2703
|
}
|
|
2704
|
+
/** Sets the time in seconds and the event for the specified key frame. */
|
|
2046
2705
|
setFrame(frame, event) {
|
|
2047
2706
|
this.frames[frame] = event.time;
|
|
2048
2707
|
this.events[frame] = event;
|
|
2049
2708
|
}
|
|
2709
|
+
/** Fires events for frames > `lastTime` and <= `time`. */
|
|
2050
2710
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2051
2711
|
if (!firedEvents)
|
|
2052
2712
|
return;
|
|
@@ -2085,18 +2745,21 @@ var spine = (() => {
|
|
|
2085
2745
|
getFrameCount() {
|
|
2086
2746
|
return this.frames.length;
|
|
2087
2747
|
}
|
|
2748
|
+
/** Sets the time in seconds and the draw order for the specified key frame.
|
|
2749
|
+
* @param drawOrder For each slot in {@link Skeleton#slots}, the index of the new draw order. May be null to use setup pose
|
|
2750
|
+
* draw order. */
|
|
2088
2751
|
setFrame(frame, time, drawOrder) {
|
|
2089
2752
|
this.frames[frame] = time;
|
|
2090
2753
|
this.drawOrders[frame] = drawOrder;
|
|
2091
2754
|
}
|
|
2092
2755
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2093
|
-
if (direction == 1) {
|
|
2094
|
-
if (blend == 0)
|
|
2756
|
+
if (direction == 1 /* mixOut */) {
|
|
2757
|
+
if (blend == 0 /* setup */)
|
|
2095
2758
|
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2096
2759
|
return;
|
|
2097
2760
|
}
|
|
2098
2761
|
if (time < this.frames[0]) {
|
|
2099
|
-
if (blend == 0 || blend == 1)
|
|
2762
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
2100
2763
|
Utils.arrayCopy(skeleton.slots, 0, skeleton.drawOrder, 0, skeleton.slots.length);
|
|
2101
2764
|
return;
|
|
2102
2765
|
}
|
|
@@ -2119,20 +2782,37 @@ var spine = (() => {
|
|
|
2119
2782
|
super(frameCount, bezierCount, [
|
|
2120
2783
|
Property.ikConstraint + "|" + ikConstraintIndex
|
|
2121
2784
|
]);
|
|
2785
|
+
/** The index of the IK constraint slot in {@link Skeleton#ikConstraints} that will be changed. */
|
|
2122
2786
|
this.ikConstraintIndex = 0;
|
|
2123
2787
|
this.ikConstraintIndex = ikConstraintIndex;
|
|
2124
2788
|
}
|
|
2125
2789
|
getFrameEntries() {
|
|
2126
2790
|
return 6;
|
|
2127
2791
|
}
|
|
2792
|
+
/** Sets the time in seconds, mix, softness, bend direction, compress, and stretch for the specified key frame. */
|
|
2128
2793
|
setFrame(frame, time, mix, softness, bendDirection, compress, stretch) {
|
|
2129
2794
|
frame *= 6;
|
|
2130
2795
|
this.frames[frame] = time;
|
|
2131
|
-
this.frames[
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
this.frames[
|
|
2796
|
+
this.frames[
|
|
2797
|
+
frame + 1
|
|
2798
|
+
/*MIX*/
|
|
2799
|
+
] = mix;
|
|
2800
|
+
this.frames[
|
|
2801
|
+
frame + 2
|
|
2802
|
+
/*SOFTNESS*/
|
|
2803
|
+
] = softness;
|
|
2804
|
+
this.frames[
|
|
2805
|
+
frame + 3
|
|
2806
|
+
/*BEND_DIRECTION*/
|
|
2807
|
+
] = bendDirection;
|
|
2808
|
+
this.frames[
|
|
2809
|
+
frame + 4
|
|
2810
|
+
/*COMPRESS*/
|
|
2811
|
+
] = compress ? 1 : 0;
|
|
2812
|
+
this.frames[
|
|
2813
|
+
frame + 5
|
|
2814
|
+
/*STRETCH*/
|
|
2815
|
+
] = stretch ? 1 : 0;
|
|
2136
2816
|
}
|
|
2137
2817
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2138
2818
|
let constraint = skeleton.ikConstraints[this.ikConstraintIndex];
|
|
@@ -2141,14 +2821,14 @@ var spine = (() => {
|
|
|
2141
2821
|
let frames = this.frames;
|
|
2142
2822
|
if (time < frames[0]) {
|
|
2143
2823
|
switch (blend) {
|
|
2144
|
-
case 0
|
|
2824
|
+
case 0 /* setup */:
|
|
2145
2825
|
constraint.mix = constraint.data.mix;
|
|
2146
2826
|
constraint.softness = constraint.data.softness;
|
|
2147
2827
|
constraint.bendDirection = constraint.data.bendDirection;
|
|
2148
2828
|
constraint.compress = constraint.data.compress;
|
|
2149
2829
|
constraint.stretch = constraint.data.stretch;
|
|
2150
2830
|
return;
|
|
2151
|
-
case 1
|
|
2831
|
+
case 1 /* first */:
|
|
2152
2832
|
constraint.mix += (constraint.data.mix - constraint.mix) * alpha;
|
|
2153
2833
|
constraint.softness += (constraint.data.softness - constraint.softness) * alpha;
|
|
2154
2834
|
constraint.bendDirection = constraint.data.bendDirection;
|
|
@@ -2158,44 +2838,103 @@ var spine = (() => {
|
|
|
2158
2838
|
return;
|
|
2159
2839
|
}
|
|
2160
2840
|
let mix = 0, softness = 0;
|
|
2161
|
-
let i = Timeline.search(
|
|
2162
|
-
|
|
2841
|
+
let i = Timeline.search(
|
|
2842
|
+
frames,
|
|
2843
|
+
time,
|
|
2844
|
+
6
|
|
2845
|
+
/*ENTRIES*/
|
|
2846
|
+
);
|
|
2847
|
+
let curveType = this.curves[
|
|
2848
|
+
i / 6
|
|
2849
|
+
/*ENTRIES*/
|
|
2850
|
+
];
|
|
2163
2851
|
switch (curveType) {
|
|
2164
2852
|
case 0:
|
|
2165
2853
|
let before = frames[i];
|
|
2166
|
-
mix = frames[
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
softness
|
|
2854
|
+
mix = frames[
|
|
2855
|
+
i + 1
|
|
2856
|
+
/*MIX*/
|
|
2857
|
+
];
|
|
2858
|
+
softness = frames[
|
|
2859
|
+
i + 2
|
|
2860
|
+
/*SOFTNESS*/
|
|
2861
|
+
];
|
|
2862
|
+
let t = (time - before) / (frames[
|
|
2863
|
+
i + 6
|
|
2864
|
+
/*ENTRIES*/
|
|
2865
|
+
] - before);
|
|
2866
|
+
mix += (frames[
|
|
2867
|
+
i + 6 + 1
|
|
2868
|
+
/*MIX*/
|
|
2869
|
+
] - mix) * t;
|
|
2870
|
+
softness += (frames[
|
|
2871
|
+
i + 6 + 2
|
|
2872
|
+
/*SOFTNESS*/
|
|
2873
|
+
] - softness) * t;
|
|
2171
2874
|
break;
|
|
2172
2875
|
case 1:
|
|
2173
|
-
mix = frames[
|
|
2174
|
-
|
|
2876
|
+
mix = frames[
|
|
2877
|
+
i + 1
|
|
2878
|
+
/*MIX*/
|
|
2879
|
+
];
|
|
2880
|
+
softness = frames[
|
|
2881
|
+
i + 2
|
|
2882
|
+
/*SOFTNESS*/
|
|
2883
|
+
];
|
|
2175
2884
|
break;
|
|
2176
2885
|
default:
|
|
2177
|
-
mix = this.getBezierValue(
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2886
|
+
mix = this.getBezierValue(
|
|
2887
|
+
time,
|
|
2888
|
+
i,
|
|
2889
|
+
1,
|
|
2890
|
+
curveType - 2
|
|
2891
|
+
/*BEZIER*/
|
|
2892
|
+
);
|
|
2893
|
+
softness = this.getBezierValue(
|
|
2894
|
+
time,
|
|
2895
|
+
i,
|
|
2896
|
+
2,
|
|
2897
|
+
curveType + 18 - 2
|
|
2898
|
+
/*BEZIER*/
|
|
2899
|
+
);
|
|
2900
|
+
}
|
|
2901
|
+
if (blend == 0 /* setup */) {
|
|
2181
2902
|
constraint.mix = constraint.data.mix + (mix - constraint.data.mix) * alpha;
|
|
2182
2903
|
constraint.softness = constraint.data.softness + (softness - constraint.data.softness) * alpha;
|
|
2183
|
-
if (direction == 1) {
|
|
2904
|
+
if (direction == 1 /* mixOut */) {
|
|
2184
2905
|
constraint.bendDirection = constraint.data.bendDirection;
|
|
2185
2906
|
constraint.compress = constraint.data.compress;
|
|
2186
2907
|
constraint.stretch = constraint.data.stretch;
|
|
2187
2908
|
} else {
|
|
2188
|
-
constraint.bendDirection = frames[
|
|
2189
|
-
|
|
2190
|
-
|
|
2909
|
+
constraint.bendDirection = frames[
|
|
2910
|
+
i + 3
|
|
2911
|
+
/*BEND_DIRECTION*/
|
|
2912
|
+
];
|
|
2913
|
+
constraint.compress = frames[
|
|
2914
|
+
i + 4
|
|
2915
|
+
/*COMPRESS*/
|
|
2916
|
+
] != 0;
|
|
2917
|
+
constraint.stretch = frames[
|
|
2918
|
+
i + 5
|
|
2919
|
+
/*STRETCH*/
|
|
2920
|
+
] != 0;
|
|
2191
2921
|
}
|
|
2192
2922
|
} else {
|
|
2193
2923
|
constraint.mix += (mix - constraint.mix) * alpha;
|
|
2194
2924
|
constraint.softness += (softness - constraint.softness) * alpha;
|
|
2195
|
-
if (direction == 0) {
|
|
2196
|
-
constraint.bendDirection = frames[
|
|
2197
|
-
|
|
2198
|
-
|
|
2925
|
+
if (direction == 0 /* mixIn */) {
|
|
2926
|
+
constraint.bendDirection = frames[
|
|
2927
|
+
i + 3
|
|
2928
|
+
/*BEND_DIRECTION*/
|
|
2929
|
+
];
|
|
2930
|
+
constraint.compress = frames[
|
|
2931
|
+
i + 4
|
|
2932
|
+
/*COMPRESS*/
|
|
2933
|
+
] != 0;
|
|
2934
|
+
constraint.stretch = frames[
|
|
2935
|
+
i + 5
|
|
2936
|
+
/*STRETCH*/
|
|
2937
|
+
] != 0;
|
|
2199
2938
|
}
|
|
2200
2939
|
}
|
|
2201
2940
|
}
|
|
@@ -2205,22 +2944,42 @@ var spine = (() => {
|
|
|
2205
2944
|
super(frameCount, bezierCount, [
|
|
2206
2945
|
Property.transformConstraint + "|" + transformConstraintIndex
|
|
2207
2946
|
]);
|
|
2947
|
+
/** The index of the transform constraint slot in {@link Skeleton#transformConstraints} that will be changed. */
|
|
2208
2948
|
this.transformConstraintIndex = 0;
|
|
2209
2949
|
this.transformConstraintIndex = transformConstraintIndex;
|
|
2210
2950
|
}
|
|
2211
2951
|
getFrameEntries() {
|
|
2212
2952
|
return 7;
|
|
2213
2953
|
}
|
|
2954
|
+
/** The time in seconds, rotate mix, translate mix, scale mix, and shear mix for the specified key frame. */
|
|
2214
2955
|
setFrame(frame, time, mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY) {
|
|
2215
2956
|
let frames = this.frames;
|
|
2216
2957
|
frame *= 7;
|
|
2217
2958
|
frames[frame] = time;
|
|
2218
|
-
frames[
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
frames[
|
|
2223
|
-
|
|
2959
|
+
frames[
|
|
2960
|
+
frame + 1
|
|
2961
|
+
/*ROTATE*/
|
|
2962
|
+
] = mixRotate;
|
|
2963
|
+
frames[
|
|
2964
|
+
frame + 2
|
|
2965
|
+
/*X*/
|
|
2966
|
+
] = mixX;
|
|
2967
|
+
frames[
|
|
2968
|
+
frame + 3
|
|
2969
|
+
/*Y*/
|
|
2970
|
+
] = mixY;
|
|
2971
|
+
frames[
|
|
2972
|
+
frame + 4
|
|
2973
|
+
/*SCALEX*/
|
|
2974
|
+
] = mixScaleX;
|
|
2975
|
+
frames[
|
|
2976
|
+
frame + 5
|
|
2977
|
+
/*SCALEY*/
|
|
2978
|
+
] = mixScaleY;
|
|
2979
|
+
frames[
|
|
2980
|
+
frame + 6
|
|
2981
|
+
/*SHEARY*/
|
|
2982
|
+
] = mixShearY;
|
|
2224
2983
|
}
|
|
2225
2984
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2226
2985
|
let constraint = skeleton.transformConstraints[this.transformConstraintIndex];
|
|
@@ -2230,7 +2989,7 @@ var spine = (() => {
|
|
|
2230
2989
|
if (time < frames[0]) {
|
|
2231
2990
|
let data = constraint.data;
|
|
2232
2991
|
switch (blend) {
|
|
2233
|
-
case 0
|
|
2992
|
+
case 0 /* setup */:
|
|
2234
2993
|
constraint.mixRotate = data.mixRotate;
|
|
2235
2994
|
constraint.mixX = data.mixX;
|
|
2236
2995
|
constraint.mixY = data.mixY;
|
|
@@ -2238,7 +2997,7 @@ var spine = (() => {
|
|
|
2238
2997
|
constraint.mixScaleY = data.mixScaleY;
|
|
2239
2998
|
constraint.mixShearY = data.mixShearY;
|
|
2240
2999
|
return;
|
|
2241
|
-
case 1
|
|
3000
|
+
case 1 /* first */:
|
|
2242
3001
|
constraint.mixRotate += (data.mixRotate - constraint.mixRotate) * alpha;
|
|
2243
3002
|
constraint.mixX += (data.mixX - constraint.mixX) * alpha;
|
|
2244
3003
|
constraint.mixY += (data.mixY - constraint.mixY) * alpha;
|
|
@@ -2249,42 +3008,143 @@ var spine = (() => {
|
|
|
2249
3008
|
return;
|
|
2250
3009
|
}
|
|
2251
3010
|
let rotate, x, y, scaleX, scaleY, shearY;
|
|
2252
|
-
let i = Timeline.search(
|
|
2253
|
-
|
|
3011
|
+
let i = Timeline.search(
|
|
3012
|
+
frames,
|
|
3013
|
+
time,
|
|
3014
|
+
7
|
|
3015
|
+
/*ENTRIES*/
|
|
3016
|
+
);
|
|
3017
|
+
let curveType = this.curves[
|
|
3018
|
+
i / 7
|
|
3019
|
+
/*ENTRIES*/
|
|
3020
|
+
];
|
|
2254
3021
|
switch (curveType) {
|
|
2255
3022
|
case 0:
|
|
2256
3023
|
let before = frames[i];
|
|
2257
|
-
rotate = frames[
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
3024
|
+
rotate = frames[
|
|
3025
|
+
i + 1
|
|
3026
|
+
/*ROTATE*/
|
|
3027
|
+
];
|
|
3028
|
+
x = frames[
|
|
3029
|
+
i + 2
|
|
3030
|
+
/*X*/
|
|
3031
|
+
];
|
|
3032
|
+
y = frames[
|
|
3033
|
+
i + 3
|
|
3034
|
+
/*Y*/
|
|
3035
|
+
];
|
|
3036
|
+
scaleX = frames[
|
|
3037
|
+
i + 4
|
|
3038
|
+
/*SCALEX*/
|
|
3039
|
+
];
|
|
3040
|
+
scaleY = frames[
|
|
3041
|
+
i + 5
|
|
3042
|
+
/*SCALEY*/
|
|
3043
|
+
];
|
|
3044
|
+
shearY = frames[
|
|
3045
|
+
i + 6
|
|
3046
|
+
/*SHEARY*/
|
|
3047
|
+
];
|
|
3048
|
+
let t = (time - before) / (frames[
|
|
3049
|
+
i + 7
|
|
3050
|
+
/*ENTRIES*/
|
|
3051
|
+
] - before);
|
|
3052
|
+
rotate += (frames[
|
|
3053
|
+
i + 7 + 1
|
|
3054
|
+
/*ROTATE*/
|
|
3055
|
+
] - rotate) * t;
|
|
3056
|
+
x += (frames[
|
|
3057
|
+
i + 7 + 2
|
|
3058
|
+
/*X*/
|
|
3059
|
+
] - x) * t;
|
|
3060
|
+
y += (frames[
|
|
3061
|
+
i + 7 + 3
|
|
3062
|
+
/*Y*/
|
|
3063
|
+
] - y) * t;
|
|
3064
|
+
scaleX += (frames[
|
|
3065
|
+
i + 7 + 4
|
|
3066
|
+
/*SCALEX*/
|
|
3067
|
+
] - scaleX) * t;
|
|
3068
|
+
scaleY += (frames[
|
|
3069
|
+
i + 7 + 5
|
|
3070
|
+
/*SCALEY*/
|
|
3071
|
+
] - scaleY) * t;
|
|
3072
|
+
shearY += (frames[
|
|
3073
|
+
i + 7 + 6
|
|
3074
|
+
/*SHEARY*/
|
|
3075
|
+
] - shearY) * t;
|
|
2270
3076
|
break;
|
|
2271
3077
|
case 1:
|
|
2272
|
-
rotate = frames[
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
3078
|
+
rotate = frames[
|
|
3079
|
+
i + 1
|
|
3080
|
+
/*ROTATE*/
|
|
3081
|
+
];
|
|
3082
|
+
x = frames[
|
|
3083
|
+
i + 2
|
|
3084
|
+
/*X*/
|
|
3085
|
+
];
|
|
3086
|
+
y = frames[
|
|
3087
|
+
i + 3
|
|
3088
|
+
/*Y*/
|
|
3089
|
+
];
|
|
3090
|
+
scaleX = frames[
|
|
3091
|
+
i + 4
|
|
3092
|
+
/*SCALEX*/
|
|
3093
|
+
];
|
|
3094
|
+
scaleY = frames[
|
|
3095
|
+
i + 5
|
|
3096
|
+
/*SCALEY*/
|
|
3097
|
+
];
|
|
3098
|
+
shearY = frames[
|
|
3099
|
+
i + 6
|
|
3100
|
+
/*SHEARY*/
|
|
3101
|
+
];
|
|
2278
3102
|
break;
|
|
2279
3103
|
default:
|
|
2280
|
-
rotate = this.getBezierValue(
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
3104
|
+
rotate = this.getBezierValue(
|
|
3105
|
+
time,
|
|
3106
|
+
i,
|
|
3107
|
+
1,
|
|
3108
|
+
curveType - 2
|
|
3109
|
+
/*BEZIER*/
|
|
3110
|
+
);
|
|
3111
|
+
x = this.getBezierValue(
|
|
3112
|
+
time,
|
|
3113
|
+
i,
|
|
3114
|
+
2,
|
|
3115
|
+
curveType + 18 - 2
|
|
3116
|
+
/*BEZIER*/
|
|
3117
|
+
);
|
|
3118
|
+
y = this.getBezierValue(
|
|
3119
|
+
time,
|
|
3120
|
+
i,
|
|
3121
|
+
3,
|
|
3122
|
+
curveType + 18 * 2 - 2
|
|
3123
|
+
/*BEZIER*/
|
|
3124
|
+
);
|
|
3125
|
+
scaleX = this.getBezierValue(
|
|
3126
|
+
time,
|
|
3127
|
+
i,
|
|
3128
|
+
4,
|
|
3129
|
+
curveType + 18 * 3 - 2
|
|
3130
|
+
/*BEZIER*/
|
|
3131
|
+
);
|
|
3132
|
+
scaleY = this.getBezierValue(
|
|
3133
|
+
time,
|
|
3134
|
+
i,
|
|
3135
|
+
5,
|
|
3136
|
+
curveType + 18 * 4 - 2
|
|
3137
|
+
/*BEZIER*/
|
|
3138
|
+
);
|
|
3139
|
+
shearY = this.getBezierValue(
|
|
3140
|
+
time,
|
|
3141
|
+
i,
|
|
3142
|
+
6,
|
|
3143
|
+
curveType + 18 * 5 - 2
|
|
3144
|
+
/*BEZIER*/
|
|
3145
|
+
);
|
|
3146
|
+
}
|
|
3147
|
+
if (blend == 0 /* setup */) {
|
|
2288
3148
|
let data = constraint.data;
|
|
2289
3149
|
constraint.mixRotate = data.mixRotate + (rotate - data.mixRotate) * alpha;
|
|
2290
3150
|
constraint.mixX = data.mixX + (x - data.mixX) * alpha;
|
|
@@ -2305,6 +3165,7 @@ var spine = (() => {
|
|
|
2305
3165
|
var PathConstraintPositionTimeline = class extends CurveTimeline1 {
|
|
2306
3166
|
constructor(frameCount, bezierCount, pathConstraintIndex) {
|
|
2307
3167
|
super(frameCount, bezierCount, Property.pathConstraintPosition + "|" + pathConstraintIndex);
|
|
3168
|
+
/** The index of the path constraint slot in {@link Skeleton#pathConstraints} that will be changed. */
|
|
2308
3169
|
this.pathConstraintIndex = 0;
|
|
2309
3170
|
this.pathConstraintIndex = pathConstraintIndex;
|
|
2310
3171
|
}
|
|
@@ -2315,16 +3176,16 @@ var spine = (() => {
|
|
|
2315
3176
|
let frames = this.frames;
|
|
2316
3177
|
if (time < frames[0]) {
|
|
2317
3178
|
switch (blend) {
|
|
2318
|
-
case 0
|
|
3179
|
+
case 0 /* setup */:
|
|
2319
3180
|
constraint.position = constraint.data.position;
|
|
2320
3181
|
return;
|
|
2321
|
-
case 1
|
|
3182
|
+
case 1 /* first */:
|
|
2322
3183
|
constraint.position += (constraint.data.position - constraint.position) * alpha;
|
|
2323
3184
|
}
|
|
2324
3185
|
return;
|
|
2325
3186
|
}
|
|
2326
3187
|
let position = this.getCurveValue(time);
|
|
2327
|
-
if (blend == 0)
|
|
3188
|
+
if (blend == 0 /* setup */)
|
|
2328
3189
|
constraint.position = constraint.data.position + (position - constraint.data.position) * alpha;
|
|
2329
3190
|
else
|
|
2330
3191
|
constraint.position += (position - constraint.position) * alpha;
|
|
@@ -2333,6 +3194,7 @@ var spine = (() => {
|
|
|
2333
3194
|
var PathConstraintSpacingTimeline = class extends CurveTimeline1 {
|
|
2334
3195
|
constructor(frameCount, bezierCount, pathConstraintIndex) {
|
|
2335
3196
|
super(frameCount, bezierCount, Property.pathConstraintSpacing + "|" + pathConstraintIndex);
|
|
3197
|
+
/** The index of the path constraint slot in {@link Skeleton#getPathConstraints()} that will be changed. */
|
|
2336
3198
|
this.pathConstraintIndex = 0;
|
|
2337
3199
|
this.pathConstraintIndex = pathConstraintIndex;
|
|
2338
3200
|
}
|
|
@@ -2343,16 +3205,16 @@ var spine = (() => {
|
|
|
2343
3205
|
let frames = this.frames;
|
|
2344
3206
|
if (time < frames[0]) {
|
|
2345
3207
|
switch (blend) {
|
|
2346
|
-
case 0
|
|
3208
|
+
case 0 /* setup */:
|
|
2347
3209
|
constraint.spacing = constraint.data.spacing;
|
|
2348
3210
|
return;
|
|
2349
|
-
case 1
|
|
3211
|
+
case 1 /* first */:
|
|
2350
3212
|
constraint.spacing += (constraint.data.spacing - constraint.spacing) * alpha;
|
|
2351
3213
|
}
|
|
2352
3214
|
return;
|
|
2353
3215
|
}
|
|
2354
3216
|
let spacing = this.getCurveValue(time);
|
|
2355
|
-
if (blend == 0)
|
|
3217
|
+
if (blend == 0 /* setup */)
|
|
2356
3218
|
constraint.spacing = constraint.data.spacing + (spacing - constraint.data.spacing) * alpha;
|
|
2357
3219
|
else
|
|
2358
3220
|
constraint.spacing += (spacing - constraint.spacing) * alpha;
|
|
@@ -2363,6 +3225,7 @@ var spine = (() => {
|
|
|
2363
3225
|
super(frameCount, bezierCount, [
|
|
2364
3226
|
Property.pathConstraintMix + "|" + pathConstraintIndex
|
|
2365
3227
|
]);
|
|
3228
|
+
/** The index of the path constraint slot in {@link Skeleton#getPathConstraints()} that will be changed. */
|
|
2366
3229
|
this.pathConstraintIndex = 0;
|
|
2367
3230
|
this.pathConstraintIndex = pathConstraintIndex;
|
|
2368
3231
|
}
|
|
@@ -2373,9 +3236,18 @@ var spine = (() => {
|
|
|
2373
3236
|
let frames = this.frames;
|
|
2374
3237
|
frame <<= 2;
|
|
2375
3238
|
frames[frame] = time;
|
|
2376
|
-
frames[
|
|
2377
|
-
|
|
2378
|
-
|
|
3239
|
+
frames[
|
|
3240
|
+
frame + 1
|
|
3241
|
+
/*ROTATE*/
|
|
3242
|
+
] = mixRotate;
|
|
3243
|
+
frames[
|
|
3244
|
+
frame + 2
|
|
3245
|
+
/*X*/
|
|
3246
|
+
] = mixX;
|
|
3247
|
+
frames[
|
|
3248
|
+
frame + 3
|
|
3249
|
+
/*Y*/
|
|
3250
|
+
] = mixY;
|
|
2379
3251
|
}
|
|
2380
3252
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2381
3253
|
let constraint = skeleton.pathConstraints[this.pathConstraintIndex];
|
|
@@ -2384,12 +3256,12 @@ var spine = (() => {
|
|
|
2384
3256
|
let frames = this.frames;
|
|
2385
3257
|
if (time < frames[0]) {
|
|
2386
3258
|
switch (blend) {
|
|
2387
|
-
case 0
|
|
3259
|
+
case 0 /* setup */:
|
|
2388
3260
|
constraint.mixRotate = constraint.data.mixRotate;
|
|
2389
3261
|
constraint.mixX = constraint.data.mixX;
|
|
2390
3262
|
constraint.mixY = constraint.data.mixY;
|
|
2391
3263
|
return;
|
|
2392
|
-
case 1
|
|
3264
|
+
case 1 /* first */:
|
|
2393
3265
|
constraint.mixRotate += (constraint.data.mixRotate - constraint.mixRotate) * alpha;
|
|
2394
3266
|
constraint.mixX += (constraint.data.mixX - constraint.mixX) * alpha;
|
|
2395
3267
|
constraint.mixY += (constraint.data.mixY - constraint.mixY) * alpha;
|
|
@@ -2397,30 +3269,83 @@ var spine = (() => {
|
|
|
2397
3269
|
return;
|
|
2398
3270
|
}
|
|
2399
3271
|
let rotate, x, y;
|
|
2400
|
-
let i = Timeline.search(
|
|
3272
|
+
let i = Timeline.search(
|
|
3273
|
+
frames,
|
|
3274
|
+
time,
|
|
3275
|
+
4
|
|
3276
|
+
/*ENTRIES*/
|
|
3277
|
+
);
|
|
2401
3278
|
let curveType = this.curves[i >> 2];
|
|
2402
3279
|
switch (curveType) {
|
|
2403
3280
|
case 0:
|
|
2404
3281
|
let before = frames[i];
|
|
2405
|
-
rotate = frames[
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
3282
|
+
rotate = frames[
|
|
3283
|
+
i + 1
|
|
3284
|
+
/*ROTATE*/
|
|
3285
|
+
];
|
|
3286
|
+
x = frames[
|
|
3287
|
+
i + 2
|
|
3288
|
+
/*X*/
|
|
3289
|
+
];
|
|
3290
|
+
y = frames[
|
|
3291
|
+
i + 3
|
|
3292
|
+
/*Y*/
|
|
3293
|
+
];
|
|
3294
|
+
let t = (time - before) / (frames[
|
|
3295
|
+
i + 4
|
|
3296
|
+
/*ENTRIES*/
|
|
3297
|
+
] - before);
|
|
3298
|
+
rotate += (frames[
|
|
3299
|
+
i + 4 + 1
|
|
3300
|
+
/*ROTATE*/
|
|
3301
|
+
] - rotate) * t;
|
|
3302
|
+
x += (frames[
|
|
3303
|
+
i + 4 + 2
|
|
3304
|
+
/*X*/
|
|
3305
|
+
] - x) * t;
|
|
3306
|
+
y += (frames[
|
|
3307
|
+
i + 4 + 3
|
|
3308
|
+
/*Y*/
|
|
3309
|
+
] - y) * t;
|
|
2412
3310
|
break;
|
|
2413
3311
|
case 1:
|
|
2414
|
-
rotate = frames[
|
|
2415
|
-
|
|
2416
|
-
|
|
3312
|
+
rotate = frames[
|
|
3313
|
+
i + 1
|
|
3314
|
+
/*ROTATE*/
|
|
3315
|
+
];
|
|
3316
|
+
x = frames[
|
|
3317
|
+
i + 2
|
|
3318
|
+
/*X*/
|
|
3319
|
+
];
|
|
3320
|
+
y = frames[
|
|
3321
|
+
i + 3
|
|
3322
|
+
/*Y*/
|
|
3323
|
+
];
|
|
2417
3324
|
break;
|
|
2418
3325
|
default:
|
|
2419
|
-
rotate = this.getBezierValue(
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
3326
|
+
rotate = this.getBezierValue(
|
|
3327
|
+
time,
|
|
3328
|
+
i,
|
|
3329
|
+
1,
|
|
3330
|
+
curveType - 2
|
|
3331
|
+
/*BEZIER*/
|
|
3332
|
+
);
|
|
3333
|
+
x = this.getBezierValue(
|
|
3334
|
+
time,
|
|
3335
|
+
i,
|
|
3336
|
+
2,
|
|
3337
|
+
curveType + 18 - 2
|
|
3338
|
+
/*BEZIER*/
|
|
3339
|
+
);
|
|
3340
|
+
y = this.getBezierValue(
|
|
3341
|
+
time,
|
|
3342
|
+
i,
|
|
3343
|
+
3,
|
|
3344
|
+
curveType + 18 * 2 - 2
|
|
3345
|
+
/*BEZIER*/
|
|
3346
|
+
);
|
|
3347
|
+
}
|
|
3348
|
+
if (blend == 0 /* setup */) {
|
|
2424
3349
|
let data = constraint.data;
|
|
2425
3350
|
constraint.mixRotate = data.mixRotate + (rotate - data.mixRotate) * alpha;
|
|
2426
3351
|
constraint.mixX = data.mixX + (x - data.mixX) * alpha;
|
|
@@ -2449,6 +3374,9 @@ var spine = (() => {
|
|
|
2449
3374
|
getAttachment() {
|
|
2450
3375
|
return this.attachment;
|
|
2451
3376
|
}
|
|
3377
|
+
/** Sets the time, mode, index, and frame time for the specified frame.
|
|
3378
|
+
* @param frame Between 0 and <code>frameCount</code>, inclusive.
|
|
3379
|
+
* @param time Seconds between frames. */
|
|
2452
3380
|
setFrame(frame, time, mode, index, delay) {
|
|
2453
3381
|
let frames = this.frames;
|
|
2454
3382
|
frame *= _SequenceTimeline.ENTRIES;
|
|
@@ -2468,7 +3396,7 @@ var spine = (() => {
|
|
|
2468
3396
|
}
|
|
2469
3397
|
let frames = this.frames;
|
|
2470
3398
|
if (time < frames[0]) {
|
|
2471
|
-
if (blend == 0 || blend == 1)
|
|
3399
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
2472
3400
|
slot.sequenceIndex = -1;
|
|
2473
3401
|
return;
|
|
2474
3402
|
}
|
|
@@ -2480,29 +3408,29 @@ var spine = (() => {
|
|
|
2480
3408
|
return;
|
|
2481
3409
|
let index = modeAndIndex >> 4, count = this.attachment.sequence.regions.length;
|
|
2482
3410
|
let mode = SequenceModeValues[modeAndIndex & 15];
|
|
2483
|
-
if (mode !=
|
|
3411
|
+
if (mode != 0 /* hold */) {
|
|
2484
3412
|
index += (time - before) / delay + 1e-5 | 0;
|
|
2485
3413
|
switch (mode) {
|
|
2486
|
-
case
|
|
3414
|
+
case 1 /* once */:
|
|
2487
3415
|
index = Math.min(count - 1, index);
|
|
2488
3416
|
break;
|
|
2489
|
-
case
|
|
3417
|
+
case 2 /* loop */:
|
|
2490
3418
|
index %= count;
|
|
2491
3419
|
break;
|
|
2492
|
-
case
|
|
3420
|
+
case 3 /* pingpong */: {
|
|
2493
3421
|
let n = (count << 1) - 2;
|
|
2494
3422
|
index = n == 0 ? 0 : index % n;
|
|
2495
3423
|
if (index >= count)
|
|
2496
3424
|
index = n - index;
|
|
2497
3425
|
break;
|
|
2498
3426
|
}
|
|
2499
|
-
case
|
|
3427
|
+
case 4 /* onceReverse */:
|
|
2500
3428
|
index = Math.max(count - 1 - index, 0);
|
|
2501
3429
|
break;
|
|
2502
|
-
case
|
|
3430
|
+
case 5 /* loopReverse */:
|
|
2503
3431
|
index = count - 1 - index % count;
|
|
2504
3432
|
break;
|
|
2505
|
-
case
|
|
3433
|
+
case 6 /* pingpongReverse */: {
|
|
2506
3434
|
let n = (count << 1) - 2;
|
|
2507
3435
|
index = n == 0 ? 0 : (index + count - 1) % n;
|
|
2508
3436
|
if (index >= count)
|
|
@@ -2521,7 +3449,12 @@ var spine = (() => {
|
|
|
2521
3449
|
// spine-core/src/AnimationState.ts
|
|
2522
3450
|
var _AnimationState = class {
|
|
2523
3451
|
constructor(data) {
|
|
3452
|
+
/** The list of tracks that currently have animations, which may contain null entries. */
|
|
2524
3453
|
this.tracks = new Array();
|
|
3454
|
+
/** Multiplier for the delta time when the animation state is updated, causing time for all animations and mixes to play slower
|
|
3455
|
+
* or faster. Defaults to 1.
|
|
3456
|
+
*
|
|
3457
|
+
* See TrackEntry {@link TrackEntry#timeScale} for affecting a single animation. */
|
|
2525
3458
|
this.timeScale = 1;
|
|
2526
3459
|
this.unkeyedState = 0;
|
|
2527
3460
|
this.events = new Array();
|
|
@@ -2535,6 +3468,7 @@ var spine = (() => {
|
|
|
2535
3468
|
static emptyAnimation() {
|
|
2536
3469
|
return _AnimationState._emptyAnimation;
|
|
2537
3470
|
}
|
|
3471
|
+
/** Increments each track entry {@link TrackEntry#trackTime()}, setting queued animations as current if needed. */
|
|
2538
3472
|
update(delta) {
|
|
2539
3473
|
delta *= this.timeScale;
|
|
2540
3474
|
let tracks = this.tracks;
|
|
@@ -2586,6 +3520,7 @@ var spine = (() => {
|
|
|
2586
3520
|
}
|
|
2587
3521
|
this.queue.drain();
|
|
2588
3522
|
}
|
|
3523
|
+
/** Returns true when all mixing from entries are complete. */
|
|
2589
3524
|
updateMixingFrom(to, delta) {
|
|
2590
3525
|
let from = to.mixingFrom;
|
|
2591
3526
|
if (!from)
|
|
@@ -2607,6 +3542,9 @@ var spine = (() => {
|
|
|
2607
3542
|
to.mixTime += delta;
|
|
2608
3543
|
return false;
|
|
2609
3544
|
}
|
|
3545
|
+
/** Poses the skeleton using the track entry animations. There are no side effects other than invoking listeners, so the
|
|
3546
|
+
* animation state can be applied to multiple skeletons to pose them identically.
|
|
3547
|
+
* @returns True if any animations were applied. */
|
|
2610
3548
|
apply(skeleton) {
|
|
2611
3549
|
if (!skeleton)
|
|
2612
3550
|
throw new Error("skeleton cannot be null.");
|
|
@@ -2620,7 +3558,7 @@ var spine = (() => {
|
|
|
2620
3558
|
if (!current || current.delay > 0)
|
|
2621
3559
|
continue;
|
|
2622
3560
|
applied = true;
|
|
2623
|
-
let blend = i2 == 0 ?
|
|
3561
|
+
let blend = i2 == 0 ? 1 /* first */ : current.mixBlend;
|
|
2624
3562
|
let mix = current.alpha;
|
|
2625
3563
|
if (current.mixingFrom)
|
|
2626
3564
|
mix *= this.applyMixingFrom(current, skeleton, blend);
|
|
@@ -2634,14 +3572,14 @@ var spine = (() => {
|
|
|
2634
3572
|
}
|
|
2635
3573
|
let timelines = current.animation.timelines;
|
|
2636
3574
|
let timelineCount = timelines.length;
|
|
2637
|
-
if (i2 == 0 && mix == 1 || blend ==
|
|
3575
|
+
if (i2 == 0 && mix == 1 || blend == 3 /* add */) {
|
|
2638
3576
|
for (let ii = 0; ii < timelineCount; ii++) {
|
|
2639
3577
|
Utils.webkit602BugfixHelper(mix, blend);
|
|
2640
3578
|
var timeline = timelines[ii];
|
|
2641
3579
|
if (timeline instanceof AttachmentTimeline)
|
|
2642
3580
|
this.applyAttachmentTimeline(timeline, skeleton, applyTime, blend, true);
|
|
2643
3581
|
else
|
|
2644
|
-
timeline.apply(skeleton, animationLast, applyTime, applyEvents, mix, blend,
|
|
3582
|
+
timeline.apply(skeleton, animationLast, applyTime, applyEvents, mix, blend, 0 /* mixIn */);
|
|
2645
3583
|
}
|
|
2646
3584
|
} else {
|
|
2647
3585
|
let timelineMode = current.timelineMode;
|
|
@@ -2651,14 +3589,14 @@ var spine = (() => {
|
|
|
2651
3589
|
current.timelinesRotation.length = timelineCount << 1;
|
|
2652
3590
|
for (let ii = 0; ii < timelineCount; ii++) {
|
|
2653
3591
|
let timeline2 = timelines[ii];
|
|
2654
|
-
let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend :
|
|
3592
|
+
let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend : 0 /* setup */;
|
|
2655
3593
|
if (!shortestRotation && timeline2 instanceof RotateTimeline) {
|
|
2656
3594
|
this.applyRotateTimeline(timeline2, skeleton, applyTime, mix, timelineBlend, current.timelinesRotation, ii << 1, firstFrame);
|
|
2657
3595
|
} else if (timeline2 instanceof AttachmentTimeline) {
|
|
2658
3596
|
this.applyAttachmentTimeline(timeline2, skeleton, applyTime, blend, true);
|
|
2659
3597
|
} else {
|
|
2660
3598
|
Utils.webkit602BugfixHelper(mix, blend);
|
|
2661
|
-
timeline2.apply(skeleton, animationLast, applyTime, applyEvents, mix, timelineBlend,
|
|
3599
|
+
timeline2.apply(skeleton, animationLast, applyTime, applyEvents, mix, timelineBlend, 0 /* mixIn */);
|
|
2662
3600
|
}
|
|
2663
3601
|
}
|
|
2664
3602
|
}
|
|
@@ -2687,13 +3625,13 @@ var spine = (() => {
|
|
|
2687
3625
|
let mix = 0;
|
|
2688
3626
|
if (to.mixDuration == 0) {
|
|
2689
3627
|
mix = 1;
|
|
2690
|
-
if (blend ==
|
|
2691
|
-
blend =
|
|
3628
|
+
if (blend == 1 /* first */)
|
|
3629
|
+
blend = 0 /* setup */;
|
|
2692
3630
|
} else {
|
|
2693
3631
|
mix = to.mixTime / to.mixDuration;
|
|
2694
3632
|
if (mix > 1)
|
|
2695
3633
|
mix = 1;
|
|
2696
|
-
if (blend !=
|
|
3634
|
+
if (blend != 1 /* first */)
|
|
2697
3635
|
blend = from.mixBlend;
|
|
2698
3636
|
}
|
|
2699
3637
|
let attachments = mix < from.attachmentThreshold, drawOrder = mix < from.drawOrderThreshold;
|
|
@@ -2706,9 +3644,9 @@ var spine = (() => {
|
|
|
2706
3644
|
applyTime = from.animation.duration - applyTime;
|
|
2707
3645
|
else if (mix < from.eventThreshold)
|
|
2708
3646
|
events = this.events;
|
|
2709
|
-
if (blend ==
|
|
3647
|
+
if (blend == 3 /* add */) {
|
|
2710
3648
|
for (let i = 0; i < timelineCount; i++)
|
|
2711
|
-
timelines[i].apply(skeleton, animationLast, applyTime, events, alphaMix, blend,
|
|
3649
|
+
timelines[i].apply(skeleton, animationLast, applyTime, events, alphaMix, blend, 1 /* mixOut */);
|
|
2712
3650
|
} else {
|
|
2713
3651
|
let timelineMode = from.timelineMode;
|
|
2714
3652
|
let timelineHoldMix = from.timelineHoldMix;
|
|
@@ -2719,7 +3657,7 @@ var spine = (() => {
|
|
|
2719
3657
|
from.totalAlpha = 0;
|
|
2720
3658
|
for (let i = 0; i < timelineCount; i++) {
|
|
2721
3659
|
let timeline = timelines[i];
|
|
2722
|
-
let direction =
|
|
3660
|
+
let direction = 1 /* mixOut */;
|
|
2723
3661
|
let timelineBlend;
|
|
2724
3662
|
let alpha = 0;
|
|
2725
3663
|
switch (timelineMode[i]) {
|
|
@@ -2730,7 +3668,7 @@ var spine = (() => {
|
|
|
2730
3668
|
alpha = alphaMix;
|
|
2731
3669
|
break;
|
|
2732
3670
|
case FIRST:
|
|
2733
|
-
timelineBlend =
|
|
3671
|
+
timelineBlend = 0 /* setup */;
|
|
2734
3672
|
alpha = alphaMix;
|
|
2735
3673
|
break;
|
|
2736
3674
|
case HOLD_SUBSEQUENT:
|
|
@@ -2738,11 +3676,11 @@ var spine = (() => {
|
|
|
2738
3676
|
alpha = alphaHold;
|
|
2739
3677
|
break;
|
|
2740
3678
|
case HOLD_FIRST:
|
|
2741
|
-
timelineBlend =
|
|
3679
|
+
timelineBlend = 0 /* setup */;
|
|
2742
3680
|
alpha = alphaHold;
|
|
2743
3681
|
break;
|
|
2744
3682
|
default:
|
|
2745
|
-
timelineBlend =
|
|
3683
|
+
timelineBlend = 0 /* setup */;
|
|
2746
3684
|
let holdMix = timelineHoldMix[i];
|
|
2747
3685
|
alpha = alphaHold * Math.max(0, 1 - holdMix.mixTime / holdMix.mixDuration);
|
|
2748
3686
|
break;
|
|
@@ -2754,8 +3692,8 @@ var spine = (() => {
|
|
|
2754
3692
|
this.applyAttachmentTimeline(timeline, skeleton, applyTime, timelineBlend, attachments);
|
|
2755
3693
|
else {
|
|
2756
3694
|
Utils.webkit602BugfixHelper(alpha, blend);
|
|
2757
|
-
if (drawOrder && timeline instanceof DrawOrderTimeline && timelineBlend ==
|
|
2758
|
-
direction =
|
|
3695
|
+
if (drawOrder && timeline instanceof DrawOrderTimeline && timelineBlend == 0 /* setup */)
|
|
3696
|
+
direction = 0 /* mixIn */;
|
|
2759
3697
|
timeline.apply(skeleton, animationLast, applyTime, events, alpha, timelineBlend, direction);
|
|
2760
3698
|
}
|
|
2761
3699
|
}
|
|
@@ -2772,7 +3710,7 @@ var spine = (() => {
|
|
|
2772
3710
|
if (!slot.bone.active)
|
|
2773
3711
|
return;
|
|
2774
3712
|
if (time < timeline.frames[0]) {
|
|
2775
|
-
if (blend ==
|
|
3713
|
+
if (blend == 0 /* setup */ || blend == 1 /* first */)
|
|
2776
3714
|
this.setAttachment(skeleton, slot, slot.data.attachmentName, attachments);
|
|
2777
3715
|
} else
|
|
2778
3716
|
this.setAttachment(skeleton, slot, timeline.attachmentNames[Timeline.search1(timeline.frames, time)], attachments);
|
|
@@ -2788,7 +3726,7 @@ var spine = (() => {
|
|
|
2788
3726
|
if (firstFrame)
|
|
2789
3727
|
timelinesRotation[i] = 0;
|
|
2790
3728
|
if (alpha == 1) {
|
|
2791
|
-
timeline.apply(skeleton, 0, time, null, 1, blend,
|
|
3729
|
+
timeline.apply(skeleton, 0, time, null, 1, blend, 0 /* mixIn */);
|
|
2792
3730
|
return;
|
|
2793
3731
|
}
|
|
2794
3732
|
let bone = skeleton.bones[timeline.boneIndex];
|
|
@@ -2798,16 +3736,16 @@ var spine = (() => {
|
|
|
2798
3736
|
let r1 = 0, r2 = 0;
|
|
2799
3737
|
if (time < frames[0]) {
|
|
2800
3738
|
switch (blend) {
|
|
2801
|
-
case
|
|
3739
|
+
case 0 /* setup */:
|
|
2802
3740
|
bone.rotation = bone.data.rotation;
|
|
2803
3741
|
default:
|
|
2804
3742
|
return;
|
|
2805
|
-
case
|
|
3743
|
+
case 1 /* first */:
|
|
2806
3744
|
r1 = bone.rotation;
|
|
2807
3745
|
r2 = bone.data.rotation;
|
|
2808
3746
|
}
|
|
2809
3747
|
} else {
|
|
2810
|
-
r1 = blend ==
|
|
3748
|
+
r1 = blend == 0 /* setup */ ? bone.data.rotation : bone.rotation;
|
|
2811
3749
|
r2 = bone.data.rotation + timeline.getCurveValue(time);
|
|
2812
3750
|
}
|
|
2813
3751
|
let total = 0, diff = r2 - r1;
|
|
@@ -2870,6 +3808,10 @@ var spine = (() => {
|
|
|
2870
3808
|
this.queue.event(entry, event);
|
|
2871
3809
|
}
|
|
2872
3810
|
}
|
|
3811
|
+
/** Removes all animations from all tracks, leaving skeletons in their current pose.
|
|
3812
|
+
*
|
|
3813
|
+
* It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
|
|
3814
|
+
* rather than leaving them in their current pose. */
|
|
2873
3815
|
clearTracks() {
|
|
2874
3816
|
let oldDrainDisabled = this.queue.drainDisabled;
|
|
2875
3817
|
this.queue.drainDisabled = true;
|
|
@@ -2879,6 +3821,10 @@ var spine = (() => {
|
|
|
2879
3821
|
this.queue.drainDisabled = oldDrainDisabled;
|
|
2880
3822
|
this.queue.drain();
|
|
2881
3823
|
}
|
|
3824
|
+
/** Removes all animations from the track, leaving skeletons in their current pose.
|
|
3825
|
+
*
|
|
3826
|
+
* It may be desired to use {@link AnimationState#setEmptyAnimation()} to mix the skeletons back to the setup pose,
|
|
3827
|
+
* rather than leaving them in their current pose. */
|
|
2882
3828
|
clearTrack(trackIndex) {
|
|
2883
3829
|
if (trackIndex >= this.tracks.length)
|
|
2884
3830
|
return;
|
|
@@ -2916,12 +3862,21 @@ var spine = (() => {
|
|
|
2916
3862
|
}
|
|
2917
3863
|
this.queue.start(current);
|
|
2918
3864
|
}
|
|
3865
|
+
/** Sets an animation by name.
|
|
3866
|
+
*
|
|
3867
|
+
* See {@link #setAnimationWith()}. */
|
|
2919
3868
|
setAnimation(trackIndex, animationName, loop = false) {
|
|
2920
3869
|
let animation = this.data.skeletonData.findAnimation(animationName);
|
|
2921
3870
|
if (!animation)
|
|
2922
3871
|
throw new Error("Animation not found: " + animationName);
|
|
2923
3872
|
return this.setAnimationWith(trackIndex, animation, loop);
|
|
2924
3873
|
}
|
|
3874
|
+
/** Sets the current animation for a track, discarding any queued animations. If the formerly current track entry was never
|
|
3875
|
+
* applied to a skeleton, it is replaced (not mixed from).
|
|
3876
|
+
* @param loop If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
|
|
3877
|
+
* duration. In either case {@link TrackEntry#trackEnd} determines when the track is cleared.
|
|
3878
|
+
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
3879
|
+
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
2925
3880
|
setAnimationWith(trackIndex, animation, loop = false) {
|
|
2926
3881
|
if (!animation)
|
|
2927
3882
|
throw new Error("animation cannot be null.");
|
|
@@ -2943,12 +3898,23 @@ var spine = (() => {
|
|
|
2943
3898
|
this.queue.drain();
|
|
2944
3899
|
return entry;
|
|
2945
3900
|
}
|
|
3901
|
+
/** Queues an animation by name.
|
|
3902
|
+
*
|
|
3903
|
+
* See {@link #addAnimationWith()}. */
|
|
2946
3904
|
addAnimation(trackIndex, animationName, loop = false, delay = 0) {
|
|
2947
3905
|
let animation = this.data.skeletonData.findAnimation(animationName);
|
|
2948
3906
|
if (!animation)
|
|
2949
3907
|
throw new Error("Animation not found: " + animationName);
|
|
2950
3908
|
return this.addAnimationWith(trackIndex, animation, loop, delay);
|
|
2951
3909
|
}
|
|
3910
|
+
/** Adds an animation to be played after the current or last queued animation for a track. If the track is empty, it is
|
|
3911
|
+
* equivalent to calling {@link #setAnimationWith()}.
|
|
3912
|
+
* @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
|
|
3913
|
+
* minus any mix duration (from the {@link AnimationStateData}) plus the specified `delay` (ie the mix
|
|
3914
|
+
* ends at (`delay` = 0) or before (`delay` < 0) the previous track entry duration). If the
|
|
3915
|
+
* previous entry is looping, its next loop completion is used instead of its duration.
|
|
3916
|
+
* @returns A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
3917
|
+
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
2952
3918
|
addAnimationWith(trackIndex, animation, loop = false, delay = 0) {
|
|
2953
3919
|
if (!animation)
|
|
2954
3920
|
throw new Error("animation cannot be null.");
|
|
@@ -2970,12 +3936,37 @@ var spine = (() => {
|
|
|
2970
3936
|
entry.delay = delay;
|
|
2971
3937
|
return entry;
|
|
2972
3938
|
}
|
|
3939
|
+
/** Sets an empty animation for a track, discarding any queued animations, and sets the track entry's
|
|
3940
|
+
* {@link TrackEntry#mixduration}. An empty animation has no timelines and serves as a placeholder for mixing in or out.
|
|
3941
|
+
*
|
|
3942
|
+
* Mixing out is done by setting an empty animation with a mix duration using either {@link #setEmptyAnimation()},
|
|
3943
|
+
* {@link #setEmptyAnimations()}, or {@link #addEmptyAnimation()}. Mixing to an empty animation causes
|
|
3944
|
+
* the previous animation to be applied less and less over the mix duration. Properties keyed in the previous animation
|
|
3945
|
+
* transition to the value from lower tracks or to the setup pose value if no lower tracks key the property. A mix duration of
|
|
3946
|
+
* 0 still mixes out over one frame.
|
|
3947
|
+
*
|
|
3948
|
+
* Mixing in is done by first setting an empty animation, then adding an animation using
|
|
3949
|
+
* {@link #addAnimation()} and on the returned track entry, set the
|
|
3950
|
+
* {@link TrackEntry#setMixDuration()}. Mixing from an empty animation causes the new animation to be applied more and
|
|
3951
|
+
* more over the mix duration. Properties keyed in the new animation transition from the value from lower tracks or from the
|
|
3952
|
+
* setup pose value if no lower tracks key the property to the value keyed in the new animation. */
|
|
2973
3953
|
setEmptyAnimation(trackIndex, mixDuration = 0) {
|
|
2974
3954
|
let entry = this.setAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false);
|
|
2975
3955
|
entry.mixDuration = mixDuration;
|
|
2976
3956
|
entry.trackEnd = mixDuration;
|
|
2977
3957
|
return entry;
|
|
2978
3958
|
}
|
|
3959
|
+
/** Adds an empty animation to be played after the current or last queued animation for a track, and sets the track entry's
|
|
3960
|
+
* {@link TrackEntry#mixDuration}. If the track is empty, it is equivalent to calling
|
|
3961
|
+
* {@link #setEmptyAnimation()}.
|
|
3962
|
+
*
|
|
3963
|
+
* See {@link #setEmptyAnimation()}.
|
|
3964
|
+
* @param delay If > 0, sets {@link TrackEntry#delay}. If <= 0, the delay set is the duration of the previous track entry
|
|
3965
|
+
* minus any mix duration plus the specified `delay` (ie the mix ends at (`delay` = 0) or
|
|
3966
|
+
* before (`delay` < 0) the previous track entry duration). If the previous entry is looping, its next
|
|
3967
|
+
* loop completion is used instead of its duration.
|
|
3968
|
+
* @return A track entry to allow further customization of animation playback. References to the track entry must not be kept
|
|
3969
|
+
* after the {@link AnimationStateListener#dispose()} event occurs. */
|
|
2979
3970
|
addEmptyAnimation(trackIndex, mixDuration = 0, delay = 0) {
|
|
2980
3971
|
let entry = this.addAnimationWith(trackIndex, _AnimationState.emptyAnimation(), false, delay);
|
|
2981
3972
|
if (delay <= 0)
|
|
@@ -2984,6 +3975,8 @@ var spine = (() => {
|
|
|
2984
3975
|
entry.trackEnd = mixDuration;
|
|
2985
3976
|
return entry;
|
|
2986
3977
|
}
|
|
3978
|
+
/** Sets an empty animation for every track, discarding any queued animations, and mixes to it over the specified mix
|
|
3979
|
+
* duration. */
|
|
2987
3980
|
setEmptyAnimations(mixDuration = 0) {
|
|
2988
3981
|
let oldDrainDisabled = this.queue.drainDisabled;
|
|
2989
3982
|
this.queue.drainDisabled = true;
|
|
@@ -3002,6 +3995,7 @@ var spine = (() => {
|
|
|
3002
3995
|
this.tracks.length = index + 1;
|
|
3003
3996
|
return null;
|
|
3004
3997
|
}
|
|
3998
|
+
/** @param last May be null. */
|
|
3005
3999
|
trackEntry(trackIndex, animation, loop, last) {
|
|
3006
4000
|
let entry = this.trackEntryPool.obtain();
|
|
3007
4001
|
entry.reset();
|
|
@@ -3029,9 +4023,10 @@ var spine = (() => {
|
|
|
3029
4023
|
entry.mixDuration = !last ? 0 : this.data.getMix(last.animation, animation);
|
|
3030
4024
|
entry.interruptAlpha = 1;
|
|
3031
4025
|
entry.totalAlpha = 0;
|
|
3032
|
-
entry.mixBlend =
|
|
4026
|
+
entry.mixBlend = 2 /* replace */;
|
|
3033
4027
|
return entry;
|
|
3034
4028
|
}
|
|
4029
|
+
/** Removes the {@link TrackEntry#getNext() next entry} and all entries after it for the specified entry. */
|
|
3035
4030
|
clearNext(entry) {
|
|
3036
4031
|
let next = entry.next;
|
|
3037
4032
|
while (next) {
|
|
@@ -3051,7 +4046,7 @@ var spine = (() => {
|
|
|
3051
4046
|
while (entry.mixingFrom)
|
|
3052
4047
|
entry = entry.mixingFrom;
|
|
3053
4048
|
do {
|
|
3054
|
-
if (!entry.mixingTo || entry.mixBlend !=
|
|
4049
|
+
if (!entry.mixingTo || entry.mixBlend != 3 /* add */)
|
|
3055
4050
|
this.computeHold(entry);
|
|
3056
4051
|
entry = entry.mixingTo;
|
|
3057
4052
|
} while (entry);
|
|
@@ -3094,24 +4089,31 @@ var spine = (() => {
|
|
|
3094
4089
|
}
|
|
3095
4090
|
}
|
|
3096
4091
|
}
|
|
4092
|
+
/** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */
|
|
3097
4093
|
getCurrent(trackIndex) {
|
|
3098
4094
|
if (trackIndex >= this.tracks.length)
|
|
3099
4095
|
return null;
|
|
3100
4096
|
return this.tracks[trackIndex];
|
|
3101
4097
|
}
|
|
4098
|
+
/** Adds a listener to receive events for all track entries. */
|
|
3102
4099
|
addListener(listener) {
|
|
3103
4100
|
if (!listener)
|
|
3104
4101
|
throw new Error("listener cannot be null.");
|
|
3105
4102
|
this.listeners.push(listener);
|
|
3106
4103
|
}
|
|
4104
|
+
/** Removes the listener added with {@link #addListener()}. */
|
|
3107
4105
|
removeListener(listener) {
|
|
3108
4106
|
let index = this.listeners.indexOf(listener);
|
|
3109
4107
|
if (index >= 0)
|
|
3110
4108
|
this.listeners.splice(index, 1);
|
|
3111
4109
|
}
|
|
4110
|
+
/** Removes all listeners added with {@link #addListener()}. */
|
|
3112
4111
|
clearListeners() {
|
|
3113
4112
|
this.listeners.length = 0;
|
|
3114
4113
|
}
|
|
4114
|
+
/** Discards all listener notifications that have not yet been delivered. This can be useful to call from an
|
|
4115
|
+
* {@link AnimationStateListener} when it is known that further notifications that may have been already queued for delivery
|
|
4116
|
+
* are not wanted because new animations are being set. */
|
|
3115
4117
|
clearListenerNotifications() {
|
|
3116
4118
|
this.queue.clear();
|
|
3117
4119
|
}
|
|
@@ -3120,36 +4122,134 @@ var spine = (() => {
|
|
|
3120
4122
|
AnimationState._emptyAnimation = new Animation("<empty>", [], 0);
|
|
3121
4123
|
var TrackEntry = class {
|
|
3122
4124
|
constructor() {
|
|
4125
|
+
/** The animation to apply for this track entry. */
|
|
3123
4126
|
this.animation = null;
|
|
3124
4127
|
this.previous = null;
|
|
4128
|
+
/** The animation queued to start after this animation, or null. `next` makes up a linked list. */
|
|
3125
4129
|
this.next = null;
|
|
4130
|
+
/** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no
|
|
4131
|
+
* mixing is currently occuring. When mixing from multiple animations, `mixingFrom` makes up a linked list. */
|
|
3126
4132
|
this.mixingFrom = null;
|
|
4133
|
+
/** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is
|
|
4134
|
+
* currently occuring. When mixing to multiple animations, `mixingTo` makes up a linked list. */
|
|
3127
4135
|
this.mixingTo = null;
|
|
4136
|
+
/** The listener for events generated by this track entry, or null.
|
|
4137
|
+
*
|
|
4138
|
+
* A track entry returned from {@link AnimationState#setAnimation()} is already the current animation
|
|
4139
|
+
* for the track, so the track entry listener {@link AnimationStateListener#start()} will not be called. */
|
|
3128
4140
|
this.listener = null;
|
|
4141
|
+
/** The index of the track where this track entry is either current or queued.
|
|
4142
|
+
*
|
|
4143
|
+
* See {@link AnimationState#getCurrent()}. */
|
|
3129
4144
|
this.trackIndex = 0;
|
|
4145
|
+
/** If true, the animation will repeat. If false it will not, instead its last frame is applied if played beyond its
|
|
4146
|
+
* duration. */
|
|
3130
4147
|
this.loop = false;
|
|
4148
|
+
/** If true, when mixing from the previous animation to this animation, the previous animation is applied as normal instead
|
|
4149
|
+
* of being mixed out.
|
|
4150
|
+
*
|
|
4151
|
+
* When mixing between animations that key the same property, if a lower track also keys that property then the value will
|
|
4152
|
+
* briefly dip toward the lower track value during the mix. This happens because the first animation mixes from 100% to 0%
|
|
4153
|
+
* while the second animation mixes from 0% to 100%. Setting `holdPrevious` to true applies the first animation
|
|
4154
|
+
* at 100% during the mix so the lower track value is overwritten. Such dipping does not occur on the lowest track which
|
|
4155
|
+
* keys the property, only when a higher track also keys the property.
|
|
4156
|
+
*
|
|
4157
|
+
* Snapping will occur if `holdPrevious` is true and this animation does not key all the same properties as the
|
|
4158
|
+
* previous animation. */
|
|
3131
4159
|
this.holdPrevious = false;
|
|
3132
4160
|
this.reverse = false;
|
|
3133
4161
|
this.shortestRotation = false;
|
|
4162
|
+
/** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
|
|
4163
|
+
* `eventThreshold`, event timelines are applied while this animation is being mixed out. Defaults to 0, so event
|
|
4164
|
+
* timelines are not applied while this animation is being mixed out. */
|
|
3134
4165
|
this.eventThreshold = 0;
|
|
4166
|
+
/** When the mix percentage ({@link #mixtime} / {@link #mixDuration}) is less than the
|
|
4167
|
+
* `attachmentThreshold`, attachment timelines are applied while this animation is being mixed out. Defaults to
|
|
4168
|
+
* 0, so attachment timelines are not applied while this animation is being mixed out. */
|
|
3135
4169
|
this.attachmentThreshold = 0;
|
|
4170
|
+
/** When the mix percentage ({@link #mixTime} / {@link #mixDuration}) is less than the
|
|
4171
|
+
* `drawOrderThreshold`, draw order timelines are applied while this animation is being mixed out. Defaults to 0,
|
|
4172
|
+
* so draw order timelines are not applied while this animation is being mixed out. */
|
|
3136
4173
|
this.drawOrderThreshold = 0;
|
|
4174
|
+
/** Seconds when this animation starts, both initially and after looping. Defaults to 0.
|
|
4175
|
+
*
|
|
4176
|
+
* When changing the `animationStart` time, it often makes sense to set {@link #animationLast} to the same
|
|
4177
|
+
* value to prevent timeline keys before the start time from triggering. */
|
|
3137
4178
|
this.animationStart = 0;
|
|
4179
|
+
/** Seconds for the last frame of this animation. Non-looping animations won't play past this time. Looping animations will
|
|
4180
|
+
* loop back to {@link #animationStart} at this time. Defaults to the animation {@link Animation#duration}. */
|
|
3138
4181
|
this.animationEnd = 0;
|
|
4182
|
+
/** The time in seconds this animation was last applied. Some timelines use this for one-time triggers. Eg, when this
|
|
4183
|
+
* animation is applied, event timelines will fire all events between the `animationLast` time (exclusive) and
|
|
4184
|
+
* `animationTime` (inclusive). Defaults to -1 to ensure triggers on frame 0 happen the first time this animation
|
|
4185
|
+
* is applied. */
|
|
3139
4186
|
this.animationLast = 0;
|
|
3140
4187
|
this.nextAnimationLast = 0;
|
|
4188
|
+
/** Seconds to postpone playing the animation. When this track entry is the current track entry, `delay`
|
|
4189
|
+
* postpones incrementing the {@link #trackTime}. When this track entry is queued, `delay` is the time from
|
|
4190
|
+
* the start of the previous animation to when this track entry will become the current track entry (ie when the previous
|
|
4191
|
+
* track entry {@link TrackEntry#trackTime} >= this track entry's `delay`).
|
|
4192
|
+
*
|
|
4193
|
+
* {@link #timeScale} affects the delay. */
|
|
3141
4194
|
this.delay = 0;
|
|
4195
|
+
/** Current time in seconds this track entry has been the current track entry. The track time determines
|
|
4196
|
+
* {@link #animationTime}. The track time can be set to start the animation at a time other than 0, without affecting
|
|
4197
|
+
* looping. */
|
|
3142
4198
|
this.trackTime = 0;
|
|
3143
4199
|
this.trackLast = 0;
|
|
3144
4200
|
this.nextTrackLast = 0;
|
|
4201
|
+
/** The track time in seconds when this animation will be removed from the track. Defaults to the highest possible float
|
|
4202
|
+
* value, meaning the animation will be applied until a new animation is set or the track is cleared. If the track end time
|
|
4203
|
+
* is reached, no other animations are queued for playback, and mixing from any previous animations is complete, then the
|
|
4204
|
+
* properties keyed by the animation are set to the setup pose and the track is cleared.
|
|
4205
|
+
*
|
|
4206
|
+
* It may be desired to use {@link AnimationState#addEmptyAnimation()} rather than have the animation
|
|
4207
|
+
* abruptly cease being applied. */
|
|
3145
4208
|
this.trackEnd = 0;
|
|
4209
|
+
/** Multiplier for the delta time when this track entry is updated, causing time for this animation to pass slower or
|
|
4210
|
+
* faster. Defaults to 1.
|
|
4211
|
+
*
|
|
4212
|
+
* {@link #mixTime} is not affected by track entry time scale, so {@link #mixDuration} may need to be adjusted to
|
|
4213
|
+
* match the animation speed.
|
|
4214
|
+
*
|
|
4215
|
+
* When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
|
|
4216
|
+
* {@link #delay} is set using the mix duration from the {@link AnimationStateData}, assuming time scale to be 1. If
|
|
4217
|
+
* the time scale is not 1, the delay may need to be adjusted.
|
|
4218
|
+
*
|
|
4219
|
+
* See AnimationState {@link AnimationState#timeScale} for affecting all animations. */
|
|
3146
4220
|
this.timeScale = 0;
|
|
4221
|
+
/** Values < 1 mix this animation with the skeleton's current pose (usually the pose resulting from lower tracks). Defaults
|
|
4222
|
+
* to 1, which overwrites the skeleton's current pose with this animation.
|
|
4223
|
+
*
|
|
4224
|
+
* Typically track 0 is used to completely pose the skeleton, then alpha is used on higher tracks. It doesn't make sense to
|
|
4225
|
+
* use alpha on track 0 if the skeleton pose is from the last frame render. */
|
|
3147
4226
|
this.alpha = 0;
|
|
4227
|
+
/** Seconds from 0 to the {@link #getMixDuration()} when mixing from the previous animation to this animation. May be
|
|
4228
|
+
* slightly more than `mixDuration` when the mix is complete. */
|
|
3148
4229
|
this.mixTime = 0;
|
|
4230
|
+
/** Seconds for mixing from the previous animation to this animation. Defaults to the value provided by AnimationStateData
|
|
4231
|
+
* {@link AnimationStateData#getMix()} based on the animation before this animation (if any).
|
|
4232
|
+
*
|
|
4233
|
+
* A mix duration of 0 still mixes out over one frame to provide the track entry being mixed out a chance to revert the
|
|
4234
|
+
* properties it was animating.
|
|
4235
|
+
*
|
|
4236
|
+
* The `mixDuration` can be set manually rather than use the value from
|
|
4237
|
+
* {@link AnimationStateData#getMix()}. In that case, the `mixDuration` can be set for a new
|
|
4238
|
+
* track entry only before {@link AnimationState#update(float)} is first called.
|
|
4239
|
+
*
|
|
4240
|
+
* When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
|
|
4241
|
+
* {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set
|
|
4242
|
+
* afterward. */
|
|
3149
4243
|
this.mixDuration = 0;
|
|
3150
4244
|
this.interruptAlpha = 0;
|
|
3151
4245
|
this.totalAlpha = 0;
|
|
3152
|
-
|
|
4246
|
+
/** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
|
|
4247
|
+
* replaces the values from the lower tracks with the animation values. {@link MixBlend#add} adds the animation values to
|
|
4248
|
+
* the values from the lower tracks.
|
|
4249
|
+
*
|
|
4250
|
+
* The `mixBlend` can be set for a new track entry only before {@link AnimationState#apply()} is first
|
|
4251
|
+
* called. */
|
|
4252
|
+
this.mixBlend = 2 /* replace */;
|
|
3153
4253
|
this.timelineMode = new Array();
|
|
3154
4254
|
this.timelineHoldMix = new Array();
|
|
3155
4255
|
this.timelinesRotation = new Array();
|
|
@@ -3165,6 +4265,9 @@ var spine = (() => {
|
|
|
3165
4265
|
this.timelineHoldMix.length = 0;
|
|
3166
4266
|
this.timelinesRotation.length = 0;
|
|
3167
4267
|
}
|
|
4268
|
+
/** Uses {@link #trackTime} to compute the `animationTime`, which is between {@link #animationStart}
|
|
4269
|
+
* and {@link #animationEnd}. When the `trackTime` is 0, the `animationTime` is equal to the
|
|
4270
|
+
* `animationStart` time. */
|
|
3168
4271
|
getAnimationTime() {
|
|
3169
4272
|
if (this.loop) {
|
|
3170
4273
|
let duration = this.animationEnd - this.animationStart;
|
|
@@ -3178,9 +4281,19 @@ var spine = (() => {
|
|
|
3178
4281
|
this.animationLast = animationLast;
|
|
3179
4282
|
this.nextAnimationLast = animationLast;
|
|
3180
4283
|
}
|
|
4284
|
+
/** Returns true if at least one loop has been completed.
|
|
4285
|
+
*
|
|
4286
|
+
* See {@link AnimationStateListener#complete()}. */
|
|
3181
4287
|
isComplete() {
|
|
3182
4288
|
return this.trackTime >= this.animationEnd - this.animationStart;
|
|
3183
4289
|
}
|
|
4290
|
+
/** Resets the rotation directions for mixing this entry's rotate timelines. This can be useful to avoid bones rotating the
|
|
4291
|
+
* long way around when using {@link #alpha} and starting animations on other tracks.
|
|
4292
|
+
*
|
|
4293
|
+
* Mixing with {@link MixBlend#replace} involves finding a rotation between two others, which has two possible solutions:
|
|
4294
|
+
* the short way or the long way around. The two rotations likely change over time, so which direction is the short or long
|
|
4295
|
+
* way also changes. If the short way was always chosen, bones would flip to the other side when that direction became the
|
|
4296
|
+
* long way. TrackEntry chooses the short way the first time it is applied and remembers that direction. */
|
|
3184
4297
|
resetRotationDirections() {
|
|
3185
4298
|
this.timelinesRotation.length = 0;
|
|
3186
4299
|
}
|
|
@@ -3302,15 +4415,15 @@ var spine = (() => {
|
|
|
3302
4415
|
this.objects.length = 0;
|
|
3303
4416
|
}
|
|
3304
4417
|
};
|
|
3305
|
-
var EventType
|
|
3306
|
-
(function(EventType2) {
|
|
4418
|
+
var EventType = /* @__PURE__ */ ((EventType2) => {
|
|
3307
4419
|
EventType2[EventType2["start"] = 0] = "start";
|
|
3308
4420
|
EventType2[EventType2["interrupt"] = 1] = "interrupt";
|
|
3309
4421
|
EventType2[EventType2["end"] = 2] = "end";
|
|
3310
4422
|
EventType2[EventType2["dispose"] = 3] = "dispose";
|
|
3311
4423
|
EventType2[EventType2["complete"] = 4] = "complete";
|
|
3312
4424
|
EventType2[EventType2["event"] = 5] = "event";
|
|
3313
|
-
|
|
4425
|
+
return EventType2;
|
|
4426
|
+
})(EventType || {});
|
|
3314
4427
|
var AnimationStateAdapter = class {
|
|
3315
4428
|
start(entry) {
|
|
3316
4429
|
}
|
|
@@ -3337,11 +4450,15 @@ var spine = (() => {
|
|
|
3337
4450
|
var AnimationStateData = class {
|
|
3338
4451
|
constructor(skeletonData) {
|
|
3339
4452
|
this.animationToMixTime = {};
|
|
4453
|
+
/** The mix duration to use when no mix duration has been defined between two animations. */
|
|
3340
4454
|
this.defaultMix = 0;
|
|
3341
4455
|
if (!skeletonData)
|
|
3342
4456
|
throw new Error("skeletonData cannot be null.");
|
|
3343
4457
|
this.skeletonData = skeletonData;
|
|
3344
4458
|
}
|
|
4459
|
+
/** Sets a mix duration by animation name.
|
|
4460
|
+
*
|
|
4461
|
+
* See {@link #setMixWith()}. */
|
|
3345
4462
|
setMix(fromName, toName, duration) {
|
|
3346
4463
|
let from = this.skeletonData.findAnimation(fromName);
|
|
3347
4464
|
if (!from)
|
|
@@ -3351,6 +4468,9 @@ var spine = (() => {
|
|
|
3351
4468
|
throw new Error("Animation not found: " + toName);
|
|
3352
4469
|
this.setMixWith(from, to, duration);
|
|
3353
4470
|
}
|
|
4471
|
+
/** Sets the mix duration when changing from the specified animation to the other.
|
|
4472
|
+
*
|
|
4473
|
+
* See {@link TrackEntry#mixDuration}. */
|
|
3354
4474
|
setMixWith(from, to, duration) {
|
|
3355
4475
|
if (!from)
|
|
3356
4476
|
throw new Error("from cannot be null.");
|
|
@@ -3359,6 +4479,8 @@ var spine = (() => {
|
|
|
3359
4479
|
let key = from.name + "." + to.name;
|
|
3360
4480
|
this.animationToMixTime[key] = duration;
|
|
3361
4481
|
}
|
|
4482
|
+
/** Returns the mix duration to use when changing from the specified animation to the other, or the {@link #defaultMix} if
|
|
4483
|
+
* no mix duration has been set. */
|
|
3362
4484
|
getMix(from, to) {
|
|
3363
4485
|
let key = from.name + "." + to.name;
|
|
3364
4486
|
let value = this.animationToMixTime[key];
|
|
@@ -3382,9 +4504,15 @@ var spine = (() => {
|
|
|
3382
4504
|
|
|
3383
4505
|
// spine-core/src/attachments/ClippingAttachment.ts
|
|
3384
4506
|
var ClippingAttachment = class extends VertexAttachment {
|
|
4507
|
+
// ce3a3aff
|
|
3385
4508
|
constructor(name) {
|
|
3386
4509
|
super(name);
|
|
4510
|
+
/** Clipping is performed between the clipping polygon's slot and the end slot. Returns null if clipping is done until the end of
|
|
4511
|
+
* the skeleton's rendering. */
|
|
3387
4512
|
this.endSlot = null;
|
|
4513
|
+
// Nonessential.
|
|
4514
|
+
/** The color of the clipping polygon as it was in Spine. Available only when nonessential data was exported. Clipping polygons
|
|
4515
|
+
* are not usually rendered at runtime. */
|
|
3388
4516
|
this.color = new Color(0.2275, 0.2275, 0.8078, 1);
|
|
3389
4517
|
}
|
|
3390
4518
|
copy() {
|
|
@@ -3405,8 +4533,7 @@ var spine = (() => {
|
|
|
3405
4533
|
return this._image;
|
|
3406
4534
|
}
|
|
3407
4535
|
};
|
|
3408
|
-
var TextureFilter
|
|
3409
|
-
(function(TextureFilter3) {
|
|
4536
|
+
var TextureFilter = /* @__PURE__ */ ((TextureFilter3) => {
|
|
3410
4537
|
TextureFilter3[TextureFilter3["Nearest"] = 9728] = "Nearest";
|
|
3411
4538
|
TextureFilter3[TextureFilter3["Linear"] = 9729] = "Linear";
|
|
3412
4539
|
TextureFilter3[TextureFilter3["MipMap"] = 9987] = "MipMap";
|
|
@@ -3414,13 +4541,14 @@ var spine = (() => {
|
|
|
3414
4541
|
TextureFilter3[TextureFilter3["MipMapLinearNearest"] = 9985] = "MipMapLinearNearest";
|
|
3415
4542
|
TextureFilter3[TextureFilter3["MipMapNearestLinear"] = 9986] = "MipMapNearestLinear";
|
|
3416
4543
|
TextureFilter3[TextureFilter3["MipMapLinearLinear"] = 9987] = "MipMapLinearLinear";
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
(
|
|
4544
|
+
return TextureFilter3;
|
|
4545
|
+
})(TextureFilter || {});
|
|
4546
|
+
var TextureWrap = /* @__PURE__ */ ((TextureWrap3) => {
|
|
3420
4547
|
TextureWrap3[TextureWrap3["MirroredRepeat"] = 33648] = "MirroredRepeat";
|
|
3421
4548
|
TextureWrap3[TextureWrap3["ClampToEdge"] = 33071] = "ClampToEdge";
|
|
3422
4549
|
TextureWrap3[TextureWrap3["Repeat"] = 10497] = "Repeat";
|
|
3423
|
-
|
|
4550
|
+
return TextureWrap3;
|
|
4551
|
+
})(TextureWrap || {});
|
|
3424
4552
|
var TextureRegion = class {
|
|
3425
4553
|
constructor() {
|
|
3426
4554
|
this.u = 0;
|
|
@@ -3465,9 +4593,9 @@ var spine = (() => {
|
|
|
3465
4593
|
};
|
|
3466
4594
|
pageFields["repeat"] = (page2) => {
|
|
3467
4595
|
if (entry[1].indexOf("x") != -1)
|
|
3468
|
-
page2.uWrap =
|
|
4596
|
+
page2.uWrap = 10497 /* Repeat */;
|
|
3469
4597
|
if (entry[1].indexOf("y") != -1)
|
|
3470
|
-
page2.vWrap =
|
|
4598
|
+
page2.vWrap = 10497 /* Repeat */;
|
|
3471
4599
|
};
|
|
3472
4600
|
pageFields["pma"] = (page2) => {
|
|
3473
4601
|
page2.pma = entry[1] == "true";
|
|
@@ -3638,20 +4766,23 @@ var spine = (() => {
|
|
|
3638
4766
|
};
|
|
3639
4767
|
var TextureAtlasPage = class {
|
|
3640
4768
|
constructor(name) {
|
|
3641
|
-
this.minFilter =
|
|
3642
|
-
this.magFilter =
|
|
3643
|
-
this.uWrap =
|
|
3644
|
-
this.vWrap =
|
|
4769
|
+
this.minFilter = 9728 /* Nearest */;
|
|
4770
|
+
this.magFilter = 9728 /* Nearest */;
|
|
4771
|
+
this.uWrap = 33071 /* ClampToEdge */;
|
|
4772
|
+
this.vWrap = 33071 /* ClampToEdge */;
|
|
3645
4773
|
this.texture = null;
|
|
3646
4774
|
this.width = 0;
|
|
3647
4775
|
this.height = 0;
|
|
3648
4776
|
this.pma = false;
|
|
4777
|
+
this.regions = new Array();
|
|
3649
4778
|
this.name = name;
|
|
3650
4779
|
}
|
|
3651
4780
|
setTexture(texture) {
|
|
3652
4781
|
this.texture = texture;
|
|
3653
4782
|
texture.setFilters(this.minFilter, this.magFilter);
|
|
3654
4783
|
texture.setWraps(this.uWrap, this.vWrap);
|
|
4784
|
+
for (let region of this.regions)
|
|
4785
|
+
region.texture = texture;
|
|
3655
4786
|
}
|
|
3656
4787
|
};
|
|
3657
4788
|
var TextureAtlasRegion = class extends TextureRegion {
|
|
@@ -3669,6 +4800,7 @@ var spine = (() => {
|
|
|
3669
4800
|
this.values = null;
|
|
3670
4801
|
this.page = page;
|
|
3671
4802
|
this.name = name;
|
|
4803
|
+
page.regions.push(this);
|
|
3672
4804
|
}
|
|
3673
4805
|
};
|
|
3674
4806
|
|
|
@@ -3677,19 +4809,32 @@ var spine = (() => {
|
|
|
3677
4809
|
constructor(name, path) {
|
|
3678
4810
|
super(name);
|
|
3679
4811
|
this.region = null;
|
|
4812
|
+
/** The UV pair for each vertex, normalized within the texture region. */
|
|
3680
4813
|
this.regionUVs = [];
|
|
4814
|
+
/** The UV pair for each vertex, normalized within the entire texture.
|
|
4815
|
+
*
|
|
4816
|
+
* See {@link #updateUVs}. */
|
|
3681
4817
|
this.uvs = [];
|
|
4818
|
+
/** Triplets of vertex indices which describe the mesh's triangulation. */
|
|
3682
4819
|
this.triangles = [];
|
|
4820
|
+
/** The color to tint the mesh. */
|
|
3683
4821
|
this.color = new Color(1, 1, 1, 1);
|
|
4822
|
+
/** The width of the mesh's image. Available only when nonessential data was exported. */
|
|
3684
4823
|
this.width = 0;
|
|
4824
|
+
/** The height of the mesh's image. Available only when nonessential data was exported. */
|
|
3685
4825
|
this.height = 0;
|
|
4826
|
+
/** The number of entries at the beginning of {@link #vertices} that make up the mesh hull. */
|
|
3686
4827
|
this.hullLength = 0;
|
|
4828
|
+
/** Vertex index pairs describing edges for controling triangulation. Mesh triangles will never cross edges. Only available if
|
|
4829
|
+
* nonessential data was exported. Triangulation is not performed at runtime. */
|
|
3687
4830
|
this.edges = [];
|
|
3688
4831
|
this.parentMesh = null;
|
|
3689
4832
|
this.sequence = null;
|
|
3690
4833
|
this.tempColor = new Color(0, 0, 0, 0);
|
|
3691
4834
|
this.path = path;
|
|
3692
4835
|
}
|
|
4836
|
+
/** Calculates {@link #uvs} using the {@link #regionUVs} and region. Must be called if the region, the region's properties, or
|
|
4837
|
+
* the {@link #regionUVs} are changed. */
|
|
3693
4838
|
updateRegion() {
|
|
3694
4839
|
if (!this.region)
|
|
3695
4840
|
throw new Error("Region not set.");
|
|
@@ -3700,8 +4845,8 @@ var spine = (() => {
|
|
|
3700
4845
|
let n = this.uvs.length;
|
|
3701
4846
|
let u = this.region.u, v = this.region.v, width = 0, height = 0;
|
|
3702
4847
|
if (this.region instanceof TextureAtlasRegion) {
|
|
3703
|
-
let region = this.region,
|
|
3704
|
-
let textureWidth =
|
|
4848
|
+
let region = this.region, page = region.page;
|
|
4849
|
+
let textureWidth = page.width, textureHeight = page.height;
|
|
3705
4850
|
switch (region.degrees) {
|
|
3706
4851
|
case 90:
|
|
3707
4852
|
u -= (region.originalHeight - region.offsetY - region.height) / textureWidth;
|
|
@@ -3750,9 +4895,13 @@ var spine = (() => {
|
|
|
3750
4895
|
uvs[i + 1] = v + regionUVs[i + 1] * height;
|
|
3751
4896
|
}
|
|
3752
4897
|
}
|
|
4898
|
+
/** The parent mesh if this is a linked mesh, else null. A linked mesh shares the {@link #bones}, {@link #vertices},
|
|
4899
|
+
* {@link #regionUVs}, {@link #triangles}, {@link #hullLength}, {@link #edges}, {@link #width}, and {@link #height} with the
|
|
4900
|
+
* parent mesh, but may have a different {@link #name} or {@link #path} (and therefore a different texture). */
|
|
3753
4901
|
getParentMesh() {
|
|
3754
4902
|
return this.parentMesh;
|
|
3755
4903
|
}
|
|
4904
|
+
/** @param parentMesh May be null. */
|
|
3756
4905
|
setParentMesh(parentMesh) {
|
|
3757
4906
|
this.parentMesh = parentMesh;
|
|
3758
4907
|
if (parentMesh) {
|
|
@@ -3793,6 +4942,7 @@ var spine = (() => {
|
|
|
3793
4942
|
this.sequence.apply(slot, this);
|
|
3794
4943
|
super.computeWorldVertices(slot, start, count, worldVertices2, offset, stride);
|
|
3795
4944
|
}
|
|
4945
|
+
/** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/
|
|
3796
4946
|
newLinkedMesh() {
|
|
3797
4947
|
let copy = new MeshAttachment(this.name, this.path);
|
|
3798
4948
|
copy.region = this.region;
|
|
@@ -3809,9 +4959,15 @@ var spine = (() => {
|
|
|
3809
4959
|
var PathAttachment = class extends VertexAttachment {
|
|
3810
4960
|
constructor(name) {
|
|
3811
4961
|
super(name);
|
|
4962
|
+
/** The lengths along the path in the setup pose from the start of the path to the end of each Bezier curve. */
|
|
3812
4963
|
this.lengths = [];
|
|
4964
|
+
/** If true, the start and end knots are connected. */
|
|
3813
4965
|
this.closed = false;
|
|
4966
|
+
/** If true, additional calculations are performed to make calculating positions along the path more accurate. If false, fewer
|
|
4967
|
+
* calculations are performed but calculating positions along the path is less accurate. */
|
|
3814
4968
|
this.constantSpeed = false;
|
|
4969
|
+
/** The color of the path as it was in Spine. Available only when nonessential data was exported. Paths are not usually
|
|
4970
|
+
* rendered at runtime. */
|
|
3815
4971
|
this.color = new Color(1, 1, 1, 1);
|
|
3816
4972
|
}
|
|
3817
4973
|
copy() {
|
|
@@ -3833,6 +4989,8 @@ var spine = (() => {
|
|
|
3833
4989
|
this.x = 0;
|
|
3834
4990
|
this.y = 0;
|
|
3835
4991
|
this.rotation = 0;
|
|
4992
|
+
/** The color of the point attachment as it was in Spine. Available only when nonessential data was exported. Point attachments
|
|
4993
|
+
* are not usually rendered at runtime. */
|
|
3836
4994
|
this.color = new Color(0.38, 0.94, 0, 1);
|
|
3837
4995
|
}
|
|
3838
4996
|
computeWorldPosition(bone, point) {
|
|
@@ -3860,22 +5018,33 @@ var spine = (() => {
|
|
|
3860
5018
|
var _RegionAttachment = class extends Attachment {
|
|
3861
5019
|
constructor(name, path) {
|
|
3862
5020
|
super(name);
|
|
5021
|
+
/** The local x translation. */
|
|
3863
5022
|
this.x = 0;
|
|
5023
|
+
/** The local y translation. */
|
|
3864
5024
|
this.y = 0;
|
|
5025
|
+
/** The local scaleX. */
|
|
3865
5026
|
this.scaleX = 1;
|
|
5027
|
+
/** The local scaleY. */
|
|
3866
5028
|
this.scaleY = 1;
|
|
5029
|
+
/** The local rotation. */
|
|
3867
5030
|
this.rotation = 0;
|
|
5031
|
+
/** The width of the region attachment in Spine. */
|
|
3868
5032
|
this.width = 0;
|
|
5033
|
+
/** The height of the region attachment in Spine. */
|
|
3869
5034
|
this.height = 0;
|
|
5035
|
+
/** The color to tint the region attachment. */
|
|
3870
5036
|
this.color = new Color(1, 1, 1, 1);
|
|
3871
|
-
this.rendererObject = null;
|
|
3872
5037
|
this.region = null;
|
|
3873
5038
|
this.sequence = null;
|
|
5039
|
+
/** For each of the 4 vertices, a pair of <code>x,y</code> values that is the local position of the vertex.
|
|
5040
|
+
*
|
|
5041
|
+
* See {@link #updateOffset()}. */
|
|
3874
5042
|
this.offset = Utils.newFloatArray(8);
|
|
3875
5043
|
this.uvs = Utils.newFloatArray(8);
|
|
3876
5044
|
this.tempColor = new Color(1, 1, 1, 1);
|
|
3877
5045
|
this.path = path;
|
|
3878
5046
|
}
|
|
5047
|
+
/** Calculates the {@link #offset} using the region settings. Must be called after changing region settings. */
|
|
3879
5048
|
updateRegion() {
|
|
3880
5049
|
if (!this.region)
|
|
3881
5050
|
throw new Error("Region not set.");
|
|
@@ -3939,6 +5108,14 @@ var spine = (() => {
|
|
|
3939
5108
|
uvs[7] = region.v2;
|
|
3940
5109
|
}
|
|
3941
5110
|
}
|
|
5111
|
+
/** Transforms the attachment's four vertices to world coordinates. If the attachment has a {@link #sequence}, the region may
|
|
5112
|
+
* be changed.
|
|
5113
|
+
* <p>
|
|
5114
|
+
* See <a href="http://esotericsoftware.com/spine-runtime-skeletons#World-transforms">World transforms</a> in the Spine
|
|
5115
|
+
* Runtimes Guide.
|
|
5116
|
+
* @param worldVertices The output world vertices. Must have a length >= <code>offset</code> + 8.
|
|
5117
|
+
* @param offset The <code>worldVertices</code> index to begin writing values.
|
|
5118
|
+
* @param stride The number of <code>worldVertices</code> entries between the value pairs written. */
|
|
3942
5119
|
computeWorldVertices(slot, worldVertices2, offset, stride) {
|
|
3943
5120
|
if (this.sequence != null)
|
|
3944
5121
|
this.sequence.apply(slot, this);
|
|
@@ -3970,7 +5147,6 @@ var spine = (() => {
|
|
|
3970
5147
|
copy() {
|
|
3971
5148
|
let copy = new _RegionAttachment(this.name, this.path);
|
|
3972
5149
|
copy.region = this.region;
|
|
3973
|
-
copy.rendererObject = this.rendererObject;
|
|
3974
5150
|
copy.x = this.x;
|
|
3975
5151
|
copy.y = this.y;
|
|
3976
5152
|
copy.scaleX = this.scaleX;
|
|
@@ -4032,7 +5208,6 @@ var spine = (() => {
|
|
|
4032
5208
|
if (region == null)
|
|
4033
5209
|
throw new Error("Region not found in atlas: " + path + " (sequence: " + name + ")");
|
|
4034
5210
|
regions[i] = region;
|
|
4035
|
-
regions[i].renderObject = regions[i];
|
|
4036
5211
|
}
|
|
4037
5212
|
}
|
|
4038
5213
|
newRegionAttachment(skin, name, path, sequence) {
|
|
@@ -4043,7 +5218,6 @@ var spine = (() => {
|
|
|
4043
5218
|
let region = this.atlas.findRegion(path);
|
|
4044
5219
|
if (!region)
|
|
4045
5220
|
throw new Error("Region not found in atlas: " + path + " (region attachment: " + name + ")");
|
|
4046
|
-
region.renderObject = region;
|
|
4047
5221
|
attachment.region = region;
|
|
4048
5222
|
}
|
|
4049
5223
|
return attachment;
|
|
@@ -4056,7 +5230,6 @@ var spine = (() => {
|
|
|
4056
5230
|
let region = this.atlas.findRegion(path);
|
|
4057
5231
|
if (!region)
|
|
4058
5232
|
throw new Error("Region not found in atlas: " + path + " (mesh attachment: " + name + ")");
|
|
4059
|
-
region.renderObject = region;
|
|
4060
5233
|
attachment.region = region;
|
|
4061
5234
|
}
|
|
4062
5235
|
return attachment;
|
|
@@ -4078,18 +5251,34 @@ var spine = (() => {
|
|
|
4078
5251
|
// spine-core/src/BoneData.ts
|
|
4079
5252
|
var BoneData = class {
|
|
4080
5253
|
constructor(index, name, parent) {
|
|
5254
|
+
/** The index of the bone in {@link Skeleton#getBones()}. */
|
|
4081
5255
|
this.index = 0;
|
|
5256
|
+
/** @returns May be null. */
|
|
4082
5257
|
this.parent = null;
|
|
5258
|
+
/** The bone's length. */
|
|
4083
5259
|
this.length = 0;
|
|
5260
|
+
/** The local x translation. */
|
|
4084
5261
|
this.x = 0;
|
|
5262
|
+
/** The local y translation. */
|
|
4085
5263
|
this.y = 0;
|
|
5264
|
+
/** The local rotation. */
|
|
4086
5265
|
this.rotation = 0;
|
|
5266
|
+
/** The local scaleX. */
|
|
4087
5267
|
this.scaleX = 1;
|
|
5268
|
+
/** The local scaleY. */
|
|
4088
5269
|
this.scaleY = 1;
|
|
5270
|
+
/** The local shearX. */
|
|
4089
5271
|
this.shearX = 0;
|
|
5272
|
+
/** The local shearX. */
|
|
4090
5273
|
this.shearY = 0;
|
|
5274
|
+
/** The transform mode for how parent world transforms affect this bone. */
|
|
4091
5275
|
this.transformMode = TransformMode.Normal;
|
|
5276
|
+
/** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#skin} contains this
|
|
5277
|
+
* bone.
|
|
5278
|
+
* @see Skin#bones */
|
|
4092
5279
|
this.skinRequired = false;
|
|
5280
|
+
/** The color of the bone as it was in Spine. Available only when nonessential data was exported. Bones are not usually
|
|
5281
|
+
* rendered at runtime. */
|
|
4093
5282
|
this.color = new Color();
|
|
4094
5283
|
if (index < 0)
|
|
4095
5284
|
throw new Error("index must be >= 0.");
|
|
@@ -4100,39 +5289,62 @@ var spine = (() => {
|
|
|
4100
5289
|
this.parent = parent;
|
|
4101
5290
|
}
|
|
4102
5291
|
};
|
|
4103
|
-
var TransformMode
|
|
4104
|
-
(function(TransformMode2) {
|
|
5292
|
+
var TransformMode = /* @__PURE__ */ ((TransformMode2) => {
|
|
4105
5293
|
TransformMode2[TransformMode2["Normal"] = 0] = "Normal";
|
|
4106
5294
|
TransformMode2[TransformMode2["OnlyTranslation"] = 1] = "OnlyTranslation";
|
|
4107
5295
|
TransformMode2[TransformMode2["NoRotationOrReflection"] = 2] = "NoRotationOrReflection";
|
|
4108
5296
|
TransformMode2[TransformMode2["NoScale"] = 3] = "NoScale";
|
|
4109
5297
|
TransformMode2[TransformMode2["NoScaleOrReflection"] = 4] = "NoScaleOrReflection";
|
|
4110
|
-
|
|
5298
|
+
return TransformMode2;
|
|
5299
|
+
})(TransformMode || {});
|
|
4111
5300
|
|
|
4112
5301
|
// spine-core/src/Bone.ts
|
|
4113
5302
|
var Bone = class {
|
|
5303
|
+
/** @param parent May be null. */
|
|
4114
5304
|
constructor(data, skeleton, parent) {
|
|
5305
|
+
/** The parent bone, or null if this is the root bone. */
|
|
4115
5306
|
this.parent = null;
|
|
5307
|
+
/** The immediate children of this bone. */
|
|
4116
5308
|
this.children = new Array();
|
|
5309
|
+
/** The local x translation. */
|
|
4117
5310
|
this.x = 0;
|
|
5311
|
+
/** The local y translation. */
|
|
4118
5312
|
this.y = 0;
|
|
5313
|
+
/** The local rotation in degrees, counter clockwise. */
|
|
4119
5314
|
this.rotation = 0;
|
|
5315
|
+
/** The local scaleX. */
|
|
4120
5316
|
this.scaleX = 0;
|
|
5317
|
+
/** The local scaleY. */
|
|
4121
5318
|
this.scaleY = 0;
|
|
5319
|
+
/** The local shearX. */
|
|
4122
5320
|
this.shearX = 0;
|
|
5321
|
+
/** The local shearY. */
|
|
4123
5322
|
this.shearY = 0;
|
|
5323
|
+
/** The applied local x translation. */
|
|
4124
5324
|
this.ax = 0;
|
|
5325
|
+
/** The applied local y translation. */
|
|
4125
5326
|
this.ay = 0;
|
|
5327
|
+
/** The applied local rotation in degrees, counter clockwise. */
|
|
4126
5328
|
this.arotation = 0;
|
|
5329
|
+
/** The applied local scaleX. */
|
|
4127
5330
|
this.ascaleX = 0;
|
|
5331
|
+
/** The applied local scaleY. */
|
|
4128
5332
|
this.ascaleY = 0;
|
|
5333
|
+
/** The applied local shearX. */
|
|
4129
5334
|
this.ashearX = 0;
|
|
5335
|
+
/** The applied local shearY. */
|
|
4130
5336
|
this.ashearY = 0;
|
|
5337
|
+
/** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4131
5338
|
this.a = 0;
|
|
5339
|
+
/** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4132
5340
|
this.b = 0;
|
|
5341
|
+
/** Part of the world transform matrix for the X axis. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4133
5342
|
this.c = 0;
|
|
5343
|
+
/** Part of the world transform matrix for the Y axis. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4134
5344
|
this.d = 0;
|
|
5345
|
+
/** The world X position. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4135
5346
|
this.worldY = 0;
|
|
5347
|
+
/** The world Y position. If changed, {@link #updateAppliedTransform()} should be called. */
|
|
4136
5348
|
this.worldX = 0;
|
|
4137
5349
|
this.sorted = false;
|
|
4138
5350
|
this.active = false;
|
|
@@ -4145,15 +5357,26 @@ var spine = (() => {
|
|
|
4145
5357
|
this.parent = parent;
|
|
4146
5358
|
this.setToSetupPose();
|
|
4147
5359
|
}
|
|
5360
|
+
/** Returns false when the bone has not been computed because {@link BoneData#skinRequired} is true and the
|
|
5361
|
+
* {@link Skeleton#skin active skin} does not {@link Skin#bones contain} this bone. */
|
|
4148
5362
|
isActive() {
|
|
4149
5363
|
return this.active;
|
|
4150
5364
|
}
|
|
5365
|
+
/** Computes the world transform using the parent bone and this bone's local applied transform. */
|
|
4151
5366
|
update() {
|
|
4152
5367
|
this.updateWorldTransformWith(this.ax, this.ay, this.arotation, this.ascaleX, this.ascaleY, this.ashearX, this.ashearY);
|
|
4153
5368
|
}
|
|
5369
|
+
/** Computes the world transform using the parent bone and this bone's local transform.
|
|
5370
|
+
*
|
|
5371
|
+
* See {@link #updateWorldTransformWith()}. */
|
|
4154
5372
|
updateWorldTransform() {
|
|
4155
5373
|
this.updateWorldTransformWith(this.x, this.y, this.rotation, this.scaleX, this.scaleY, this.shearX, this.shearY);
|
|
4156
5374
|
}
|
|
5375
|
+
/** Computes the world transform using the parent bone and the specified local transform. The applied transform is set to the
|
|
5376
|
+
* specified local transform. Child bones are not updated.
|
|
5377
|
+
*
|
|
5378
|
+
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
|
5379
|
+
* Runtimes Guide. */
|
|
4157
5380
|
updateWorldTransformWith(x, y, rotation, scaleX, scaleY, shearX, shearY) {
|
|
4158
5381
|
this.ax = x;
|
|
4159
5382
|
this.ay = y;
|
|
@@ -4180,7 +5403,7 @@ var spine = (() => {
|
|
|
4180
5403
|
this.worldX = pa * x + pb * y + parent.worldX;
|
|
4181
5404
|
this.worldY = pc * x + pd * y + parent.worldY;
|
|
4182
5405
|
switch (this.data.transformMode) {
|
|
4183
|
-
case
|
|
5406
|
+
case 0 /* Normal */: {
|
|
4184
5407
|
let rotationY = rotation + 90 + shearY;
|
|
4185
5408
|
let la = MathUtils.cosDeg(rotation + shearX) * scaleX;
|
|
4186
5409
|
let lb = MathUtils.cosDeg(rotationY) * scaleY;
|
|
@@ -4192,7 +5415,7 @@ var spine = (() => {
|
|
|
4192
5415
|
this.d = pc * lb + pd * ld;
|
|
4193
5416
|
return;
|
|
4194
5417
|
}
|
|
4195
|
-
case
|
|
5418
|
+
case 1 /* OnlyTranslation */: {
|
|
4196
5419
|
let rotationY = rotation + 90 + shearY;
|
|
4197
5420
|
this.a = MathUtils.cosDeg(rotation + shearX) * scaleX;
|
|
4198
5421
|
this.b = MathUtils.cosDeg(rotationY) * scaleY;
|
|
@@ -4200,7 +5423,7 @@ var spine = (() => {
|
|
|
4200
5423
|
this.d = MathUtils.sinDeg(rotationY) * scaleY;
|
|
4201
5424
|
break;
|
|
4202
5425
|
}
|
|
4203
|
-
case
|
|
5426
|
+
case 2 /* NoRotationOrReflection */: {
|
|
4204
5427
|
let s = pa * pa + pc * pc;
|
|
4205
5428
|
let prx = 0;
|
|
4206
5429
|
if (s > 1e-4) {
|
|
@@ -4227,8 +5450,8 @@ var spine = (() => {
|
|
|
4227
5450
|
this.d = pc * lb + pd * ld;
|
|
4228
5451
|
break;
|
|
4229
5452
|
}
|
|
4230
|
-
case
|
|
4231
|
-
case
|
|
5453
|
+
case 3 /* NoScale */:
|
|
5454
|
+
case 4 /* NoScaleOrReflection */: {
|
|
4232
5455
|
let cos = MathUtils.cosDeg(rotation);
|
|
4233
5456
|
let sin = MathUtils.sinDeg(rotation);
|
|
4234
5457
|
let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
@@ -4239,7 +5462,7 @@ var spine = (() => {
|
|
|
4239
5462
|
za *= s;
|
|
4240
5463
|
zc *= s;
|
|
4241
5464
|
s = Math.sqrt(za * za + zc * zc);
|
|
4242
|
-
if (this.data.transformMode ==
|
|
5465
|
+
if (this.data.transformMode == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
4243
5466
|
s = -s;
|
|
4244
5467
|
let r = Math.PI / 2 + Math.atan2(zc, za);
|
|
4245
5468
|
let zb = Math.cos(r) * s;
|
|
@@ -4260,6 +5483,7 @@ var spine = (() => {
|
|
|
4260
5483
|
this.c *= this.skeleton.scaleY;
|
|
4261
5484
|
this.d *= this.skeleton.scaleY;
|
|
4262
5485
|
}
|
|
5486
|
+
/** Sets this bone's local transform to the setup pose. */
|
|
4263
5487
|
setToSetupPose() {
|
|
4264
5488
|
let data = this.data;
|
|
4265
5489
|
this.x = data.x;
|
|
@@ -4270,18 +5494,30 @@ var spine = (() => {
|
|
|
4270
5494
|
this.shearX = data.shearX;
|
|
4271
5495
|
this.shearY = data.shearY;
|
|
4272
5496
|
}
|
|
5497
|
+
/** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */
|
|
4273
5498
|
getWorldRotationX() {
|
|
4274
5499
|
return Math.atan2(this.c, this.a) * MathUtils.radDeg;
|
|
4275
5500
|
}
|
|
5501
|
+
/** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */
|
|
4276
5502
|
getWorldRotationY() {
|
|
4277
5503
|
return Math.atan2(this.d, this.b) * MathUtils.radDeg;
|
|
4278
5504
|
}
|
|
5505
|
+
/** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */
|
|
4279
5506
|
getWorldScaleX() {
|
|
4280
5507
|
return Math.sqrt(this.a * this.a + this.c * this.c);
|
|
4281
5508
|
}
|
|
5509
|
+
/** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */
|
|
4282
5510
|
getWorldScaleY() {
|
|
4283
5511
|
return Math.sqrt(this.b * this.b + this.d * this.d);
|
|
4284
5512
|
}
|
|
5513
|
+
/** Computes the applied transform values from the world transform.
|
|
5514
|
+
*
|
|
5515
|
+
* If the world transform is modified (by a constraint, {@link #rotateWorld(float)}, etc) then this method should be called so
|
|
5516
|
+
* the applied transform matches the world transform. The applied transform may be needed by other code (eg to apply other
|
|
5517
|
+
* constraints).
|
|
5518
|
+
*
|
|
5519
|
+
* Some information is ambiguous in the world transform, such as -1,-1 scale versus 180 rotation. The applied transform after
|
|
5520
|
+
* calling this method is equivalent to the local transform used to compute the world transform, but may not be identical. */
|
|
4285
5521
|
updateAppliedTransform() {
|
|
4286
5522
|
let parent = this.parent;
|
|
4287
5523
|
if (!parent) {
|
|
@@ -4301,14 +5537,14 @@ var spine = (() => {
|
|
|
4301
5537
|
this.ax = dx * ia - dy * ib;
|
|
4302
5538
|
this.ay = dy * id - dx * ic;
|
|
4303
5539
|
let ra, rb, rc, rd;
|
|
4304
|
-
if (this.data.transformMode ==
|
|
5540
|
+
if (this.data.transformMode == 1 /* OnlyTranslation */) {
|
|
4305
5541
|
ra = this.a;
|
|
4306
5542
|
rb = this.b;
|
|
4307
5543
|
rc = this.c;
|
|
4308
5544
|
rd = this.d;
|
|
4309
5545
|
} else {
|
|
4310
5546
|
switch (this.data.transformMode) {
|
|
4311
|
-
case
|
|
5547
|
+
case 2 /* NoRotationOrReflection */: {
|
|
4312
5548
|
let s2 = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
|
|
4313
5549
|
let sa = pa / this.skeleton.scaleX;
|
|
4314
5550
|
let sc = pc / this.skeleton.scaleY;
|
|
@@ -4319,8 +5555,8 @@ var spine = (() => {
|
|
|
4319
5555
|
ib = pb * pid;
|
|
4320
5556
|
break;
|
|
4321
5557
|
}
|
|
4322
|
-
case
|
|
4323
|
-
case
|
|
5558
|
+
case 3 /* NoScale */:
|
|
5559
|
+
case 4 /* NoScaleOrReflection */:
|
|
4324
5560
|
let cos = MathUtils.cosDeg(this.rotation), sin = MathUtils.sinDeg(this.rotation);
|
|
4325
5561
|
pa = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
4326
5562
|
pc = (pc * cos + pd * sin) / this.skeleton.scaleY;
|
|
@@ -4330,7 +5566,7 @@ var spine = (() => {
|
|
|
4330
5566
|
pa *= s;
|
|
4331
5567
|
pc *= s;
|
|
4332
5568
|
s = Math.sqrt(pa * pa + pc * pc);
|
|
4333
|
-
if (this.data.transformMode ==
|
|
5569
|
+
if (this.data.transformMode == 3 /* NoScale */ && pid < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
4334
5570
|
s = -s;
|
|
4335
5571
|
let r = MathUtils.PI / 2 + Math.atan2(pc, pa);
|
|
4336
5572
|
pb = Math.cos(r) * s;
|
|
@@ -4360,6 +5596,7 @@ var spine = (() => {
|
|
|
4360
5596
|
this.arotation = 90 - Math.atan2(rd, rb) * MathUtils.radDeg;
|
|
4361
5597
|
}
|
|
4362
5598
|
}
|
|
5599
|
+
/** Transforms a point from world coordinates to the bone's local coordinates. */
|
|
4363
5600
|
worldToLocal(world) {
|
|
4364
5601
|
let invDet = 1 / (this.a * this.d - this.b * this.c);
|
|
4365
5602
|
let x = world.x - this.worldX, y = world.y - this.worldY;
|
|
@@ -4367,21 +5604,28 @@ var spine = (() => {
|
|
|
4367
5604
|
world.y = y * this.a * invDet - x * this.c * invDet;
|
|
4368
5605
|
return world;
|
|
4369
5606
|
}
|
|
5607
|
+
/** Transforms a point from the bone's local coordinates to world coordinates. */
|
|
4370
5608
|
localToWorld(local) {
|
|
4371
5609
|
let x = local.x, y = local.y;
|
|
4372
5610
|
local.x = x * this.a + y * this.b + this.worldX;
|
|
4373
5611
|
local.y = x * this.c + y * this.d + this.worldY;
|
|
4374
5612
|
return local;
|
|
4375
5613
|
}
|
|
5614
|
+
/** Transforms a world rotation to a local rotation. */
|
|
4376
5615
|
worldToLocalRotation(worldRotation) {
|
|
4377
5616
|
let sin = MathUtils.sinDeg(worldRotation), cos = MathUtils.cosDeg(worldRotation);
|
|
4378
5617
|
return Math.atan2(this.a * sin - this.c * cos, this.d * cos - this.b * sin) * MathUtils.radDeg + this.rotation - this.shearX;
|
|
4379
5618
|
}
|
|
5619
|
+
/** Transforms a local rotation to a world rotation. */
|
|
4380
5620
|
localToWorldRotation(localRotation) {
|
|
4381
5621
|
localRotation -= this.rotation - this.shearX;
|
|
4382
5622
|
let sin = MathUtils.sinDeg(localRotation), cos = MathUtils.cosDeg(localRotation);
|
|
4383
5623
|
return Math.atan2(cos * this.c + sin * this.d, cos * this.a + sin * this.b) * MathUtils.radDeg;
|
|
4384
5624
|
}
|
|
5625
|
+
/** Rotates the world transform the specified amount.
|
|
5626
|
+
* <p>
|
|
5627
|
+
* After changes are made to the world transform, {@link #updateAppliedTransform()} should be called and {@link #update()} will
|
|
5628
|
+
* need to be called on any child bones, recursively. */
|
|
4385
5629
|
rotateWorld(degrees) {
|
|
4386
5630
|
let a = this.a, b = this.b, c = this.c, d = this.d;
|
|
4387
5631
|
let cos = MathUtils.cosDeg(degrees), sin = MathUtils.sinDeg(degrees);
|
|
@@ -4523,17 +5767,21 @@ var spine = (() => {
|
|
|
4523
5767
|
let atlas = new TextureAtlas(atlasText);
|
|
4524
5768
|
let toLoad = atlas.pages.length, abort = false;
|
|
4525
5769
|
for (let page of atlas.pages) {
|
|
4526
|
-
this.loadTexture(
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
if (
|
|
4530
|
-
|
|
5770
|
+
this.loadTexture(
|
|
5771
|
+
!fileAlias ? parent + page.name : fileAlias[page.name],
|
|
5772
|
+
(imagePath, texture) => {
|
|
5773
|
+
if (!abort) {
|
|
5774
|
+
page.setTexture(texture);
|
|
5775
|
+
if (--toLoad == 0)
|
|
5776
|
+
this.success(success, path, atlas);
|
|
5777
|
+
}
|
|
5778
|
+
},
|
|
5779
|
+
(imagePath, message) => {
|
|
5780
|
+
if (!abort)
|
|
5781
|
+
this.error(error, path, `Couldn't load texture atlas ${path} page image: ${imagePath}`);
|
|
5782
|
+
abort = true;
|
|
4531
5783
|
}
|
|
4532
|
-
|
|
4533
|
-
if (!abort)
|
|
4534
|
-
this.error(error, path, `Couldn't load texture atlas ${path} page image: ${imagePath}`);
|
|
4535
|
-
abort = true;
|
|
4536
|
-
});
|
|
5784
|
+
);
|
|
4537
5785
|
}
|
|
4538
5786
|
} catch (e) {
|
|
4539
5787
|
this.error(error, path, `Couldn't parse texture atlas ${path}: ${e.message}`);
|
|
@@ -4729,10 +5977,16 @@ var spine = (() => {
|
|
|
4729
5977
|
// spine-core/src/IkConstraint.ts
|
|
4730
5978
|
var IkConstraint = class {
|
|
4731
5979
|
constructor(data, skeleton) {
|
|
5980
|
+
/** Controls the bend direction of the IK bones, either 1 or -1. */
|
|
4732
5981
|
this.bendDirection = 0;
|
|
5982
|
+
/** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
|
|
4733
5983
|
this.compress = false;
|
|
5984
|
+
/** When true, if the target is out of range, the parent bone is scaled to reach it. If more than one bone is being constrained
|
|
5985
|
+
* and the parent bone has local nonuniform scale, stretch is not applied. */
|
|
4734
5986
|
this.stretch = false;
|
|
5987
|
+
/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
|
|
4735
5988
|
this.mix = 1;
|
|
5989
|
+
/** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
|
|
4736
5990
|
this.softness = 0;
|
|
4737
5991
|
this.active = false;
|
|
4738
5992
|
if (!data)
|
|
@@ -4774,6 +6028,7 @@ var spine = (() => {
|
|
|
4774
6028
|
break;
|
|
4775
6029
|
}
|
|
4776
6030
|
}
|
|
6031
|
+
/** Applies 1 bone IK. The target is specified in the world coordinate system. */
|
|
4777
6032
|
apply1(bone, targetX, targetY, compress, stretch, uniform, alpha) {
|
|
4778
6033
|
let p = bone.parent;
|
|
4779
6034
|
if (!p)
|
|
@@ -4781,12 +6036,12 @@ var spine = (() => {
|
|
|
4781
6036
|
let pa = p.a, pb = p.b, pc = p.c, pd = p.d;
|
|
4782
6037
|
let rotationIK = -bone.ashearX - bone.arotation, tx = 0, ty = 0;
|
|
4783
6038
|
switch (bone.data.transformMode) {
|
|
4784
|
-
case
|
|
6039
|
+
case 1 /* OnlyTranslation */:
|
|
4785
6040
|
tx = targetX - bone.worldX;
|
|
4786
6041
|
ty = targetY - bone.worldY;
|
|
4787
6042
|
break;
|
|
4788
|
-
case
|
|
4789
|
-
let s = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
|
|
6043
|
+
case 2 /* NoRotationOrReflection */:
|
|
6044
|
+
let s = Math.abs(pa * pd - pb * pc) / Math.max(1e-4, pa * pa + pc * pc);
|
|
4790
6045
|
let sa = pa / bone.skeleton.scaleX;
|
|
4791
6046
|
let sc = pc / bone.skeleton.scaleY;
|
|
4792
6047
|
pb = -sc * s * bone.skeleton.scaleX;
|
|
@@ -4795,8 +6050,13 @@ var spine = (() => {
|
|
|
4795
6050
|
default:
|
|
4796
6051
|
let x = targetX - p.worldX, y = targetY - p.worldY;
|
|
4797
6052
|
let d = pa * pd - pb * pc;
|
|
4798
|
-
|
|
4799
|
-
|
|
6053
|
+
if (Math.abs(d) <= 1e-4) {
|
|
6054
|
+
tx = 0;
|
|
6055
|
+
ty = 0;
|
|
6056
|
+
} else {
|
|
6057
|
+
tx = (x * pd - y * pb) / d - bone.ax;
|
|
6058
|
+
ty = (y * pa - x * pc) / d - bone.ay;
|
|
6059
|
+
}
|
|
4800
6060
|
}
|
|
4801
6061
|
rotationIK += Math.atan2(ty, tx) * MathUtils.radDeg;
|
|
4802
6062
|
if (bone.ascaleX < 0)
|
|
@@ -4808,8 +6068,8 @@ var spine = (() => {
|
|
|
4808
6068
|
let sx = bone.ascaleX, sy = bone.ascaleY;
|
|
4809
6069
|
if (compress || stretch) {
|
|
4810
6070
|
switch (bone.data.transformMode) {
|
|
4811
|
-
case
|
|
4812
|
-
case
|
|
6071
|
+
case 3 /* NoScale */:
|
|
6072
|
+
case 4 /* NoScaleOrReflection */:
|
|
4813
6073
|
tx = targetX - bone.worldX;
|
|
4814
6074
|
ty = targetY - bone.worldY;
|
|
4815
6075
|
}
|
|
@@ -4821,8 +6081,18 @@ var spine = (() => {
|
|
|
4821
6081
|
sy *= s;
|
|
4822
6082
|
}
|
|
4823
6083
|
}
|
|
4824
|
-
bone.updateWorldTransformWith(
|
|
6084
|
+
bone.updateWorldTransformWith(
|
|
6085
|
+
bone.ax,
|
|
6086
|
+
bone.ay,
|
|
6087
|
+
bone.arotation + rotationIK * alpha,
|
|
6088
|
+
sx,
|
|
6089
|
+
sy,
|
|
6090
|
+
bone.ashearX,
|
|
6091
|
+
bone.ashearY
|
|
6092
|
+
);
|
|
4825
6093
|
}
|
|
6094
|
+
/** Applies 2 bone IK. The target is specified in the world coordinate system.
|
|
6095
|
+
* @param child A direct descendant of the parent bone. */
|
|
4826
6096
|
apply2(parent, child, targetX, targetY, bendDir, stretch, uniform, softness, alpha) {
|
|
4827
6097
|
let px = parent.ax, py = parent.ay, psx = parent.ascaleX, psy = parent.ascaleY, sx = psx, sy = psy, csx = child.ascaleX;
|
|
4828
6098
|
let os1 = 0, os2 = 0, s2 = 0;
|
|
@@ -4861,7 +6131,8 @@ var spine = (() => {
|
|
|
4861
6131
|
b = pp.b;
|
|
4862
6132
|
c = pp.c;
|
|
4863
6133
|
d = pp.d;
|
|
4864
|
-
let id =
|
|
6134
|
+
let id = a * d - b * c, x = cwx - pp.worldX, y = cwy - pp.worldY;
|
|
6135
|
+
id = Math.abs(id) <= 1e-4 ? 0 : 1 / id;
|
|
4865
6136
|
let dx = (x * d - y * b) * id - px, dy = (y * a - x * c) * id - py;
|
|
4866
6137
|
let l1 = Math.sqrt(dx * dx + dy * dy), l2 = child.data.length * csx, a1, a2;
|
|
4867
6138
|
if (l1 < 1e-4) {
|
|
@@ -4977,13 +6248,23 @@ var spine = (() => {
|
|
|
4977
6248
|
var IkConstraintData = class extends ConstraintData {
|
|
4978
6249
|
constructor(name) {
|
|
4979
6250
|
super(name, 0, false);
|
|
6251
|
+
/** The bones that are constrained by this IK constraint. */
|
|
4980
6252
|
this.bones = new Array();
|
|
6253
|
+
/** The bone that is the IK target. */
|
|
4981
6254
|
this._target = null;
|
|
6255
|
+
/** Controls the bend direction of the IK bones, either 1 or -1. */
|
|
4982
6256
|
this.bendDirection = 1;
|
|
6257
|
+
/** When true and only a single bone is being constrained, if the target is too close, the bone is scaled to reach it. */
|
|
4983
6258
|
this.compress = false;
|
|
6259
|
+
/** When true, if the target is out of range, the parent bone is scaled to reach it. If more than one bone is being constrained
|
|
6260
|
+
* and the parent bone has local nonuniform scale, stretch is not applied. */
|
|
4984
6261
|
this.stretch = false;
|
|
6262
|
+
/** When true, only a single bone is being constrained, and {@link #getCompress()} or {@link #getStretch()} is used, the bone
|
|
6263
|
+
* is scaled on both the X and Y axes. */
|
|
4985
6264
|
this.uniform = false;
|
|
6265
|
+
/** A percentage (0-1) that controls the mix between the constrained and unconstrained rotations. */
|
|
4986
6266
|
this.mix = 1;
|
|
6267
|
+
/** For two bone IK, the distance from the maximum reach of the bones that rotation will slow. */
|
|
4987
6268
|
this.softness = 0;
|
|
4988
6269
|
}
|
|
4989
6270
|
set target(boneData) {
|
|
@@ -5001,13 +6282,21 @@ var spine = (() => {
|
|
|
5001
6282
|
var PathConstraintData = class extends ConstraintData {
|
|
5002
6283
|
constructor(name) {
|
|
5003
6284
|
super(name, 0, false);
|
|
6285
|
+
/** The bones that will be modified by this path constraint. */
|
|
5004
6286
|
this.bones = new Array();
|
|
6287
|
+
/** The slot whose path attachment will be used to constrained the bones. */
|
|
5005
6288
|
this._target = null;
|
|
6289
|
+
/** The mode for positioning the first bone on the path. */
|
|
5006
6290
|
this.positionMode = PositionMode.Fixed;
|
|
6291
|
+
/** The mode for positioning the bones after the first bone on the path. */
|
|
5007
6292
|
this.spacingMode = SpacingMode.Fixed;
|
|
6293
|
+
/** The mode for adjusting the rotation of the bones. */
|
|
5008
6294
|
this.rotateMode = RotateMode.Chain;
|
|
6295
|
+
/** An offset added to the constrained bone rotation. */
|
|
5009
6296
|
this.offsetRotation = 0;
|
|
6297
|
+
/** The position along the path. */
|
|
5010
6298
|
this.position = 0;
|
|
6299
|
+
/** The spacing between bones. */
|
|
5011
6300
|
this.spacing = 0;
|
|
5012
6301
|
this.mixRotate = 0;
|
|
5013
6302
|
this.mixX = 0;
|
|
@@ -5023,29 +6312,31 @@ var spine = (() => {
|
|
|
5023
6312
|
return this._target;
|
|
5024
6313
|
}
|
|
5025
6314
|
};
|
|
5026
|
-
var PositionMode
|
|
5027
|
-
(function(PositionMode2) {
|
|
6315
|
+
var PositionMode = /* @__PURE__ */ ((PositionMode2) => {
|
|
5028
6316
|
PositionMode2[PositionMode2["Fixed"] = 0] = "Fixed";
|
|
5029
6317
|
PositionMode2[PositionMode2["Percent"] = 1] = "Percent";
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
(
|
|
6318
|
+
return PositionMode2;
|
|
6319
|
+
})(PositionMode || {});
|
|
6320
|
+
var SpacingMode = /* @__PURE__ */ ((SpacingMode2) => {
|
|
5033
6321
|
SpacingMode2[SpacingMode2["Length"] = 0] = "Length";
|
|
5034
6322
|
SpacingMode2[SpacingMode2["Fixed"] = 1] = "Fixed";
|
|
5035
6323
|
SpacingMode2[SpacingMode2["Percent"] = 2] = "Percent";
|
|
5036
6324
|
SpacingMode2[SpacingMode2["Proportional"] = 3] = "Proportional";
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
(
|
|
6325
|
+
return SpacingMode2;
|
|
6326
|
+
})(SpacingMode || {});
|
|
6327
|
+
var RotateMode = /* @__PURE__ */ ((RotateMode2) => {
|
|
5040
6328
|
RotateMode2[RotateMode2["Tangent"] = 0] = "Tangent";
|
|
5041
6329
|
RotateMode2[RotateMode2["Chain"] = 1] = "Chain";
|
|
5042
6330
|
RotateMode2[RotateMode2["ChainScale"] = 2] = "ChainScale";
|
|
5043
|
-
|
|
6331
|
+
return RotateMode2;
|
|
6332
|
+
})(RotateMode || {});
|
|
5044
6333
|
|
|
5045
6334
|
// spine-core/src/PathConstraint.ts
|
|
5046
6335
|
var _PathConstraint = class {
|
|
5047
6336
|
constructor(data, skeleton) {
|
|
6337
|
+
/** The position along the path. */
|
|
5048
6338
|
this.position = 0;
|
|
6339
|
+
/** The spacing between bones. */
|
|
5049
6340
|
this.spacing = 0;
|
|
5050
6341
|
this.mixRotate = 0;
|
|
5051
6342
|
this.mixX = 0;
|
|
@@ -5090,13 +6381,13 @@ var spine = (() => {
|
|
|
5090
6381
|
if (mixRotate == 0 && mixX == 0 && mixY == 0)
|
|
5091
6382
|
return;
|
|
5092
6383
|
let data = this.data;
|
|
5093
|
-
let tangents = data.rotateMode ==
|
|
6384
|
+
let tangents = data.rotateMode == 0 /* Tangent */, scale = data.rotateMode == 2 /* ChainScale */;
|
|
5094
6385
|
let bones = this.bones;
|
|
5095
6386
|
let boneCount = bones.length, spacesCount = tangents ? boneCount : boneCount + 1;
|
|
5096
6387
|
let spaces = Utils.setArraySize(this.spaces, spacesCount), lengths = scale ? this.lengths = Utils.setArraySize(this.lengths, boneCount) : [];
|
|
5097
6388
|
let spacing = this.spacing;
|
|
5098
6389
|
switch (data.spacingMode) {
|
|
5099
|
-
case
|
|
6390
|
+
case 2 /* Percent */:
|
|
5100
6391
|
if (scale) {
|
|
5101
6392
|
for (let i = 0, n = spacesCount - 1; i < n; i++) {
|
|
5102
6393
|
let bone = bones[i];
|
|
@@ -5111,7 +6402,7 @@ var spine = (() => {
|
|
|
5111
6402
|
}
|
|
5112
6403
|
Utils.arrayFill(spaces, 1, spacesCount, spacing);
|
|
5113
6404
|
break;
|
|
5114
|
-
case
|
|
6405
|
+
case 3 /* Proportional */:
|
|
5115
6406
|
let sum = 0;
|
|
5116
6407
|
for (let i = 0, n = spacesCount - 1; i < n; ) {
|
|
5117
6408
|
let bone = bones[i];
|
|
@@ -5136,7 +6427,7 @@ var spine = (() => {
|
|
|
5136
6427
|
}
|
|
5137
6428
|
break;
|
|
5138
6429
|
default:
|
|
5139
|
-
let lengthSpacing = data.spacingMode ==
|
|
6430
|
+
let lengthSpacing = data.spacingMode == 0 /* Length */;
|
|
5140
6431
|
for (let i = 0, n = spacesCount - 1; i < n; ) {
|
|
5141
6432
|
let bone = bones[i];
|
|
5142
6433
|
let setupLength = bone.data.length;
|
|
@@ -5157,7 +6448,7 @@ var spine = (() => {
|
|
|
5157
6448
|
let boneX = positions[0], boneY = positions[1], offsetRotation = data.offsetRotation;
|
|
5158
6449
|
let tip = false;
|
|
5159
6450
|
if (offsetRotation == 0)
|
|
5160
|
-
tip = data.rotateMode ==
|
|
6451
|
+
tip = data.rotateMode == 1 /* Chain */;
|
|
5161
6452
|
else {
|
|
5162
6453
|
tip = false;
|
|
5163
6454
|
let p = this.target.bone;
|
|
@@ -5221,14 +6512,14 @@ var spine = (() => {
|
|
|
5221
6512
|
let lengths = path.lengths;
|
|
5222
6513
|
curveCount -= closed2 ? 1 : 2;
|
|
5223
6514
|
let pathLength2 = lengths[curveCount];
|
|
5224
|
-
if (this.data.positionMode ==
|
|
6515
|
+
if (this.data.positionMode == 1 /* Percent */)
|
|
5225
6516
|
position *= pathLength2;
|
|
5226
6517
|
let multiplier2;
|
|
5227
6518
|
switch (this.data.spacingMode) {
|
|
5228
|
-
case
|
|
6519
|
+
case 2 /* Percent */:
|
|
5229
6520
|
multiplier2 = pathLength2;
|
|
5230
6521
|
break;
|
|
5231
|
-
case
|
|
6522
|
+
case 3 /* Proportional */:
|
|
5232
6523
|
multiplier2 = pathLength2 / spacesCount;
|
|
5233
6524
|
break;
|
|
5234
6525
|
default:
|
|
@@ -5279,7 +6570,20 @@ var spine = (() => {
|
|
|
5279
6570
|
} else
|
|
5280
6571
|
path.computeWorldVertices(target, curve * 6 + 2, 8, world, 0, 2);
|
|
5281
6572
|
}
|
|
5282
|
-
this.addCurvePosition(
|
|
6573
|
+
this.addCurvePosition(
|
|
6574
|
+
p,
|
|
6575
|
+
world[0],
|
|
6576
|
+
world[1],
|
|
6577
|
+
world[2],
|
|
6578
|
+
world[3],
|
|
6579
|
+
world[4],
|
|
6580
|
+
world[5],
|
|
6581
|
+
world[6],
|
|
6582
|
+
world[7],
|
|
6583
|
+
out,
|
|
6584
|
+
o,
|
|
6585
|
+
tangents || i > 0 && space == 0
|
|
6586
|
+
);
|
|
5283
6587
|
}
|
|
5284
6588
|
return out;
|
|
5285
6589
|
}
|
|
@@ -5331,14 +6635,14 @@ var spine = (() => {
|
|
|
5331
6635
|
x1 = x2;
|
|
5332
6636
|
y1 = y2;
|
|
5333
6637
|
}
|
|
5334
|
-
if (this.data.positionMode ==
|
|
6638
|
+
if (this.data.positionMode == 1 /* Percent */)
|
|
5335
6639
|
position *= pathLength;
|
|
5336
6640
|
let multiplier;
|
|
5337
6641
|
switch (this.data.spacingMode) {
|
|
5338
|
-
case
|
|
6642
|
+
case 2 /* Percent */:
|
|
5339
6643
|
multiplier = pathLength;
|
|
5340
6644
|
break;
|
|
5341
|
-
case
|
|
6645
|
+
case 3 /* Proportional */:
|
|
5342
6646
|
multiplier = pathLength / spacesCount;
|
|
5343
6647
|
break;
|
|
5344
6648
|
default:
|
|
@@ -5471,10 +6775,18 @@ var spine = (() => {
|
|
|
5471
6775
|
// spine-core/src/Slot.ts
|
|
5472
6776
|
var Slot = class {
|
|
5473
6777
|
constructor(data, bone) {
|
|
6778
|
+
/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
|
|
6779
|
+
* color's alpha is not used. */
|
|
5474
6780
|
this.darkColor = null;
|
|
5475
6781
|
this.attachment = null;
|
|
5476
6782
|
this.attachmentState = 0;
|
|
6783
|
+
/** The index of the texture region to display when the slot's attachment has a {@link Sequence}. -1 represents the
|
|
6784
|
+
* {@link Sequence#getSetupIndex()}. */
|
|
5477
6785
|
this.sequenceIndex = -1;
|
|
6786
|
+
/** Values to deform the slot's attachment. For an unweighted mesh, the entries are local positions for each vertex. For a
|
|
6787
|
+
* weighted mesh, the entries are an offset for each vertex which will be added to the mesh's local vertex positions.
|
|
6788
|
+
*
|
|
6789
|
+
* See {@link VertexAttachment#computeWorldVertices()} and {@link DeformTimeline}. */
|
|
5478
6790
|
this.deform = new Array();
|
|
5479
6791
|
if (!data)
|
|
5480
6792
|
throw new Error("data cannot be null.");
|
|
@@ -5486,12 +6798,17 @@ var spine = (() => {
|
|
|
5486
6798
|
this.darkColor = !data.darkColor ? null : new Color();
|
|
5487
6799
|
this.setToSetupPose();
|
|
5488
6800
|
}
|
|
6801
|
+
/** The skeleton this slot belongs to. */
|
|
5489
6802
|
getSkeleton() {
|
|
5490
6803
|
return this.bone.skeleton;
|
|
5491
6804
|
}
|
|
6805
|
+
/** The current attachment for the slot, or null if the slot has no attachment. */
|
|
5492
6806
|
getAttachment() {
|
|
5493
6807
|
return this.attachment;
|
|
5494
6808
|
}
|
|
6809
|
+
/** Sets the slot's attachment and, if the attachment changed, resets {@link #sequenceIndex} and clears the {@link #deform}.
|
|
6810
|
+
* The deform is not cleared if the old attachment has the same {@link VertexAttachment#getTimelineAttachment()} as the
|
|
6811
|
+
* specified attachment. */
|
|
5495
6812
|
setAttachment(attachment) {
|
|
5496
6813
|
if (this.attachment == attachment)
|
|
5497
6814
|
return;
|
|
@@ -5501,6 +6818,7 @@ var spine = (() => {
|
|
|
5501
6818
|
this.attachment = attachment;
|
|
5502
6819
|
this.sequenceIndex = -1;
|
|
5503
6820
|
}
|
|
6821
|
+
/** Sets this slot to the setup pose. */
|
|
5504
6822
|
setToSetupPose() {
|
|
5505
6823
|
this.color.setFromColor(this.data.color);
|
|
5506
6824
|
if (this.darkColor)
|
|
@@ -5552,7 +6870,7 @@ var spine = (() => {
|
|
|
5552
6870
|
return this.active;
|
|
5553
6871
|
}
|
|
5554
6872
|
update() {
|
|
5555
|
-
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.
|
|
6873
|
+
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
|
|
5556
6874
|
return;
|
|
5557
6875
|
if (this.data.local) {
|
|
5558
6876
|
if (this.data.relative)
|
|
@@ -5729,13 +7047,21 @@ var spine = (() => {
|
|
|
5729
7047
|
};
|
|
5730
7048
|
|
|
5731
7049
|
// spine-core/src/Skeleton.ts
|
|
5732
|
-
var
|
|
7050
|
+
var _Skeleton = class {
|
|
5733
7051
|
constructor(data) {
|
|
7052
|
+
/** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */
|
|
5734
7053
|
this._updateCache = new Array();
|
|
7054
|
+
/** The skeleton's current skin. May be null. */
|
|
5735
7055
|
this.skin = null;
|
|
7056
|
+
/** Scales the entire skeleton on the X axis. This affects all bones, even if the bone's transform mode disallows scale
|
|
7057
|
+
* inheritance. */
|
|
5736
7058
|
this.scaleX = 1;
|
|
5737
|
-
|
|
7059
|
+
/** Scales the entire skeleton on the Y axis. This affects all bones, even if the bone's transform mode disallows scale
|
|
7060
|
+
* inheritance. */
|
|
7061
|
+
this._scaleY = 1;
|
|
7062
|
+
/** Sets the skeleton X position, which is added to the root bone worldX position. */
|
|
5738
7063
|
this.x = 0;
|
|
7064
|
+
/** Sets the skeleton Y position, which is added to the root bone worldY position. */
|
|
5739
7065
|
this.y = 0;
|
|
5740
7066
|
if (!data)
|
|
5741
7067
|
throw new Error("data cannot be null.");
|
|
@@ -5780,6 +7106,14 @@ var spine = (() => {
|
|
|
5780
7106
|
this.color = new Color(1, 1, 1, 1);
|
|
5781
7107
|
this.updateCache();
|
|
5782
7108
|
}
|
|
7109
|
+
get scaleY() {
|
|
7110
|
+
return _Skeleton.yDown ? -this._scaleY : this._scaleY;
|
|
7111
|
+
}
|
|
7112
|
+
set scaleY(scaleY) {
|
|
7113
|
+
this._scaleY = scaleY;
|
|
7114
|
+
}
|
|
7115
|
+
/** Caches information about bones and constraints. Must be called if the {@link #getSkin()} is modified or if bones,
|
|
7116
|
+
* constraints, or weighted path attachments are added or removed. */
|
|
5783
7117
|
updateCache() {
|
|
5784
7118
|
let updateCache = this._updateCache;
|
|
5785
7119
|
updateCache.length = 0;
|
|
@@ -5947,6 +7281,10 @@ var spine = (() => {
|
|
|
5947
7281
|
bone.sorted = false;
|
|
5948
7282
|
}
|
|
5949
7283
|
}
|
|
7284
|
+
/** Updates the world transform for each bone and applies all constraints.
|
|
7285
|
+
*
|
|
7286
|
+
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
|
7287
|
+
* Runtimes Guide. */
|
|
5950
7288
|
updateWorldTransform() {
|
|
5951
7289
|
let bones = this.bones;
|
|
5952
7290
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
@@ -5986,10 +7324,12 @@ var spine = (() => {
|
|
|
5986
7324
|
updatable.update();
|
|
5987
7325
|
}
|
|
5988
7326
|
}
|
|
7327
|
+
/** Sets the bones, constraints, and slots to their setup pose values. */
|
|
5989
7328
|
setToSetupPose() {
|
|
5990
7329
|
this.setBonesToSetupPose();
|
|
5991
7330
|
this.setSlotsToSetupPose();
|
|
5992
7331
|
}
|
|
7332
|
+
/** Sets the bones and constraints to their setup pose values. */
|
|
5993
7333
|
setBonesToSetupPose() {
|
|
5994
7334
|
let bones = this.bones;
|
|
5995
7335
|
for (let i = 0, n = bones.length; i < n; i++)
|
|
@@ -6025,17 +7365,20 @@ var spine = (() => {
|
|
|
6025
7365
|
constraint.mixY = data.mixY;
|
|
6026
7366
|
}
|
|
6027
7367
|
}
|
|
7368
|
+
/** Sets the slots and draw order to their setup pose values. */
|
|
6028
7369
|
setSlotsToSetupPose() {
|
|
6029
7370
|
let slots = this.slots;
|
|
6030
7371
|
Utils.arrayCopy(slots, 0, this.drawOrder, 0, slots.length);
|
|
6031
7372
|
for (let i = 0, n = slots.length; i < n; i++)
|
|
6032
7373
|
slots[i].setToSetupPose();
|
|
6033
7374
|
}
|
|
7375
|
+
/** @returns May return null. */
|
|
6034
7376
|
getRootBone() {
|
|
6035
7377
|
if (this.bones.length == 0)
|
|
6036
7378
|
return null;
|
|
6037
7379
|
return this.bones[0];
|
|
6038
7380
|
}
|
|
7381
|
+
/** @returns May be null. */
|
|
6039
7382
|
findBone(boneName) {
|
|
6040
7383
|
if (!boneName)
|
|
6041
7384
|
throw new Error("boneName cannot be null.");
|
|
@@ -6047,6 +7390,9 @@ var spine = (() => {
|
|
|
6047
7390
|
}
|
|
6048
7391
|
return null;
|
|
6049
7392
|
}
|
|
7393
|
+
/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
|
|
7394
|
+
* repeatedly.
|
|
7395
|
+
* @returns May be null. */
|
|
6050
7396
|
findSlot(slotName) {
|
|
6051
7397
|
if (!slotName)
|
|
6052
7398
|
throw new Error("slotName cannot be null.");
|
|
@@ -6058,12 +7404,25 @@ var spine = (() => {
|
|
|
6058
7404
|
}
|
|
6059
7405
|
return null;
|
|
6060
7406
|
}
|
|
7407
|
+
/** Sets a skin by name.
|
|
7408
|
+
*
|
|
7409
|
+
* See {@link #setSkin()}. */
|
|
6061
7410
|
setSkinByName(skinName) {
|
|
6062
7411
|
let skin = this.data.findSkin(skinName);
|
|
6063
7412
|
if (!skin)
|
|
6064
7413
|
throw new Error("Skin not found: " + skinName);
|
|
6065
7414
|
this.setSkin(skin);
|
|
6066
7415
|
}
|
|
7416
|
+
/** Sets the skin used to look up attachments before looking in the {@link SkeletonData#defaultSkin default skin}. If the
|
|
7417
|
+
* skin is changed, {@link #updateCache()} is called.
|
|
7418
|
+
*
|
|
7419
|
+
* Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. If there was no
|
|
7420
|
+
* old skin, each slot's setup mode attachment is attached from the new skin.
|
|
7421
|
+
*
|
|
7422
|
+
* After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling
|
|
7423
|
+
* {@link #setSlotsToSetupPose()}. Also, often {@link AnimationState#apply()} is called before the next time the
|
|
7424
|
+
* skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.
|
|
7425
|
+
* @param newSkin May be null. */
|
|
6067
7426
|
setSkin(newSkin) {
|
|
6068
7427
|
if (newSkin == this.skin)
|
|
6069
7428
|
return;
|
|
@@ -6086,12 +7445,22 @@ var spine = (() => {
|
|
|
6086
7445
|
this.skin = newSkin;
|
|
6087
7446
|
this.updateCache();
|
|
6088
7447
|
}
|
|
7448
|
+
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot name and attachment
|
|
7449
|
+
* name.
|
|
7450
|
+
*
|
|
7451
|
+
* See {@link #getAttachment()}.
|
|
7452
|
+
* @returns May be null. */
|
|
6089
7453
|
getAttachmentByName(slotName, attachmentName) {
|
|
6090
7454
|
let slot = this.data.findSlot(slotName);
|
|
6091
7455
|
if (!slot)
|
|
6092
7456
|
throw new Error(`Can't find slot with name ${slotName}`);
|
|
6093
7457
|
return this.getAttachment(slot.index, attachmentName);
|
|
6094
7458
|
}
|
|
7459
|
+
/** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and
|
|
7460
|
+
* attachment name. First the skin is checked and if the attachment was not found, the default skin is checked.
|
|
7461
|
+
*
|
|
7462
|
+
* See [Runtime skins](http://esotericsoftware.com/spine-runtime-skins) in the Spine Runtimes Guide.
|
|
7463
|
+
* @returns May be null. */
|
|
6095
7464
|
getAttachment(slotIndex, attachmentName) {
|
|
6096
7465
|
if (!attachmentName)
|
|
6097
7466
|
throw new Error("attachmentName cannot be null.");
|
|
@@ -6104,6 +7473,9 @@ var spine = (() => {
|
|
|
6104
7473
|
return this.data.defaultSkin.getAttachment(slotIndex, attachmentName);
|
|
6105
7474
|
return null;
|
|
6106
7475
|
}
|
|
7476
|
+
/** A convenience method to set an attachment by finding the slot with {@link #findSlot()}, finding the attachment with
|
|
7477
|
+
* {@link #getAttachment()}, then setting the slot's {@link Slot#attachment}.
|
|
7478
|
+
* @param attachmentName May be null to clear the slot's attachment. */
|
|
6107
7479
|
setAttachment(slotName, attachmentName) {
|
|
6108
7480
|
if (!slotName)
|
|
6109
7481
|
throw new Error("slotName cannot be null.");
|
|
@@ -6123,6 +7495,9 @@ var spine = (() => {
|
|
|
6123
7495
|
}
|
|
6124
7496
|
throw new Error("Slot not found: " + slotName);
|
|
6125
7497
|
}
|
|
7498
|
+
/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
|
|
7499
|
+
* than to call it repeatedly.
|
|
7500
|
+
* @return May be null. */
|
|
6126
7501
|
findIkConstraint(constraintName) {
|
|
6127
7502
|
if (!constraintName)
|
|
6128
7503
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6134,6 +7509,9 @@ var spine = (() => {
|
|
|
6134
7509
|
}
|
|
6135
7510
|
return null;
|
|
6136
7511
|
}
|
|
7512
|
+
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
|
|
7513
|
+
* this method than to call it repeatedly.
|
|
7514
|
+
* @return May be null. */
|
|
6137
7515
|
findTransformConstraint(constraintName) {
|
|
6138
7516
|
if (!constraintName)
|
|
6139
7517
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6145,6 +7523,9 @@ var spine = (() => {
|
|
|
6145
7523
|
}
|
|
6146
7524
|
return null;
|
|
6147
7525
|
}
|
|
7526
|
+
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
|
|
7527
|
+
* than to call it repeatedly.
|
|
7528
|
+
* @return May be null. */
|
|
6148
7529
|
findPathConstraint(constraintName) {
|
|
6149
7530
|
if (!constraintName)
|
|
6150
7531
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6156,12 +7537,18 @@ var spine = (() => {
|
|
|
6156
7537
|
}
|
|
6157
7538
|
return null;
|
|
6158
7539
|
}
|
|
7540
|
+
/** 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 }`.
|
|
7541
|
+
* Note that this method will create temporary objects which can add to garbage collection pressure. Use `getBounds()` if garbage collection is a concern. */
|
|
6159
7542
|
getBoundsRect() {
|
|
6160
7543
|
let offset = new Vector2();
|
|
6161
7544
|
let size = new Vector2();
|
|
6162
7545
|
this.getBounds(offset, size);
|
|
6163
7546
|
return { x: offset.x, y: offset.y, width: size.x, height: size.y };
|
|
6164
7547
|
}
|
|
7548
|
+
/** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose.
|
|
7549
|
+
* @param offset An output value, the distance from the skeleton origin to the bottom left corner of the AABB.
|
|
7550
|
+
* @param size An output value, the width and height of the AABB.
|
|
7551
|
+
* @param temp Working memory to temporarily store attachments' computed world vertices. */
|
|
6165
7552
|
getBounds(offset, size, temp = new Array(2)) {
|
|
6166
7553
|
if (!offset)
|
|
6167
7554
|
throw new Error("offset cannot be null.");
|
|
@@ -6200,30 +7587,59 @@ var spine = (() => {
|
|
|
6200
7587
|
size.set(maxX - minX, maxY - minY);
|
|
6201
7588
|
}
|
|
6202
7589
|
};
|
|
7590
|
+
var Skeleton = _Skeleton;
|
|
7591
|
+
Skeleton.yDown = false;
|
|
6203
7592
|
|
|
6204
7593
|
// spine-core/src/SkeletonData.ts
|
|
6205
7594
|
var SkeletonData = class {
|
|
6206
7595
|
constructor() {
|
|
7596
|
+
/** The skeleton's name, which by default is the name of the skeleton data file, if possible. May be null. */
|
|
6207
7597
|
this.name = null;
|
|
7598
|
+
/** The skeleton's bones, sorted parent first. The root bone is always the first bone. */
|
|
6208
7599
|
this.bones = new Array();
|
|
7600
|
+
// Ordered parents first.
|
|
7601
|
+
/** The skeleton's slots. */
|
|
6209
7602
|
this.slots = new Array();
|
|
7603
|
+
// Setup pose draw order.
|
|
6210
7604
|
this.skins = new Array();
|
|
7605
|
+
/** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine.
|
|
7606
|
+
*
|
|
7607
|
+
* See {@link Skeleton#getAttachmentByName()}.
|
|
7608
|
+
* May be null. */
|
|
6211
7609
|
this.defaultSkin = null;
|
|
7610
|
+
/** The skeleton's events. */
|
|
6212
7611
|
this.events = new Array();
|
|
7612
|
+
/** The skeleton's animations. */
|
|
6213
7613
|
this.animations = new Array();
|
|
7614
|
+
/** The skeleton's IK constraints. */
|
|
6214
7615
|
this.ikConstraints = new Array();
|
|
7616
|
+
/** The skeleton's transform constraints. */
|
|
6215
7617
|
this.transformConstraints = new Array();
|
|
7618
|
+
/** The skeleton's path constraints. */
|
|
6216
7619
|
this.pathConstraints = new Array();
|
|
7620
|
+
/** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */
|
|
6217
7621
|
this.x = 0;
|
|
7622
|
+
/** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */
|
|
6218
7623
|
this.y = 0;
|
|
7624
|
+
/** The width of the skeleton's axis aligned bounding box in the setup pose. */
|
|
6219
7625
|
this.width = 0;
|
|
7626
|
+
/** The height of the skeleton's axis aligned bounding box in the setup pose. */
|
|
6220
7627
|
this.height = 0;
|
|
7628
|
+
/** The Spine version used to export the skeleton data, or null. */
|
|
6221
7629
|
this.version = null;
|
|
7630
|
+
/** The skeleton data hash. This value will change if any of the skeleton data has changed. May be null. */
|
|
6222
7631
|
this.hash = null;
|
|
7632
|
+
// Nonessential
|
|
7633
|
+
/** The dopesheet FPS in Spine. Available only when nonessential data was exported. */
|
|
6223
7634
|
this.fps = 0;
|
|
7635
|
+
/** The path to the images directory as defined in Spine. Available only when nonessential data was exported. May be null. */
|
|
6224
7636
|
this.imagesPath = null;
|
|
7637
|
+
/** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. May be null. */
|
|
6225
7638
|
this.audioPath = null;
|
|
6226
7639
|
}
|
|
7640
|
+
/** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it
|
|
7641
|
+
* multiple times.
|
|
7642
|
+
* @returns May be null. */
|
|
6227
7643
|
findBone(boneName) {
|
|
6228
7644
|
if (!boneName)
|
|
6229
7645
|
throw new Error("boneName cannot be null.");
|
|
@@ -6235,6 +7651,9 @@ var spine = (() => {
|
|
|
6235
7651
|
}
|
|
6236
7652
|
return null;
|
|
6237
7653
|
}
|
|
7654
|
+
/** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it
|
|
7655
|
+
* multiple times.
|
|
7656
|
+
* @returns May be null. */
|
|
6238
7657
|
findSlot(slotName) {
|
|
6239
7658
|
if (!slotName)
|
|
6240
7659
|
throw new Error("slotName cannot be null.");
|
|
@@ -6246,6 +7665,9 @@ var spine = (() => {
|
|
|
6246
7665
|
}
|
|
6247
7666
|
return null;
|
|
6248
7667
|
}
|
|
7668
|
+
/** Finds a skin by comparing each skin's name. It is more efficient to cache the results of this method than to call it
|
|
7669
|
+
* multiple times.
|
|
7670
|
+
* @returns May be null. */
|
|
6249
7671
|
findSkin(skinName) {
|
|
6250
7672
|
if (!skinName)
|
|
6251
7673
|
throw new Error("skinName cannot be null.");
|
|
@@ -6257,6 +7679,9 @@ var spine = (() => {
|
|
|
6257
7679
|
}
|
|
6258
7680
|
return null;
|
|
6259
7681
|
}
|
|
7682
|
+
/** Finds an event by comparing each events's name. It is more efficient to cache the results of this method than to call it
|
|
7683
|
+
* multiple times.
|
|
7684
|
+
* @returns May be null. */
|
|
6260
7685
|
findEvent(eventDataName) {
|
|
6261
7686
|
if (!eventDataName)
|
|
6262
7687
|
throw new Error("eventDataName cannot be null.");
|
|
@@ -6268,6 +7693,9 @@ var spine = (() => {
|
|
|
6268
7693
|
}
|
|
6269
7694
|
return null;
|
|
6270
7695
|
}
|
|
7696
|
+
/** Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to
|
|
7697
|
+
* call it multiple times.
|
|
7698
|
+
* @returns May be null. */
|
|
6271
7699
|
findAnimation(animationName) {
|
|
6272
7700
|
if (!animationName)
|
|
6273
7701
|
throw new Error("animationName cannot be null.");
|
|
@@ -6279,6 +7707,9 @@ var spine = (() => {
|
|
|
6279
7707
|
}
|
|
6280
7708
|
return null;
|
|
6281
7709
|
}
|
|
7710
|
+
/** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method
|
|
7711
|
+
* than to call it multiple times.
|
|
7712
|
+
* @return May be null. */
|
|
6282
7713
|
findIkConstraint(constraintName) {
|
|
6283
7714
|
if (!constraintName)
|
|
6284
7715
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6290,6 +7721,9 @@ var spine = (() => {
|
|
|
6290
7721
|
}
|
|
6291
7722
|
return null;
|
|
6292
7723
|
}
|
|
7724
|
+
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
|
|
7725
|
+
* this method than to call it multiple times.
|
|
7726
|
+
* @return May be null. */
|
|
6293
7727
|
findTransformConstraint(constraintName) {
|
|
6294
7728
|
if (!constraintName)
|
|
6295
7729
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6301,6 +7735,9 @@ var spine = (() => {
|
|
|
6301
7735
|
}
|
|
6302
7736
|
return null;
|
|
6303
7737
|
}
|
|
7738
|
+
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
|
|
7739
|
+
* than to call it multiple times.
|
|
7740
|
+
* @return May be null. */
|
|
6304
7741
|
findPathConstraint(constraintName) {
|
|
6305
7742
|
if (!constraintName)
|
|
6306
7743
|
throw new Error("constraintName cannot be null.");
|
|
@@ -6331,6 +7768,7 @@ var spine = (() => {
|
|
|
6331
7768
|
throw new Error("name cannot be null.");
|
|
6332
7769
|
this.name = name;
|
|
6333
7770
|
}
|
|
7771
|
+
/** Adds an attachment to the skin for the specified slot index and name. */
|
|
6334
7772
|
setAttachment(slotIndex, name, attachment) {
|
|
6335
7773
|
if (!attachment)
|
|
6336
7774
|
throw new Error("attachment cannot be null.");
|
|
@@ -6341,6 +7779,7 @@ var spine = (() => {
|
|
|
6341
7779
|
attachments[slotIndex] = {};
|
|
6342
7780
|
attachments[slotIndex][name] = attachment;
|
|
6343
7781
|
}
|
|
7782
|
+
/** Adds all attachments, bones, and constraints from the specified skin to this skin. */
|
|
6344
7783
|
addSkin(skin) {
|
|
6345
7784
|
for (let i = 0; i < skin.bones.length; i++) {
|
|
6346
7785
|
let bone = skin.bones[i];
|
|
@@ -6372,6 +7811,8 @@ var spine = (() => {
|
|
|
6372
7811
|
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
|
6373
7812
|
}
|
|
6374
7813
|
}
|
|
7814
|
+
/** Adds all bones and constraints and copies of all attachments from the specified skin to this skin. Mesh attachments are not
|
|
7815
|
+
* copied, instead a new linked mesh is created. The attachment copies can be modified without affecting the originals. */
|
|
6375
7816
|
copySkin(skin) {
|
|
6376
7817
|
for (let i = 0; i < skin.bones.length; i++) {
|
|
6377
7818
|
let bone = skin.bones[i];
|
|
@@ -6411,15 +7852,18 @@ var spine = (() => {
|
|
|
6411
7852
|
}
|
|
6412
7853
|
}
|
|
6413
7854
|
}
|
|
7855
|
+
/** Returns the attachment for the specified slot index and name, or null. */
|
|
6414
7856
|
getAttachment(slotIndex, name) {
|
|
6415
7857
|
let dictionary = this.attachments[slotIndex];
|
|
6416
7858
|
return dictionary ? dictionary[name] : null;
|
|
6417
7859
|
}
|
|
7860
|
+
/** Removes the attachment in the skin for the specified slot index and name, if any. */
|
|
6418
7861
|
removeAttachment(slotIndex, name) {
|
|
6419
7862
|
let dictionary = this.attachments[slotIndex];
|
|
6420
7863
|
if (dictionary)
|
|
6421
7864
|
delete dictionary[name];
|
|
6422
7865
|
}
|
|
7866
|
+
/** Returns all attachments in this skin. */
|
|
6423
7867
|
getAttachments() {
|
|
6424
7868
|
let entries = new Array();
|
|
6425
7869
|
for (var i = 0; i < this.attachments.length; i++) {
|
|
@@ -6434,6 +7878,7 @@ var spine = (() => {
|
|
|
6434
7878
|
}
|
|
6435
7879
|
return entries;
|
|
6436
7880
|
}
|
|
7881
|
+
/** Returns all attachments in this skin for the specified slot index. */
|
|
6437
7882
|
getAttachmentsForSlot(slotIndex, attachments) {
|
|
6438
7883
|
let slotAttachments = this.attachments[slotIndex];
|
|
6439
7884
|
if (slotAttachments) {
|
|
@@ -6444,11 +7889,13 @@ var spine = (() => {
|
|
|
6444
7889
|
}
|
|
6445
7890
|
}
|
|
6446
7891
|
}
|
|
7892
|
+
/** Clears all attachments, bones, and constraints. */
|
|
6447
7893
|
clear() {
|
|
6448
7894
|
this.attachments.length = 0;
|
|
6449
7895
|
this.bones.length = 0;
|
|
6450
7896
|
this.constraints.length = 0;
|
|
6451
7897
|
}
|
|
7898
|
+
/** Attach each attachment in this skin if the corresponding attachment in the old skin is currently attached. */
|
|
6452
7899
|
attachAll(skeleton, oldSkin) {
|
|
6453
7900
|
let slotIndex = 0;
|
|
6454
7901
|
for (let i = 0; i < skeleton.slots.length; i++) {
|
|
@@ -6474,10 +7921,17 @@ var spine = (() => {
|
|
|
6474
7921
|
// spine-core/src/SlotData.ts
|
|
6475
7922
|
var SlotData = class {
|
|
6476
7923
|
constructor(index, name, boneData) {
|
|
7924
|
+
/** The index of the slot in {@link Skeleton#getSlots()}. */
|
|
6477
7925
|
this.index = 0;
|
|
7926
|
+
/** The color used to tint the slot's attachment. If {@link #getDarkColor()} is set, this is used as the light color for two
|
|
7927
|
+
* color tinting. */
|
|
6478
7928
|
this.color = new Color(1, 1, 1, 1);
|
|
7929
|
+
/** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark
|
|
7930
|
+
* color's alpha is not used. */
|
|
6479
7931
|
this.darkColor = null;
|
|
7932
|
+
/** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */
|
|
6480
7933
|
this.attachmentName = null;
|
|
7934
|
+
/** The blend mode for drawing the slot's attachment. */
|
|
6481
7935
|
this.blendMode = BlendMode.Normal;
|
|
6482
7936
|
if (index < 0)
|
|
6483
7937
|
throw new Error("index must be >= 0.");
|
|
@@ -6490,19 +7944,21 @@ var spine = (() => {
|
|
|
6490
7944
|
this.boneData = boneData;
|
|
6491
7945
|
}
|
|
6492
7946
|
};
|
|
6493
|
-
var BlendMode
|
|
6494
|
-
(function(BlendMode3) {
|
|
7947
|
+
var BlendMode = /* @__PURE__ */ ((BlendMode3) => {
|
|
6495
7948
|
BlendMode3[BlendMode3["Normal"] = 0] = "Normal";
|
|
6496
7949
|
BlendMode3[BlendMode3["Additive"] = 1] = "Additive";
|
|
6497
7950
|
BlendMode3[BlendMode3["Multiply"] = 2] = "Multiply";
|
|
6498
7951
|
BlendMode3[BlendMode3["Screen"] = 3] = "Screen";
|
|
6499
|
-
|
|
7952
|
+
return BlendMode3;
|
|
7953
|
+
})(BlendMode || {});
|
|
6500
7954
|
|
|
6501
7955
|
// spine-core/src/TransformConstraintData.ts
|
|
6502
7956
|
var TransformConstraintData = class extends ConstraintData {
|
|
6503
7957
|
constructor(name) {
|
|
6504
7958
|
super(name, 0, false);
|
|
7959
|
+
/** The bones that will be modified by this transform constraint. */
|
|
6505
7960
|
this.bones = new Array();
|
|
7961
|
+
/** The target bone whose world transform will be copied to the constrained bones. */
|
|
6506
7962
|
this._target = null;
|
|
6507
7963
|
this.mixRotate = 0;
|
|
6508
7964
|
this.mixX = 0;
|
|
@@ -6510,11 +7966,17 @@ var spine = (() => {
|
|
|
6510
7966
|
this.mixScaleX = 0;
|
|
6511
7967
|
this.mixScaleY = 0;
|
|
6512
7968
|
this.mixShearY = 0;
|
|
7969
|
+
/** An offset added to the constrained bone rotation. */
|
|
6513
7970
|
this.offsetRotation = 0;
|
|
7971
|
+
/** An offset added to the constrained bone X translation. */
|
|
6514
7972
|
this.offsetX = 0;
|
|
7973
|
+
/** An offset added to the constrained bone Y translation. */
|
|
6515
7974
|
this.offsetY = 0;
|
|
7975
|
+
/** An offset added to the constrained bone scaleX. */
|
|
6516
7976
|
this.offsetScaleX = 0;
|
|
7977
|
+
/** An offset added to the constrained bone scaleY. */
|
|
6517
7978
|
this.offsetScaleY = 0;
|
|
7979
|
+
/** An offset added to the constrained bone shearY. */
|
|
6518
7980
|
this.offsetShearY = 0;
|
|
6519
7981
|
this.relative = false;
|
|
6520
7982
|
this.local = false;
|
|
@@ -6533,6 +7995,10 @@ var spine = (() => {
|
|
|
6533
7995
|
// spine-core/src/SkeletonBinary.ts
|
|
6534
7996
|
var SkeletonBinary = class {
|
|
6535
7997
|
constructor(attachmentLoader) {
|
|
7998
|
+
/** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
|
|
7999
|
+
* runtime than were used in Spine.
|
|
8000
|
+
*
|
|
8001
|
+
* See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
|
|
6536
8002
|
this.scale = 1;
|
|
6537
8003
|
this.linkedMeshes = new Array();
|
|
6538
8004
|
this.attachmentLoader = attachmentLoader;
|
|
@@ -6665,10 +8131,10 @@ var spine = (() => {
|
|
|
6665
8131
|
data.rotateMode = input.readInt(true);
|
|
6666
8132
|
data.offsetRotation = input.readFloat();
|
|
6667
8133
|
data.position = input.readFloat();
|
|
6668
|
-
if (data.positionMode ==
|
|
8134
|
+
if (data.positionMode == 0 /* Fixed */)
|
|
6669
8135
|
data.position *= scale;
|
|
6670
8136
|
data.spacing = input.readFloat();
|
|
6671
|
-
if (data.spacingMode ==
|
|
8137
|
+
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
|
|
6672
8138
|
data.spacing *= scale;
|
|
6673
8139
|
data.mixRotate = input.readFloat();
|
|
6674
8140
|
data.mixX = input.readFloat();
|
|
@@ -7293,10 +8759,18 @@ var spine = (() => {
|
|
|
7293
8759
|
for (let ii = 0, nn = input.readInt(true); ii < nn; ii++) {
|
|
7294
8760
|
switch (input.readByte()) {
|
|
7295
8761
|
case PATH_POSITION:
|
|
7296
|
-
timelines.push(readTimeline1(
|
|
8762
|
+
timelines.push(readTimeline1(
|
|
8763
|
+
input,
|
|
8764
|
+
new PathConstraintPositionTimeline(input.readInt(true), input.readInt(true), index),
|
|
8765
|
+
data.positionMode == 0 /* Fixed */ ? scale : 1
|
|
8766
|
+
));
|
|
7297
8767
|
break;
|
|
7298
8768
|
case PATH_SPACING:
|
|
7299
|
-
timelines.push(readTimeline1(
|
|
8769
|
+
timelines.push(readTimeline1(
|
|
8770
|
+
input,
|
|
8771
|
+
new PathConstraintSpacingTimeline(input.readInt(true), input.readInt(true), index),
|
|
8772
|
+
data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */ ? scale : 1
|
|
8773
|
+
));
|
|
7300
8774
|
break;
|
|
7301
8775
|
case PATH_MIX:
|
|
7302
8776
|
let timeline = new PathConstraintMixTimeline(input.readInt(true), input.readInt(true), index);
|
|
@@ -7387,7 +8861,13 @@ var spine = (() => {
|
|
|
7387
8861
|
for (let frame = 0; frame < frameCount; frame++) {
|
|
7388
8862
|
let time = input.readFloat();
|
|
7389
8863
|
let modeAndIndex = input.readInt32();
|
|
7390
|
-
timeline.setFrame(
|
|
8864
|
+
timeline.setFrame(
|
|
8865
|
+
frame,
|
|
8866
|
+
time,
|
|
8867
|
+
SequenceModeValues[modeAndIndex & 15],
|
|
8868
|
+
modeAndIndex >> 4,
|
|
8869
|
+
input.readFloat()
|
|
8870
|
+
);
|
|
7391
8871
|
}
|
|
7392
8872
|
timelines.push(timeline);
|
|
7393
8873
|
break;
|
|
@@ -7548,8 +9028,7 @@ var spine = (() => {
|
|
|
7548
9028
|
this.vertices = vertices;
|
|
7549
9029
|
}
|
|
7550
9030
|
};
|
|
7551
|
-
var AttachmentType
|
|
7552
|
-
(function(AttachmentType2) {
|
|
9031
|
+
var AttachmentType = /* @__PURE__ */ ((AttachmentType2) => {
|
|
7553
9032
|
AttachmentType2[AttachmentType2["Region"] = 0] = "Region";
|
|
7554
9033
|
AttachmentType2[AttachmentType2["BoundingBox"] = 1] = "BoundingBox";
|
|
7555
9034
|
AttachmentType2[AttachmentType2["Mesh"] = 2] = "Mesh";
|
|
@@ -7557,7 +9036,8 @@ var spine = (() => {
|
|
|
7557
9036
|
AttachmentType2[AttachmentType2["Path"] = 4] = "Path";
|
|
7558
9037
|
AttachmentType2[AttachmentType2["Point"] = 5] = "Point";
|
|
7559
9038
|
AttachmentType2[AttachmentType2["Clipping"] = 6] = "Clipping";
|
|
7560
|
-
|
|
9039
|
+
return AttachmentType2;
|
|
9040
|
+
})(AttachmentType || {});
|
|
7561
9041
|
function readTimeline1(input, timeline, scale) {
|
|
7562
9042
|
let time = input.readFloat(), value = input.readFloat() * scale;
|
|
7563
9043
|
for (let frame = 0, bezier = 0, frameLast = timeline.getFrameCount() - 1; ; frame++) {
|
|
@@ -7628,16 +9108,26 @@ var spine = (() => {
|
|
|
7628
9108
|
// spine-core/src/SkeletonBounds.ts
|
|
7629
9109
|
var SkeletonBounds = class {
|
|
7630
9110
|
constructor() {
|
|
9111
|
+
/** The left edge of the axis aligned bounding box. */
|
|
7631
9112
|
this.minX = 0;
|
|
9113
|
+
/** The bottom edge of the axis aligned bounding box. */
|
|
7632
9114
|
this.minY = 0;
|
|
9115
|
+
/** The right edge of the axis aligned bounding box. */
|
|
7633
9116
|
this.maxX = 0;
|
|
9117
|
+
/** The top edge of the axis aligned bounding box. */
|
|
7634
9118
|
this.maxY = 0;
|
|
9119
|
+
/** The visible bounding boxes. */
|
|
7635
9120
|
this.boundingBoxes = new Array();
|
|
9121
|
+
/** The world vertices for the bounding box polygons. */
|
|
7636
9122
|
this.polygons = new Array();
|
|
7637
9123
|
this.polygonPool = new Pool(() => {
|
|
7638
9124
|
return Utils.newFloatArray(16);
|
|
7639
9125
|
});
|
|
7640
9126
|
}
|
|
9127
|
+
/** Clears any previous polygons, finds all visible bounding box attachments, and computes the world vertices for each bounding
|
|
9128
|
+
* box's polygon.
|
|
9129
|
+
* @param updateAabb If true, the axis aligned bounding box containing all the polygons is computed. If false, the
|
|
9130
|
+
* SkeletonBounds AABB methods will always return true. */
|
|
7641
9131
|
update(skeleton, updateAabb) {
|
|
7642
9132
|
if (!skeleton)
|
|
7643
9133
|
throw new Error("skeleton cannot be null.");
|
|
@@ -7694,9 +9184,11 @@ var spine = (() => {
|
|
|
7694
9184
|
this.maxX = maxX;
|
|
7695
9185
|
this.maxY = maxY;
|
|
7696
9186
|
}
|
|
9187
|
+
/** Returns true if the axis aligned bounding box contains the point. */
|
|
7697
9188
|
aabbContainsPoint(x, y) {
|
|
7698
9189
|
return x >= this.minX && x <= this.maxX && y >= this.minY && y <= this.maxY;
|
|
7699
9190
|
}
|
|
9191
|
+
/** Returns true if the axis aligned bounding box intersects the line segment. */
|
|
7700
9192
|
aabbIntersectsSegment(x1, y1, x2, y2) {
|
|
7701
9193
|
let minX = this.minX;
|
|
7702
9194
|
let minY = this.minY;
|
|
@@ -7719,9 +9211,12 @@ var spine = (() => {
|
|
|
7719
9211
|
return true;
|
|
7720
9212
|
return false;
|
|
7721
9213
|
}
|
|
9214
|
+
/** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
|
|
7722
9215
|
aabbIntersectsSkeleton(bounds) {
|
|
7723
9216
|
return this.minX < bounds.maxX && this.maxX > bounds.minX && this.minY < bounds.maxY && this.maxY > bounds.minY;
|
|
7724
9217
|
}
|
|
9218
|
+
/** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more
|
|
9219
|
+
* efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true. */
|
|
7725
9220
|
containsPoint(x, y) {
|
|
7726
9221
|
let polygons = this.polygons;
|
|
7727
9222
|
for (let i = 0, n = polygons.length; i < n; i++)
|
|
@@ -7729,6 +9224,7 @@ var spine = (() => {
|
|
|
7729
9224
|
return this.boundingBoxes[i];
|
|
7730
9225
|
return null;
|
|
7731
9226
|
}
|
|
9227
|
+
/** Returns true if the polygon contains the point. */
|
|
7732
9228
|
containsPointPolygon(polygon, x, y) {
|
|
7733
9229
|
let vertices = polygon;
|
|
7734
9230
|
let nn = polygon.length;
|
|
@@ -7746,6 +9242,9 @@ var spine = (() => {
|
|
|
7746
9242
|
}
|
|
7747
9243
|
return inside;
|
|
7748
9244
|
}
|
|
9245
|
+
/** Returns the first bounding box attachment that contains any part of the line segment, or null. When doing many checks, it
|
|
9246
|
+
* is usually more efficient to only call this method if {@link #aabbIntersectsSegment()} returns
|
|
9247
|
+
* true. */
|
|
7749
9248
|
intersectsSegment(x1, y1, x2, y2) {
|
|
7750
9249
|
let polygons = this.polygons;
|
|
7751
9250
|
for (let i = 0, n = polygons.length; i < n; i++)
|
|
@@ -7753,6 +9252,7 @@ var spine = (() => {
|
|
|
7753
9252
|
return this.boundingBoxes[i];
|
|
7754
9253
|
return null;
|
|
7755
9254
|
}
|
|
9255
|
+
/** Returns true if the polygon contains any part of the line segment. */
|
|
7756
9256
|
intersectsSegmentPolygon(polygon, x1, y1, x2, y2) {
|
|
7757
9257
|
let vertices = polygon;
|
|
7758
9258
|
let nn = polygon.length;
|
|
@@ -7775,15 +9275,18 @@ var spine = (() => {
|
|
|
7775
9275
|
}
|
|
7776
9276
|
return false;
|
|
7777
9277
|
}
|
|
9278
|
+
/** Returns the polygon for the specified bounding box, or null. */
|
|
7778
9279
|
getPolygon(boundingBox) {
|
|
7779
9280
|
if (!boundingBox)
|
|
7780
9281
|
throw new Error("boundingBox cannot be null.");
|
|
7781
9282
|
let index = this.boundingBoxes.indexOf(boundingBox);
|
|
7782
9283
|
return index == -1 ? null : this.polygons[index];
|
|
7783
9284
|
}
|
|
9285
|
+
/** The width of the axis aligned bounding box. */
|
|
7784
9286
|
getWidth() {
|
|
7785
9287
|
return this.maxX - this.minX;
|
|
7786
9288
|
}
|
|
9289
|
+
/** The height of the axis aligned bounding box. */
|
|
7787
9290
|
getHeight() {
|
|
7788
9291
|
return this.maxY - this.minY;
|
|
7789
9292
|
}
|
|
@@ -7987,7 +9490,14 @@ var spine = (() => {
|
|
|
7987
9490
|
let previous = indices[(vertexCount + index - 1) % vertexCount] << 1;
|
|
7988
9491
|
let current = indices[index] << 1;
|
|
7989
9492
|
let next = indices[(index + 1) % vertexCount] << 1;
|
|
7990
|
-
return !this.positiveArea(
|
|
9493
|
+
return !this.positiveArea(
|
|
9494
|
+
vertices[previous],
|
|
9495
|
+
vertices[previous + 1],
|
|
9496
|
+
vertices[current],
|
|
9497
|
+
vertices[current + 1],
|
|
9498
|
+
vertices[next],
|
|
9499
|
+
vertices[next + 1]
|
|
9500
|
+
);
|
|
7991
9501
|
}
|
|
7992
9502
|
static positiveArea(p1x, p1y, p2x, p2y, p3x, p3y) {
|
|
7993
9503
|
return p1x * (p3y - p2y) + p2x * (p1y - p3y) + p3x * (p2y - p1y) >= 0;
|
|
@@ -8177,6 +9687,8 @@ var spine = (() => {
|
|
|
8177
9687
|
}
|
|
8178
9688
|
}
|
|
8179
9689
|
}
|
|
9690
|
+
/** Clips the input triangle against the convex, clockwise clipping area. If the triangle lies entirely within the clipping
|
|
9691
|
+
* area, false is returned. The clipping area must duplicate the first vertex at the end of the vertices list. */
|
|
8180
9692
|
clip(x1, y1, x2, y2, x3, y3, clippingArea, output) {
|
|
8181
9693
|
let originalOutput = output;
|
|
8182
9694
|
let clipped = false;
|
|
@@ -8288,6 +9800,10 @@ var spine = (() => {
|
|
|
8288
9800
|
// spine-core/src/SkeletonJson.ts
|
|
8289
9801
|
var SkeletonJson = class {
|
|
8290
9802
|
constructor(attachmentLoader) {
|
|
9803
|
+
/** Scales bone positions, image sizes, and translations as they are loaded. This allows different size images to be used at
|
|
9804
|
+
* runtime than were used in Spine.
|
|
9805
|
+
*
|
|
9806
|
+
* See [Scaling](http://esotericsoftware.com/spine-loading-skeleton-data#Scaling) in the Spine Runtimes Guide. */
|
|
8291
9807
|
this.scale = 1;
|
|
8292
9808
|
this.linkedMeshes = new Array();
|
|
8293
9809
|
this.attachmentLoader = attachmentLoader;
|
|
@@ -8433,10 +9949,10 @@ var spine = (() => {
|
|
|
8433
9949
|
data.rotateMode = Utils.enumValue(RotateMode, getValue(constraintMap, "rotateMode", "Tangent"));
|
|
8434
9950
|
data.offsetRotation = getValue(constraintMap, "rotation", 0);
|
|
8435
9951
|
data.position = getValue(constraintMap, "position", 0);
|
|
8436
|
-
if (data.positionMode ==
|
|
9952
|
+
if (data.positionMode == 0 /* Fixed */)
|
|
8437
9953
|
data.position *= scale;
|
|
8438
9954
|
data.spacing = getValue(constraintMap, "spacing", 0);
|
|
8439
|
-
if (data.spacingMode ==
|
|
9955
|
+
if (data.spacingMode == 0 /* Length */ || data.spacingMode == 1 /* Fixed */)
|
|
8440
9956
|
data.spacing *= scale;
|
|
8441
9957
|
data.mixRotate = getValue(constraintMap, "mixRotate", 1);
|
|
8442
9958
|
data.mixX = getValue(constraintMap, "mixX", 1);
|
|
@@ -8977,10 +10493,10 @@ var spine = (() => {
|
|
|
8977
10493
|
let frames = timelineMap.length;
|
|
8978
10494
|
if (timelineName === "position") {
|
|
8979
10495
|
let timeline = new PathConstraintPositionTimeline(frames, frames, constraintIndex);
|
|
8980
|
-
timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.positionMode ==
|
|
10496
|
+
timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.positionMode == 0 /* Fixed */ ? scale : 1));
|
|
8981
10497
|
} else if (timelineName === "spacing") {
|
|
8982
10498
|
let timeline = new PathConstraintSpacingTimeline(frames, frames, constraintIndex);
|
|
8983
|
-
timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.spacingMode ==
|
|
10499
|
+
timelines.push(readTimeline12(timelineMap, timeline, 0, constraint.spacingMode == 0 /* Length */ || constraint.spacingMode == 1 /* Fixed */ ? scale : 1));
|
|
8984
10500
|
} else if (timelineName === "mix") {
|
|
8985
10501
|
let timeline = new PathConstraintMixTimeline(frames, frames * 3, constraintIndex);
|
|
8986
10502
|
let time = getValue(keyMap, "time", 0);
|
|
@@ -9290,10 +10806,15 @@ var spine = (() => {
|
|
|
9290
10806
|
continue;
|
|
9291
10807
|
attachment.computeWorldVertices(slot, worldVertices, 0, 2);
|
|
9292
10808
|
let region = attachment.region;
|
|
9293
|
-
let image = region.
|
|
10809
|
+
let image = region.texture.getImage();
|
|
9294
10810
|
let slotColor = slot.color;
|
|
9295
10811
|
let regionColor = attachment.color;
|
|
9296
|
-
color.set(
|
|
10812
|
+
color.set(
|
|
10813
|
+
skeletonColor.r * slotColor.r * regionColor.r,
|
|
10814
|
+
skeletonColor.g * slotColor.g * regionColor.g,
|
|
10815
|
+
skeletonColor.b * slotColor.b * regionColor.b,
|
|
10816
|
+
skeletonColor.a * slotColor.a * regionColor.a
|
|
10817
|
+
);
|
|
9297
10818
|
ctx.save();
|
|
9298
10819
|
ctx.transform(bone.a, bone.c, bone.b, bone.d, bone.worldX, bone.worldY);
|
|
9299
10820
|
ctx.translate(attachment.offset[0], attachment.offset[1]);
|
|
@@ -9311,7 +10832,7 @@ var spine = (() => {
|
|
|
9311
10832
|
ctx.scale(1, -1);
|
|
9312
10833
|
ctx.translate(-w / 2, -h / 2);
|
|
9313
10834
|
ctx.globalAlpha = color.a;
|
|
9314
|
-
ctx.drawImage(image, region.
|
|
10835
|
+
ctx.drawImage(image, image.width * region.u, image.height * region.v, w, h, 0, 0, w, h);
|
|
9315
10836
|
if (this.debugRendering)
|
|
9316
10837
|
ctx.strokeRect(0, 0, w, h);
|
|
9317
10838
|
ctx.restore();
|
|
@@ -9334,14 +10855,12 @@ var spine = (() => {
|
|
|
9334
10855
|
let regionAttachment = attachment;
|
|
9335
10856
|
vertices = this.computeRegionVertices(slot, regionAttachment, false);
|
|
9336
10857
|
triangles = _SkeletonRenderer.QUAD_TRIANGLES;
|
|
9337
|
-
|
|
9338
|
-
texture = region.page.texture.getImage();
|
|
10858
|
+
texture = regionAttachment.region.texture.getImage();
|
|
9339
10859
|
} else if (attachment instanceof MeshAttachment) {
|
|
9340
10860
|
let mesh = attachment;
|
|
9341
10861
|
vertices = this.computeMeshVertices(slot, mesh, false);
|
|
9342
10862
|
triangles = mesh.triangles;
|
|
9343
|
-
|
|
9344
|
-
texture = region2.page.texture.getImage();
|
|
10863
|
+
texture = mesh.region.texture.getImage();
|
|
9345
10864
|
} else
|
|
9346
10865
|
continue;
|
|
9347
10866
|
if (texture) {
|
|
@@ -9349,7 +10868,12 @@ var spine = (() => {
|
|
|
9349
10868
|
blendMode = slot.data.blendMode;
|
|
9350
10869
|
let slotColor = slot.color;
|
|
9351
10870
|
let attachmentColor = attachment.color;
|
|
9352
|
-
color.set(
|
|
10871
|
+
color.set(
|
|
10872
|
+
skeletonColor.r * slotColor.r * attachmentColor.r,
|
|
10873
|
+
skeletonColor.g * slotColor.g * attachmentColor.g,
|
|
10874
|
+
skeletonColor.b * slotColor.b * attachmentColor.b,
|
|
10875
|
+
skeletonColor.a * slotColor.a * attachmentColor.a
|
|
10876
|
+
);
|
|
9353
10877
|
ctx.globalAlpha = color.a;
|
|
9354
10878
|
for (var j = 0; j < triangles.length; j += 3) {
|
|
9355
10879
|
let t1 = triangles[j] * 8, t2 = triangles[j + 1] * 8, t3 = triangles[j + 2] * 8;
|
|
@@ -9371,6 +10895,8 @@ var spine = (() => {
|
|
|
9371
10895
|
}
|
|
9372
10896
|
this.ctx.globalAlpha = 1;
|
|
9373
10897
|
}
|
|
10898
|
+
// Adapted from http://extremelysatisfactorytotalitarianism.com/blog/?p=2120
|
|
10899
|
+
// Apache 2 licensed
|
|
9374
10900
|
drawTriangle(img, x0, y0, u0, v0, x1, y1, u1, v1, x2, y2, u2, v2) {
|
|
9375
10901
|
let ctx = this.ctx;
|
|
9376
10902
|
u0 *= img.width;
|
|
@@ -9406,7 +10932,12 @@ var spine = (() => {
|
|
|
9406
10932
|
let alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
|
9407
10933
|
let multiplier = pma ? alpha : 1;
|
|
9408
10934
|
let color = this.tempColor;
|
|
9409
|
-
color.set(
|
|
10935
|
+
color.set(
|
|
10936
|
+
skeletonColor.r * slotColor.r * regionColor.r * multiplier,
|
|
10937
|
+
skeletonColor.g * slotColor.g * regionColor.g * multiplier,
|
|
10938
|
+
skeletonColor.b * slotColor.b * regionColor.b * multiplier,
|
|
10939
|
+
alpha
|
|
10940
|
+
);
|
|
9410
10941
|
region.computeWorldVertices(slot, this.vertices, 0, _SkeletonRenderer.VERTEX_SIZE);
|
|
9411
10942
|
let vertices = this.vertices;
|
|
9412
10943
|
let uvs = region.uvs;
|
|
@@ -9443,7 +10974,12 @@ var spine = (() => {
|
|
|
9443
10974
|
let alpha = skeletonColor.a * slotColor.a * regionColor.a;
|
|
9444
10975
|
let multiplier = pma ? alpha : 1;
|
|
9445
10976
|
let color = this.tempColor;
|
|
9446
|
-
color.set(
|
|
10977
|
+
color.set(
|
|
10978
|
+
skeletonColor.r * slotColor.r * regionColor.r * multiplier,
|
|
10979
|
+
skeletonColor.g * slotColor.g * regionColor.g * multiplier,
|
|
10980
|
+
skeletonColor.b * slotColor.b * regionColor.b * multiplier,
|
|
10981
|
+
alpha
|
|
10982
|
+
);
|
|
9447
10983
|
let vertexCount = mesh.worldVerticesLength / 2;
|
|
9448
10984
|
let vertices = this.vertices;
|
|
9449
10985
|
if (vertices.length < mesh.worldVerticesLength)
|
|
@@ -9465,6 +11001,6 @@ var spine = (() => {
|
|
|
9465
11001
|
var SkeletonRenderer = _SkeletonRenderer;
|
|
9466
11002
|
SkeletonRenderer.QUAD_TRIANGLES = [0, 1, 2, 2, 3, 0];
|
|
9467
11003
|
SkeletonRenderer.VERTEX_SIZE = 2 + 2 + 4;
|
|
9468
|
-
return src_exports;
|
|
11004
|
+
return __toCommonJS(src_exports);
|
|
9469
11005
|
})();
|
|
9470
11006
|
//# sourceMappingURL=spine-canvas.js.map
|