@esotericsoftware/spine-canvas 4.2.26 → 4.2.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -78,6 +78,16 @@ var spine = (() => {
|
|
|
78
78
|
PathConstraintMixTimeline: () => PathConstraintMixTimeline,
|
|
79
79
|
PathConstraintPositionTimeline: () => PathConstraintPositionTimeline,
|
|
80
80
|
PathConstraintSpacingTimeline: () => PathConstraintSpacingTimeline,
|
|
81
|
+
Physics: () => Physics,
|
|
82
|
+
PhysicsConstraintDampingTimeline: () => PhysicsConstraintDampingTimeline,
|
|
83
|
+
PhysicsConstraintGravityTimeline: () => PhysicsConstraintGravityTimeline,
|
|
84
|
+
PhysicsConstraintInertiaTimeline: () => PhysicsConstraintInertiaTimeline,
|
|
85
|
+
PhysicsConstraintMassTimeline: () => PhysicsConstraintMassTimeline,
|
|
86
|
+
PhysicsConstraintMixTimeline: () => PhysicsConstraintMixTimeline,
|
|
87
|
+
PhysicsConstraintResetTimeline: () => PhysicsConstraintResetTimeline,
|
|
88
|
+
PhysicsConstraintStrengthTimeline: () => PhysicsConstraintStrengthTimeline,
|
|
89
|
+
PhysicsConstraintTimeline: () => PhysicsConstraintTimeline,
|
|
90
|
+
PhysicsConstraintWindTimeline: () => PhysicsConstraintWindTimeline,
|
|
81
91
|
PointAttachment: () => PointAttachment,
|
|
82
92
|
Pool: () => Pool,
|
|
83
93
|
PositionMode: () => PositionMode,
|
|
@@ -99,7 +109,7 @@ var spine = (() => {
|
|
|
99
109
|
ShearTimeline: () => ShearTimeline,
|
|
100
110
|
ShearXTimeline: () => ShearXTimeline,
|
|
101
111
|
ShearYTimeline: () => ShearYTimeline,
|
|
102
|
-
Skeleton: () =>
|
|
112
|
+
Skeleton: () => Skeleton2,
|
|
103
113
|
SkeletonBinary: () => SkeletonBinary,
|
|
104
114
|
SkeletonBounds: () => SkeletonBounds,
|
|
105
115
|
SkeletonClipping: () => SkeletonClipping,
|
|
@@ -270,6 +280,9 @@ var spine = (() => {
|
|
|
270
280
|
static sinDeg(degrees) {
|
|
271
281
|
return Math.sin(degrees * _MathUtils.degRad);
|
|
272
282
|
}
|
|
283
|
+
static atan2Deg(y, x) {
|
|
284
|
+
return Math.atan2(y, x) * _MathUtils.degRad;
|
|
285
|
+
}
|
|
273
286
|
static signum(value) {
|
|
274
287
|
return value > 0 ? 1 : value < 0 ? -1 : 0;
|
|
275
288
|
}
|
|
@@ -297,6 +310,7 @@ var spine = (() => {
|
|
|
297
310
|
var MathUtils = _MathUtils;
|
|
298
311
|
__publicField(MathUtils, "PI", 3.1415927);
|
|
299
312
|
__publicField(MathUtils, "PI2", _MathUtils.PI * 2);
|
|
313
|
+
__publicField(MathUtils, "invPI2", 1 / _MathUtils.PI2);
|
|
300
314
|
__publicField(MathUtils, "radiansToDegrees", 180 / _MathUtils.PI);
|
|
301
315
|
__publicField(MathUtils, "radDeg", _MathUtils.radiansToDegrees);
|
|
302
316
|
__publicField(MathUtils, "degreesToRadians", _MathUtils.PI / 180);
|
|
@@ -772,7 +786,15 @@ var spine = (() => {
|
|
|
772
786
|
pathConstraintPosition: 16,
|
|
773
787
|
pathConstraintSpacing: 17,
|
|
774
788
|
pathConstraintMix: 18,
|
|
775
|
-
|
|
789
|
+
physicsConstraintInertia: 19,
|
|
790
|
+
physicsConstraintStrength: 20,
|
|
791
|
+
physicsConstraintDamping: 21,
|
|
792
|
+
physicsConstraintMass: 22,
|
|
793
|
+
physicsConstraintWind: 23,
|
|
794
|
+
physicsConstraintGravity: 24,
|
|
795
|
+
physicsConstraintMix: 25,
|
|
796
|
+
physicsConstraintReset: 26,
|
|
797
|
+
sequence: 27
|
|
776
798
|
};
|
|
777
799
|
var Timeline = class {
|
|
778
800
|
propertyIds;
|
|
@@ -950,6 +972,94 @@ var spine = (() => {
|
|
|
950
972
|
/*BEZIER*/
|
|
951
973
|
);
|
|
952
974
|
}
|
|
975
|
+
getRelativeValue(time, alpha, blend, current, setup) {
|
|
976
|
+
if (time < this.frames[0]) {
|
|
977
|
+
switch (blend) {
|
|
978
|
+
case 0 /* setup */:
|
|
979
|
+
return setup;
|
|
980
|
+
case 1 /* first */:
|
|
981
|
+
return current + (setup - current) * alpha;
|
|
982
|
+
}
|
|
983
|
+
return current;
|
|
984
|
+
}
|
|
985
|
+
let value = this.getCurveValue(time);
|
|
986
|
+
switch (blend) {
|
|
987
|
+
case 0 /* setup */:
|
|
988
|
+
return setup + value * alpha;
|
|
989
|
+
case 1 /* first */:
|
|
990
|
+
case 2 /* replace */:
|
|
991
|
+
value += setup - current;
|
|
992
|
+
}
|
|
993
|
+
return current + value * alpha;
|
|
994
|
+
}
|
|
995
|
+
getAbsoluteValue(time, alpha, blend, current, setup) {
|
|
996
|
+
if (time < this.frames[0]) {
|
|
997
|
+
switch (blend) {
|
|
998
|
+
case 0 /* setup */:
|
|
999
|
+
return setup;
|
|
1000
|
+
case 1 /* first */:
|
|
1001
|
+
return current + (setup - current) * alpha;
|
|
1002
|
+
}
|
|
1003
|
+
return current;
|
|
1004
|
+
}
|
|
1005
|
+
let value = this.getCurveValue(time);
|
|
1006
|
+
if (blend == 0 /* setup */)
|
|
1007
|
+
return setup + (value - setup) * alpha;
|
|
1008
|
+
return current + (value - current) * alpha;
|
|
1009
|
+
}
|
|
1010
|
+
getAbsoluteValue2(time, alpha, blend, current, setup, value) {
|
|
1011
|
+
if (time < this.frames[0]) {
|
|
1012
|
+
switch (blend) {
|
|
1013
|
+
case 0 /* setup */:
|
|
1014
|
+
return setup;
|
|
1015
|
+
case 1 /* first */:
|
|
1016
|
+
return current + (setup - current) * alpha;
|
|
1017
|
+
}
|
|
1018
|
+
return current;
|
|
1019
|
+
}
|
|
1020
|
+
if (blend == 0 /* setup */)
|
|
1021
|
+
return setup + (value - setup) * alpha;
|
|
1022
|
+
return current + (value - current) * alpha;
|
|
1023
|
+
}
|
|
1024
|
+
getScaleValue(time, alpha, blend, direction, current, setup) {
|
|
1025
|
+
const frames = this.frames;
|
|
1026
|
+
if (time < frames[0]) {
|
|
1027
|
+
switch (blend) {
|
|
1028
|
+
case 0 /* setup */:
|
|
1029
|
+
return setup;
|
|
1030
|
+
case 1 /* first */:
|
|
1031
|
+
return current + (setup - current) * alpha;
|
|
1032
|
+
}
|
|
1033
|
+
return current;
|
|
1034
|
+
}
|
|
1035
|
+
let value = this.getCurveValue(time) * setup;
|
|
1036
|
+
if (alpha == 1) {
|
|
1037
|
+
if (blend == 3 /* add */)
|
|
1038
|
+
return current + value - setup;
|
|
1039
|
+
return value;
|
|
1040
|
+
}
|
|
1041
|
+
if (direction == 1 /* mixOut */) {
|
|
1042
|
+
switch (blend) {
|
|
1043
|
+
case 0 /* setup */:
|
|
1044
|
+
return setup + (Math.abs(value) * MathUtils.signum(setup) - setup) * alpha;
|
|
1045
|
+
case 1 /* first */:
|
|
1046
|
+
case 2 /* replace */:
|
|
1047
|
+
return current + (Math.abs(value) * MathUtils.signum(current) - current) * alpha;
|
|
1048
|
+
}
|
|
1049
|
+
} else {
|
|
1050
|
+
let s = 0;
|
|
1051
|
+
switch (blend) {
|
|
1052
|
+
case 0 /* setup */:
|
|
1053
|
+
s = Math.abs(setup) * MathUtils.signum(value);
|
|
1054
|
+
return s + (value - s) * alpha;
|
|
1055
|
+
case 1 /* first */:
|
|
1056
|
+
case 2 /* replace */:
|
|
1057
|
+
s = Math.abs(current) * MathUtils.signum(value);
|
|
1058
|
+
return s + (value - s) * alpha;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
return current + (value - setup) * alpha;
|
|
1062
|
+
}
|
|
953
1063
|
};
|
|
954
1064
|
var CurveTimeline2 = class extends CurveTimeline {
|
|
955
1065
|
/** @param bezierCount The maximum number of Bezier curves. See {@link #shrink(int)}.
|
|
@@ -984,30 +1094,8 @@ var spine = (() => {
|
|
|
984
1094
|
}
|
|
985
1095
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
986
1096
|
let bone = skeleton.bones[this.boneIndex];
|
|
987
|
-
if (
|
|
988
|
-
|
|
989
|
-
let frames = this.frames;
|
|
990
|
-
if (time < frames[0]) {
|
|
991
|
-
switch (blend) {
|
|
992
|
-
case 0 /* setup */:
|
|
993
|
-
bone.rotation = bone.data.rotation;
|
|
994
|
-
return;
|
|
995
|
-
case 1 /* first */:
|
|
996
|
-
bone.rotation += (bone.data.rotation - bone.rotation) * alpha;
|
|
997
|
-
}
|
|
998
|
-
return;
|
|
999
|
-
}
|
|
1000
|
-
let r = this.getCurveValue(time);
|
|
1001
|
-
switch (blend) {
|
|
1002
|
-
case 0 /* setup */:
|
|
1003
|
-
bone.rotation = bone.data.rotation + r * alpha;
|
|
1004
|
-
break;
|
|
1005
|
-
case 1 /* first */:
|
|
1006
|
-
case 2 /* replace */:
|
|
1007
|
-
r += bone.data.rotation - bone.rotation;
|
|
1008
|
-
case 3 /* add */:
|
|
1009
|
-
bone.rotation += r * alpha;
|
|
1010
|
-
}
|
|
1097
|
+
if (bone.active)
|
|
1098
|
+
bone.rotation = this.getRelativeValue(time, alpha, blend, bone.rotation, bone.data.rotation);
|
|
1011
1099
|
}
|
|
1012
1100
|
};
|
|
1013
1101
|
var TranslateTimeline = class extends CurveTimeline2 {
|
|
@@ -1123,31 +1211,8 @@ var spine = (() => {
|
|
|
1123
1211
|
}
|
|
1124
1212
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1125
1213
|
let bone = skeleton.bones[this.boneIndex];
|
|
1126
|
-
if (
|
|
1127
|
-
|
|
1128
|
-
let frames = this.frames;
|
|
1129
|
-
if (time < frames[0]) {
|
|
1130
|
-
switch (blend) {
|
|
1131
|
-
case 0 /* setup */:
|
|
1132
|
-
bone.x = bone.data.x;
|
|
1133
|
-
return;
|
|
1134
|
-
case 1 /* first */:
|
|
1135
|
-
bone.x += (bone.data.x - bone.x) * alpha;
|
|
1136
|
-
}
|
|
1137
|
-
return;
|
|
1138
|
-
}
|
|
1139
|
-
let x = this.getCurveValue(time);
|
|
1140
|
-
switch (blend) {
|
|
1141
|
-
case 0 /* setup */:
|
|
1142
|
-
bone.x = bone.data.x + x * alpha;
|
|
1143
|
-
break;
|
|
1144
|
-
case 1 /* first */:
|
|
1145
|
-
case 2 /* replace */:
|
|
1146
|
-
bone.x += (bone.data.x + x - bone.x) * alpha;
|
|
1147
|
-
break;
|
|
1148
|
-
case 3 /* add */:
|
|
1149
|
-
bone.x += x * alpha;
|
|
1150
|
-
}
|
|
1214
|
+
if (bone.active)
|
|
1215
|
+
bone.x = this.getRelativeValue(time, alpha, blend, bone.x, bone.data.x);
|
|
1151
1216
|
}
|
|
1152
1217
|
};
|
|
1153
1218
|
var TranslateYTimeline = class extends CurveTimeline1 {
|
|
@@ -1158,31 +1223,8 @@ var spine = (() => {
|
|
|
1158
1223
|
}
|
|
1159
1224
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1160
1225
|
let bone = skeleton.bones[this.boneIndex];
|
|
1161
|
-
if (
|
|
1162
|
-
|
|
1163
|
-
let frames = this.frames;
|
|
1164
|
-
if (time < frames[0]) {
|
|
1165
|
-
switch (blend) {
|
|
1166
|
-
case 0 /* setup */:
|
|
1167
|
-
bone.y = bone.data.y;
|
|
1168
|
-
return;
|
|
1169
|
-
case 1 /* first */:
|
|
1170
|
-
bone.y += (bone.data.y - bone.y) * alpha;
|
|
1171
|
-
}
|
|
1172
|
-
return;
|
|
1173
|
-
}
|
|
1174
|
-
let y = this.getCurveValue(time);
|
|
1175
|
-
switch (blend) {
|
|
1176
|
-
case 0 /* setup */:
|
|
1177
|
-
bone.y = bone.data.y + y * alpha;
|
|
1178
|
-
break;
|
|
1179
|
-
case 1 /* first */:
|
|
1180
|
-
case 2 /* replace */:
|
|
1181
|
-
bone.y += (bone.data.y + y - bone.y) * alpha;
|
|
1182
|
-
break;
|
|
1183
|
-
case 3 /* add */:
|
|
1184
|
-
bone.y += y * alpha;
|
|
1185
|
-
}
|
|
1226
|
+
if (bone.active)
|
|
1227
|
+
bone.y = this.getRelativeValue(time, alpha, blend, bone.y, bone.data.y);
|
|
1186
1228
|
}
|
|
1187
1229
|
};
|
|
1188
1230
|
var ScaleTimeline = class extends CurveTimeline2 {
|
|
@@ -1336,57 +1378,8 @@ var spine = (() => {
|
|
|
1336
1378
|
}
|
|
1337
1379
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1338
1380
|
let bone = skeleton.bones[this.boneIndex];
|
|
1339
|
-
if (
|
|
1340
|
-
|
|
1341
|
-
let frames = this.frames;
|
|
1342
|
-
if (time < frames[0]) {
|
|
1343
|
-
switch (blend) {
|
|
1344
|
-
case 0 /* setup */:
|
|
1345
|
-
bone.scaleX = bone.data.scaleX;
|
|
1346
|
-
return;
|
|
1347
|
-
case 1 /* first */:
|
|
1348
|
-
bone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha;
|
|
1349
|
-
}
|
|
1350
|
-
return;
|
|
1351
|
-
}
|
|
1352
|
-
let x = this.getCurveValue(time) * bone.data.scaleX;
|
|
1353
|
-
if (alpha == 1) {
|
|
1354
|
-
if (blend == 3 /* add */)
|
|
1355
|
-
bone.scaleX += x - bone.data.scaleX;
|
|
1356
|
-
else
|
|
1357
|
-
bone.scaleX = x;
|
|
1358
|
-
} else {
|
|
1359
|
-
let bx = 0;
|
|
1360
|
-
if (direction == 1 /* mixOut */) {
|
|
1361
|
-
switch (blend) {
|
|
1362
|
-
case 0 /* setup */:
|
|
1363
|
-
bx = bone.data.scaleX;
|
|
1364
|
-
bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
|
|
1365
|
-
break;
|
|
1366
|
-
case 1 /* first */:
|
|
1367
|
-
case 2 /* replace */:
|
|
1368
|
-
bx = bone.scaleX;
|
|
1369
|
-
bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
|
|
1370
|
-
break;
|
|
1371
|
-
case 3 /* add */:
|
|
1372
|
-
bone.scaleX += (x - bone.data.scaleX) * alpha;
|
|
1373
|
-
}
|
|
1374
|
-
} else {
|
|
1375
|
-
switch (blend) {
|
|
1376
|
-
case 0 /* setup */:
|
|
1377
|
-
bx = Math.abs(bone.data.scaleX) * MathUtils.signum(x);
|
|
1378
|
-
bone.scaleX = bx + (x - bx) * alpha;
|
|
1379
|
-
break;
|
|
1380
|
-
case 1 /* first */:
|
|
1381
|
-
case 2 /* replace */:
|
|
1382
|
-
bx = Math.abs(bone.scaleX) * MathUtils.signum(x);
|
|
1383
|
-
bone.scaleX = bx + (x - bx) * alpha;
|
|
1384
|
-
break;
|
|
1385
|
-
case 3 /* add */:
|
|
1386
|
-
bone.scaleX += (x - bone.data.scaleX) * alpha;
|
|
1387
|
-
}
|
|
1388
|
-
}
|
|
1389
|
-
}
|
|
1381
|
+
if (bone.active)
|
|
1382
|
+
bone.scaleX = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleX);
|
|
1390
1383
|
}
|
|
1391
1384
|
};
|
|
1392
1385
|
var ScaleYTimeline = class extends CurveTimeline1 {
|
|
@@ -1397,57 +1390,8 @@ var spine = (() => {
|
|
|
1397
1390
|
}
|
|
1398
1391
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1399
1392
|
let bone = skeleton.bones[this.boneIndex];
|
|
1400
|
-
if (
|
|
1401
|
-
|
|
1402
|
-
let frames = this.frames;
|
|
1403
|
-
if (time < frames[0]) {
|
|
1404
|
-
switch (blend) {
|
|
1405
|
-
case 0 /* setup */:
|
|
1406
|
-
bone.scaleY = bone.data.scaleY;
|
|
1407
|
-
return;
|
|
1408
|
-
case 1 /* first */:
|
|
1409
|
-
bone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha;
|
|
1410
|
-
}
|
|
1411
|
-
return;
|
|
1412
|
-
}
|
|
1413
|
-
let y = this.getCurveValue(time) * bone.data.scaleY;
|
|
1414
|
-
if (alpha == 1) {
|
|
1415
|
-
if (blend == 3 /* add */)
|
|
1416
|
-
bone.scaleY += y - bone.data.scaleY;
|
|
1417
|
-
else
|
|
1418
|
-
bone.scaleY = y;
|
|
1419
|
-
} else {
|
|
1420
|
-
let by = 0;
|
|
1421
|
-
if (direction == 1 /* mixOut */) {
|
|
1422
|
-
switch (blend) {
|
|
1423
|
-
case 0 /* setup */:
|
|
1424
|
-
by = bone.data.scaleY;
|
|
1425
|
-
bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
|
|
1426
|
-
break;
|
|
1427
|
-
case 1 /* first */:
|
|
1428
|
-
case 2 /* replace */:
|
|
1429
|
-
by = bone.scaleY;
|
|
1430
|
-
bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
|
|
1431
|
-
break;
|
|
1432
|
-
case 3 /* add */:
|
|
1433
|
-
bone.scaleY += (y - bone.data.scaleY) * alpha;
|
|
1434
|
-
}
|
|
1435
|
-
} else {
|
|
1436
|
-
switch (blend) {
|
|
1437
|
-
case 0 /* setup */:
|
|
1438
|
-
by = Math.abs(bone.data.scaleY) * MathUtils.signum(y);
|
|
1439
|
-
bone.scaleY = by + (y - by) * alpha;
|
|
1440
|
-
break;
|
|
1441
|
-
case 1 /* first */:
|
|
1442
|
-
case 2 /* replace */:
|
|
1443
|
-
by = Math.abs(bone.scaleY) * MathUtils.signum(y);
|
|
1444
|
-
bone.scaleY = by + (y - by) * alpha;
|
|
1445
|
-
break;
|
|
1446
|
-
case 3 /* add */:
|
|
1447
|
-
bone.scaleY += (y - bone.data.scaleY) * alpha;
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1393
|
+
if (bone.active)
|
|
1394
|
+
bone.scaleY = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleY);
|
|
1451
1395
|
}
|
|
1452
1396
|
};
|
|
1453
1397
|
var ShearTimeline = class extends CurveTimeline2 {
|
|
@@ -1563,31 +1507,8 @@ var spine = (() => {
|
|
|
1563
1507
|
}
|
|
1564
1508
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1565
1509
|
let bone = skeleton.bones[this.boneIndex];
|
|
1566
|
-
if (
|
|
1567
|
-
|
|
1568
|
-
let frames = this.frames;
|
|
1569
|
-
if (time < frames[0]) {
|
|
1570
|
-
switch (blend) {
|
|
1571
|
-
case 0 /* setup */:
|
|
1572
|
-
bone.shearX = bone.data.shearX;
|
|
1573
|
-
return;
|
|
1574
|
-
case 1 /* first */:
|
|
1575
|
-
bone.shearX += (bone.data.shearX - bone.shearX) * alpha;
|
|
1576
|
-
}
|
|
1577
|
-
return;
|
|
1578
|
-
}
|
|
1579
|
-
let x = this.getCurveValue(time);
|
|
1580
|
-
switch (blend) {
|
|
1581
|
-
case 0 /* setup */:
|
|
1582
|
-
bone.shearX = bone.data.shearX + x * alpha;
|
|
1583
|
-
break;
|
|
1584
|
-
case 1 /* first */:
|
|
1585
|
-
case 2 /* replace */:
|
|
1586
|
-
bone.shearX += (bone.data.shearX + x - bone.shearX) * alpha;
|
|
1587
|
-
break;
|
|
1588
|
-
case 3 /* add */:
|
|
1589
|
-
bone.shearX += x * alpha;
|
|
1590
|
-
}
|
|
1510
|
+
if (bone.active)
|
|
1511
|
+
bone.shearX = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearX);
|
|
1591
1512
|
}
|
|
1592
1513
|
};
|
|
1593
1514
|
var ShearYTimeline = class extends CurveTimeline1 {
|
|
@@ -1598,31 +1519,8 @@ var spine = (() => {
|
|
|
1598
1519
|
}
|
|
1599
1520
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1600
1521
|
let bone = skeleton.bones[this.boneIndex];
|
|
1601
|
-
if (
|
|
1602
|
-
|
|
1603
|
-
let frames = this.frames;
|
|
1604
|
-
if (time < frames[0]) {
|
|
1605
|
-
switch (blend) {
|
|
1606
|
-
case 0 /* setup */:
|
|
1607
|
-
bone.shearY = bone.data.shearY;
|
|
1608
|
-
return;
|
|
1609
|
-
case 1 /* first */:
|
|
1610
|
-
bone.shearY += (bone.data.shearY - bone.shearY) * alpha;
|
|
1611
|
-
}
|
|
1612
|
-
return;
|
|
1613
|
-
}
|
|
1614
|
-
let y = this.getCurveValue(time);
|
|
1615
|
-
switch (blend) {
|
|
1616
|
-
case 0 /* setup */:
|
|
1617
|
-
bone.shearY = bone.data.shearY + y * alpha;
|
|
1618
|
-
break;
|
|
1619
|
-
case 1 /* first */:
|
|
1620
|
-
case 2 /* replace */:
|
|
1621
|
-
bone.shearY += (bone.data.shearY + y - bone.shearY) * alpha;
|
|
1622
|
-
break;
|
|
1623
|
-
case 3 /* add */:
|
|
1624
|
-
bone.shearY += y * alpha;
|
|
1625
|
-
}
|
|
1522
|
+
if (bone.active)
|
|
1523
|
+
bone.shearY = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearY);
|
|
1626
1524
|
}
|
|
1627
1525
|
};
|
|
1628
1526
|
var RGBATimeline = class extends CurveTimeline {
|
|
@@ -2798,13 +2696,13 @@ var spine = (() => {
|
|
|
2798
2696
|
var DrawOrderTimeline = _DrawOrderTimeline;
|
|
2799
2697
|
__publicField(DrawOrderTimeline, "propertyIds", ["" + Property.drawOrder]);
|
|
2800
2698
|
var IkConstraintTimeline = class extends CurveTimeline {
|
|
2801
|
-
/** The index of the IK constraint
|
|
2802
|
-
|
|
2699
|
+
/** The index of the IK constraint in {@link Skeleton#getIkConstraints()} that will be changed when this timeline is */
|
|
2700
|
+
constraintIndex = 0;
|
|
2803
2701
|
constructor(frameCount, bezierCount, ikConstraintIndex) {
|
|
2804
2702
|
super(frameCount, bezierCount, [
|
|
2805
2703
|
Property.ikConstraint + "|" + ikConstraintIndex
|
|
2806
2704
|
]);
|
|
2807
|
-
this.
|
|
2705
|
+
this.constraintIndex = ikConstraintIndex;
|
|
2808
2706
|
}
|
|
2809
2707
|
getFrameEntries() {
|
|
2810
2708
|
return 6;
|
|
@@ -2835,7 +2733,7 @@ var spine = (() => {
|
|
|
2835
2733
|
] = stretch ? 1 : 0;
|
|
2836
2734
|
}
|
|
2837
2735
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2838
|
-
let constraint = skeleton.ikConstraints[this.
|
|
2736
|
+
let constraint = skeleton.ikConstraints[this.constraintIndex];
|
|
2839
2737
|
if (!constraint.active)
|
|
2840
2738
|
return;
|
|
2841
2739
|
let frames = this.frames;
|
|
@@ -2961,12 +2859,12 @@ var spine = (() => {
|
|
|
2961
2859
|
};
|
|
2962
2860
|
var TransformConstraintTimeline = class extends CurveTimeline {
|
|
2963
2861
|
/** The index of the transform constraint slot in {@link Skeleton#transformConstraints} that will be changed. */
|
|
2964
|
-
|
|
2862
|
+
constraintIndex = 0;
|
|
2965
2863
|
constructor(frameCount, bezierCount, transformConstraintIndex) {
|
|
2966
2864
|
super(frameCount, bezierCount, [
|
|
2967
2865
|
Property.transformConstraint + "|" + transformConstraintIndex
|
|
2968
2866
|
]);
|
|
2969
|
-
this.
|
|
2867
|
+
this.constraintIndex = transformConstraintIndex;
|
|
2970
2868
|
}
|
|
2971
2869
|
getFrameEntries() {
|
|
2972
2870
|
return 7;
|
|
@@ -3002,7 +2900,7 @@ var spine = (() => {
|
|
|
3002
2900
|
] = mixShearY;
|
|
3003
2901
|
}
|
|
3004
2902
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
3005
|
-
let constraint = skeleton.transformConstraints[this.
|
|
2903
|
+
let constraint = skeleton.transformConstraints[this.constraintIndex];
|
|
3006
2904
|
if (!constraint.active)
|
|
3007
2905
|
return;
|
|
3008
2906
|
let frames = this.frames;
|
|
@@ -3183,71 +3081,42 @@ var spine = (() => {
|
|
|
3183
3081
|
}
|
|
3184
3082
|
};
|
|
3185
3083
|
var PathConstraintPositionTimeline = class extends CurveTimeline1 {
|
|
3186
|
-
/** The index of the path constraint
|
|
3187
|
-
|
|
3084
|
+
/** The index of the path constraint in {@link Skeleton#getPathConstraints()} that will be changed when this timeline is
|
|
3085
|
+
* applied. */
|
|
3086
|
+
constraintIndex = 0;
|
|
3188
3087
|
constructor(frameCount, bezierCount, pathConstraintIndex) {
|
|
3189
3088
|
super(frameCount, bezierCount, Property.pathConstraintPosition + "|" + pathConstraintIndex);
|
|
3190
|
-
this.
|
|
3089
|
+
this.constraintIndex = pathConstraintIndex;
|
|
3191
3090
|
}
|
|
3192
3091
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
3193
|
-
let constraint = skeleton.pathConstraints[this.
|
|
3194
|
-
if (
|
|
3195
|
-
|
|
3196
|
-
let frames = this.frames;
|
|
3197
|
-
if (time < frames[0]) {
|
|
3198
|
-
switch (blend) {
|
|
3199
|
-
case 0 /* setup */:
|
|
3200
|
-
constraint.position = constraint.data.position;
|
|
3201
|
-
return;
|
|
3202
|
-
case 1 /* first */:
|
|
3203
|
-
constraint.position += (constraint.data.position - constraint.position) * alpha;
|
|
3204
|
-
}
|
|
3205
|
-
return;
|
|
3206
|
-
}
|
|
3207
|
-
let position = this.getCurveValue(time);
|
|
3208
|
-
if (blend == 0 /* setup */)
|
|
3209
|
-
constraint.position = constraint.data.position + (position - constraint.data.position) * alpha;
|
|
3210
|
-
else
|
|
3211
|
-
constraint.position += (position - constraint.position) * alpha;
|
|
3092
|
+
let constraint = skeleton.pathConstraints[this.constraintIndex];
|
|
3093
|
+
if (constraint.active)
|
|
3094
|
+
constraint.position = this.getAbsoluteValue(time, alpha, blend, constraint.position, constraint.data.position);
|
|
3212
3095
|
}
|
|
3213
3096
|
};
|
|
3214
3097
|
var PathConstraintSpacingTimeline = class extends CurveTimeline1 {
|
|
3215
|
-
/** The index of the path constraint
|
|
3216
|
-
|
|
3098
|
+
/** The index of the path constraint in {@link Skeleton#getPathConstraints()} that will be changed when this timeline is
|
|
3099
|
+
* applied. */
|
|
3100
|
+
constraintIndex = 0;
|
|
3217
3101
|
constructor(frameCount, bezierCount, pathConstraintIndex) {
|
|
3218
3102
|
super(frameCount, bezierCount, Property.pathConstraintSpacing + "|" + pathConstraintIndex);
|
|
3219
|
-
this.
|
|
3103
|
+
this.constraintIndex = pathConstraintIndex;
|
|
3220
3104
|
}
|
|
3221
3105
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
3222
|
-
let constraint = skeleton.pathConstraints[this.
|
|
3223
|
-
if (
|
|
3224
|
-
|
|
3225
|
-
let frames = this.frames;
|
|
3226
|
-
if (time < frames[0]) {
|
|
3227
|
-
switch (blend) {
|
|
3228
|
-
case 0 /* setup */:
|
|
3229
|
-
constraint.spacing = constraint.data.spacing;
|
|
3230
|
-
return;
|
|
3231
|
-
case 1 /* first */:
|
|
3232
|
-
constraint.spacing += (constraint.data.spacing - constraint.spacing) * alpha;
|
|
3233
|
-
}
|
|
3234
|
-
return;
|
|
3235
|
-
}
|
|
3236
|
-
let spacing = this.getCurveValue(time);
|
|
3237
|
-
if (blend == 0 /* setup */)
|
|
3238
|
-
constraint.spacing = constraint.data.spacing + (spacing - constraint.data.spacing) * alpha;
|
|
3239
|
-
else
|
|
3240
|
-
constraint.spacing += (spacing - constraint.spacing) * alpha;
|
|
3106
|
+
let constraint = skeleton.pathConstraints[this.constraintIndex];
|
|
3107
|
+
if (constraint.active)
|
|
3108
|
+
constraint.spacing = this.getAbsoluteValue(time, alpha, blend, constraint.spacing, constraint.data.spacing);
|
|
3241
3109
|
}
|
|
3242
3110
|
};
|
|
3243
3111
|
var PathConstraintMixTimeline = class extends CurveTimeline {
|
|
3244
|
-
/** The index of the path constraint
|
|
3245
|
-
|
|
3112
|
+
/** The index of the path constraint in {@link Skeleton#getPathConstraints()} that will be changed when this timeline is
|
|
3113
|
+
* applied. */
|
|
3114
|
+
constraintIndex = 0;
|
|
3246
3115
|
constructor(frameCount, bezierCount, pathConstraintIndex) {
|
|
3247
3116
|
super(frameCount, bezierCount, [
|
|
3248
3117
|
Property.pathConstraintMix + "|" + pathConstraintIndex
|
|
3249
3118
|
]);
|
|
3250
|
-
this.
|
|
3119
|
+
this.constraintIndex = pathConstraintIndex;
|
|
3251
3120
|
}
|
|
3252
3121
|
getFrameEntries() {
|
|
3253
3122
|
return 4;
|
|
@@ -3270,7 +3139,7 @@ var spine = (() => {
|
|
|
3270
3139
|
] = mixY;
|
|
3271
3140
|
}
|
|
3272
3141
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
3273
|
-
let constraint = skeleton.pathConstraints[this.
|
|
3142
|
+
let constraint = skeleton.pathConstraints[this.constraintIndex];
|
|
3274
3143
|
if (!constraint.active)
|
|
3275
3144
|
return;
|
|
3276
3145
|
let frames = this.frames;
|
|
@@ -3377,6 +3246,196 @@ var spine = (() => {
|
|
|
3377
3246
|
}
|
|
3378
3247
|
}
|
|
3379
3248
|
};
|
|
3249
|
+
var PhysicsConstraintTimeline = class extends CurveTimeline1 {
|
|
3250
|
+
/** The index of the physics constraint in {@link Skeleton#getPhysicsConstraints()} that will be changed when this timeline
|
|
3251
|
+
* is applied, or -1 if all physics constraints in the skeleton will be changed. */
|
|
3252
|
+
constraintIndex = 0;
|
|
3253
|
+
/** @param physicsConstraintIndex -1 for all physics constraints in the skeleton. */
|
|
3254
|
+
constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
|
|
3255
|
+
super(frameCount, bezierCount, property + "|" + physicsConstraintIndex);
|
|
3256
|
+
this.constraintIndex = physicsConstraintIndex;
|
|
3257
|
+
}
|
|
3258
|
+
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
3259
|
+
let constraint;
|
|
3260
|
+
if (this.constraintIndex == -1) {
|
|
3261
|
+
const value = time >= this.frames[0] ? this.getCurveValue(time) : 0;
|
|
3262
|
+
for (const constraint2 of skeleton.physicsConstraints) {
|
|
3263
|
+
if (constraint2.active && this.global(constraint2.data))
|
|
3264
|
+
this.set(constraint2, this.getAbsoluteValue2(time, alpha, blend, this.get(constraint2), this.setup(constraint2), value));
|
|
3265
|
+
}
|
|
3266
|
+
} else {
|
|
3267
|
+
constraint = skeleton.physicsConstraints[this.constraintIndex];
|
|
3268
|
+
if (constraint.active)
|
|
3269
|
+
this.set(constraint, this.getAbsoluteValue(time, alpha, blend, this.get(constraint), this.setup(constraint)));
|
|
3270
|
+
}
|
|
3271
|
+
}
|
|
3272
|
+
};
|
|
3273
|
+
var PhysicsConstraintInertiaTimeline = class extends PhysicsConstraintTimeline {
|
|
3274
|
+
constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
|
|
3275
|
+
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintInertia);
|
|
3276
|
+
}
|
|
3277
|
+
setup(constraint) {
|
|
3278
|
+
return constraint.data.inertia;
|
|
3279
|
+
}
|
|
3280
|
+
get(constraint) {
|
|
3281
|
+
return constraint.inertia;
|
|
3282
|
+
}
|
|
3283
|
+
set(constraint, value) {
|
|
3284
|
+
constraint.inertia = value;
|
|
3285
|
+
}
|
|
3286
|
+
global(constraint) {
|
|
3287
|
+
return constraint.inertiaGlobal;
|
|
3288
|
+
}
|
|
3289
|
+
};
|
|
3290
|
+
var PhysicsConstraintStrengthTimeline = class extends PhysicsConstraintTimeline {
|
|
3291
|
+
constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
|
|
3292
|
+
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintStrength);
|
|
3293
|
+
}
|
|
3294
|
+
setup(constraint) {
|
|
3295
|
+
return constraint.data.strength;
|
|
3296
|
+
}
|
|
3297
|
+
get(constraint) {
|
|
3298
|
+
return constraint.strength;
|
|
3299
|
+
}
|
|
3300
|
+
set(constraint, value) {
|
|
3301
|
+
constraint.strength = value;
|
|
3302
|
+
}
|
|
3303
|
+
global(constraint) {
|
|
3304
|
+
return constraint.strengthGlobal;
|
|
3305
|
+
}
|
|
3306
|
+
};
|
|
3307
|
+
var PhysicsConstraintDampingTimeline = class extends PhysicsConstraintTimeline {
|
|
3308
|
+
constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
|
|
3309
|
+
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintDamping);
|
|
3310
|
+
}
|
|
3311
|
+
setup(constraint) {
|
|
3312
|
+
return constraint.data.damping;
|
|
3313
|
+
}
|
|
3314
|
+
get(constraint) {
|
|
3315
|
+
return constraint.damping;
|
|
3316
|
+
}
|
|
3317
|
+
set(constraint, value) {
|
|
3318
|
+
constraint.damping = value;
|
|
3319
|
+
}
|
|
3320
|
+
global(constraint) {
|
|
3321
|
+
return constraint.dampingGlobal;
|
|
3322
|
+
}
|
|
3323
|
+
};
|
|
3324
|
+
var PhysicsConstraintMassTimeline = class extends PhysicsConstraintTimeline {
|
|
3325
|
+
constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
|
|
3326
|
+
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintMass);
|
|
3327
|
+
}
|
|
3328
|
+
setup(constraint) {
|
|
3329
|
+
return 1 / constraint.data.massInverse;
|
|
3330
|
+
}
|
|
3331
|
+
get(constraint) {
|
|
3332
|
+
return 1 / constraint.massInverse;
|
|
3333
|
+
}
|
|
3334
|
+
set(constraint, value) {
|
|
3335
|
+
constraint.massInverse = 1 / value;
|
|
3336
|
+
}
|
|
3337
|
+
global(constraint) {
|
|
3338
|
+
return constraint.massGlobal;
|
|
3339
|
+
}
|
|
3340
|
+
};
|
|
3341
|
+
var PhysicsConstraintWindTimeline = class extends PhysicsConstraintTimeline {
|
|
3342
|
+
constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
|
|
3343
|
+
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintWind);
|
|
3344
|
+
}
|
|
3345
|
+
setup(constraint) {
|
|
3346
|
+
return constraint.data.wind;
|
|
3347
|
+
}
|
|
3348
|
+
get(constraint) {
|
|
3349
|
+
return constraint.wind;
|
|
3350
|
+
}
|
|
3351
|
+
set(constraint, value) {
|
|
3352
|
+
constraint.wind = value;
|
|
3353
|
+
}
|
|
3354
|
+
global(constraint) {
|
|
3355
|
+
return constraint.windGlobal;
|
|
3356
|
+
}
|
|
3357
|
+
};
|
|
3358
|
+
var PhysicsConstraintGravityTimeline = class extends PhysicsConstraintTimeline {
|
|
3359
|
+
constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
|
|
3360
|
+
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintGravity);
|
|
3361
|
+
}
|
|
3362
|
+
setup(constraint) {
|
|
3363
|
+
return constraint.data.gravity;
|
|
3364
|
+
}
|
|
3365
|
+
get(constraint) {
|
|
3366
|
+
return constraint.gravity;
|
|
3367
|
+
}
|
|
3368
|
+
set(constraint, value) {
|
|
3369
|
+
constraint.gravity = value;
|
|
3370
|
+
}
|
|
3371
|
+
global(constraint) {
|
|
3372
|
+
return constraint.gravityGlobal;
|
|
3373
|
+
}
|
|
3374
|
+
};
|
|
3375
|
+
var PhysicsConstraintMixTimeline = class extends PhysicsConstraintTimeline {
|
|
3376
|
+
constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
|
|
3377
|
+
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintMix);
|
|
3378
|
+
}
|
|
3379
|
+
setup(constraint) {
|
|
3380
|
+
return constraint.data.mix;
|
|
3381
|
+
}
|
|
3382
|
+
get(constraint) {
|
|
3383
|
+
return constraint.mix;
|
|
3384
|
+
}
|
|
3385
|
+
set(constraint, value) {
|
|
3386
|
+
constraint.mix = value;
|
|
3387
|
+
}
|
|
3388
|
+
global(constraint) {
|
|
3389
|
+
return constraint.mixGlobal;
|
|
3390
|
+
}
|
|
3391
|
+
};
|
|
3392
|
+
var _PhysicsConstraintResetTimeline = class extends Timeline {
|
|
3393
|
+
/** The index of the physics constraint in {@link Skeleton#getPhysicsConstraints()} that will be reset when this timeline is
|
|
3394
|
+
* applied, or -1 if all physics constraints in the skeleton will be reset. */
|
|
3395
|
+
constraintIndex;
|
|
3396
|
+
/** @param physicsConstraintIndex -1 for all physics constraints in the skeleton. */
|
|
3397
|
+
constructor(frameCount, physicsConstraintIndex) {
|
|
3398
|
+
super(frameCount, _PhysicsConstraintResetTimeline.propertyIds);
|
|
3399
|
+
this.constraintIndex = physicsConstraintIndex;
|
|
3400
|
+
}
|
|
3401
|
+
getFrameCount() {
|
|
3402
|
+
return this.frames.length;
|
|
3403
|
+
}
|
|
3404
|
+
/** Sets the time for the specified frame.
|
|
3405
|
+
* @param frame Between 0 and <code>frameCount</code>, inclusive. */
|
|
3406
|
+
setFrame(frame, time) {
|
|
3407
|
+
this.frames[frame] = time;
|
|
3408
|
+
}
|
|
3409
|
+
/** Resets the physics constraint when frames > <code>lastTime</code> and <= <code>time</code>. */
|
|
3410
|
+
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
3411
|
+
let constraint;
|
|
3412
|
+
if (this.constraintIndex != -1) {
|
|
3413
|
+
constraint = skeleton.physicsConstraints[this.constraintIndex];
|
|
3414
|
+
if (!constraint.active)
|
|
3415
|
+
return;
|
|
3416
|
+
}
|
|
3417
|
+
const frames = this.frames;
|
|
3418
|
+
if (lastTime > time) {
|
|
3419
|
+
this.apply(skeleton, lastTime, Number.MAX_VALUE, [], alpha, blend, direction);
|
|
3420
|
+
lastTime = -1;
|
|
3421
|
+
} else if (lastTime >= frames[frames.length - 1])
|
|
3422
|
+
return;
|
|
3423
|
+
if (time < frames[0])
|
|
3424
|
+
return;
|
|
3425
|
+
if (lastTime < frames[0] || time >= frames[Timeline.search1(frames, lastTime) + 1]) {
|
|
3426
|
+
if (constraint != null)
|
|
3427
|
+
constraint.reset();
|
|
3428
|
+
else {
|
|
3429
|
+
for (const constraint2 of skeleton.physicsConstraints) {
|
|
3430
|
+
if (constraint2.active)
|
|
3431
|
+
constraint2.reset();
|
|
3432
|
+
}
|
|
3433
|
+
}
|
|
3434
|
+
}
|
|
3435
|
+
}
|
|
3436
|
+
};
|
|
3437
|
+
var PhysicsConstraintResetTimeline = _PhysicsConstraintResetTimeline;
|
|
3438
|
+
__publicField(PhysicsConstraintResetTimeline, "propertyIds", [Property.physicsConstraintReset.toString()]);
|
|
3380
3439
|
var _SequenceTimeline = class extends Timeline {
|
|
3381
3440
|
slotIndex;
|
|
3382
3441
|
attachment;
|
|
@@ -3583,11 +3642,12 @@ var spine = (() => {
|
|
|
3583
3642
|
continue;
|
|
3584
3643
|
applied = true;
|
|
3585
3644
|
let blend = i2 == 0 ? 1 /* first */ : current.mixBlend;
|
|
3586
|
-
let
|
|
3645
|
+
let alpha = current.alpha;
|
|
3587
3646
|
if (current.mixingFrom)
|
|
3588
|
-
|
|
3647
|
+
alpha *= this.applyMixingFrom(current, skeleton, blend);
|
|
3589
3648
|
else if (current.trackTime >= current.trackEnd && !current.next)
|
|
3590
|
-
|
|
3649
|
+
alpha = 0;
|
|
3650
|
+
let attachments = alpha >= current.alphaAttachmentThreshold;
|
|
3591
3651
|
let animationLast = current.animationLast, animationTime = current.getAnimationTime(), applyTime = animationTime;
|
|
3592
3652
|
let applyEvents = events;
|
|
3593
3653
|
if (current.reverse) {
|
|
@@ -3596,14 +3656,16 @@ var spine = (() => {
|
|
|
3596
3656
|
}
|
|
3597
3657
|
let timelines = current.animation.timelines;
|
|
3598
3658
|
let timelineCount = timelines.length;
|
|
3599
|
-
if (i2 == 0 &&
|
|
3659
|
+
if (i2 == 0 && alpha == 1 || blend == 3 /* add */) {
|
|
3660
|
+
if (i2 == 0)
|
|
3661
|
+
attachments = true;
|
|
3600
3662
|
for (let ii = 0; ii < timelineCount; ii++) {
|
|
3601
|
-
Utils.webkit602BugfixHelper(
|
|
3663
|
+
Utils.webkit602BugfixHelper(alpha, blend);
|
|
3602
3664
|
var timeline = timelines[ii];
|
|
3603
3665
|
if (timeline instanceof AttachmentTimeline)
|
|
3604
|
-
this.applyAttachmentTimeline(timeline, skeleton, applyTime, blend,
|
|
3666
|
+
this.applyAttachmentTimeline(timeline, skeleton, applyTime, blend, attachments);
|
|
3605
3667
|
else
|
|
3606
|
-
timeline.apply(skeleton, animationLast, applyTime, applyEvents,
|
|
3668
|
+
timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, blend, 0 /* mixIn */);
|
|
3607
3669
|
}
|
|
3608
3670
|
} else {
|
|
3609
3671
|
let timelineMode = current.timelineMode;
|
|
@@ -3615,12 +3677,12 @@ var spine = (() => {
|
|
|
3615
3677
|
let timeline2 = timelines[ii];
|
|
3616
3678
|
let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend : 0 /* setup */;
|
|
3617
3679
|
if (!shortestRotation && timeline2 instanceof RotateTimeline) {
|
|
3618
|
-
this.applyRotateTimeline(timeline2, skeleton, applyTime,
|
|
3680
|
+
this.applyRotateTimeline(timeline2, skeleton, applyTime, alpha, timelineBlend, current.timelinesRotation, ii << 1, firstFrame);
|
|
3619
3681
|
} else if (timeline2 instanceof AttachmentTimeline) {
|
|
3620
|
-
this.applyAttachmentTimeline(timeline2, skeleton, applyTime, blend,
|
|
3682
|
+
this.applyAttachmentTimeline(timeline2, skeleton, applyTime, blend, attachments);
|
|
3621
3683
|
} else {
|
|
3622
|
-
Utils.webkit602BugfixHelper(
|
|
3623
|
-
timeline2.apply(skeleton, animationLast, applyTime, applyEvents,
|
|
3684
|
+
Utils.webkit602BugfixHelper(alpha, blend);
|
|
3685
|
+
timeline2.apply(skeleton, animationLast, applyTime, applyEvents, alpha, timelineBlend, 0 /* mixIn */);
|
|
3624
3686
|
}
|
|
3625
3687
|
}
|
|
3626
3688
|
}
|
|
@@ -3658,7 +3720,7 @@ var spine = (() => {
|
|
|
3658
3720
|
if (blend != 1 /* first */)
|
|
3659
3721
|
blend = from.mixBlend;
|
|
3660
3722
|
}
|
|
3661
|
-
let attachments = mix < from.
|
|
3723
|
+
let attachments = mix < from.mixAttachmentThreshold, drawOrder = mix < from.mixDrawOrderThreshold;
|
|
3662
3724
|
let timelines = from.animation.timelines;
|
|
3663
3725
|
let timelineCount = timelines.length;
|
|
3664
3726
|
let alphaHold = from.alpha * to.interruptAlpha, alphaMix = alphaHold * (1 - mix);
|
|
@@ -3713,7 +3775,7 @@ var spine = (() => {
|
|
|
3713
3775
|
if (!shortestRotation && timeline instanceof RotateTimeline)
|
|
3714
3776
|
this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, timelineBlend, from.timelinesRotation, i << 1, firstFrame);
|
|
3715
3777
|
else if (timeline instanceof AttachmentTimeline)
|
|
3716
|
-
this.applyAttachmentTimeline(timeline, skeleton, applyTime, timelineBlend, attachments);
|
|
3778
|
+
this.applyAttachmentTimeline(timeline, skeleton, applyTime, timelineBlend, attachments && alpha >= from.alphaAttachmentThreshold);
|
|
3717
3779
|
else {
|
|
3718
3780
|
Utils.webkit602BugfixHelper(alpha, blend);
|
|
3719
3781
|
if (drawOrder && timeline instanceof DrawOrderTimeline && timelineBlend == 0 /* setup */)
|
|
@@ -3773,7 +3835,7 @@ var spine = (() => {
|
|
|
3773
3835
|
r2 = bone.data.rotation + timeline.getCurveValue(time);
|
|
3774
3836
|
}
|
|
3775
3837
|
let total = 0, diff = r2 - r1;
|
|
3776
|
-
diff -= (
|
|
3838
|
+
diff -= Math.ceil(diff / 360 - 0.5) * 360;
|
|
3777
3839
|
if (diff == 0) {
|
|
3778
3840
|
total = timelinesRotation[i];
|
|
3779
3841
|
} else {
|
|
@@ -4030,8 +4092,9 @@ var spine = (() => {
|
|
|
4030
4092
|
entry.reverse = false;
|
|
4031
4093
|
entry.shortestRotation = false;
|
|
4032
4094
|
entry.eventThreshold = 0;
|
|
4033
|
-
entry.
|
|
4034
|
-
entry.
|
|
4095
|
+
entry.alphaAttachmentThreshold = 0;
|
|
4096
|
+
entry.mixAttachmentThreshold = 0;
|
|
4097
|
+
entry.mixDrawOrderThreshold = 0;
|
|
4035
4098
|
entry.animationStart = 0;
|
|
4036
4099
|
entry.animationEnd = animation.duration;
|
|
4037
4100
|
entry.animationLast = -1;
|
|
@@ -4189,11 +4252,14 @@ var spine = (() => {
|
|
|
4189
4252
|
/** When the mix percentage ({@link #mixtime} / {@link #mixDuration}) is less than the
|
|
4190
4253
|
* `attachmentThreshold`, attachment timelines are applied while this animation is being mixed out. Defaults to
|
|
4191
4254
|
* 0, so attachment timelines are not applied while this animation is being mixed out. */
|
|
4192
|
-
|
|
4193
|
-
/** When
|
|
4194
|
-
*
|
|
4195
|
-
|
|
4196
|
-
|
|
4255
|
+
mixAttachmentThreshold = 0;
|
|
4256
|
+
/** When {@link #getAlpha()} is greater than <code>alphaAttachmentThreshold</code>, attachment timelines are applied.
|
|
4257
|
+
* Defaults to 0, so attachment timelines are always applied. */
|
|
4258
|
+
alphaAttachmentThreshold = 0;
|
|
4259
|
+
/** When the mix percentage ({@link #getMixTime()} / {@link #getMixDuration()}) is less than the
|
|
4260
|
+
* <code>mixDrawOrderThreshold</code>, draw order timelines are applied while this animation is being mixed out. Defaults to
|
|
4261
|
+
* 0, so draw order timelines are not applied while this animation is being mixed out. */
|
|
4262
|
+
mixDrawOrderThreshold = 0;
|
|
4197
4263
|
/** Seconds when this animation starts, both initially and after looping. Defaults to 0.
|
|
4198
4264
|
*
|
|
4199
4265
|
* When changing the `animationStart` time, it often makes sense to set {@link #animationLast} to the same
|
|
@@ -4263,9 +4329,18 @@ var spine = (() => {
|
|
|
4263
4329
|
* When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
|
|
4264
4330
|
* {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set
|
|
4265
4331
|
* afterward. */
|
|
4266
|
-
|
|
4332
|
+
_mixDuration = 0;
|
|
4267
4333
|
interruptAlpha = 0;
|
|
4268
4334
|
totalAlpha = 0;
|
|
4335
|
+
get mixDuration() {
|
|
4336
|
+
return this._mixDuration;
|
|
4337
|
+
}
|
|
4338
|
+
set mixDuration(mixDuration) {
|
|
4339
|
+
this._mixDuration = mixDuration;
|
|
4340
|
+
if (this.previous != null && this.delay <= 0)
|
|
4341
|
+
this.delay += this.previous.getTrackComplete() - mixDuration;
|
|
4342
|
+
this.delay = this.delay;
|
|
4343
|
+
}
|
|
4269
4344
|
/** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
|
|
4270
4345
|
* replaces the values from the lower tracks with the animation values. {@link MixBlend#add} adds the animation values to
|
|
4271
4346
|
* the values from the lower tracks.
|
|
@@ -4329,6 +4404,12 @@ var spine = (() => {
|
|
|
4329
4404
|
}
|
|
4330
4405
|
return this.trackTime;
|
|
4331
4406
|
}
|
|
4407
|
+
/** Returns true if this track entry has been applied at least once.
|
|
4408
|
+
* <p>
|
|
4409
|
+
* See {@link AnimationState#apply(Skeleton)}. */
|
|
4410
|
+
wasApplied() {
|
|
4411
|
+
return this.nextTrackLast != -1;
|
|
4412
|
+
}
|
|
4332
4413
|
};
|
|
4333
4414
|
var EventQueue = class {
|
|
4334
4415
|
objects = [];
|
|
@@ -5029,10 +5110,10 @@ var spine = (() => {
|
|
|
5029
5110
|
return point;
|
|
5030
5111
|
}
|
|
5031
5112
|
computeWorldRotation(bone) {
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
return
|
|
5113
|
+
const r = this.rotation * MathUtils.degRad, cos = Math.cos(r), sin = Math.sin(r);
|
|
5114
|
+
const x = cos * bone.a + sin * bone.b;
|
|
5115
|
+
const y = cos * bone.c + sin * bone.d;
|
|
5116
|
+
return MathUtils.atan2Deg(y, x);
|
|
5036
5117
|
}
|
|
5037
5118
|
copy() {
|
|
5038
5119
|
let copy = new PointAttachment(this.name);
|
|
@@ -5099,7 +5180,7 @@ var spine = (() => {
|
|
|
5099
5180
|
let localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
|
5100
5181
|
let localX2 = localX + this.region.width * regionScaleX;
|
|
5101
5182
|
let localY2 = localY + this.region.height * regionScaleY;
|
|
5102
|
-
let radians = this.rotation *
|
|
5183
|
+
let radians = this.rotation * MathUtils.degRad;
|
|
5103
5184
|
let cos = Math.cos(radians);
|
|
5104
5185
|
let sin = Math.sin(radians);
|
|
5105
5186
|
let x = this.x, y = this.y;
|
|
@@ -5295,7 +5376,7 @@ var spine = (() => {
|
|
|
5295
5376
|
x = 0;
|
|
5296
5377
|
/** The local y translation. */
|
|
5297
5378
|
y = 0;
|
|
5298
|
-
/** The local rotation. */
|
|
5379
|
+
/** The local rotation in degrees, counter clockwise. */
|
|
5299
5380
|
rotation = 0;
|
|
5300
5381
|
/** The local scaleX. */
|
|
5301
5382
|
scaleX = 1;
|
|
@@ -5314,6 +5395,10 @@ var spine = (() => {
|
|
|
5314
5395
|
/** The color of the bone as it was in Spine. Available only when nonessential data was exported. Bones are not usually
|
|
5315
5396
|
* rendered at runtime. */
|
|
5316
5397
|
color = new Color();
|
|
5398
|
+
/** The bone icon as it was in Spine, or null if nonessential data was not exported. */
|
|
5399
|
+
icon;
|
|
5400
|
+
/** False if the bone was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
|
|
5401
|
+
visible = false;
|
|
5317
5402
|
constructor(index, name, parent) {
|
|
5318
5403
|
if (index < 0)
|
|
5319
5404
|
throw new Error("index must be >= 0.");
|
|
@@ -5402,7 +5487,7 @@ var spine = (() => {
|
|
|
5402
5487
|
return this.active;
|
|
5403
5488
|
}
|
|
5404
5489
|
/** Computes the world transform using the parent bone and this bone's local applied transform. */
|
|
5405
|
-
update() {
|
|
5490
|
+
update(physics) {
|
|
5406
5491
|
this.updateWorldTransformWith(this.ax, this.ay, this.arotation, this.ascaleX, this.ascaleY, this.ashearX, this.ashearY);
|
|
5407
5492
|
}
|
|
5408
5493
|
/** Computes the world transform using the parent bone and this bone's local transform.
|
|
@@ -5427,13 +5512,13 @@ var spine = (() => {
|
|
|
5427
5512
|
let parent = this.parent;
|
|
5428
5513
|
if (!parent) {
|
|
5429
5514
|
let skeleton = this.skeleton;
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
this.a =
|
|
5434
|
-
this.b =
|
|
5435
|
-
this.c =
|
|
5436
|
-
this.d =
|
|
5515
|
+
const sx = skeleton.scaleX, sy = skeleton.scaleY;
|
|
5516
|
+
const rx = (rotation + shearX) * MathUtils.degRad;
|
|
5517
|
+
const ry = (rotation + 90 + shearY) * MathUtils.degRad;
|
|
5518
|
+
this.a = Math.cos(rx) * scaleX * sx;
|
|
5519
|
+
this.b = Math.cos(ry) * scaleY * sx;
|
|
5520
|
+
this.c = Math.sin(rx) * scaleX * sy;
|
|
5521
|
+
this.d = Math.sin(ry) * scaleY * sy;
|
|
5437
5522
|
this.worldX = x * sx + skeleton.x;
|
|
5438
5523
|
this.worldY = y * sy + skeleton.y;
|
|
5439
5524
|
return;
|
|
@@ -5443,11 +5528,12 @@ var spine = (() => {
|
|
|
5443
5528
|
this.worldY = pc * x + pd * y + parent.worldY;
|
|
5444
5529
|
switch (this.data.transformMode) {
|
|
5445
5530
|
case 0 /* Normal */: {
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5531
|
+
const rx = (rotation + shearX) * MathUtils.degRad;
|
|
5532
|
+
const ry = (rotation + 90 + shearY) * MathUtils.degRad;
|
|
5533
|
+
const la = Math.cos(rx) * scaleX;
|
|
5534
|
+
const lb = Math.cos(ry) * scaleY;
|
|
5535
|
+
const lc = Math.sin(rx) * scaleX;
|
|
5536
|
+
const ld = Math.sin(ry) * scaleY;
|
|
5451
5537
|
this.a = pa * la + pb * lc;
|
|
5452
5538
|
this.b = pa * lb + pb * ld;
|
|
5453
5539
|
this.c = pc * la + pd * lc;
|
|
@@ -5455,11 +5541,12 @@ var spine = (() => {
|
|
|
5455
5541
|
return;
|
|
5456
5542
|
}
|
|
5457
5543
|
case 1 /* OnlyTranslation */: {
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
this.
|
|
5461
|
-
this.
|
|
5462
|
-
this.
|
|
5544
|
+
const rx = (rotation + shearX) * MathUtils.degRad;
|
|
5545
|
+
const ry = (rotation + 90 + shearY) * MathUtils.degRad;
|
|
5546
|
+
this.a = Math.cos(rx) * scaleX;
|
|
5547
|
+
this.b = Math.cos(ry) * scaleY;
|
|
5548
|
+
this.c = Math.sin(rx) * scaleX;
|
|
5549
|
+
this.d = Math.sin(ry) * scaleY;
|
|
5463
5550
|
break;
|
|
5464
5551
|
}
|
|
5465
5552
|
case 2 /* NoRotationOrReflection */: {
|
|
@@ -5477,12 +5564,12 @@ var spine = (() => {
|
|
|
5477
5564
|
pc = 0;
|
|
5478
5565
|
prx = 90 - Math.atan2(pd, pb) * MathUtils.radDeg;
|
|
5479
5566
|
}
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5567
|
+
const rx = (rotation + shearX - prx) * MathUtils.degRad;
|
|
5568
|
+
const ry = (rotation + shearY - prx + 90) * MathUtils.degRad;
|
|
5569
|
+
const la = Math.cos(rx) * scaleX;
|
|
5570
|
+
const lb = Math.cos(ry) * scaleY;
|
|
5571
|
+
const lc = Math.sin(rx) * scaleX;
|
|
5572
|
+
const ld = Math.sin(ry) * scaleY;
|
|
5486
5573
|
this.a = pa * la - pb * lc;
|
|
5487
5574
|
this.b = pa * lb - pb * ld;
|
|
5488
5575
|
this.c = pc * la + pd * lc;
|
|
@@ -5491,8 +5578,8 @@ var spine = (() => {
|
|
|
5491
5578
|
}
|
|
5492
5579
|
case 3 /* NoScale */:
|
|
5493
5580
|
case 4 /* NoScaleOrReflection */: {
|
|
5494
|
-
|
|
5495
|
-
|
|
5581
|
+
rotation *= MathUtils.degRad;
|
|
5582
|
+
const cos = Math.cos(rotation), sin = Math.sin(rotation);
|
|
5496
5583
|
let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
5497
5584
|
let zc = (pc * cos + pd * sin) / this.skeleton.scaleY;
|
|
5498
5585
|
let s = Math.sqrt(za * za + zc * zc);
|
|
@@ -5503,13 +5590,15 @@ var spine = (() => {
|
|
|
5503
5590
|
s = Math.sqrt(za * za + zc * zc);
|
|
5504
5591
|
if (this.data.transformMode == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
5505
5592
|
s = -s;
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5593
|
+
rotation = Math.PI / 2 + Math.atan2(zc, za);
|
|
5594
|
+
const zb = Math.cos(rotation) * s;
|
|
5595
|
+
const zd = Math.sin(rotation) * s;
|
|
5596
|
+
shearX *= MathUtils.degRad;
|
|
5597
|
+
shearY = (90 + shearY) * MathUtils.degRad;
|
|
5598
|
+
const la = Math.cos(shearX) * scaleX;
|
|
5599
|
+
const lb = Math.cos(shearY) * scaleY;
|
|
5600
|
+
const lc = Math.sin(shearX) * scaleX;
|
|
5601
|
+
const ld = Math.sin(shearY) * scaleY;
|
|
5513
5602
|
this.a = za * la + zb * lc;
|
|
5514
5603
|
this.b = za * lb + zb * ld;
|
|
5515
5604
|
this.c = zc * la + zd * lc;
|
|
@@ -5533,22 +5622,6 @@ var spine = (() => {
|
|
|
5533
5622
|
this.shearX = data.shearX;
|
|
5534
5623
|
this.shearY = data.shearY;
|
|
5535
5624
|
}
|
|
5536
|
-
/** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */
|
|
5537
|
-
getWorldRotationX() {
|
|
5538
|
-
return Math.atan2(this.c, this.a) * MathUtils.radDeg;
|
|
5539
|
-
}
|
|
5540
|
-
/** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */
|
|
5541
|
-
getWorldRotationY() {
|
|
5542
|
-
return Math.atan2(this.d, this.b) * MathUtils.radDeg;
|
|
5543
|
-
}
|
|
5544
|
-
/** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */
|
|
5545
|
-
getWorldScaleX() {
|
|
5546
|
-
return Math.sqrt(this.a * this.a + this.c * this.c);
|
|
5547
|
-
}
|
|
5548
|
-
/** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */
|
|
5549
|
-
getWorldScaleY() {
|
|
5550
|
-
return Math.sqrt(this.b * this.b + this.d * this.d);
|
|
5551
|
-
}
|
|
5552
5625
|
/** Computes the applied transform values from the world transform.
|
|
5553
5626
|
*
|
|
5554
5627
|
* If the world transform is modified (by a constraint, {@link #rotateWorld(float)}, etc) then this method should be called so
|
|
@@ -5635,6 +5708,22 @@ var spine = (() => {
|
|
|
5635
5708
|
this.arotation = 90 - Math.atan2(rd, rb) * MathUtils.radDeg;
|
|
5636
5709
|
}
|
|
5637
5710
|
}
|
|
5711
|
+
/** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */
|
|
5712
|
+
getWorldRotationX() {
|
|
5713
|
+
return Math.atan2(this.c, this.a) * MathUtils.radDeg;
|
|
5714
|
+
}
|
|
5715
|
+
/** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */
|
|
5716
|
+
getWorldRotationY() {
|
|
5717
|
+
return Math.atan2(this.d, this.b) * MathUtils.radDeg;
|
|
5718
|
+
}
|
|
5719
|
+
/** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */
|
|
5720
|
+
getWorldScaleX() {
|
|
5721
|
+
return Math.sqrt(this.a * this.a + this.c * this.c);
|
|
5722
|
+
}
|
|
5723
|
+
/** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */
|
|
5724
|
+
getWorldScaleY() {
|
|
5725
|
+
return Math.sqrt(this.b * this.b + this.d * this.d);
|
|
5726
|
+
}
|
|
5638
5727
|
/** Transforms a point from world coordinates to the bone's local coordinates. */
|
|
5639
5728
|
worldToLocal(world) {
|
|
5640
5729
|
let invDet = 1 / (this.a * this.d - this.b * this.c);
|
|
@@ -5650,6 +5739,18 @@ var spine = (() => {
|
|
|
5650
5739
|
local.y = x * this.c + y * this.d + this.worldY;
|
|
5651
5740
|
return local;
|
|
5652
5741
|
}
|
|
5742
|
+
/** Transforms a point from world coordinates to the parent bone's local coordinates. */
|
|
5743
|
+
worldToParent(world) {
|
|
5744
|
+
if (world == null)
|
|
5745
|
+
throw new Error("world cannot be null.");
|
|
5746
|
+
return this.parent == null ? world : this.parent.worldToLocal(world);
|
|
5747
|
+
}
|
|
5748
|
+
/** Transforms a point from the parent bone's coordinates to world coordinates. */
|
|
5749
|
+
parentToWorld(world) {
|
|
5750
|
+
if (world == null)
|
|
5751
|
+
throw new Error("world cannot be null.");
|
|
5752
|
+
return this.parent == null ? world : this.parent.localToWorld(world);
|
|
5753
|
+
}
|
|
5653
5754
|
/** Transforms a world rotation to a local rotation. */
|
|
5654
5755
|
worldToLocalRotation(worldRotation) {
|
|
5655
5756
|
let sin = MathUtils.sinDeg(worldRotation), cos = MathUtils.cosDeg(worldRotation);
|
|
@@ -5663,15 +5764,16 @@ var spine = (() => {
|
|
|
5663
5764
|
}
|
|
5664
5765
|
/** Rotates the world transform the specified amount.
|
|
5665
5766
|
* <p>
|
|
5666
|
-
* After changes are made to the world transform, {@link #updateAppliedTransform()} should be called and
|
|
5667
|
-
* need to be called on any child bones, recursively. */
|
|
5767
|
+
* After changes are made to the world transform, {@link #updateAppliedTransform()} should be called and
|
|
5768
|
+
* {@link #update(Physics)} will need to be called on any child bones, recursively. */
|
|
5668
5769
|
rotateWorld(degrees) {
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
this.
|
|
5673
|
-
this.
|
|
5674
|
-
this.
|
|
5770
|
+
degrees *= MathUtils.degRad;
|
|
5771
|
+
const sin = Math.sin(degrees), cos = Math.cos(degrees);
|
|
5772
|
+
const ra = this.a, rb = this.b;
|
|
5773
|
+
this.a = cos * ra - sin * this.c;
|
|
5774
|
+
this.b = cos * rb - sin * this.d;
|
|
5775
|
+
this.c = sin * ra + cos * this.c;
|
|
5776
|
+
this.d = sin * rb + cos * this.d;
|
|
5675
5777
|
}
|
|
5676
5778
|
};
|
|
5677
5779
|
|
|
@@ -6061,7 +6163,15 @@ var spine = (() => {
|
|
|
6061
6163
|
isActive() {
|
|
6062
6164
|
return this.active;
|
|
6063
6165
|
}
|
|
6064
|
-
|
|
6166
|
+
setToSetupPose() {
|
|
6167
|
+
const data = this.data;
|
|
6168
|
+
this.mix = data.mix;
|
|
6169
|
+
this.softness = data.softness;
|
|
6170
|
+
this.bendDirection = data.bendDirection;
|
|
6171
|
+
this.compress = data.compress;
|
|
6172
|
+
this.stretch = data.stretch;
|
|
6173
|
+
}
|
|
6174
|
+
update(physics) {
|
|
6065
6175
|
if (this.mix == 0)
|
|
6066
6176
|
return;
|
|
6067
6177
|
let target = this.target;
|
|
@@ -6120,12 +6230,15 @@ var spine = (() => {
|
|
|
6120
6230
|
tx = targetX - bone.worldX;
|
|
6121
6231
|
ty = targetY - bone.worldY;
|
|
6122
6232
|
}
|
|
6123
|
-
|
|
6124
|
-
if (
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6233
|
+
const b = bone.data.length * sx;
|
|
6234
|
+
if (b > 1e-4) {
|
|
6235
|
+
const dd = tx * tx + ty * ty;
|
|
6236
|
+
if (compress && dd < b * b || stretch && dd > b * b) {
|
|
6237
|
+
const s = (Math.sqrt(dd) / b - 1) * alpha + 1;
|
|
6238
|
+
sx *= s;
|
|
6239
|
+
if (uniform)
|
|
6240
|
+
sy *= s;
|
|
6241
|
+
}
|
|
6129
6242
|
}
|
|
6130
6243
|
}
|
|
6131
6244
|
bone.updateWorldTransformWith(
|
|
@@ -6426,7 +6539,15 @@ var spine = (() => {
|
|
|
6426
6539
|
isActive() {
|
|
6427
6540
|
return this.active;
|
|
6428
6541
|
}
|
|
6429
|
-
|
|
6542
|
+
setToSetupPose() {
|
|
6543
|
+
const data = this.data;
|
|
6544
|
+
this.position = data.position;
|
|
6545
|
+
this.spacing = data.spacing;
|
|
6546
|
+
this.mixRotate = data.mixRotate;
|
|
6547
|
+
this.mixX = data.mixX;
|
|
6548
|
+
this.mixY = data.mixY;
|
|
6549
|
+
}
|
|
6550
|
+
update(physics) {
|
|
6430
6551
|
let attachment = this.target.getAttachment();
|
|
6431
6552
|
if (!(attachment instanceof PathAttachment))
|
|
6432
6553
|
return;
|
|
@@ -6445,12 +6566,8 @@ var spine = (() => {
|
|
|
6445
6566
|
for (let i = 0, n = spacesCount - 1; i < n; i++) {
|
|
6446
6567
|
let bone = bones[i];
|
|
6447
6568
|
let setupLength = bone.data.length;
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
else {
|
|
6451
|
-
let x = setupLength * bone.a, y = setupLength * bone.c;
|
|
6452
|
-
lengths[i] = Math.sqrt(x * x + y * y);
|
|
6453
|
-
}
|
|
6569
|
+
let x = setupLength * bone.a, y = setupLength * bone.c;
|
|
6570
|
+
lengths[i] = Math.sqrt(x * x + y * y);
|
|
6454
6571
|
}
|
|
6455
6572
|
}
|
|
6456
6573
|
Utils.arrayFill(spaces, 1, spacesCount, spacing);
|
|
@@ -6825,6 +6942,238 @@ var spine = (() => {
|
|
|
6825
6942
|
__publicField(PathConstraint, "AFTER", -3);
|
|
6826
6943
|
__publicField(PathConstraint, "epsilon", 1e-5);
|
|
6827
6944
|
|
|
6945
|
+
// spine-core/src/PhysicsConstraint.ts
|
|
6946
|
+
var PhysicsConstraint = class {
|
|
6947
|
+
data;
|
|
6948
|
+
_bone = null;
|
|
6949
|
+
/** The bone constrained by this physics constraint. */
|
|
6950
|
+
set bone(bone) {
|
|
6951
|
+
this._bone = bone;
|
|
6952
|
+
}
|
|
6953
|
+
get bone() {
|
|
6954
|
+
if (!this._bone)
|
|
6955
|
+
throw new Error("Bone not set.");
|
|
6956
|
+
else
|
|
6957
|
+
return this._bone;
|
|
6958
|
+
}
|
|
6959
|
+
inertia = 0;
|
|
6960
|
+
strength = 0;
|
|
6961
|
+
damping = 0;
|
|
6962
|
+
massInverse = 0;
|
|
6963
|
+
wind = 0;
|
|
6964
|
+
gravity = 0;
|
|
6965
|
+
mix = 0;
|
|
6966
|
+
_reset = true;
|
|
6967
|
+
ux = 0;
|
|
6968
|
+
uy = 0;
|
|
6969
|
+
cx = 0;
|
|
6970
|
+
cy = 0;
|
|
6971
|
+
tx = 0;
|
|
6972
|
+
ty = 0;
|
|
6973
|
+
xOffset = 0;
|
|
6974
|
+
xVelocity = 0;
|
|
6975
|
+
yOffset = 0;
|
|
6976
|
+
yVelocity = 0;
|
|
6977
|
+
rotateOffset = 0;
|
|
6978
|
+
rotateVelocity = 0;
|
|
6979
|
+
scaleOffset = 0;
|
|
6980
|
+
scaleVelocity = 0;
|
|
6981
|
+
active = false;
|
|
6982
|
+
skeleton;
|
|
6983
|
+
remaining = 0;
|
|
6984
|
+
lastTime = 0;
|
|
6985
|
+
constructor(data, skeleton) {
|
|
6986
|
+
this.data = data;
|
|
6987
|
+
this.skeleton = skeleton;
|
|
6988
|
+
this.bone = skeleton.bones[data.bone.index];
|
|
6989
|
+
this.inertia = data.inertia;
|
|
6990
|
+
this.strength = data.strength;
|
|
6991
|
+
this.damping = data.damping;
|
|
6992
|
+
this.massInverse = data.massInverse;
|
|
6993
|
+
this.wind = data.wind;
|
|
6994
|
+
this.gravity = data.gravity;
|
|
6995
|
+
this.mix = data.mix;
|
|
6996
|
+
}
|
|
6997
|
+
reset() {
|
|
6998
|
+
this.remaining = 0;
|
|
6999
|
+
this.lastTime = this.skeleton.time;
|
|
7000
|
+
this._reset = true;
|
|
7001
|
+
this.xOffset = 0;
|
|
7002
|
+
this.xVelocity = 0;
|
|
7003
|
+
this.yOffset = 0;
|
|
7004
|
+
this.yVelocity = 0;
|
|
7005
|
+
this.rotateOffset = 0;
|
|
7006
|
+
this.rotateVelocity = 0;
|
|
7007
|
+
this.scaleOffset = 0;
|
|
7008
|
+
this.scaleVelocity = 0;
|
|
7009
|
+
}
|
|
7010
|
+
setToSetupPose() {
|
|
7011
|
+
const data = this.data;
|
|
7012
|
+
this.inertia = data.inertia;
|
|
7013
|
+
this.strength = data.strength;
|
|
7014
|
+
this.damping = data.damping;
|
|
7015
|
+
this.massInverse = data.massInverse;
|
|
7016
|
+
this.wind = data.wind;
|
|
7017
|
+
this.gravity = data.gravity;
|
|
7018
|
+
this.mix = data.mix;
|
|
7019
|
+
}
|
|
7020
|
+
isActive() {
|
|
7021
|
+
return this.active;
|
|
7022
|
+
}
|
|
7023
|
+
/** Applies the constraint to the constrained bones. */
|
|
7024
|
+
update(physics) {
|
|
7025
|
+
const mix = this.mix;
|
|
7026
|
+
if (mix == 0)
|
|
7027
|
+
return;
|
|
7028
|
+
const x = this.data.x > 0, y = this.data.y > 0, rotateOrShearX = this.data.rotate > 0 || this.data.shearX > 0, scaleX = this.data.scaleX > 0;
|
|
7029
|
+
const bone = this.bone;
|
|
7030
|
+
const l = bone.data.length;
|
|
7031
|
+
switch (physics) {
|
|
7032
|
+
case 0 /* none */:
|
|
7033
|
+
return;
|
|
7034
|
+
case 1 /* reset */:
|
|
7035
|
+
this.reset();
|
|
7036
|
+
case 2 /* update */:
|
|
7037
|
+
this.remaining += Math.max(this.skeleton.time - this.lastTime, 0);
|
|
7038
|
+
this.lastTime = this.skeleton.time;
|
|
7039
|
+
const bx = bone.worldX, by = bone.worldY;
|
|
7040
|
+
if (this._reset) {
|
|
7041
|
+
this._reset = false;
|
|
7042
|
+
this.ux = bx;
|
|
7043
|
+
this.uy = by;
|
|
7044
|
+
} else {
|
|
7045
|
+
let remaining = this.remaining, i = this.inertia, step = this.data.step;
|
|
7046
|
+
if (x || y) {
|
|
7047
|
+
if (x) {
|
|
7048
|
+
this.xOffset += (this.ux - bx) * i;
|
|
7049
|
+
this.ux = bx;
|
|
7050
|
+
}
|
|
7051
|
+
if (y) {
|
|
7052
|
+
this.yOffset += (this.uy - by) * i;
|
|
7053
|
+
this.uy = by;
|
|
7054
|
+
}
|
|
7055
|
+
if (remaining >= step) {
|
|
7056
|
+
const m = this.massInverse * step, e = this.strength, w = this.wind * 100, g = this.gravity * -100;
|
|
7057
|
+
const d = Math.pow(this.damping, 60 * step);
|
|
7058
|
+
do {
|
|
7059
|
+
if (x) {
|
|
7060
|
+
this.xVelocity += (w - this.xOffset * e) * m;
|
|
7061
|
+
this.xOffset += this.xVelocity * step;
|
|
7062
|
+
this.xVelocity *= d;
|
|
7063
|
+
}
|
|
7064
|
+
if (y) {
|
|
7065
|
+
this.yVelocity += (g - this.yOffset * e) * m;
|
|
7066
|
+
this.yOffset += this.yVelocity * step;
|
|
7067
|
+
this.yVelocity *= d;
|
|
7068
|
+
}
|
|
7069
|
+
remaining -= step;
|
|
7070
|
+
} while (remaining >= step);
|
|
7071
|
+
}
|
|
7072
|
+
if (x)
|
|
7073
|
+
bone.worldX += this.xOffset * mix * this.data.x;
|
|
7074
|
+
if (y)
|
|
7075
|
+
bone.worldY += this.yOffset * mix * this.data.y;
|
|
7076
|
+
}
|
|
7077
|
+
if (rotateOrShearX || scaleX) {
|
|
7078
|
+
let ca = Math.atan2(bone.c, bone.a), c = 0, s = 0, mr = 0;
|
|
7079
|
+
if (rotateOrShearX) {
|
|
7080
|
+
mr = mix * this.data.rotate;
|
|
7081
|
+
let dx = this.cx - bone.worldX, dy = this.cy - bone.worldY, r = Math.atan2(dy + this.ty, dx + this.tx) - ca - this.rotateOffset * mr;
|
|
7082
|
+
this.rotateOffset += (r - Math.ceil(r * MathUtils.invPI2 - 0.5) * MathUtils.PI2) * i;
|
|
7083
|
+
r = this.rotateOffset * mr + ca;
|
|
7084
|
+
c = Math.cos(r);
|
|
7085
|
+
s = Math.sin(r);
|
|
7086
|
+
if (scaleX) {
|
|
7087
|
+
r = l * bone.getWorldScaleX();
|
|
7088
|
+
if (r > 0)
|
|
7089
|
+
this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
7090
|
+
}
|
|
7091
|
+
} else {
|
|
7092
|
+
c = Math.cos(ca);
|
|
7093
|
+
s = Math.sin(ca);
|
|
7094
|
+
const r = l * bone.getWorldScaleX();
|
|
7095
|
+
if (r > 0)
|
|
7096
|
+
this.scaleOffset += ((this.cx - bone.worldX) * c + (this.cy - bone.worldY) * s) * i / r;
|
|
7097
|
+
}
|
|
7098
|
+
remaining = this.remaining;
|
|
7099
|
+
if (remaining >= step) {
|
|
7100
|
+
const m = this.massInverse * step, e = this.strength, w = this.wind, g = this.gravity;
|
|
7101
|
+
const d = Math.pow(this.damping, 60 * step);
|
|
7102
|
+
while (true) {
|
|
7103
|
+
remaining -= step;
|
|
7104
|
+
if (scaleX) {
|
|
7105
|
+
this.scaleVelocity += (w * c - g * s - this.scaleOffset * e) * m;
|
|
7106
|
+
this.scaleOffset += this.scaleVelocity * step;
|
|
7107
|
+
this.scaleVelocity *= d;
|
|
7108
|
+
}
|
|
7109
|
+
if (rotateOrShearX) {
|
|
7110
|
+
this.rotateVelocity += (-0.01 * l * (w * s + g * c) - this.rotateOffset * e) * m;
|
|
7111
|
+
this.rotateOffset += this.rotateVelocity * step;
|
|
7112
|
+
this.rotateVelocity *= d;
|
|
7113
|
+
if (remaining < step)
|
|
7114
|
+
break;
|
|
7115
|
+
const r = this.rotateOffset * mr + ca;
|
|
7116
|
+
c = Math.cos(r);
|
|
7117
|
+
s = Math.sin(r);
|
|
7118
|
+
} else if (remaining < step)
|
|
7119
|
+
break;
|
|
7120
|
+
}
|
|
7121
|
+
}
|
|
7122
|
+
}
|
|
7123
|
+
this.remaining = remaining;
|
|
7124
|
+
}
|
|
7125
|
+
this.cx = bone.worldX;
|
|
7126
|
+
this.cy = bone.worldY;
|
|
7127
|
+
break;
|
|
7128
|
+
case 3 /* pose */:
|
|
7129
|
+
if (x)
|
|
7130
|
+
bone.worldX += this.xOffset * mix * this.data.x;
|
|
7131
|
+
if (y)
|
|
7132
|
+
bone.worldY += this.yOffset * mix * this.data.y;
|
|
7133
|
+
}
|
|
7134
|
+
if (rotateOrShearX) {
|
|
7135
|
+
let o = this.rotateOffset * mix, s = 0, c = 0, a = 0;
|
|
7136
|
+
if (this.data.shearX > 0) {
|
|
7137
|
+
let r = 0;
|
|
7138
|
+
if (this.data.rotate > 0) {
|
|
7139
|
+
r = o * this.data.rotate;
|
|
7140
|
+
s = Math.sin(r);
|
|
7141
|
+
c = Math.cos(r);
|
|
7142
|
+
a = bone.b;
|
|
7143
|
+
bone.b = c * a - s * bone.d;
|
|
7144
|
+
bone.d = s * a + c * bone.d;
|
|
7145
|
+
}
|
|
7146
|
+
r += o * this.data.shearX;
|
|
7147
|
+
s = Math.sin(r);
|
|
7148
|
+
c = Math.cos(r);
|
|
7149
|
+
a = bone.a;
|
|
7150
|
+
bone.a = c * a - s * bone.c;
|
|
7151
|
+
bone.c = s * a + c * bone.c;
|
|
7152
|
+
} else {
|
|
7153
|
+
o *= this.data.rotate;
|
|
7154
|
+
s = Math.sin(o);
|
|
7155
|
+
c = Math.cos(o);
|
|
7156
|
+
a = bone.a;
|
|
7157
|
+
bone.a = c * a - s * bone.c;
|
|
7158
|
+
bone.c = s * a + c * bone.c;
|
|
7159
|
+
a = bone.b;
|
|
7160
|
+
bone.b = c * a - s * bone.d;
|
|
7161
|
+
bone.d = s * a + c * bone.d;
|
|
7162
|
+
}
|
|
7163
|
+
}
|
|
7164
|
+
if (scaleX) {
|
|
7165
|
+
const s = 1 + this.scaleOffset * mix * this.data.scaleX;
|
|
7166
|
+
bone.a *= s;
|
|
7167
|
+
bone.c *= s;
|
|
7168
|
+
}
|
|
7169
|
+
if (physics != 3 /* pose */) {
|
|
7170
|
+
this.tx = l * bone.a;
|
|
7171
|
+
this.ty = l * bone.c;
|
|
7172
|
+
}
|
|
7173
|
+
bone.updateAppliedTransform();
|
|
7174
|
+
}
|
|
7175
|
+
};
|
|
7176
|
+
|
|
6828
7177
|
// spine-core/src/Slot.ts
|
|
6829
7178
|
var Slot = class {
|
|
6830
7179
|
/** The slot's setup pose data. */
|
|
@@ -6935,7 +7284,16 @@ var spine = (() => {
|
|
|
6935
7284
|
isActive() {
|
|
6936
7285
|
return this.active;
|
|
6937
7286
|
}
|
|
6938
|
-
|
|
7287
|
+
setToSetupPose() {
|
|
7288
|
+
const data = this.data;
|
|
7289
|
+
this.mixRotate = data.mixRotate;
|
|
7290
|
+
this.mixX = data.mixX;
|
|
7291
|
+
this.mixY = data.mixY;
|
|
7292
|
+
this.mixScaleX = data.mixScaleX;
|
|
7293
|
+
this.mixScaleY = data.mixScaleY;
|
|
7294
|
+
this.mixShearY = data.mixShearY;
|
|
7295
|
+
}
|
|
7296
|
+
update(physics) {
|
|
6939
7297
|
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
|
|
6940
7298
|
return;
|
|
6941
7299
|
if (this.data.local) {
|
|
@@ -7075,7 +7433,7 @@ var spine = (() => {
|
|
|
7075
7433
|
let rotation = bone.arotation;
|
|
7076
7434
|
if (mixRotate != 0) {
|
|
7077
7435
|
let r = target.arotation - rotation + this.data.offsetRotation;
|
|
7078
|
-
r -= (
|
|
7436
|
+
r -= Math.ceil(r / 360 - 0.5) * 360;
|
|
7079
7437
|
rotation += r * mixRotate;
|
|
7080
7438
|
}
|
|
7081
7439
|
let x = bone.ax, y = bone.ay;
|
|
@@ -7089,7 +7447,7 @@ var spine = (() => {
|
|
|
7089
7447
|
let shearY = bone.ashearY;
|
|
7090
7448
|
if (mixShearY != 0) {
|
|
7091
7449
|
let r = target.ashearY - shearY + this.data.offsetShearY;
|
|
7092
|
-
r -= (
|
|
7450
|
+
r -= Math.ceil(r / 360 - 0.5) * 360;
|
|
7093
7451
|
shearY += r * mixShearY;
|
|
7094
7452
|
}
|
|
7095
7453
|
bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
|
|
@@ -7128,6 +7486,8 @@ var spine = (() => {
|
|
|
7128
7486
|
transformConstraints;
|
|
7129
7487
|
/** The skeleton's path constraints. */
|
|
7130
7488
|
pathConstraints;
|
|
7489
|
+
/** The skeleton's physics constraints. */
|
|
7490
|
+
physicsConstraints;
|
|
7131
7491
|
/** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */
|
|
7132
7492
|
_updateCache = new Array();
|
|
7133
7493
|
/** The skeleton's current skin. May be null. */
|
|
@@ -7150,6 +7510,10 @@ var spine = (() => {
|
|
|
7150
7510
|
x = 0;
|
|
7151
7511
|
/** Sets the skeleton Y position, which is added to the root bone worldY position. */
|
|
7152
7512
|
y = 0;
|
|
7513
|
+
/** Returns the skeleton's time. This is used for time-based manipulations, such as {@link PhysicsConstraint}.
|
|
7514
|
+
* <p>
|
|
7515
|
+
* See {@link #update(float)}. */
|
|
7516
|
+
time = 0;
|
|
7153
7517
|
constructor(data) {
|
|
7154
7518
|
if (!data)
|
|
7155
7519
|
throw new Error("data cannot be null.");
|
|
@@ -7191,6 +7555,11 @@ var spine = (() => {
|
|
|
7191
7555
|
let pathConstraintData = data.pathConstraints[i];
|
|
7192
7556
|
this.pathConstraints.push(new PathConstraint(pathConstraintData, this));
|
|
7193
7557
|
}
|
|
7558
|
+
this.physicsConstraints = new Array();
|
|
7559
|
+
for (let i = 0; i < data.physicsConstraints.length; i++) {
|
|
7560
|
+
let physicsConstraintData = data.physicsConstraints[i];
|
|
7561
|
+
this.physicsConstraints.push(new PhysicsConstraint(physicsConstraintData, this));
|
|
7562
|
+
}
|
|
7194
7563
|
this.color = new Color(1, 1, 1, 1);
|
|
7195
7564
|
this.updateCache();
|
|
7196
7565
|
}
|
|
@@ -7219,8 +7588,9 @@ var spine = (() => {
|
|
|
7219
7588
|
let ikConstraints = this.ikConstraints;
|
|
7220
7589
|
let transformConstraints = this.transformConstraints;
|
|
7221
7590
|
let pathConstraints = this.pathConstraints;
|
|
7222
|
-
let
|
|
7223
|
-
let
|
|
7591
|
+
let physicsConstraints = this.physicsConstraints;
|
|
7592
|
+
let ikCount = ikConstraints.length, transformCount = transformConstraints.length, pathCount = pathConstraints.length, physicsCount = this.physicsConstraints.length;
|
|
7593
|
+
let constraintCount = ikCount + transformCount + pathCount + physicsCount;
|
|
7224
7594
|
outer:
|
|
7225
7595
|
for (let i = 0; i < constraintCount; i++) {
|
|
7226
7596
|
for (let ii = 0; ii < ikCount; ii++) {
|
|
@@ -7244,6 +7614,13 @@ var spine = (() => {
|
|
|
7244
7614
|
continue outer;
|
|
7245
7615
|
}
|
|
7246
7616
|
}
|
|
7617
|
+
for (let ii = 0; ii < physicsCount; ii++) {
|
|
7618
|
+
const constraint = physicsConstraints[ii];
|
|
7619
|
+
if (constraint.data.order == i) {
|
|
7620
|
+
this.sortPhysicsConstraint(constraint);
|
|
7621
|
+
continue outer;
|
|
7622
|
+
}
|
|
7623
|
+
}
|
|
7247
7624
|
}
|
|
7248
7625
|
for (let i = 0, n = bones.length; i < n; i++)
|
|
7249
7626
|
this.sortBone(bones[i]);
|
|
@@ -7342,6 +7719,16 @@ var spine = (() => {
|
|
|
7342
7719
|
}
|
|
7343
7720
|
}
|
|
7344
7721
|
}
|
|
7722
|
+
sortPhysicsConstraint(constraint) {
|
|
7723
|
+
const bone = constraint.bone;
|
|
7724
|
+
constraint.active = bone.active && !constraint.data.skinRequired || this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true);
|
|
7725
|
+
if (!constraint.active)
|
|
7726
|
+
return;
|
|
7727
|
+
this.sortBone(bone);
|
|
7728
|
+
this._updateCache.push(constraint);
|
|
7729
|
+
this.sortReset(bone.children);
|
|
7730
|
+
bone.sorted = true;
|
|
7731
|
+
}
|
|
7345
7732
|
sortBone(bone) {
|
|
7346
7733
|
if (!bone)
|
|
7347
7734
|
return;
|
|
@@ -7367,7 +7754,9 @@ var spine = (() => {
|
|
|
7367
7754
|
*
|
|
7368
7755
|
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
|
7369
7756
|
* Runtimes Guide. */
|
|
7370
|
-
updateWorldTransform() {
|
|
7757
|
+
updateWorldTransform(physics) {
|
|
7758
|
+
if (!physics)
|
|
7759
|
+
throw new Error("physics is undefined");
|
|
7371
7760
|
let bones = this.bones;
|
|
7372
7761
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7373
7762
|
let bone = bones[i];
|
|
@@ -7381,20 +7770,21 @@ var spine = (() => {
|
|
|
7381
7770
|
}
|
|
7382
7771
|
let updateCache = this._updateCache;
|
|
7383
7772
|
for (let i = 0, n = updateCache.length; i < n; i++)
|
|
7384
|
-
updateCache[i].update();
|
|
7773
|
+
updateCache[i].update(physics);
|
|
7385
7774
|
}
|
|
7386
|
-
updateWorldTransformWith(parent) {
|
|
7775
|
+
updateWorldTransformWith(physics, parent) {
|
|
7387
7776
|
let rootBone = this.getRootBone();
|
|
7388
7777
|
if (!rootBone)
|
|
7389
7778
|
throw new Error("Root bone must not be null.");
|
|
7390
7779
|
let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
|
|
7391
7780
|
rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
|
|
7392
7781
|
rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7782
|
+
const rx = (rootBone.rotation + rootBone.shearX) * MathUtils.degRad;
|
|
7783
|
+
const ry = (rootBone.rotation + 90 + rootBone.shearY) * MathUtils.degRad;
|
|
7784
|
+
const la = Math.cos(rx) * rootBone.scaleX;
|
|
7785
|
+
const lb = Math.cos(ry) * rootBone.scaleY;
|
|
7786
|
+
const lc = Math.sin(rx) * rootBone.scaleX;
|
|
7787
|
+
const ld = Math.sin(ry) * rootBone.scaleY;
|
|
7398
7788
|
rootBone.a = (pa * la + pb * lc) * this.scaleX;
|
|
7399
7789
|
rootBone.b = (pa * lb + pb * ld) * this.scaleX;
|
|
7400
7790
|
rootBone.c = (pc * la + pd * lc) * this.scaleY;
|
|
@@ -7403,7 +7793,7 @@ var spine = (() => {
|
|
|
7403
7793
|
for (let i = 0, n = updateCache.length; i < n; i++) {
|
|
7404
7794
|
let updatable = updateCache[i];
|
|
7405
7795
|
if (updatable != rootBone)
|
|
7406
|
-
updatable.update();
|
|
7796
|
+
updatable.update(physics);
|
|
7407
7797
|
}
|
|
7408
7798
|
}
|
|
7409
7799
|
/** Sets the bones, constraints, and slots to their setup pose values. */
|
|
@@ -7413,39 +7803,16 @@ var spine = (() => {
|
|
|
7413
7803
|
}
|
|
7414
7804
|
/** Sets the bones and constraints to their setup pose values. */
|
|
7415
7805
|
setBonesToSetupPose() {
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
for (
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
constraint.
|
|
7424
|
-
|
|
7425
|
-
constraint.
|
|
7426
|
-
constraint.stretch = constraint.data.stretch;
|
|
7427
|
-
}
|
|
7428
|
-
let transformConstraints = this.transformConstraints;
|
|
7429
|
-
for (let i = 0, n = transformConstraints.length; i < n; i++) {
|
|
7430
|
-
let constraint = transformConstraints[i];
|
|
7431
|
-
let data = constraint.data;
|
|
7432
|
-
constraint.mixRotate = data.mixRotate;
|
|
7433
|
-
constraint.mixX = data.mixX;
|
|
7434
|
-
constraint.mixY = data.mixY;
|
|
7435
|
-
constraint.mixScaleX = data.mixScaleX;
|
|
7436
|
-
constraint.mixScaleY = data.mixScaleY;
|
|
7437
|
-
constraint.mixShearY = data.mixShearY;
|
|
7438
|
-
}
|
|
7439
|
-
let pathConstraints = this.pathConstraints;
|
|
7440
|
-
for (let i = 0, n = pathConstraints.length; i < n; i++) {
|
|
7441
|
-
let constraint = pathConstraints[i];
|
|
7442
|
-
let data = constraint.data;
|
|
7443
|
-
constraint.position = data.position;
|
|
7444
|
-
constraint.spacing = data.spacing;
|
|
7445
|
-
constraint.mixRotate = data.mixRotate;
|
|
7446
|
-
constraint.mixX = data.mixX;
|
|
7447
|
-
constraint.mixY = data.mixY;
|
|
7448
|
-
}
|
|
7806
|
+
for (const bone of this.bones)
|
|
7807
|
+
bone.setToSetupPose();
|
|
7808
|
+
for (const constraint of this.ikConstraints)
|
|
7809
|
+
constraint.setToSetupPose();
|
|
7810
|
+
for (const constraint of this.transformConstraints)
|
|
7811
|
+
constraint.setToSetupPose();
|
|
7812
|
+
for (const constraint of this.pathConstraints)
|
|
7813
|
+
constraint.setToSetupPose();
|
|
7814
|
+
for (const constraint of this.physicsConstraints)
|
|
7815
|
+
constraint.setToSetupPose();
|
|
7449
7816
|
}
|
|
7450
7817
|
/** Sets the slots and draw order to their setup pose values. */
|
|
7451
7818
|
setSlotsToSetupPose() {
|
|
@@ -7583,13 +7950,7 @@ var spine = (() => {
|
|
|
7583
7950
|
findIkConstraint(constraintName) {
|
|
7584
7951
|
if (!constraintName)
|
|
7585
7952
|
throw new Error("constraintName cannot be null.");
|
|
7586
|
-
|
|
7587
|
-
for (let i = 0, n = ikConstraints.length; i < n; i++) {
|
|
7588
|
-
let ikConstraint = ikConstraints[i];
|
|
7589
|
-
if (ikConstraint.data.name == constraintName)
|
|
7590
|
-
return ikConstraint;
|
|
7591
|
-
}
|
|
7592
|
-
return null;
|
|
7953
|
+
return this.ikConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
7593
7954
|
}
|
|
7594
7955
|
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
|
|
7595
7956
|
* this method than to call it repeatedly.
|
|
@@ -7597,13 +7958,7 @@ var spine = (() => {
|
|
|
7597
7958
|
findTransformConstraint(constraintName) {
|
|
7598
7959
|
if (!constraintName)
|
|
7599
7960
|
throw new Error("constraintName cannot be null.");
|
|
7600
|
-
|
|
7601
|
-
for (let i = 0, n = transformConstraints.length; i < n; i++) {
|
|
7602
|
-
let constraint = transformConstraints[i];
|
|
7603
|
-
if (constraint.data.name == constraintName)
|
|
7604
|
-
return constraint;
|
|
7605
|
-
}
|
|
7606
|
-
return null;
|
|
7961
|
+
return this.transformConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
7607
7962
|
}
|
|
7608
7963
|
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
|
|
7609
7964
|
* than to call it repeatedly.
|
|
@@ -7611,13 +7966,14 @@ var spine = (() => {
|
|
|
7611
7966
|
findPathConstraint(constraintName) {
|
|
7612
7967
|
if (!constraintName)
|
|
7613
7968
|
throw new Error("constraintName cannot be null.");
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7969
|
+
return this.pathConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
7970
|
+
}
|
|
7971
|
+
/** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this
|
|
7972
|
+
* method than to call it repeatedly. */
|
|
7973
|
+
findPhysicsConstraint(constraintName) {
|
|
7974
|
+
if (constraintName == null)
|
|
7975
|
+
throw new Error("constraintName cannot be null.");
|
|
7976
|
+
return this.physicsConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
7621
7977
|
}
|
|
7622
7978
|
/** 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 }`.
|
|
7623
7979
|
* Note that this method will create temporary objects which can add to garbage collection pressure. Use `getBounds()` if garbage collection is a concern. */
|
|
@@ -7668,9 +8024,20 @@ var spine = (() => {
|
|
|
7668
8024
|
offset.set(minX, minY);
|
|
7669
8025
|
size.set(maxX - minX, maxY - minY);
|
|
7670
8026
|
}
|
|
8027
|
+
/** Increments the skeleton's {@link #time}. */
|
|
8028
|
+
update(delta) {
|
|
8029
|
+
this.time += delta;
|
|
8030
|
+
}
|
|
7671
8031
|
};
|
|
7672
|
-
var
|
|
7673
|
-
__publicField(
|
|
8032
|
+
var Skeleton2 = _Skeleton;
|
|
8033
|
+
__publicField(Skeleton2, "yDown", false);
|
|
8034
|
+
var Physics = /* @__PURE__ */ ((Physics2) => {
|
|
8035
|
+
Physics2[Physics2["none"] = 0] = "none";
|
|
8036
|
+
Physics2[Physics2["reset"] = 1] = "reset";
|
|
8037
|
+
Physics2[Physics2["update"] = 2] = "update";
|
|
8038
|
+
Physics2[Physics2["pose"] = 3] = "pose";
|
|
8039
|
+
return Physics2;
|
|
8040
|
+
})(Physics || {});
|
|
7674
8041
|
|
|
7675
8042
|
// spine-core/src/SkeletonData.ts
|
|
7676
8043
|
var SkeletonData = class {
|
|
@@ -7698,6 +8065,8 @@ var spine = (() => {
|
|
|
7698
8065
|
transformConstraints = new Array();
|
|
7699
8066
|
/** The skeleton's path constraints. */
|
|
7700
8067
|
pathConstraints = new Array();
|
|
8068
|
+
/** The skeleton's physics constraints. */
|
|
8069
|
+
physicsConstraints = new Array();
|
|
7701
8070
|
/** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */
|
|
7702
8071
|
x = 0;
|
|
7703
8072
|
/** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */
|
|
@@ -7793,9 +8162,9 @@ var spine = (() => {
|
|
|
7793
8162
|
findIkConstraint(constraintName) {
|
|
7794
8163
|
if (!constraintName)
|
|
7795
8164
|
throw new Error("constraintName cannot be null.");
|
|
7796
|
-
|
|
8165
|
+
const ikConstraints = this.ikConstraints;
|
|
7797
8166
|
for (let i = 0, n = ikConstraints.length; i < n; i++) {
|
|
7798
|
-
|
|
8167
|
+
const constraint = ikConstraints[i];
|
|
7799
8168
|
if (constraint.name == constraintName)
|
|
7800
8169
|
return constraint;
|
|
7801
8170
|
}
|
|
@@ -7807,9 +8176,9 @@ var spine = (() => {
|
|
|
7807
8176
|
findTransformConstraint(constraintName) {
|
|
7808
8177
|
if (!constraintName)
|
|
7809
8178
|
throw new Error("constraintName cannot be null.");
|
|
7810
|
-
|
|
8179
|
+
const transformConstraints = this.transformConstraints;
|
|
7811
8180
|
for (let i = 0, n = transformConstraints.length; i < n; i++) {
|
|
7812
|
-
|
|
8181
|
+
const constraint = transformConstraints[i];
|
|
7813
8182
|
if (constraint.name == constraintName)
|
|
7814
8183
|
return constraint;
|
|
7815
8184
|
}
|
|
@@ -7821,9 +8190,23 @@ var spine = (() => {
|
|
|
7821
8190
|
findPathConstraint(constraintName) {
|
|
7822
8191
|
if (!constraintName)
|
|
7823
8192
|
throw new Error("constraintName cannot be null.");
|
|
7824
|
-
|
|
8193
|
+
const pathConstraints = this.pathConstraints;
|
|
7825
8194
|
for (let i = 0, n = pathConstraints.length; i < n; i++) {
|
|
7826
|
-
|
|
8195
|
+
const constraint = pathConstraints[i];
|
|
8196
|
+
if (constraint.name == constraintName)
|
|
8197
|
+
return constraint;
|
|
8198
|
+
}
|
|
8199
|
+
return null;
|
|
8200
|
+
}
|
|
8201
|
+
/** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this method
|
|
8202
|
+
* than to call it multiple times.
|
|
8203
|
+
* @return May be null. */
|
|
8204
|
+
findPhysicsConstraint(constraintName) {
|
|
8205
|
+
if (!constraintName)
|
|
8206
|
+
throw new Error("constraintName cannot be null.");
|
|
8207
|
+
const physicsConstraints = this.physicsConstraints;
|
|
8208
|
+
for (let i = 0, n = physicsConstraints.length; i < n; i++) {
|
|
8209
|
+
const constraint = physicsConstraints[i];
|
|
7827
8210
|
if (constraint.name == constraintName)
|
|
7828
8211
|
return constraint;
|
|
7829
8212
|
}
|
|
@@ -7845,6 +8228,9 @@ var spine = (() => {
|
|
|
7845
8228
|
attachments = new Array();
|
|
7846
8229
|
bones = Array();
|
|
7847
8230
|
constraints = new Array();
|
|
8231
|
+
/** The color of the skin as it was in Spine, or a default color if nonessential data was not exported. */
|
|
8232
|
+
color = new Color(0.99607843, 0.61960787, 0.30980393, 1);
|
|
8233
|
+
// fe9e4fff
|
|
7848
8234
|
constructor(name) {
|
|
7849
8235
|
if (!name)
|
|
7850
8236
|
throw new Error("name cannot be null.");
|
|
@@ -8018,6 +8404,8 @@ var spine = (() => {
|
|
|
8018
8404
|
attachmentName = null;
|
|
8019
8405
|
/** The blend mode for drawing the slot's attachment. */
|
|
8020
8406
|
blendMode = BlendMode.Normal;
|
|
8407
|
+
/** False if the slot was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
|
|
8408
|
+
visible = true;
|
|
8021
8409
|
constructor(index, name, boneData) {
|
|
8022
8410
|
if (index < 0)
|
|
8023
8411
|
throw new Error("index must be >= 0.");
|