@esotericsoftware/spine-webgl 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.
- package/dist/iife/spine-webgl.js +846 -458
- package/dist/iife/spine-webgl.js.map +4 -4
- package/dist/iife/spine-webgl.min.js +3 -3
- package/package.json +2 -2
package/dist/iife/spine-webgl.js
CHANGED
|
@@ -103,6 +103,16 @@ var spine = (() => {
|
|
|
103
103
|
PathConstraintMixTimeline: () => PathConstraintMixTimeline,
|
|
104
104
|
PathConstraintPositionTimeline: () => PathConstraintPositionTimeline,
|
|
105
105
|
PathConstraintSpacingTimeline: () => PathConstraintSpacingTimeline,
|
|
106
|
+
Physics: () => Physics,
|
|
107
|
+
PhysicsConstraintDampingTimeline: () => PhysicsConstraintDampingTimeline,
|
|
108
|
+
PhysicsConstraintGravityTimeline: () => PhysicsConstraintGravityTimeline,
|
|
109
|
+
PhysicsConstraintInertiaTimeline: () => PhysicsConstraintInertiaTimeline,
|
|
110
|
+
PhysicsConstraintMassTimeline: () => PhysicsConstraintMassTimeline,
|
|
111
|
+
PhysicsConstraintMixTimeline: () => PhysicsConstraintMixTimeline,
|
|
112
|
+
PhysicsConstraintResetTimeline: () => PhysicsConstraintResetTimeline,
|
|
113
|
+
PhysicsConstraintStrengthTimeline: () => PhysicsConstraintStrengthTimeline,
|
|
114
|
+
PhysicsConstraintTimeline: () => PhysicsConstraintTimeline,
|
|
115
|
+
PhysicsConstraintWindTimeline: () => PhysicsConstraintWindTimeline,
|
|
106
116
|
PointAttachment: () => PointAttachment,
|
|
107
117
|
PolygonBatcher: () => PolygonBatcher,
|
|
108
118
|
Pool: () => Pool,
|
|
@@ -132,7 +142,7 @@ var spine = (() => {
|
|
|
132
142
|
ShearTimeline: () => ShearTimeline,
|
|
133
143
|
ShearXTimeline: () => ShearXTimeline,
|
|
134
144
|
ShearYTimeline: () => ShearYTimeline,
|
|
135
|
-
Skeleton: () =>
|
|
145
|
+
Skeleton: () => Skeleton2,
|
|
136
146
|
SkeletonBinary: () => SkeletonBinary,
|
|
137
147
|
SkeletonBounds: () => SkeletonBounds,
|
|
138
148
|
SkeletonClipping: () => SkeletonClipping,
|
|
@@ -310,6 +320,9 @@ var spine = (() => {
|
|
|
310
320
|
static sinDeg(degrees) {
|
|
311
321
|
return Math.sin(degrees * _MathUtils.degRad);
|
|
312
322
|
}
|
|
323
|
+
static atan2Deg(y, x) {
|
|
324
|
+
return Math.atan2(y, x) * _MathUtils.degRad;
|
|
325
|
+
}
|
|
313
326
|
static signum(value) {
|
|
314
327
|
return value > 0 ? 1 : value < 0 ? -1 : 0;
|
|
315
328
|
}
|
|
@@ -337,6 +350,7 @@ var spine = (() => {
|
|
|
337
350
|
var MathUtils = _MathUtils;
|
|
338
351
|
__publicField(MathUtils, "PI", 3.1415927);
|
|
339
352
|
__publicField(MathUtils, "PI2", _MathUtils.PI * 2);
|
|
353
|
+
__publicField(MathUtils, "invPI2", 1 / _MathUtils.PI2);
|
|
340
354
|
__publicField(MathUtils, "radiansToDegrees", 180 / _MathUtils.PI);
|
|
341
355
|
__publicField(MathUtils, "radDeg", _MathUtils.radiansToDegrees);
|
|
342
356
|
__publicField(MathUtils, "degreesToRadians", _MathUtils.PI / 180);
|
|
@@ -812,7 +826,15 @@ var spine = (() => {
|
|
|
812
826
|
pathConstraintPosition: 16,
|
|
813
827
|
pathConstraintSpacing: 17,
|
|
814
828
|
pathConstraintMix: 18,
|
|
815
|
-
|
|
829
|
+
physicsConstraintInertia: 19,
|
|
830
|
+
physicsConstraintStrength: 20,
|
|
831
|
+
physicsConstraintDamping: 21,
|
|
832
|
+
physicsConstraintMass: 22,
|
|
833
|
+
physicsConstraintWind: 23,
|
|
834
|
+
physicsConstraintGravity: 24,
|
|
835
|
+
physicsConstraintMix: 25,
|
|
836
|
+
physicsConstraintReset: 26,
|
|
837
|
+
sequence: 27
|
|
816
838
|
};
|
|
817
839
|
var Timeline = class {
|
|
818
840
|
propertyIds;
|
|
@@ -990,6 +1012,94 @@ var spine = (() => {
|
|
|
990
1012
|
/*BEZIER*/
|
|
991
1013
|
);
|
|
992
1014
|
}
|
|
1015
|
+
getRelativeValue(time, alpha, blend, current, setup) {
|
|
1016
|
+
if (time < this.frames[0]) {
|
|
1017
|
+
switch (blend) {
|
|
1018
|
+
case 0 /* setup */:
|
|
1019
|
+
return setup;
|
|
1020
|
+
case 1 /* first */:
|
|
1021
|
+
return current + (setup - current) * alpha;
|
|
1022
|
+
}
|
|
1023
|
+
return current;
|
|
1024
|
+
}
|
|
1025
|
+
let value = this.getCurveValue(time);
|
|
1026
|
+
switch (blend) {
|
|
1027
|
+
case 0 /* setup */:
|
|
1028
|
+
return setup + value * alpha;
|
|
1029
|
+
case 1 /* first */:
|
|
1030
|
+
case 2 /* replace */:
|
|
1031
|
+
value += setup - current;
|
|
1032
|
+
}
|
|
1033
|
+
return current + value * alpha;
|
|
1034
|
+
}
|
|
1035
|
+
getAbsoluteValue(time, alpha, blend, current, setup) {
|
|
1036
|
+
if (time < this.frames[0]) {
|
|
1037
|
+
switch (blend) {
|
|
1038
|
+
case 0 /* setup */:
|
|
1039
|
+
return setup;
|
|
1040
|
+
case 1 /* first */:
|
|
1041
|
+
return current + (setup - current) * alpha;
|
|
1042
|
+
}
|
|
1043
|
+
return current;
|
|
1044
|
+
}
|
|
1045
|
+
let value = this.getCurveValue(time);
|
|
1046
|
+
if (blend == 0 /* setup */)
|
|
1047
|
+
return setup + (value - setup) * alpha;
|
|
1048
|
+
return current + (value - current) * alpha;
|
|
1049
|
+
}
|
|
1050
|
+
getAbsoluteValue2(time, alpha, blend, current, setup, value) {
|
|
1051
|
+
if (time < this.frames[0]) {
|
|
1052
|
+
switch (blend) {
|
|
1053
|
+
case 0 /* setup */:
|
|
1054
|
+
return setup;
|
|
1055
|
+
case 1 /* first */:
|
|
1056
|
+
return current + (setup - current) * alpha;
|
|
1057
|
+
}
|
|
1058
|
+
return current;
|
|
1059
|
+
}
|
|
1060
|
+
if (blend == 0 /* setup */)
|
|
1061
|
+
return setup + (value - setup) * alpha;
|
|
1062
|
+
return current + (value - current) * alpha;
|
|
1063
|
+
}
|
|
1064
|
+
getScaleValue(time, alpha, blend, direction, current, setup) {
|
|
1065
|
+
const frames = this.frames;
|
|
1066
|
+
if (time < frames[0]) {
|
|
1067
|
+
switch (blend) {
|
|
1068
|
+
case 0 /* setup */:
|
|
1069
|
+
return setup;
|
|
1070
|
+
case 1 /* first */:
|
|
1071
|
+
return current + (setup - current) * alpha;
|
|
1072
|
+
}
|
|
1073
|
+
return current;
|
|
1074
|
+
}
|
|
1075
|
+
let value = this.getCurveValue(time) * setup;
|
|
1076
|
+
if (alpha == 1) {
|
|
1077
|
+
if (blend == 3 /* add */)
|
|
1078
|
+
return current + value - setup;
|
|
1079
|
+
return value;
|
|
1080
|
+
}
|
|
1081
|
+
if (direction == 1 /* mixOut */) {
|
|
1082
|
+
switch (blend) {
|
|
1083
|
+
case 0 /* setup */:
|
|
1084
|
+
return setup + (Math.abs(value) * MathUtils.signum(setup) - setup) * alpha;
|
|
1085
|
+
case 1 /* first */:
|
|
1086
|
+
case 2 /* replace */:
|
|
1087
|
+
return current + (Math.abs(value) * MathUtils.signum(current) - current) * alpha;
|
|
1088
|
+
}
|
|
1089
|
+
} else {
|
|
1090
|
+
let s = 0;
|
|
1091
|
+
switch (blend) {
|
|
1092
|
+
case 0 /* setup */:
|
|
1093
|
+
s = Math.abs(setup) * MathUtils.signum(value);
|
|
1094
|
+
return s + (value - s) * alpha;
|
|
1095
|
+
case 1 /* first */:
|
|
1096
|
+
case 2 /* replace */:
|
|
1097
|
+
s = Math.abs(current) * MathUtils.signum(value);
|
|
1098
|
+
return s + (value - s) * alpha;
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
return current + (value - setup) * alpha;
|
|
1102
|
+
}
|
|
993
1103
|
};
|
|
994
1104
|
var CurveTimeline2 = class extends CurveTimeline {
|
|
995
1105
|
/** @param bezierCount The maximum number of Bezier curves. See {@link #shrink(int)}.
|
|
@@ -1024,30 +1134,8 @@ var spine = (() => {
|
|
|
1024
1134
|
}
|
|
1025
1135
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1026
1136
|
let bone = skeleton.bones[this.boneIndex];
|
|
1027
|
-
if (
|
|
1028
|
-
|
|
1029
|
-
let frames = this.frames;
|
|
1030
|
-
if (time < frames[0]) {
|
|
1031
|
-
switch (blend) {
|
|
1032
|
-
case 0 /* setup */:
|
|
1033
|
-
bone.rotation = bone.data.rotation;
|
|
1034
|
-
return;
|
|
1035
|
-
case 1 /* first */:
|
|
1036
|
-
bone.rotation += (bone.data.rotation - bone.rotation) * alpha;
|
|
1037
|
-
}
|
|
1038
|
-
return;
|
|
1039
|
-
}
|
|
1040
|
-
let r = this.getCurveValue(time);
|
|
1041
|
-
switch (blend) {
|
|
1042
|
-
case 0 /* setup */:
|
|
1043
|
-
bone.rotation = bone.data.rotation + r * alpha;
|
|
1044
|
-
break;
|
|
1045
|
-
case 1 /* first */:
|
|
1046
|
-
case 2 /* replace */:
|
|
1047
|
-
r += bone.data.rotation - bone.rotation;
|
|
1048
|
-
case 3 /* add */:
|
|
1049
|
-
bone.rotation += r * alpha;
|
|
1050
|
-
}
|
|
1137
|
+
if (bone.active)
|
|
1138
|
+
bone.rotation = this.getRelativeValue(time, alpha, blend, bone.rotation, bone.data.rotation);
|
|
1051
1139
|
}
|
|
1052
1140
|
};
|
|
1053
1141
|
var TranslateTimeline = class extends CurveTimeline2 {
|
|
@@ -1163,31 +1251,8 @@ var spine = (() => {
|
|
|
1163
1251
|
}
|
|
1164
1252
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1165
1253
|
let bone = skeleton.bones[this.boneIndex];
|
|
1166
|
-
if (
|
|
1167
|
-
|
|
1168
|
-
let frames = this.frames;
|
|
1169
|
-
if (time < frames[0]) {
|
|
1170
|
-
switch (blend) {
|
|
1171
|
-
case 0 /* setup */:
|
|
1172
|
-
bone.x = bone.data.x;
|
|
1173
|
-
return;
|
|
1174
|
-
case 1 /* first */:
|
|
1175
|
-
bone.x += (bone.data.x - bone.x) * alpha;
|
|
1176
|
-
}
|
|
1177
|
-
return;
|
|
1178
|
-
}
|
|
1179
|
-
let x = this.getCurveValue(time);
|
|
1180
|
-
switch (blend) {
|
|
1181
|
-
case 0 /* setup */:
|
|
1182
|
-
bone.x = bone.data.x + x * alpha;
|
|
1183
|
-
break;
|
|
1184
|
-
case 1 /* first */:
|
|
1185
|
-
case 2 /* replace */:
|
|
1186
|
-
bone.x += (bone.data.x + x - bone.x) * alpha;
|
|
1187
|
-
break;
|
|
1188
|
-
case 3 /* add */:
|
|
1189
|
-
bone.x += x * alpha;
|
|
1190
|
-
}
|
|
1254
|
+
if (bone.active)
|
|
1255
|
+
bone.x = this.getRelativeValue(time, alpha, blend, bone.x, bone.data.x);
|
|
1191
1256
|
}
|
|
1192
1257
|
};
|
|
1193
1258
|
var TranslateYTimeline = class extends CurveTimeline1 {
|
|
@@ -1198,31 +1263,8 @@ var spine = (() => {
|
|
|
1198
1263
|
}
|
|
1199
1264
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1200
1265
|
let bone = skeleton.bones[this.boneIndex];
|
|
1201
|
-
if (
|
|
1202
|
-
|
|
1203
|
-
let frames = this.frames;
|
|
1204
|
-
if (time < frames[0]) {
|
|
1205
|
-
switch (blend) {
|
|
1206
|
-
case 0 /* setup */:
|
|
1207
|
-
bone.y = bone.data.y;
|
|
1208
|
-
return;
|
|
1209
|
-
case 1 /* first */:
|
|
1210
|
-
bone.y += (bone.data.y - bone.y) * alpha;
|
|
1211
|
-
}
|
|
1212
|
-
return;
|
|
1213
|
-
}
|
|
1214
|
-
let y = this.getCurveValue(time);
|
|
1215
|
-
switch (blend) {
|
|
1216
|
-
case 0 /* setup */:
|
|
1217
|
-
bone.y = bone.data.y + y * alpha;
|
|
1218
|
-
break;
|
|
1219
|
-
case 1 /* first */:
|
|
1220
|
-
case 2 /* replace */:
|
|
1221
|
-
bone.y += (bone.data.y + y - bone.y) * alpha;
|
|
1222
|
-
break;
|
|
1223
|
-
case 3 /* add */:
|
|
1224
|
-
bone.y += y * alpha;
|
|
1225
|
-
}
|
|
1266
|
+
if (bone.active)
|
|
1267
|
+
bone.y = this.getRelativeValue(time, alpha, blend, bone.y, bone.data.y);
|
|
1226
1268
|
}
|
|
1227
1269
|
};
|
|
1228
1270
|
var ScaleTimeline = class extends CurveTimeline2 {
|
|
@@ -1376,57 +1418,8 @@ var spine = (() => {
|
|
|
1376
1418
|
}
|
|
1377
1419
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1378
1420
|
let bone = skeleton.bones[this.boneIndex];
|
|
1379
|
-
if (
|
|
1380
|
-
|
|
1381
|
-
let frames = this.frames;
|
|
1382
|
-
if (time < frames[0]) {
|
|
1383
|
-
switch (blend) {
|
|
1384
|
-
case 0 /* setup */:
|
|
1385
|
-
bone.scaleX = bone.data.scaleX;
|
|
1386
|
-
return;
|
|
1387
|
-
case 1 /* first */:
|
|
1388
|
-
bone.scaleX += (bone.data.scaleX - bone.scaleX) * alpha;
|
|
1389
|
-
}
|
|
1390
|
-
return;
|
|
1391
|
-
}
|
|
1392
|
-
let x = this.getCurveValue(time) * bone.data.scaleX;
|
|
1393
|
-
if (alpha == 1) {
|
|
1394
|
-
if (blend == 3 /* add */)
|
|
1395
|
-
bone.scaleX += x - bone.data.scaleX;
|
|
1396
|
-
else
|
|
1397
|
-
bone.scaleX = x;
|
|
1398
|
-
} else {
|
|
1399
|
-
let bx = 0;
|
|
1400
|
-
if (direction == 1 /* mixOut */) {
|
|
1401
|
-
switch (blend) {
|
|
1402
|
-
case 0 /* setup */:
|
|
1403
|
-
bx = bone.data.scaleX;
|
|
1404
|
-
bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
|
|
1405
|
-
break;
|
|
1406
|
-
case 1 /* first */:
|
|
1407
|
-
case 2 /* replace */:
|
|
1408
|
-
bx = bone.scaleX;
|
|
1409
|
-
bone.scaleX = bx + (Math.abs(x) * MathUtils.signum(bx) - bx) * alpha;
|
|
1410
|
-
break;
|
|
1411
|
-
case 3 /* add */:
|
|
1412
|
-
bone.scaleX += (x - bone.data.scaleX) * alpha;
|
|
1413
|
-
}
|
|
1414
|
-
} else {
|
|
1415
|
-
switch (blend) {
|
|
1416
|
-
case 0 /* setup */:
|
|
1417
|
-
bx = Math.abs(bone.data.scaleX) * MathUtils.signum(x);
|
|
1418
|
-
bone.scaleX = bx + (x - bx) * alpha;
|
|
1419
|
-
break;
|
|
1420
|
-
case 1 /* first */:
|
|
1421
|
-
case 2 /* replace */:
|
|
1422
|
-
bx = Math.abs(bone.scaleX) * MathUtils.signum(x);
|
|
1423
|
-
bone.scaleX = bx + (x - bx) * alpha;
|
|
1424
|
-
break;
|
|
1425
|
-
case 3 /* add */:
|
|
1426
|
-
bone.scaleX += (x - bone.data.scaleX) * alpha;
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
}
|
|
1421
|
+
if (bone.active)
|
|
1422
|
+
bone.scaleX = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleX);
|
|
1430
1423
|
}
|
|
1431
1424
|
};
|
|
1432
1425
|
var ScaleYTimeline = class extends CurveTimeline1 {
|
|
@@ -1437,57 +1430,8 @@ var spine = (() => {
|
|
|
1437
1430
|
}
|
|
1438
1431
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1439
1432
|
let bone = skeleton.bones[this.boneIndex];
|
|
1440
|
-
if (
|
|
1441
|
-
|
|
1442
|
-
let frames = this.frames;
|
|
1443
|
-
if (time < frames[0]) {
|
|
1444
|
-
switch (blend) {
|
|
1445
|
-
case 0 /* setup */:
|
|
1446
|
-
bone.scaleY = bone.data.scaleY;
|
|
1447
|
-
return;
|
|
1448
|
-
case 1 /* first */:
|
|
1449
|
-
bone.scaleY += (bone.data.scaleY - bone.scaleY) * alpha;
|
|
1450
|
-
}
|
|
1451
|
-
return;
|
|
1452
|
-
}
|
|
1453
|
-
let y = this.getCurveValue(time) * bone.data.scaleY;
|
|
1454
|
-
if (alpha == 1) {
|
|
1455
|
-
if (blend == 3 /* add */)
|
|
1456
|
-
bone.scaleY += y - bone.data.scaleY;
|
|
1457
|
-
else
|
|
1458
|
-
bone.scaleY = y;
|
|
1459
|
-
} else {
|
|
1460
|
-
let by = 0;
|
|
1461
|
-
if (direction == 1 /* mixOut */) {
|
|
1462
|
-
switch (blend) {
|
|
1463
|
-
case 0 /* setup */:
|
|
1464
|
-
by = bone.data.scaleY;
|
|
1465
|
-
bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
|
|
1466
|
-
break;
|
|
1467
|
-
case 1 /* first */:
|
|
1468
|
-
case 2 /* replace */:
|
|
1469
|
-
by = bone.scaleY;
|
|
1470
|
-
bone.scaleY = by + (Math.abs(y) * MathUtils.signum(by) - by) * alpha;
|
|
1471
|
-
break;
|
|
1472
|
-
case 3 /* add */:
|
|
1473
|
-
bone.scaleY += (y - bone.data.scaleY) * alpha;
|
|
1474
|
-
}
|
|
1475
|
-
} else {
|
|
1476
|
-
switch (blend) {
|
|
1477
|
-
case 0 /* setup */:
|
|
1478
|
-
by = Math.abs(bone.data.scaleY) * MathUtils.signum(y);
|
|
1479
|
-
bone.scaleY = by + (y - by) * alpha;
|
|
1480
|
-
break;
|
|
1481
|
-
case 1 /* first */:
|
|
1482
|
-
case 2 /* replace */:
|
|
1483
|
-
by = Math.abs(bone.scaleY) * MathUtils.signum(y);
|
|
1484
|
-
bone.scaleY = by + (y - by) * alpha;
|
|
1485
|
-
break;
|
|
1486
|
-
case 3 /* add */:
|
|
1487
|
-
bone.scaleY += (y - bone.data.scaleY) * alpha;
|
|
1488
|
-
}
|
|
1489
|
-
}
|
|
1490
|
-
}
|
|
1433
|
+
if (bone.active)
|
|
1434
|
+
bone.scaleY = this.getScaleValue(time, alpha, blend, direction, bone.scaleX, bone.data.scaleY);
|
|
1491
1435
|
}
|
|
1492
1436
|
};
|
|
1493
1437
|
var ShearTimeline = class extends CurveTimeline2 {
|
|
@@ -1603,31 +1547,8 @@ var spine = (() => {
|
|
|
1603
1547
|
}
|
|
1604
1548
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1605
1549
|
let bone = skeleton.bones[this.boneIndex];
|
|
1606
|
-
if (
|
|
1607
|
-
|
|
1608
|
-
let frames = this.frames;
|
|
1609
|
-
if (time < frames[0]) {
|
|
1610
|
-
switch (blend) {
|
|
1611
|
-
case 0 /* setup */:
|
|
1612
|
-
bone.shearX = bone.data.shearX;
|
|
1613
|
-
return;
|
|
1614
|
-
case 1 /* first */:
|
|
1615
|
-
bone.shearX += (bone.data.shearX - bone.shearX) * alpha;
|
|
1616
|
-
}
|
|
1617
|
-
return;
|
|
1618
|
-
}
|
|
1619
|
-
let x = this.getCurveValue(time);
|
|
1620
|
-
switch (blend) {
|
|
1621
|
-
case 0 /* setup */:
|
|
1622
|
-
bone.shearX = bone.data.shearX + x * alpha;
|
|
1623
|
-
break;
|
|
1624
|
-
case 1 /* first */:
|
|
1625
|
-
case 2 /* replace */:
|
|
1626
|
-
bone.shearX += (bone.data.shearX + x - bone.shearX) * alpha;
|
|
1627
|
-
break;
|
|
1628
|
-
case 3 /* add */:
|
|
1629
|
-
bone.shearX += x * alpha;
|
|
1630
|
-
}
|
|
1550
|
+
if (bone.active)
|
|
1551
|
+
bone.shearX = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearX);
|
|
1631
1552
|
}
|
|
1632
1553
|
};
|
|
1633
1554
|
var ShearYTimeline = class extends CurveTimeline1 {
|
|
@@ -1638,31 +1559,8 @@ var spine = (() => {
|
|
|
1638
1559
|
}
|
|
1639
1560
|
apply(skeleton, lastTime, time, events, alpha, blend, direction) {
|
|
1640
1561
|
let bone = skeleton.bones[this.boneIndex];
|
|
1641
|
-
if (
|
|
1642
|
-
|
|
1643
|
-
let frames = this.frames;
|
|
1644
|
-
if (time < frames[0]) {
|
|
1645
|
-
switch (blend) {
|
|
1646
|
-
case 0 /* setup */:
|
|
1647
|
-
bone.shearY = bone.data.shearY;
|
|
1648
|
-
return;
|
|
1649
|
-
case 1 /* first */:
|
|
1650
|
-
bone.shearY += (bone.data.shearY - bone.shearY) * alpha;
|
|
1651
|
-
}
|
|
1652
|
-
return;
|
|
1653
|
-
}
|
|
1654
|
-
let y = this.getCurveValue(time);
|
|
1655
|
-
switch (blend) {
|
|
1656
|
-
case 0 /* setup */:
|
|
1657
|
-
bone.shearY = bone.data.shearY + y * alpha;
|
|
1658
|
-
break;
|
|
1659
|
-
case 1 /* first */:
|
|
1660
|
-
case 2 /* replace */:
|
|
1661
|
-
bone.shearY += (bone.data.shearY + y - bone.shearY) * alpha;
|
|
1662
|
-
break;
|
|
1663
|
-
case 3 /* add */:
|
|
1664
|
-
bone.shearY += y * alpha;
|
|
1665
|
-
}
|
|
1562
|
+
if (bone.active)
|
|
1563
|
+
bone.shearY = this.getRelativeValue(time, alpha, blend, bone.shearX, bone.data.shearY);
|
|
1666
1564
|
}
|
|
1667
1565
|
};
|
|
1668
1566
|
var RGBATimeline = class extends CurveTimeline {
|
|
@@ -2838,13 +2736,13 @@ var spine = (() => {
|
|
|
2838
2736
|
var DrawOrderTimeline = _DrawOrderTimeline;
|
|
2839
2737
|
__publicField(DrawOrderTimeline, "propertyIds", ["" + Property.drawOrder]);
|
|
2840
2738
|
var IkConstraintTimeline = class extends CurveTimeline {
|
|
2841
|
-
/** The index of the IK constraint
|
|
2842
|
-
|
|
2739
|
+
/** The index of the IK constraint in {@link Skeleton#getIkConstraints()} that will be changed when this timeline is */
|
|
2740
|
+
constraintIndex = 0;
|
|
2843
2741
|
constructor(frameCount, bezierCount, ikConstraintIndex) {
|
|
2844
2742
|
super(frameCount, bezierCount, [
|
|
2845
2743
|
Property.ikConstraint + "|" + ikConstraintIndex
|
|
2846
2744
|
]);
|
|
2847
|
-
this.
|
|
2745
|
+
this.constraintIndex = ikConstraintIndex;
|
|
2848
2746
|
}
|
|
2849
2747
|
getFrameEntries() {
|
|
2850
2748
|
return 6;
|
|
@@ -2875,7 +2773,7 @@ var spine = (() => {
|
|
|
2875
2773
|
] = stretch ? 1 : 0;
|
|
2876
2774
|
}
|
|
2877
2775
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
2878
|
-
let constraint = skeleton.ikConstraints[this.
|
|
2776
|
+
let constraint = skeleton.ikConstraints[this.constraintIndex];
|
|
2879
2777
|
if (!constraint.active)
|
|
2880
2778
|
return;
|
|
2881
2779
|
let frames = this.frames;
|
|
@@ -3001,12 +2899,12 @@ var spine = (() => {
|
|
|
3001
2899
|
};
|
|
3002
2900
|
var TransformConstraintTimeline = class extends CurveTimeline {
|
|
3003
2901
|
/** The index of the transform constraint slot in {@link Skeleton#transformConstraints} that will be changed. */
|
|
3004
|
-
|
|
2902
|
+
constraintIndex = 0;
|
|
3005
2903
|
constructor(frameCount, bezierCount, transformConstraintIndex) {
|
|
3006
2904
|
super(frameCount, bezierCount, [
|
|
3007
2905
|
Property.transformConstraint + "|" + transformConstraintIndex
|
|
3008
2906
|
]);
|
|
3009
|
-
this.
|
|
2907
|
+
this.constraintIndex = transformConstraintIndex;
|
|
3010
2908
|
}
|
|
3011
2909
|
getFrameEntries() {
|
|
3012
2910
|
return 7;
|
|
@@ -3042,7 +2940,7 @@ var spine = (() => {
|
|
|
3042
2940
|
] = mixShearY;
|
|
3043
2941
|
}
|
|
3044
2942
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
3045
|
-
let constraint = skeleton.transformConstraints[this.
|
|
2943
|
+
let constraint = skeleton.transformConstraints[this.constraintIndex];
|
|
3046
2944
|
if (!constraint.active)
|
|
3047
2945
|
return;
|
|
3048
2946
|
let frames = this.frames;
|
|
@@ -3223,71 +3121,42 @@ var spine = (() => {
|
|
|
3223
3121
|
}
|
|
3224
3122
|
};
|
|
3225
3123
|
var PathConstraintPositionTimeline = class extends CurveTimeline1 {
|
|
3226
|
-
/** The index of the path constraint
|
|
3227
|
-
|
|
3124
|
+
/** The index of the path constraint in {@link Skeleton#getPathConstraints()} that will be changed when this timeline is
|
|
3125
|
+
* applied. */
|
|
3126
|
+
constraintIndex = 0;
|
|
3228
3127
|
constructor(frameCount, bezierCount, pathConstraintIndex) {
|
|
3229
3128
|
super(frameCount, bezierCount, Property.pathConstraintPosition + "|" + pathConstraintIndex);
|
|
3230
|
-
this.
|
|
3129
|
+
this.constraintIndex = pathConstraintIndex;
|
|
3231
3130
|
}
|
|
3232
3131
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
3233
|
-
let constraint = skeleton.pathConstraints[this.
|
|
3234
|
-
if (
|
|
3235
|
-
|
|
3236
|
-
let frames = this.frames;
|
|
3237
|
-
if (time < frames[0]) {
|
|
3238
|
-
switch (blend) {
|
|
3239
|
-
case 0 /* setup */:
|
|
3240
|
-
constraint.position = constraint.data.position;
|
|
3241
|
-
return;
|
|
3242
|
-
case 1 /* first */:
|
|
3243
|
-
constraint.position += (constraint.data.position - constraint.position) * alpha;
|
|
3244
|
-
}
|
|
3245
|
-
return;
|
|
3246
|
-
}
|
|
3247
|
-
let position = this.getCurveValue(time);
|
|
3248
|
-
if (blend == 0 /* setup */)
|
|
3249
|
-
constraint.position = constraint.data.position + (position - constraint.data.position) * alpha;
|
|
3250
|
-
else
|
|
3251
|
-
constraint.position += (position - constraint.position) * alpha;
|
|
3132
|
+
let constraint = skeleton.pathConstraints[this.constraintIndex];
|
|
3133
|
+
if (constraint.active)
|
|
3134
|
+
constraint.position = this.getAbsoluteValue(time, alpha, blend, constraint.position, constraint.data.position);
|
|
3252
3135
|
}
|
|
3253
3136
|
};
|
|
3254
3137
|
var PathConstraintSpacingTimeline = class extends CurveTimeline1 {
|
|
3255
|
-
/** The index of the path constraint
|
|
3256
|
-
|
|
3138
|
+
/** The index of the path constraint in {@link Skeleton#getPathConstraints()} that will be changed when this timeline is
|
|
3139
|
+
* applied. */
|
|
3140
|
+
constraintIndex = 0;
|
|
3257
3141
|
constructor(frameCount, bezierCount, pathConstraintIndex) {
|
|
3258
3142
|
super(frameCount, bezierCount, Property.pathConstraintSpacing + "|" + pathConstraintIndex);
|
|
3259
|
-
this.
|
|
3143
|
+
this.constraintIndex = pathConstraintIndex;
|
|
3260
3144
|
}
|
|
3261
3145
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
3262
|
-
let constraint = skeleton.pathConstraints[this.
|
|
3263
|
-
if (
|
|
3264
|
-
|
|
3265
|
-
let frames = this.frames;
|
|
3266
|
-
if (time < frames[0]) {
|
|
3267
|
-
switch (blend) {
|
|
3268
|
-
case 0 /* setup */:
|
|
3269
|
-
constraint.spacing = constraint.data.spacing;
|
|
3270
|
-
return;
|
|
3271
|
-
case 1 /* first */:
|
|
3272
|
-
constraint.spacing += (constraint.data.spacing - constraint.spacing) * alpha;
|
|
3273
|
-
}
|
|
3274
|
-
return;
|
|
3275
|
-
}
|
|
3276
|
-
let spacing = this.getCurveValue(time);
|
|
3277
|
-
if (blend == 0 /* setup */)
|
|
3278
|
-
constraint.spacing = constraint.data.spacing + (spacing - constraint.data.spacing) * alpha;
|
|
3279
|
-
else
|
|
3280
|
-
constraint.spacing += (spacing - constraint.spacing) * alpha;
|
|
3146
|
+
let constraint = skeleton.pathConstraints[this.constraintIndex];
|
|
3147
|
+
if (constraint.active)
|
|
3148
|
+
constraint.spacing = this.getAbsoluteValue(time, alpha, blend, constraint.spacing, constraint.data.spacing);
|
|
3281
3149
|
}
|
|
3282
3150
|
};
|
|
3283
3151
|
var PathConstraintMixTimeline = class extends CurveTimeline {
|
|
3284
|
-
/** The index of the path constraint
|
|
3285
|
-
|
|
3152
|
+
/** The index of the path constraint in {@link Skeleton#getPathConstraints()} that will be changed when this timeline is
|
|
3153
|
+
* applied. */
|
|
3154
|
+
constraintIndex = 0;
|
|
3286
3155
|
constructor(frameCount, bezierCount, pathConstraintIndex) {
|
|
3287
3156
|
super(frameCount, bezierCount, [
|
|
3288
3157
|
Property.pathConstraintMix + "|" + pathConstraintIndex
|
|
3289
3158
|
]);
|
|
3290
|
-
this.
|
|
3159
|
+
this.constraintIndex = pathConstraintIndex;
|
|
3291
3160
|
}
|
|
3292
3161
|
getFrameEntries() {
|
|
3293
3162
|
return 4;
|
|
@@ -3310,7 +3179,7 @@ var spine = (() => {
|
|
|
3310
3179
|
] = mixY;
|
|
3311
3180
|
}
|
|
3312
3181
|
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
3313
|
-
let constraint = skeleton.pathConstraints[this.
|
|
3182
|
+
let constraint = skeleton.pathConstraints[this.constraintIndex];
|
|
3314
3183
|
if (!constraint.active)
|
|
3315
3184
|
return;
|
|
3316
3185
|
let frames = this.frames;
|
|
@@ -3417,6 +3286,196 @@ var spine = (() => {
|
|
|
3417
3286
|
}
|
|
3418
3287
|
}
|
|
3419
3288
|
};
|
|
3289
|
+
var PhysicsConstraintTimeline = class extends CurveTimeline1 {
|
|
3290
|
+
/** The index of the physics constraint in {@link Skeleton#getPhysicsConstraints()} that will be changed when this timeline
|
|
3291
|
+
* is applied, or -1 if all physics constraints in the skeleton will be changed. */
|
|
3292
|
+
constraintIndex = 0;
|
|
3293
|
+
/** @param physicsConstraintIndex -1 for all physics constraints in the skeleton. */
|
|
3294
|
+
constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
|
|
3295
|
+
super(frameCount, bezierCount, property + "|" + physicsConstraintIndex);
|
|
3296
|
+
this.constraintIndex = physicsConstraintIndex;
|
|
3297
|
+
}
|
|
3298
|
+
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
3299
|
+
let constraint;
|
|
3300
|
+
if (this.constraintIndex == -1) {
|
|
3301
|
+
const value = time >= this.frames[0] ? this.getCurveValue(time) : 0;
|
|
3302
|
+
for (const constraint2 of skeleton.physicsConstraints) {
|
|
3303
|
+
if (constraint2.active && this.global(constraint2.data))
|
|
3304
|
+
this.set(constraint2, this.getAbsoluteValue2(time, alpha, blend, this.get(constraint2), this.setup(constraint2), value));
|
|
3305
|
+
}
|
|
3306
|
+
} else {
|
|
3307
|
+
constraint = skeleton.physicsConstraints[this.constraintIndex];
|
|
3308
|
+
if (constraint.active)
|
|
3309
|
+
this.set(constraint, this.getAbsoluteValue(time, alpha, blend, this.get(constraint), this.setup(constraint)));
|
|
3310
|
+
}
|
|
3311
|
+
}
|
|
3312
|
+
};
|
|
3313
|
+
var PhysicsConstraintInertiaTimeline = class extends PhysicsConstraintTimeline {
|
|
3314
|
+
constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
|
|
3315
|
+
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintInertia);
|
|
3316
|
+
}
|
|
3317
|
+
setup(constraint) {
|
|
3318
|
+
return constraint.data.inertia;
|
|
3319
|
+
}
|
|
3320
|
+
get(constraint) {
|
|
3321
|
+
return constraint.inertia;
|
|
3322
|
+
}
|
|
3323
|
+
set(constraint, value) {
|
|
3324
|
+
constraint.inertia = value;
|
|
3325
|
+
}
|
|
3326
|
+
global(constraint) {
|
|
3327
|
+
return constraint.inertiaGlobal;
|
|
3328
|
+
}
|
|
3329
|
+
};
|
|
3330
|
+
var PhysicsConstraintStrengthTimeline = class extends PhysicsConstraintTimeline {
|
|
3331
|
+
constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
|
|
3332
|
+
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintStrength);
|
|
3333
|
+
}
|
|
3334
|
+
setup(constraint) {
|
|
3335
|
+
return constraint.data.strength;
|
|
3336
|
+
}
|
|
3337
|
+
get(constraint) {
|
|
3338
|
+
return constraint.strength;
|
|
3339
|
+
}
|
|
3340
|
+
set(constraint, value) {
|
|
3341
|
+
constraint.strength = value;
|
|
3342
|
+
}
|
|
3343
|
+
global(constraint) {
|
|
3344
|
+
return constraint.strengthGlobal;
|
|
3345
|
+
}
|
|
3346
|
+
};
|
|
3347
|
+
var PhysicsConstraintDampingTimeline = class extends PhysicsConstraintTimeline {
|
|
3348
|
+
constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
|
|
3349
|
+
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintDamping);
|
|
3350
|
+
}
|
|
3351
|
+
setup(constraint) {
|
|
3352
|
+
return constraint.data.damping;
|
|
3353
|
+
}
|
|
3354
|
+
get(constraint) {
|
|
3355
|
+
return constraint.damping;
|
|
3356
|
+
}
|
|
3357
|
+
set(constraint, value) {
|
|
3358
|
+
constraint.damping = value;
|
|
3359
|
+
}
|
|
3360
|
+
global(constraint) {
|
|
3361
|
+
return constraint.dampingGlobal;
|
|
3362
|
+
}
|
|
3363
|
+
};
|
|
3364
|
+
var PhysicsConstraintMassTimeline = class extends PhysicsConstraintTimeline {
|
|
3365
|
+
constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
|
|
3366
|
+
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintMass);
|
|
3367
|
+
}
|
|
3368
|
+
setup(constraint) {
|
|
3369
|
+
return 1 / constraint.data.massInverse;
|
|
3370
|
+
}
|
|
3371
|
+
get(constraint) {
|
|
3372
|
+
return 1 / constraint.massInverse;
|
|
3373
|
+
}
|
|
3374
|
+
set(constraint, value) {
|
|
3375
|
+
constraint.massInverse = 1 / value;
|
|
3376
|
+
}
|
|
3377
|
+
global(constraint) {
|
|
3378
|
+
return constraint.massGlobal;
|
|
3379
|
+
}
|
|
3380
|
+
};
|
|
3381
|
+
var PhysicsConstraintWindTimeline = class extends PhysicsConstraintTimeline {
|
|
3382
|
+
constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
|
|
3383
|
+
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintWind);
|
|
3384
|
+
}
|
|
3385
|
+
setup(constraint) {
|
|
3386
|
+
return constraint.data.wind;
|
|
3387
|
+
}
|
|
3388
|
+
get(constraint) {
|
|
3389
|
+
return constraint.wind;
|
|
3390
|
+
}
|
|
3391
|
+
set(constraint, value) {
|
|
3392
|
+
constraint.wind = value;
|
|
3393
|
+
}
|
|
3394
|
+
global(constraint) {
|
|
3395
|
+
return constraint.windGlobal;
|
|
3396
|
+
}
|
|
3397
|
+
};
|
|
3398
|
+
var PhysicsConstraintGravityTimeline = class extends PhysicsConstraintTimeline {
|
|
3399
|
+
constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
|
|
3400
|
+
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintGravity);
|
|
3401
|
+
}
|
|
3402
|
+
setup(constraint) {
|
|
3403
|
+
return constraint.data.gravity;
|
|
3404
|
+
}
|
|
3405
|
+
get(constraint) {
|
|
3406
|
+
return constraint.gravity;
|
|
3407
|
+
}
|
|
3408
|
+
set(constraint, value) {
|
|
3409
|
+
constraint.gravity = value;
|
|
3410
|
+
}
|
|
3411
|
+
global(constraint) {
|
|
3412
|
+
return constraint.gravityGlobal;
|
|
3413
|
+
}
|
|
3414
|
+
};
|
|
3415
|
+
var PhysicsConstraintMixTimeline = class extends PhysicsConstraintTimeline {
|
|
3416
|
+
constructor(frameCount, bezierCount, physicsConstraintIndex, property) {
|
|
3417
|
+
super(frameCount, bezierCount, physicsConstraintIndex, Property.physicsConstraintMix);
|
|
3418
|
+
}
|
|
3419
|
+
setup(constraint) {
|
|
3420
|
+
return constraint.data.mix;
|
|
3421
|
+
}
|
|
3422
|
+
get(constraint) {
|
|
3423
|
+
return constraint.mix;
|
|
3424
|
+
}
|
|
3425
|
+
set(constraint, value) {
|
|
3426
|
+
constraint.mix = value;
|
|
3427
|
+
}
|
|
3428
|
+
global(constraint) {
|
|
3429
|
+
return constraint.mixGlobal;
|
|
3430
|
+
}
|
|
3431
|
+
};
|
|
3432
|
+
var _PhysicsConstraintResetTimeline = class extends Timeline {
|
|
3433
|
+
/** The index of the physics constraint in {@link Skeleton#getPhysicsConstraints()} that will be reset when this timeline is
|
|
3434
|
+
* applied, or -1 if all physics constraints in the skeleton will be reset. */
|
|
3435
|
+
constraintIndex;
|
|
3436
|
+
/** @param physicsConstraintIndex -1 for all physics constraints in the skeleton. */
|
|
3437
|
+
constructor(frameCount, physicsConstraintIndex) {
|
|
3438
|
+
super(frameCount, _PhysicsConstraintResetTimeline.propertyIds);
|
|
3439
|
+
this.constraintIndex = physicsConstraintIndex;
|
|
3440
|
+
}
|
|
3441
|
+
getFrameCount() {
|
|
3442
|
+
return this.frames.length;
|
|
3443
|
+
}
|
|
3444
|
+
/** Sets the time for the specified frame.
|
|
3445
|
+
* @param frame Between 0 and <code>frameCount</code>, inclusive. */
|
|
3446
|
+
setFrame(frame, time) {
|
|
3447
|
+
this.frames[frame] = time;
|
|
3448
|
+
}
|
|
3449
|
+
/** Resets the physics constraint when frames > <code>lastTime</code> and <= <code>time</code>. */
|
|
3450
|
+
apply(skeleton, lastTime, time, firedEvents, alpha, blend, direction) {
|
|
3451
|
+
let constraint;
|
|
3452
|
+
if (this.constraintIndex != -1) {
|
|
3453
|
+
constraint = skeleton.physicsConstraints[this.constraintIndex];
|
|
3454
|
+
if (!constraint.active)
|
|
3455
|
+
return;
|
|
3456
|
+
}
|
|
3457
|
+
const frames = this.frames;
|
|
3458
|
+
if (lastTime > time) {
|
|
3459
|
+
this.apply(skeleton, lastTime, Number.MAX_VALUE, [], alpha, blend, direction);
|
|
3460
|
+
lastTime = -1;
|
|
3461
|
+
} else if (lastTime >= frames[frames.length - 1])
|
|
3462
|
+
return;
|
|
3463
|
+
if (time < frames[0])
|
|
3464
|
+
return;
|
|
3465
|
+
if (lastTime < frames[0] || time >= frames[Timeline.search1(frames, lastTime) + 1]) {
|
|
3466
|
+
if (constraint != null)
|
|
3467
|
+
constraint.reset();
|
|
3468
|
+
else {
|
|
3469
|
+
for (const constraint2 of skeleton.physicsConstraints) {
|
|
3470
|
+
if (constraint2.active)
|
|
3471
|
+
constraint2.reset();
|
|
3472
|
+
}
|
|
3473
|
+
}
|
|
3474
|
+
}
|
|
3475
|
+
}
|
|
3476
|
+
};
|
|
3477
|
+
var PhysicsConstraintResetTimeline = _PhysicsConstraintResetTimeline;
|
|
3478
|
+
__publicField(PhysicsConstraintResetTimeline, "propertyIds", [Property.physicsConstraintReset.toString()]);
|
|
3420
3479
|
var _SequenceTimeline = class extends Timeline {
|
|
3421
3480
|
slotIndex;
|
|
3422
3481
|
attachment;
|
|
@@ -3623,11 +3682,12 @@ var spine = (() => {
|
|
|
3623
3682
|
continue;
|
|
3624
3683
|
applied = true;
|
|
3625
3684
|
let blend = i2 == 0 ? 1 /* first */ : current.mixBlend;
|
|
3626
|
-
let
|
|
3685
|
+
let alpha = current.alpha;
|
|
3627
3686
|
if (current.mixingFrom)
|
|
3628
|
-
|
|
3687
|
+
alpha *= this.applyMixingFrom(current, skeleton, blend);
|
|
3629
3688
|
else if (current.trackTime >= current.trackEnd && !current.next)
|
|
3630
|
-
|
|
3689
|
+
alpha = 0;
|
|
3690
|
+
let attachments = alpha >= current.alphaAttachmentThreshold;
|
|
3631
3691
|
let animationLast = current.animationLast, animationTime = current.getAnimationTime(), applyTime = animationTime;
|
|
3632
3692
|
let applyEvents = events;
|
|
3633
3693
|
if (current.reverse) {
|
|
@@ -3636,14 +3696,16 @@ var spine = (() => {
|
|
|
3636
3696
|
}
|
|
3637
3697
|
let timelines = current.animation.timelines;
|
|
3638
3698
|
let timelineCount = timelines.length;
|
|
3639
|
-
if (i2 == 0 &&
|
|
3699
|
+
if (i2 == 0 && alpha == 1 || blend == 3 /* add */) {
|
|
3700
|
+
if (i2 == 0)
|
|
3701
|
+
attachments = true;
|
|
3640
3702
|
for (let ii = 0; ii < timelineCount; ii++) {
|
|
3641
|
-
Utils.webkit602BugfixHelper(
|
|
3703
|
+
Utils.webkit602BugfixHelper(alpha, blend);
|
|
3642
3704
|
var timeline = timelines[ii];
|
|
3643
3705
|
if (timeline instanceof AttachmentTimeline)
|
|
3644
|
-
this.applyAttachmentTimeline(timeline, skeleton, applyTime, blend,
|
|
3706
|
+
this.applyAttachmentTimeline(timeline, skeleton, applyTime, blend, attachments);
|
|
3645
3707
|
else
|
|
3646
|
-
timeline.apply(skeleton, animationLast, applyTime, applyEvents,
|
|
3708
|
+
timeline.apply(skeleton, animationLast, applyTime, applyEvents, alpha, blend, 0 /* mixIn */);
|
|
3647
3709
|
}
|
|
3648
3710
|
} else {
|
|
3649
3711
|
let timelineMode = current.timelineMode;
|
|
@@ -3655,12 +3717,12 @@ var spine = (() => {
|
|
|
3655
3717
|
let timeline2 = timelines[ii];
|
|
3656
3718
|
let timelineBlend = timelineMode[ii] == SUBSEQUENT ? blend : 0 /* setup */;
|
|
3657
3719
|
if (!shortestRotation && timeline2 instanceof RotateTimeline) {
|
|
3658
|
-
this.applyRotateTimeline(timeline2, skeleton, applyTime,
|
|
3720
|
+
this.applyRotateTimeline(timeline2, skeleton, applyTime, alpha, timelineBlend, current.timelinesRotation, ii << 1, firstFrame);
|
|
3659
3721
|
} else if (timeline2 instanceof AttachmentTimeline) {
|
|
3660
|
-
this.applyAttachmentTimeline(timeline2, skeleton, applyTime, blend,
|
|
3722
|
+
this.applyAttachmentTimeline(timeline2, skeleton, applyTime, blend, attachments);
|
|
3661
3723
|
} else {
|
|
3662
|
-
Utils.webkit602BugfixHelper(
|
|
3663
|
-
timeline2.apply(skeleton, animationLast, applyTime, applyEvents,
|
|
3724
|
+
Utils.webkit602BugfixHelper(alpha, blend);
|
|
3725
|
+
timeline2.apply(skeleton, animationLast, applyTime, applyEvents, alpha, timelineBlend, 0 /* mixIn */);
|
|
3664
3726
|
}
|
|
3665
3727
|
}
|
|
3666
3728
|
}
|
|
@@ -3698,7 +3760,7 @@ var spine = (() => {
|
|
|
3698
3760
|
if (blend != 1 /* first */)
|
|
3699
3761
|
blend = from.mixBlend;
|
|
3700
3762
|
}
|
|
3701
|
-
let attachments = mix < from.
|
|
3763
|
+
let attachments = mix < from.mixAttachmentThreshold, drawOrder = mix < from.mixDrawOrderThreshold;
|
|
3702
3764
|
let timelines = from.animation.timelines;
|
|
3703
3765
|
let timelineCount = timelines.length;
|
|
3704
3766
|
let alphaHold = from.alpha * to.interruptAlpha, alphaMix = alphaHold * (1 - mix);
|
|
@@ -3753,7 +3815,7 @@ var spine = (() => {
|
|
|
3753
3815
|
if (!shortestRotation && timeline instanceof RotateTimeline)
|
|
3754
3816
|
this.applyRotateTimeline(timeline, skeleton, applyTime, alpha, timelineBlend, from.timelinesRotation, i << 1, firstFrame);
|
|
3755
3817
|
else if (timeline instanceof AttachmentTimeline)
|
|
3756
|
-
this.applyAttachmentTimeline(timeline, skeleton, applyTime, timelineBlend, attachments);
|
|
3818
|
+
this.applyAttachmentTimeline(timeline, skeleton, applyTime, timelineBlend, attachments && alpha >= from.alphaAttachmentThreshold);
|
|
3757
3819
|
else {
|
|
3758
3820
|
Utils.webkit602BugfixHelper(alpha, blend);
|
|
3759
3821
|
if (drawOrder && timeline instanceof DrawOrderTimeline && timelineBlend == 0 /* setup */)
|
|
@@ -3813,7 +3875,7 @@ var spine = (() => {
|
|
|
3813
3875
|
r2 = bone.data.rotation + timeline.getCurveValue(time);
|
|
3814
3876
|
}
|
|
3815
3877
|
let total = 0, diff = r2 - r1;
|
|
3816
|
-
diff -= (
|
|
3878
|
+
diff -= Math.ceil(diff / 360 - 0.5) * 360;
|
|
3817
3879
|
if (diff == 0) {
|
|
3818
3880
|
total = timelinesRotation[i];
|
|
3819
3881
|
} else {
|
|
@@ -4070,8 +4132,9 @@ var spine = (() => {
|
|
|
4070
4132
|
entry.reverse = false;
|
|
4071
4133
|
entry.shortestRotation = false;
|
|
4072
4134
|
entry.eventThreshold = 0;
|
|
4073
|
-
entry.
|
|
4074
|
-
entry.
|
|
4135
|
+
entry.alphaAttachmentThreshold = 0;
|
|
4136
|
+
entry.mixAttachmentThreshold = 0;
|
|
4137
|
+
entry.mixDrawOrderThreshold = 0;
|
|
4075
4138
|
entry.animationStart = 0;
|
|
4076
4139
|
entry.animationEnd = animation.duration;
|
|
4077
4140
|
entry.animationLast = -1;
|
|
@@ -4229,11 +4292,14 @@ var spine = (() => {
|
|
|
4229
4292
|
/** When the mix percentage ({@link #mixtime} / {@link #mixDuration}) is less than the
|
|
4230
4293
|
* `attachmentThreshold`, attachment timelines are applied while this animation is being mixed out. Defaults to
|
|
4231
4294
|
* 0, so attachment timelines are not applied while this animation is being mixed out. */
|
|
4232
|
-
|
|
4233
|
-
/** When
|
|
4234
|
-
*
|
|
4235
|
-
|
|
4236
|
-
|
|
4295
|
+
mixAttachmentThreshold = 0;
|
|
4296
|
+
/** When {@link #getAlpha()} is greater than <code>alphaAttachmentThreshold</code>, attachment timelines are applied.
|
|
4297
|
+
* Defaults to 0, so attachment timelines are always applied. */
|
|
4298
|
+
alphaAttachmentThreshold = 0;
|
|
4299
|
+
/** When the mix percentage ({@link #getMixTime()} / {@link #getMixDuration()}) is less than the
|
|
4300
|
+
* <code>mixDrawOrderThreshold</code>, draw order timelines are applied while this animation is being mixed out. Defaults to
|
|
4301
|
+
* 0, so draw order timelines are not applied while this animation is being mixed out. */
|
|
4302
|
+
mixDrawOrderThreshold = 0;
|
|
4237
4303
|
/** Seconds when this animation starts, both initially and after looping. Defaults to 0.
|
|
4238
4304
|
*
|
|
4239
4305
|
* When changing the `animationStart` time, it often makes sense to set {@link #animationLast} to the same
|
|
@@ -4303,9 +4369,18 @@ var spine = (() => {
|
|
|
4303
4369
|
* When using {@link AnimationState#addAnimation()} with a `delay` <= 0, note the
|
|
4304
4370
|
* {@link #delay} is set using the mix duration from the {@link AnimationStateData}, not a mix duration set
|
|
4305
4371
|
* afterward. */
|
|
4306
|
-
|
|
4372
|
+
_mixDuration = 0;
|
|
4307
4373
|
interruptAlpha = 0;
|
|
4308
4374
|
totalAlpha = 0;
|
|
4375
|
+
get mixDuration() {
|
|
4376
|
+
return this._mixDuration;
|
|
4377
|
+
}
|
|
4378
|
+
set mixDuration(mixDuration) {
|
|
4379
|
+
this._mixDuration = mixDuration;
|
|
4380
|
+
if (this.previous != null && this.delay <= 0)
|
|
4381
|
+
this.delay += this.previous.getTrackComplete() - mixDuration;
|
|
4382
|
+
this.delay = this.delay;
|
|
4383
|
+
}
|
|
4309
4384
|
/** Controls how properties keyed in the animation are mixed with lower tracks. Defaults to {@link MixBlend#replace}, which
|
|
4310
4385
|
* replaces the values from the lower tracks with the animation values. {@link MixBlend#add} adds the animation values to
|
|
4311
4386
|
* the values from the lower tracks.
|
|
@@ -4369,6 +4444,12 @@ var spine = (() => {
|
|
|
4369
4444
|
}
|
|
4370
4445
|
return this.trackTime;
|
|
4371
4446
|
}
|
|
4447
|
+
/** Returns true if this track entry has been applied at least once.
|
|
4448
|
+
* <p>
|
|
4449
|
+
* See {@link AnimationState#apply(Skeleton)}. */
|
|
4450
|
+
wasApplied() {
|
|
4451
|
+
return this.nextTrackLast != -1;
|
|
4452
|
+
}
|
|
4372
4453
|
};
|
|
4373
4454
|
var EventQueue = class {
|
|
4374
4455
|
objects = [];
|
|
@@ -5069,10 +5150,10 @@ var spine = (() => {
|
|
|
5069
5150
|
return point;
|
|
5070
5151
|
}
|
|
5071
5152
|
computeWorldRotation(bone) {
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
return
|
|
5153
|
+
const r = this.rotation * MathUtils.degRad, cos = Math.cos(r), sin = Math.sin(r);
|
|
5154
|
+
const x = cos * bone.a + sin * bone.b;
|
|
5155
|
+
const y = cos * bone.c + sin * bone.d;
|
|
5156
|
+
return MathUtils.atan2Deg(y, x);
|
|
5076
5157
|
}
|
|
5077
5158
|
copy() {
|
|
5078
5159
|
let copy = new PointAttachment(this.name);
|
|
@@ -5139,7 +5220,7 @@ var spine = (() => {
|
|
|
5139
5220
|
let localY = -this.height / 2 * this.scaleY + this.region.offsetY * regionScaleY;
|
|
5140
5221
|
let localX2 = localX + this.region.width * regionScaleX;
|
|
5141
5222
|
let localY2 = localY + this.region.height * regionScaleY;
|
|
5142
|
-
let radians = this.rotation *
|
|
5223
|
+
let radians = this.rotation * MathUtils.degRad;
|
|
5143
5224
|
let cos = Math.cos(radians);
|
|
5144
5225
|
let sin = Math.sin(radians);
|
|
5145
5226
|
let x = this.x, y = this.y;
|
|
@@ -5335,7 +5416,7 @@ var spine = (() => {
|
|
|
5335
5416
|
x = 0;
|
|
5336
5417
|
/** The local y translation. */
|
|
5337
5418
|
y = 0;
|
|
5338
|
-
/** The local rotation. */
|
|
5419
|
+
/** The local rotation in degrees, counter clockwise. */
|
|
5339
5420
|
rotation = 0;
|
|
5340
5421
|
/** The local scaleX. */
|
|
5341
5422
|
scaleX = 1;
|
|
@@ -5354,6 +5435,10 @@ var spine = (() => {
|
|
|
5354
5435
|
/** The color of the bone as it was in Spine. Available only when nonessential data was exported. Bones are not usually
|
|
5355
5436
|
* rendered at runtime. */
|
|
5356
5437
|
color = new Color();
|
|
5438
|
+
/** The bone icon as it was in Spine, or null if nonessential data was not exported. */
|
|
5439
|
+
icon;
|
|
5440
|
+
/** False if the bone was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
|
|
5441
|
+
visible = false;
|
|
5357
5442
|
constructor(index, name, parent) {
|
|
5358
5443
|
if (index < 0)
|
|
5359
5444
|
throw new Error("index must be >= 0.");
|
|
@@ -5442,7 +5527,7 @@ var spine = (() => {
|
|
|
5442
5527
|
return this.active;
|
|
5443
5528
|
}
|
|
5444
5529
|
/** Computes the world transform using the parent bone and this bone's local applied transform. */
|
|
5445
|
-
update() {
|
|
5530
|
+
update(physics) {
|
|
5446
5531
|
this.updateWorldTransformWith(this.ax, this.ay, this.arotation, this.ascaleX, this.ascaleY, this.ashearX, this.ashearY);
|
|
5447
5532
|
}
|
|
5448
5533
|
/** Computes the world transform using the parent bone and this bone's local transform.
|
|
@@ -5467,13 +5552,13 @@ var spine = (() => {
|
|
|
5467
5552
|
let parent = this.parent;
|
|
5468
5553
|
if (!parent) {
|
|
5469
5554
|
let skeleton = this.skeleton;
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
this.a =
|
|
5474
|
-
this.b =
|
|
5475
|
-
this.c =
|
|
5476
|
-
this.d =
|
|
5555
|
+
const sx = skeleton.scaleX, sy = skeleton.scaleY;
|
|
5556
|
+
const rx = (rotation + shearX) * MathUtils.degRad;
|
|
5557
|
+
const ry = (rotation + 90 + shearY) * MathUtils.degRad;
|
|
5558
|
+
this.a = Math.cos(rx) * scaleX * sx;
|
|
5559
|
+
this.b = Math.cos(ry) * scaleY * sx;
|
|
5560
|
+
this.c = Math.sin(rx) * scaleX * sy;
|
|
5561
|
+
this.d = Math.sin(ry) * scaleY * sy;
|
|
5477
5562
|
this.worldX = x * sx + skeleton.x;
|
|
5478
5563
|
this.worldY = y * sy + skeleton.y;
|
|
5479
5564
|
return;
|
|
@@ -5483,11 +5568,12 @@ var spine = (() => {
|
|
|
5483
5568
|
this.worldY = pc * x + pd * y + parent.worldY;
|
|
5484
5569
|
switch (this.data.transformMode) {
|
|
5485
5570
|
case 0 /* Normal */: {
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5571
|
+
const rx = (rotation + shearX) * MathUtils.degRad;
|
|
5572
|
+
const ry = (rotation + 90 + shearY) * MathUtils.degRad;
|
|
5573
|
+
const la = Math.cos(rx) * scaleX;
|
|
5574
|
+
const lb = Math.cos(ry) * scaleY;
|
|
5575
|
+
const lc = Math.sin(rx) * scaleX;
|
|
5576
|
+
const ld = Math.sin(ry) * scaleY;
|
|
5491
5577
|
this.a = pa * la + pb * lc;
|
|
5492
5578
|
this.b = pa * lb + pb * ld;
|
|
5493
5579
|
this.c = pc * la + pd * lc;
|
|
@@ -5495,11 +5581,12 @@ var spine = (() => {
|
|
|
5495
5581
|
return;
|
|
5496
5582
|
}
|
|
5497
5583
|
case 1 /* OnlyTranslation */: {
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
this.
|
|
5501
|
-
this.
|
|
5502
|
-
this.
|
|
5584
|
+
const rx = (rotation + shearX) * MathUtils.degRad;
|
|
5585
|
+
const ry = (rotation + 90 + shearY) * MathUtils.degRad;
|
|
5586
|
+
this.a = Math.cos(rx) * scaleX;
|
|
5587
|
+
this.b = Math.cos(ry) * scaleY;
|
|
5588
|
+
this.c = Math.sin(rx) * scaleX;
|
|
5589
|
+
this.d = Math.sin(ry) * scaleY;
|
|
5503
5590
|
break;
|
|
5504
5591
|
}
|
|
5505
5592
|
case 2 /* NoRotationOrReflection */: {
|
|
@@ -5517,12 +5604,12 @@ var spine = (() => {
|
|
|
5517
5604
|
pc = 0;
|
|
5518
5605
|
prx = 90 - Math.atan2(pd, pb) * MathUtils.radDeg;
|
|
5519
5606
|
}
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5607
|
+
const rx = (rotation + shearX - prx) * MathUtils.degRad;
|
|
5608
|
+
const ry = (rotation + shearY - prx + 90) * MathUtils.degRad;
|
|
5609
|
+
const la = Math.cos(rx) * scaleX;
|
|
5610
|
+
const lb = Math.cos(ry) * scaleY;
|
|
5611
|
+
const lc = Math.sin(rx) * scaleX;
|
|
5612
|
+
const ld = Math.sin(ry) * scaleY;
|
|
5526
5613
|
this.a = pa * la - pb * lc;
|
|
5527
5614
|
this.b = pa * lb - pb * ld;
|
|
5528
5615
|
this.c = pc * la + pd * lc;
|
|
@@ -5531,8 +5618,8 @@ var spine = (() => {
|
|
|
5531
5618
|
}
|
|
5532
5619
|
case 3 /* NoScale */:
|
|
5533
5620
|
case 4 /* NoScaleOrReflection */: {
|
|
5534
|
-
|
|
5535
|
-
|
|
5621
|
+
rotation *= MathUtils.degRad;
|
|
5622
|
+
const cos = Math.cos(rotation), sin = Math.sin(rotation);
|
|
5536
5623
|
let za = (pa * cos + pb * sin) / this.skeleton.scaleX;
|
|
5537
5624
|
let zc = (pc * cos + pd * sin) / this.skeleton.scaleY;
|
|
5538
5625
|
let s = Math.sqrt(za * za + zc * zc);
|
|
@@ -5543,13 +5630,15 @@ var spine = (() => {
|
|
|
5543
5630
|
s = Math.sqrt(za * za + zc * zc);
|
|
5544
5631
|
if (this.data.transformMode == 3 /* NoScale */ && pa * pd - pb * pc < 0 != (this.skeleton.scaleX < 0 != this.skeleton.scaleY < 0))
|
|
5545
5632
|
s = -s;
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5633
|
+
rotation = Math.PI / 2 + Math.atan2(zc, za);
|
|
5634
|
+
const zb = Math.cos(rotation) * s;
|
|
5635
|
+
const zd = Math.sin(rotation) * s;
|
|
5636
|
+
shearX *= MathUtils.degRad;
|
|
5637
|
+
shearY = (90 + shearY) * MathUtils.degRad;
|
|
5638
|
+
const la = Math.cos(shearX) * scaleX;
|
|
5639
|
+
const lb = Math.cos(shearY) * scaleY;
|
|
5640
|
+
const lc = Math.sin(shearX) * scaleX;
|
|
5641
|
+
const ld = Math.sin(shearY) * scaleY;
|
|
5553
5642
|
this.a = za * la + zb * lc;
|
|
5554
5643
|
this.b = za * lb + zb * ld;
|
|
5555
5644
|
this.c = zc * la + zd * lc;
|
|
@@ -5573,22 +5662,6 @@ var spine = (() => {
|
|
|
5573
5662
|
this.shearX = data.shearX;
|
|
5574
5663
|
this.shearY = data.shearY;
|
|
5575
5664
|
}
|
|
5576
|
-
/** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */
|
|
5577
|
-
getWorldRotationX() {
|
|
5578
|
-
return Math.atan2(this.c, this.a) * MathUtils.radDeg;
|
|
5579
|
-
}
|
|
5580
|
-
/** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */
|
|
5581
|
-
getWorldRotationY() {
|
|
5582
|
-
return Math.atan2(this.d, this.b) * MathUtils.radDeg;
|
|
5583
|
-
}
|
|
5584
|
-
/** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */
|
|
5585
|
-
getWorldScaleX() {
|
|
5586
|
-
return Math.sqrt(this.a * this.a + this.c * this.c);
|
|
5587
|
-
}
|
|
5588
|
-
/** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */
|
|
5589
|
-
getWorldScaleY() {
|
|
5590
|
-
return Math.sqrt(this.b * this.b + this.d * this.d);
|
|
5591
|
-
}
|
|
5592
5665
|
/** Computes the applied transform values from the world transform.
|
|
5593
5666
|
*
|
|
5594
5667
|
* If the world transform is modified (by a constraint, {@link #rotateWorld(float)}, etc) then this method should be called so
|
|
@@ -5675,6 +5748,22 @@ var spine = (() => {
|
|
|
5675
5748
|
this.arotation = 90 - Math.atan2(rd, rb) * MathUtils.radDeg;
|
|
5676
5749
|
}
|
|
5677
5750
|
}
|
|
5751
|
+
/** The world rotation for the X axis, calculated using {@link #a} and {@link #c}. */
|
|
5752
|
+
getWorldRotationX() {
|
|
5753
|
+
return Math.atan2(this.c, this.a) * MathUtils.radDeg;
|
|
5754
|
+
}
|
|
5755
|
+
/** The world rotation for the Y axis, calculated using {@link #b} and {@link #d}. */
|
|
5756
|
+
getWorldRotationY() {
|
|
5757
|
+
return Math.atan2(this.d, this.b) * MathUtils.radDeg;
|
|
5758
|
+
}
|
|
5759
|
+
/** The magnitude (always positive) of the world scale X, calculated using {@link #a} and {@link #c}. */
|
|
5760
|
+
getWorldScaleX() {
|
|
5761
|
+
return Math.sqrt(this.a * this.a + this.c * this.c);
|
|
5762
|
+
}
|
|
5763
|
+
/** The magnitude (always positive) of the world scale Y, calculated using {@link #b} and {@link #d}. */
|
|
5764
|
+
getWorldScaleY() {
|
|
5765
|
+
return Math.sqrt(this.b * this.b + this.d * this.d);
|
|
5766
|
+
}
|
|
5678
5767
|
/** Transforms a point from world coordinates to the bone's local coordinates. */
|
|
5679
5768
|
worldToLocal(world) {
|
|
5680
5769
|
let invDet = 1 / (this.a * this.d - this.b * this.c);
|
|
@@ -5690,6 +5779,18 @@ var spine = (() => {
|
|
|
5690
5779
|
local.y = x * this.c + y * this.d + this.worldY;
|
|
5691
5780
|
return local;
|
|
5692
5781
|
}
|
|
5782
|
+
/** Transforms a point from world coordinates to the parent bone's local coordinates. */
|
|
5783
|
+
worldToParent(world) {
|
|
5784
|
+
if (world == null)
|
|
5785
|
+
throw new Error("world cannot be null.");
|
|
5786
|
+
return this.parent == null ? world : this.parent.worldToLocal(world);
|
|
5787
|
+
}
|
|
5788
|
+
/** Transforms a point from the parent bone's coordinates to world coordinates. */
|
|
5789
|
+
parentToWorld(world) {
|
|
5790
|
+
if (world == null)
|
|
5791
|
+
throw new Error("world cannot be null.");
|
|
5792
|
+
return this.parent == null ? world : this.parent.localToWorld(world);
|
|
5793
|
+
}
|
|
5693
5794
|
/** Transforms a world rotation to a local rotation. */
|
|
5694
5795
|
worldToLocalRotation(worldRotation) {
|
|
5695
5796
|
let sin = MathUtils.sinDeg(worldRotation), cos = MathUtils.cosDeg(worldRotation);
|
|
@@ -5703,15 +5804,16 @@ var spine = (() => {
|
|
|
5703
5804
|
}
|
|
5704
5805
|
/** Rotates the world transform the specified amount.
|
|
5705
5806
|
* <p>
|
|
5706
|
-
* After changes are made to the world transform, {@link #updateAppliedTransform()} should be called and
|
|
5707
|
-
* need to be called on any child bones, recursively. */
|
|
5807
|
+
* After changes are made to the world transform, {@link #updateAppliedTransform()} should be called and
|
|
5808
|
+
* {@link #update(Physics)} will need to be called on any child bones, recursively. */
|
|
5708
5809
|
rotateWorld(degrees) {
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
this.
|
|
5713
|
-
this.
|
|
5714
|
-
this.
|
|
5810
|
+
degrees *= MathUtils.degRad;
|
|
5811
|
+
const sin = Math.sin(degrees), cos = Math.cos(degrees);
|
|
5812
|
+
const ra = this.a, rb = this.b;
|
|
5813
|
+
this.a = cos * ra - sin * this.c;
|
|
5814
|
+
this.b = cos * rb - sin * this.d;
|
|
5815
|
+
this.c = sin * ra + cos * this.c;
|
|
5816
|
+
this.d = sin * rb + cos * this.d;
|
|
5715
5817
|
}
|
|
5716
5818
|
};
|
|
5717
5819
|
|
|
@@ -6101,7 +6203,15 @@ var spine = (() => {
|
|
|
6101
6203
|
isActive() {
|
|
6102
6204
|
return this.active;
|
|
6103
6205
|
}
|
|
6104
|
-
|
|
6206
|
+
setToSetupPose() {
|
|
6207
|
+
const data = this.data;
|
|
6208
|
+
this.mix = data.mix;
|
|
6209
|
+
this.softness = data.softness;
|
|
6210
|
+
this.bendDirection = data.bendDirection;
|
|
6211
|
+
this.compress = data.compress;
|
|
6212
|
+
this.stretch = data.stretch;
|
|
6213
|
+
}
|
|
6214
|
+
update(physics) {
|
|
6105
6215
|
if (this.mix == 0)
|
|
6106
6216
|
return;
|
|
6107
6217
|
let target = this.target;
|
|
@@ -6160,12 +6270,15 @@ var spine = (() => {
|
|
|
6160
6270
|
tx = targetX - bone.worldX;
|
|
6161
6271
|
ty = targetY - bone.worldY;
|
|
6162
6272
|
}
|
|
6163
|
-
|
|
6164
|
-
if (
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6273
|
+
const b = bone.data.length * sx;
|
|
6274
|
+
if (b > 1e-4) {
|
|
6275
|
+
const dd = tx * tx + ty * ty;
|
|
6276
|
+
if (compress && dd < b * b || stretch && dd > b * b) {
|
|
6277
|
+
const s = (Math.sqrt(dd) / b - 1) * alpha + 1;
|
|
6278
|
+
sx *= s;
|
|
6279
|
+
if (uniform)
|
|
6280
|
+
sy *= s;
|
|
6281
|
+
}
|
|
6169
6282
|
}
|
|
6170
6283
|
}
|
|
6171
6284
|
bone.updateWorldTransformWith(
|
|
@@ -6466,7 +6579,15 @@ var spine = (() => {
|
|
|
6466
6579
|
isActive() {
|
|
6467
6580
|
return this.active;
|
|
6468
6581
|
}
|
|
6469
|
-
|
|
6582
|
+
setToSetupPose() {
|
|
6583
|
+
const data = this.data;
|
|
6584
|
+
this.position = data.position;
|
|
6585
|
+
this.spacing = data.spacing;
|
|
6586
|
+
this.mixRotate = data.mixRotate;
|
|
6587
|
+
this.mixX = data.mixX;
|
|
6588
|
+
this.mixY = data.mixY;
|
|
6589
|
+
}
|
|
6590
|
+
update(physics) {
|
|
6470
6591
|
let attachment = this.target.getAttachment();
|
|
6471
6592
|
if (!(attachment instanceof PathAttachment))
|
|
6472
6593
|
return;
|
|
@@ -6485,12 +6606,8 @@ var spine = (() => {
|
|
|
6485
6606
|
for (let i = 0, n = spacesCount - 1; i < n; i++) {
|
|
6486
6607
|
let bone = bones[i];
|
|
6487
6608
|
let setupLength = bone.data.length;
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
else {
|
|
6491
|
-
let x = setupLength * bone.a, y = setupLength * bone.c;
|
|
6492
|
-
lengths[i] = Math.sqrt(x * x + y * y);
|
|
6493
|
-
}
|
|
6609
|
+
let x = setupLength * bone.a, y = setupLength * bone.c;
|
|
6610
|
+
lengths[i] = Math.sqrt(x * x + y * y);
|
|
6494
6611
|
}
|
|
6495
6612
|
}
|
|
6496
6613
|
Utils.arrayFill(spaces, 1, spacesCount, spacing);
|
|
@@ -6865,6 +6982,238 @@ var spine = (() => {
|
|
|
6865
6982
|
__publicField(PathConstraint, "AFTER", -3);
|
|
6866
6983
|
__publicField(PathConstraint, "epsilon", 1e-5);
|
|
6867
6984
|
|
|
6985
|
+
// spine-core/src/PhysicsConstraint.ts
|
|
6986
|
+
var PhysicsConstraint = class {
|
|
6987
|
+
data;
|
|
6988
|
+
_bone = null;
|
|
6989
|
+
/** The bone constrained by this physics constraint. */
|
|
6990
|
+
set bone(bone) {
|
|
6991
|
+
this._bone = bone;
|
|
6992
|
+
}
|
|
6993
|
+
get bone() {
|
|
6994
|
+
if (!this._bone)
|
|
6995
|
+
throw new Error("Bone not set.");
|
|
6996
|
+
else
|
|
6997
|
+
return this._bone;
|
|
6998
|
+
}
|
|
6999
|
+
inertia = 0;
|
|
7000
|
+
strength = 0;
|
|
7001
|
+
damping = 0;
|
|
7002
|
+
massInverse = 0;
|
|
7003
|
+
wind = 0;
|
|
7004
|
+
gravity = 0;
|
|
7005
|
+
mix = 0;
|
|
7006
|
+
_reset = true;
|
|
7007
|
+
ux = 0;
|
|
7008
|
+
uy = 0;
|
|
7009
|
+
cx = 0;
|
|
7010
|
+
cy = 0;
|
|
7011
|
+
tx = 0;
|
|
7012
|
+
ty = 0;
|
|
7013
|
+
xOffset = 0;
|
|
7014
|
+
xVelocity = 0;
|
|
7015
|
+
yOffset = 0;
|
|
7016
|
+
yVelocity = 0;
|
|
7017
|
+
rotateOffset = 0;
|
|
7018
|
+
rotateVelocity = 0;
|
|
7019
|
+
scaleOffset = 0;
|
|
7020
|
+
scaleVelocity = 0;
|
|
7021
|
+
active = false;
|
|
7022
|
+
skeleton;
|
|
7023
|
+
remaining = 0;
|
|
7024
|
+
lastTime = 0;
|
|
7025
|
+
constructor(data, skeleton) {
|
|
7026
|
+
this.data = data;
|
|
7027
|
+
this.skeleton = skeleton;
|
|
7028
|
+
this.bone = skeleton.bones[data.bone.index];
|
|
7029
|
+
this.inertia = data.inertia;
|
|
7030
|
+
this.strength = data.strength;
|
|
7031
|
+
this.damping = data.damping;
|
|
7032
|
+
this.massInverse = data.massInverse;
|
|
7033
|
+
this.wind = data.wind;
|
|
7034
|
+
this.gravity = data.gravity;
|
|
7035
|
+
this.mix = data.mix;
|
|
7036
|
+
}
|
|
7037
|
+
reset() {
|
|
7038
|
+
this.remaining = 0;
|
|
7039
|
+
this.lastTime = this.skeleton.time;
|
|
7040
|
+
this._reset = true;
|
|
7041
|
+
this.xOffset = 0;
|
|
7042
|
+
this.xVelocity = 0;
|
|
7043
|
+
this.yOffset = 0;
|
|
7044
|
+
this.yVelocity = 0;
|
|
7045
|
+
this.rotateOffset = 0;
|
|
7046
|
+
this.rotateVelocity = 0;
|
|
7047
|
+
this.scaleOffset = 0;
|
|
7048
|
+
this.scaleVelocity = 0;
|
|
7049
|
+
}
|
|
7050
|
+
setToSetupPose() {
|
|
7051
|
+
const data = this.data;
|
|
7052
|
+
this.inertia = data.inertia;
|
|
7053
|
+
this.strength = data.strength;
|
|
7054
|
+
this.damping = data.damping;
|
|
7055
|
+
this.massInverse = data.massInverse;
|
|
7056
|
+
this.wind = data.wind;
|
|
7057
|
+
this.gravity = data.gravity;
|
|
7058
|
+
this.mix = data.mix;
|
|
7059
|
+
}
|
|
7060
|
+
isActive() {
|
|
7061
|
+
return this.active;
|
|
7062
|
+
}
|
|
7063
|
+
/** Applies the constraint to the constrained bones. */
|
|
7064
|
+
update(physics) {
|
|
7065
|
+
const mix = this.mix;
|
|
7066
|
+
if (mix == 0)
|
|
7067
|
+
return;
|
|
7068
|
+
const x = this.data.x > 0, y = this.data.y > 0, rotateOrShearX = this.data.rotate > 0 || this.data.shearX > 0, scaleX = this.data.scaleX > 0;
|
|
7069
|
+
const bone = this.bone;
|
|
7070
|
+
const l = bone.data.length;
|
|
7071
|
+
switch (physics) {
|
|
7072
|
+
case 0 /* none */:
|
|
7073
|
+
return;
|
|
7074
|
+
case 1 /* reset */:
|
|
7075
|
+
this.reset();
|
|
7076
|
+
case 2 /* update */:
|
|
7077
|
+
this.remaining += Math.max(this.skeleton.time - this.lastTime, 0);
|
|
7078
|
+
this.lastTime = this.skeleton.time;
|
|
7079
|
+
const bx = bone.worldX, by = bone.worldY;
|
|
7080
|
+
if (this._reset) {
|
|
7081
|
+
this._reset = false;
|
|
7082
|
+
this.ux = bx;
|
|
7083
|
+
this.uy = by;
|
|
7084
|
+
} else {
|
|
7085
|
+
let remaining = this.remaining, i = this.inertia, step = this.data.step;
|
|
7086
|
+
if (x || y) {
|
|
7087
|
+
if (x) {
|
|
7088
|
+
this.xOffset += (this.ux - bx) * i;
|
|
7089
|
+
this.ux = bx;
|
|
7090
|
+
}
|
|
7091
|
+
if (y) {
|
|
7092
|
+
this.yOffset += (this.uy - by) * i;
|
|
7093
|
+
this.uy = by;
|
|
7094
|
+
}
|
|
7095
|
+
if (remaining >= step) {
|
|
7096
|
+
const m = this.massInverse * step, e = this.strength, w = this.wind * 100, g = this.gravity * -100;
|
|
7097
|
+
const d = Math.pow(this.damping, 60 * step);
|
|
7098
|
+
do {
|
|
7099
|
+
if (x) {
|
|
7100
|
+
this.xVelocity += (w - this.xOffset * e) * m;
|
|
7101
|
+
this.xOffset += this.xVelocity * step;
|
|
7102
|
+
this.xVelocity *= d;
|
|
7103
|
+
}
|
|
7104
|
+
if (y) {
|
|
7105
|
+
this.yVelocity += (g - this.yOffset * e) * m;
|
|
7106
|
+
this.yOffset += this.yVelocity * step;
|
|
7107
|
+
this.yVelocity *= d;
|
|
7108
|
+
}
|
|
7109
|
+
remaining -= step;
|
|
7110
|
+
} while (remaining >= step);
|
|
7111
|
+
}
|
|
7112
|
+
if (x)
|
|
7113
|
+
bone.worldX += this.xOffset * mix * this.data.x;
|
|
7114
|
+
if (y)
|
|
7115
|
+
bone.worldY += this.yOffset * mix * this.data.y;
|
|
7116
|
+
}
|
|
7117
|
+
if (rotateOrShearX || scaleX) {
|
|
7118
|
+
let ca = Math.atan2(bone.c, bone.a), c = 0, s = 0, mr = 0;
|
|
7119
|
+
if (rotateOrShearX) {
|
|
7120
|
+
mr = mix * this.data.rotate;
|
|
7121
|
+
let dx = this.cx - bone.worldX, dy = this.cy - bone.worldY, r = Math.atan2(dy + this.ty, dx + this.tx) - ca - this.rotateOffset * mr;
|
|
7122
|
+
this.rotateOffset += (r - Math.ceil(r * MathUtils.invPI2 - 0.5) * MathUtils.PI2) * i;
|
|
7123
|
+
r = this.rotateOffset * mr + ca;
|
|
7124
|
+
c = Math.cos(r);
|
|
7125
|
+
s = Math.sin(r);
|
|
7126
|
+
if (scaleX) {
|
|
7127
|
+
r = l * bone.getWorldScaleX();
|
|
7128
|
+
if (r > 0)
|
|
7129
|
+
this.scaleOffset += (dx * c + dy * s) * i / r;
|
|
7130
|
+
}
|
|
7131
|
+
} else {
|
|
7132
|
+
c = Math.cos(ca);
|
|
7133
|
+
s = Math.sin(ca);
|
|
7134
|
+
const r = l * bone.getWorldScaleX();
|
|
7135
|
+
if (r > 0)
|
|
7136
|
+
this.scaleOffset += ((this.cx - bone.worldX) * c + (this.cy - bone.worldY) * s) * i / r;
|
|
7137
|
+
}
|
|
7138
|
+
remaining = this.remaining;
|
|
7139
|
+
if (remaining >= step) {
|
|
7140
|
+
const m = this.massInverse * step, e = this.strength, w = this.wind, g = this.gravity;
|
|
7141
|
+
const d = Math.pow(this.damping, 60 * step);
|
|
7142
|
+
while (true) {
|
|
7143
|
+
remaining -= step;
|
|
7144
|
+
if (scaleX) {
|
|
7145
|
+
this.scaleVelocity += (w * c - g * s - this.scaleOffset * e) * m;
|
|
7146
|
+
this.scaleOffset += this.scaleVelocity * step;
|
|
7147
|
+
this.scaleVelocity *= d;
|
|
7148
|
+
}
|
|
7149
|
+
if (rotateOrShearX) {
|
|
7150
|
+
this.rotateVelocity += (-0.01 * l * (w * s + g * c) - this.rotateOffset * e) * m;
|
|
7151
|
+
this.rotateOffset += this.rotateVelocity * step;
|
|
7152
|
+
this.rotateVelocity *= d;
|
|
7153
|
+
if (remaining < step)
|
|
7154
|
+
break;
|
|
7155
|
+
const r = this.rotateOffset * mr + ca;
|
|
7156
|
+
c = Math.cos(r);
|
|
7157
|
+
s = Math.sin(r);
|
|
7158
|
+
} else if (remaining < step)
|
|
7159
|
+
break;
|
|
7160
|
+
}
|
|
7161
|
+
}
|
|
7162
|
+
}
|
|
7163
|
+
this.remaining = remaining;
|
|
7164
|
+
}
|
|
7165
|
+
this.cx = bone.worldX;
|
|
7166
|
+
this.cy = bone.worldY;
|
|
7167
|
+
break;
|
|
7168
|
+
case 3 /* pose */:
|
|
7169
|
+
if (x)
|
|
7170
|
+
bone.worldX += this.xOffset * mix * this.data.x;
|
|
7171
|
+
if (y)
|
|
7172
|
+
bone.worldY += this.yOffset * mix * this.data.y;
|
|
7173
|
+
}
|
|
7174
|
+
if (rotateOrShearX) {
|
|
7175
|
+
let o = this.rotateOffset * mix, s = 0, c = 0, a = 0;
|
|
7176
|
+
if (this.data.shearX > 0) {
|
|
7177
|
+
let r = 0;
|
|
7178
|
+
if (this.data.rotate > 0) {
|
|
7179
|
+
r = o * this.data.rotate;
|
|
7180
|
+
s = Math.sin(r);
|
|
7181
|
+
c = Math.cos(r);
|
|
7182
|
+
a = bone.b;
|
|
7183
|
+
bone.b = c * a - s * bone.d;
|
|
7184
|
+
bone.d = s * a + c * bone.d;
|
|
7185
|
+
}
|
|
7186
|
+
r += o * this.data.shearX;
|
|
7187
|
+
s = Math.sin(r);
|
|
7188
|
+
c = Math.cos(r);
|
|
7189
|
+
a = bone.a;
|
|
7190
|
+
bone.a = c * a - s * bone.c;
|
|
7191
|
+
bone.c = s * a + c * bone.c;
|
|
7192
|
+
} else {
|
|
7193
|
+
o *= this.data.rotate;
|
|
7194
|
+
s = Math.sin(o);
|
|
7195
|
+
c = Math.cos(o);
|
|
7196
|
+
a = bone.a;
|
|
7197
|
+
bone.a = c * a - s * bone.c;
|
|
7198
|
+
bone.c = s * a + c * bone.c;
|
|
7199
|
+
a = bone.b;
|
|
7200
|
+
bone.b = c * a - s * bone.d;
|
|
7201
|
+
bone.d = s * a + c * bone.d;
|
|
7202
|
+
}
|
|
7203
|
+
}
|
|
7204
|
+
if (scaleX) {
|
|
7205
|
+
const s = 1 + this.scaleOffset * mix * this.data.scaleX;
|
|
7206
|
+
bone.a *= s;
|
|
7207
|
+
bone.c *= s;
|
|
7208
|
+
}
|
|
7209
|
+
if (physics != 3 /* pose */) {
|
|
7210
|
+
this.tx = l * bone.a;
|
|
7211
|
+
this.ty = l * bone.c;
|
|
7212
|
+
}
|
|
7213
|
+
bone.updateAppliedTransform();
|
|
7214
|
+
}
|
|
7215
|
+
};
|
|
7216
|
+
|
|
6868
7217
|
// spine-core/src/Slot.ts
|
|
6869
7218
|
var Slot = class {
|
|
6870
7219
|
/** The slot's setup pose data. */
|
|
@@ -6975,7 +7324,16 @@ var spine = (() => {
|
|
|
6975
7324
|
isActive() {
|
|
6976
7325
|
return this.active;
|
|
6977
7326
|
}
|
|
6978
|
-
|
|
7327
|
+
setToSetupPose() {
|
|
7328
|
+
const data = this.data;
|
|
7329
|
+
this.mixRotate = data.mixRotate;
|
|
7330
|
+
this.mixX = data.mixX;
|
|
7331
|
+
this.mixY = data.mixY;
|
|
7332
|
+
this.mixScaleX = data.mixScaleX;
|
|
7333
|
+
this.mixScaleY = data.mixScaleY;
|
|
7334
|
+
this.mixShearY = data.mixShearY;
|
|
7335
|
+
}
|
|
7336
|
+
update(physics) {
|
|
6979
7337
|
if (this.mixRotate == 0 && this.mixX == 0 && this.mixY == 0 && this.mixScaleX == 0 && this.mixScaleY == 0 && this.mixShearY == 0)
|
|
6980
7338
|
return;
|
|
6981
7339
|
if (this.data.local) {
|
|
@@ -7115,7 +7473,7 @@ var spine = (() => {
|
|
|
7115
7473
|
let rotation = bone.arotation;
|
|
7116
7474
|
if (mixRotate != 0) {
|
|
7117
7475
|
let r = target.arotation - rotation + this.data.offsetRotation;
|
|
7118
|
-
r -= (
|
|
7476
|
+
r -= Math.ceil(r / 360 - 0.5) * 360;
|
|
7119
7477
|
rotation += r * mixRotate;
|
|
7120
7478
|
}
|
|
7121
7479
|
let x = bone.ax, y = bone.ay;
|
|
@@ -7129,7 +7487,7 @@ var spine = (() => {
|
|
|
7129
7487
|
let shearY = bone.ashearY;
|
|
7130
7488
|
if (mixShearY != 0) {
|
|
7131
7489
|
let r = target.ashearY - shearY + this.data.offsetShearY;
|
|
7132
|
-
r -= (
|
|
7490
|
+
r -= Math.ceil(r / 360 - 0.5) * 360;
|
|
7133
7491
|
shearY += r * mixShearY;
|
|
7134
7492
|
}
|
|
7135
7493
|
bone.updateWorldTransformWith(x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
|
|
@@ -7168,6 +7526,8 @@ var spine = (() => {
|
|
|
7168
7526
|
transformConstraints;
|
|
7169
7527
|
/** The skeleton's path constraints. */
|
|
7170
7528
|
pathConstraints;
|
|
7529
|
+
/** The skeleton's physics constraints. */
|
|
7530
|
+
physicsConstraints;
|
|
7171
7531
|
/** The list of bones and constraints, sorted in the order they should be updated, as computed by {@link #updateCache()}. */
|
|
7172
7532
|
_updateCache = new Array();
|
|
7173
7533
|
/** The skeleton's current skin. May be null. */
|
|
@@ -7190,6 +7550,10 @@ var spine = (() => {
|
|
|
7190
7550
|
x = 0;
|
|
7191
7551
|
/** Sets the skeleton Y position, which is added to the root bone worldY position. */
|
|
7192
7552
|
y = 0;
|
|
7553
|
+
/** Returns the skeleton's time. This is used for time-based manipulations, such as {@link PhysicsConstraint}.
|
|
7554
|
+
* <p>
|
|
7555
|
+
* See {@link #update(float)}. */
|
|
7556
|
+
time = 0;
|
|
7193
7557
|
constructor(data) {
|
|
7194
7558
|
if (!data)
|
|
7195
7559
|
throw new Error("data cannot be null.");
|
|
@@ -7231,6 +7595,11 @@ var spine = (() => {
|
|
|
7231
7595
|
let pathConstraintData = data.pathConstraints[i];
|
|
7232
7596
|
this.pathConstraints.push(new PathConstraint(pathConstraintData, this));
|
|
7233
7597
|
}
|
|
7598
|
+
this.physicsConstraints = new Array();
|
|
7599
|
+
for (let i = 0; i < data.physicsConstraints.length; i++) {
|
|
7600
|
+
let physicsConstraintData = data.physicsConstraints[i];
|
|
7601
|
+
this.physicsConstraints.push(new PhysicsConstraint(physicsConstraintData, this));
|
|
7602
|
+
}
|
|
7234
7603
|
this.color = new Color(1, 1, 1, 1);
|
|
7235
7604
|
this.updateCache();
|
|
7236
7605
|
}
|
|
@@ -7259,8 +7628,9 @@ var spine = (() => {
|
|
|
7259
7628
|
let ikConstraints = this.ikConstraints;
|
|
7260
7629
|
let transformConstraints = this.transformConstraints;
|
|
7261
7630
|
let pathConstraints = this.pathConstraints;
|
|
7262
|
-
let
|
|
7263
|
-
let
|
|
7631
|
+
let physicsConstraints = this.physicsConstraints;
|
|
7632
|
+
let ikCount = ikConstraints.length, transformCount = transformConstraints.length, pathCount = pathConstraints.length, physicsCount = this.physicsConstraints.length;
|
|
7633
|
+
let constraintCount = ikCount + transformCount + pathCount + physicsCount;
|
|
7264
7634
|
outer:
|
|
7265
7635
|
for (let i = 0; i < constraintCount; i++) {
|
|
7266
7636
|
for (let ii = 0; ii < ikCount; ii++) {
|
|
@@ -7284,6 +7654,13 @@ var spine = (() => {
|
|
|
7284
7654
|
continue outer;
|
|
7285
7655
|
}
|
|
7286
7656
|
}
|
|
7657
|
+
for (let ii = 0; ii < physicsCount; ii++) {
|
|
7658
|
+
const constraint = physicsConstraints[ii];
|
|
7659
|
+
if (constraint.data.order == i) {
|
|
7660
|
+
this.sortPhysicsConstraint(constraint);
|
|
7661
|
+
continue outer;
|
|
7662
|
+
}
|
|
7663
|
+
}
|
|
7287
7664
|
}
|
|
7288
7665
|
for (let i = 0, n = bones.length; i < n; i++)
|
|
7289
7666
|
this.sortBone(bones[i]);
|
|
@@ -7382,6 +7759,16 @@ var spine = (() => {
|
|
|
7382
7759
|
}
|
|
7383
7760
|
}
|
|
7384
7761
|
}
|
|
7762
|
+
sortPhysicsConstraint(constraint) {
|
|
7763
|
+
const bone = constraint.bone;
|
|
7764
|
+
constraint.active = bone.active && !constraint.data.skinRequired || this.skin != null && Utils.contains(this.skin.constraints, constraint.data, true);
|
|
7765
|
+
if (!constraint.active)
|
|
7766
|
+
return;
|
|
7767
|
+
this.sortBone(bone);
|
|
7768
|
+
this._updateCache.push(constraint);
|
|
7769
|
+
this.sortReset(bone.children);
|
|
7770
|
+
bone.sorted = true;
|
|
7771
|
+
}
|
|
7385
7772
|
sortBone(bone) {
|
|
7386
7773
|
if (!bone)
|
|
7387
7774
|
return;
|
|
@@ -7407,7 +7794,9 @@ var spine = (() => {
|
|
|
7407
7794
|
*
|
|
7408
7795
|
* See [World transforms](http://esotericsoftware.com/spine-runtime-skeletons#World-transforms) in the Spine
|
|
7409
7796
|
* Runtimes Guide. */
|
|
7410
|
-
updateWorldTransform() {
|
|
7797
|
+
updateWorldTransform(physics) {
|
|
7798
|
+
if (!physics)
|
|
7799
|
+
throw new Error("physics is undefined");
|
|
7411
7800
|
let bones = this.bones;
|
|
7412
7801
|
for (let i = 0, n = bones.length; i < n; i++) {
|
|
7413
7802
|
let bone = bones[i];
|
|
@@ -7421,20 +7810,21 @@ var spine = (() => {
|
|
|
7421
7810
|
}
|
|
7422
7811
|
let updateCache = this._updateCache;
|
|
7423
7812
|
for (let i = 0, n = updateCache.length; i < n; i++)
|
|
7424
|
-
updateCache[i].update();
|
|
7813
|
+
updateCache[i].update(physics);
|
|
7425
7814
|
}
|
|
7426
|
-
updateWorldTransformWith(parent) {
|
|
7815
|
+
updateWorldTransformWith(physics, parent) {
|
|
7427
7816
|
let rootBone = this.getRootBone();
|
|
7428
7817
|
if (!rootBone)
|
|
7429
7818
|
throw new Error("Root bone must not be null.");
|
|
7430
7819
|
let pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
|
|
7431
7820
|
rootBone.worldX = pa * this.x + pb * this.y + parent.worldX;
|
|
7432
7821
|
rootBone.worldY = pc * this.x + pd * this.y + parent.worldY;
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7822
|
+
const rx = (rootBone.rotation + rootBone.shearX) * MathUtils.degRad;
|
|
7823
|
+
const ry = (rootBone.rotation + 90 + rootBone.shearY) * MathUtils.degRad;
|
|
7824
|
+
const la = Math.cos(rx) * rootBone.scaleX;
|
|
7825
|
+
const lb = Math.cos(ry) * rootBone.scaleY;
|
|
7826
|
+
const lc = Math.sin(rx) * rootBone.scaleX;
|
|
7827
|
+
const ld = Math.sin(ry) * rootBone.scaleY;
|
|
7438
7828
|
rootBone.a = (pa * la + pb * lc) * this.scaleX;
|
|
7439
7829
|
rootBone.b = (pa * lb + pb * ld) * this.scaleX;
|
|
7440
7830
|
rootBone.c = (pc * la + pd * lc) * this.scaleY;
|
|
@@ -7443,7 +7833,7 @@ var spine = (() => {
|
|
|
7443
7833
|
for (let i = 0, n = updateCache.length; i < n; i++) {
|
|
7444
7834
|
let updatable = updateCache[i];
|
|
7445
7835
|
if (updatable != rootBone)
|
|
7446
|
-
updatable.update();
|
|
7836
|
+
updatable.update(physics);
|
|
7447
7837
|
}
|
|
7448
7838
|
}
|
|
7449
7839
|
/** Sets the bones, constraints, and slots to their setup pose values. */
|
|
@@ -7453,39 +7843,16 @@ var spine = (() => {
|
|
|
7453
7843
|
}
|
|
7454
7844
|
/** Sets the bones and constraints to their setup pose values. */
|
|
7455
7845
|
setBonesToSetupPose() {
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
for (
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
constraint.
|
|
7464
|
-
|
|
7465
|
-
constraint.
|
|
7466
|
-
constraint.stretch = constraint.data.stretch;
|
|
7467
|
-
}
|
|
7468
|
-
let transformConstraints = this.transformConstraints;
|
|
7469
|
-
for (let i = 0, n = transformConstraints.length; i < n; i++) {
|
|
7470
|
-
let constraint = transformConstraints[i];
|
|
7471
|
-
let data = constraint.data;
|
|
7472
|
-
constraint.mixRotate = data.mixRotate;
|
|
7473
|
-
constraint.mixX = data.mixX;
|
|
7474
|
-
constraint.mixY = data.mixY;
|
|
7475
|
-
constraint.mixScaleX = data.mixScaleX;
|
|
7476
|
-
constraint.mixScaleY = data.mixScaleY;
|
|
7477
|
-
constraint.mixShearY = data.mixShearY;
|
|
7478
|
-
}
|
|
7479
|
-
let pathConstraints = this.pathConstraints;
|
|
7480
|
-
for (let i = 0, n = pathConstraints.length; i < n; i++) {
|
|
7481
|
-
let constraint = pathConstraints[i];
|
|
7482
|
-
let data = constraint.data;
|
|
7483
|
-
constraint.position = data.position;
|
|
7484
|
-
constraint.spacing = data.spacing;
|
|
7485
|
-
constraint.mixRotate = data.mixRotate;
|
|
7486
|
-
constraint.mixX = data.mixX;
|
|
7487
|
-
constraint.mixY = data.mixY;
|
|
7488
|
-
}
|
|
7846
|
+
for (const bone of this.bones)
|
|
7847
|
+
bone.setToSetupPose();
|
|
7848
|
+
for (const constraint of this.ikConstraints)
|
|
7849
|
+
constraint.setToSetupPose();
|
|
7850
|
+
for (const constraint of this.transformConstraints)
|
|
7851
|
+
constraint.setToSetupPose();
|
|
7852
|
+
for (const constraint of this.pathConstraints)
|
|
7853
|
+
constraint.setToSetupPose();
|
|
7854
|
+
for (const constraint of this.physicsConstraints)
|
|
7855
|
+
constraint.setToSetupPose();
|
|
7489
7856
|
}
|
|
7490
7857
|
/** Sets the slots and draw order to their setup pose values. */
|
|
7491
7858
|
setSlotsToSetupPose() {
|
|
@@ -7623,13 +7990,7 @@ var spine = (() => {
|
|
|
7623
7990
|
findIkConstraint(constraintName) {
|
|
7624
7991
|
if (!constraintName)
|
|
7625
7992
|
throw new Error("constraintName cannot be null.");
|
|
7626
|
-
|
|
7627
|
-
for (let i = 0, n = ikConstraints.length; i < n; i++) {
|
|
7628
|
-
let ikConstraint = ikConstraints[i];
|
|
7629
|
-
if (ikConstraint.data.name == constraintName)
|
|
7630
|
-
return ikConstraint;
|
|
7631
|
-
}
|
|
7632
|
-
return null;
|
|
7993
|
+
return this.ikConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
7633
7994
|
}
|
|
7634
7995
|
/** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of
|
|
7635
7996
|
* this method than to call it repeatedly.
|
|
@@ -7637,13 +7998,7 @@ var spine = (() => {
|
|
|
7637
7998
|
findTransformConstraint(constraintName) {
|
|
7638
7999
|
if (!constraintName)
|
|
7639
8000
|
throw new Error("constraintName cannot be null.");
|
|
7640
|
-
|
|
7641
|
-
for (let i = 0, n = transformConstraints.length; i < n; i++) {
|
|
7642
|
-
let constraint = transformConstraints[i];
|
|
7643
|
-
if (constraint.data.name == constraintName)
|
|
7644
|
-
return constraint;
|
|
7645
|
-
}
|
|
7646
|
-
return null;
|
|
8001
|
+
return this.transformConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
7647
8002
|
}
|
|
7648
8003
|
/** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method
|
|
7649
8004
|
* than to call it repeatedly.
|
|
@@ -7651,13 +8006,14 @@ var spine = (() => {
|
|
|
7651
8006
|
findPathConstraint(constraintName) {
|
|
7652
8007
|
if (!constraintName)
|
|
7653
8008
|
throw new Error("constraintName cannot be null.");
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
8009
|
+
return this.pathConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
8010
|
+
}
|
|
8011
|
+
/** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this
|
|
8012
|
+
* method than to call it repeatedly. */
|
|
8013
|
+
findPhysicsConstraint(constraintName) {
|
|
8014
|
+
if (constraintName == null)
|
|
8015
|
+
throw new Error("constraintName cannot be null.");
|
|
8016
|
+
return this.physicsConstraints.find((constraint) => constraint.data.name == constraintName) ?? null;
|
|
7661
8017
|
}
|
|
7662
8018
|
/** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose as `{ x: number, y: number, width: number, height: number }`.
|
|
7663
8019
|
* Note that this method will create temporary objects which can add to garbage collection pressure. Use `getBounds()` if garbage collection is a concern. */
|
|
@@ -7708,9 +8064,20 @@ var spine = (() => {
|
|
|
7708
8064
|
offset.set(minX, minY);
|
|
7709
8065
|
size.set(maxX - minX, maxY - minY);
|
|
7710
8066
|
}
|
|
8067
|
+
/** Increments the skeleton's {@link #time}. */
|
|
8068
|
+
update(delta) {
|
|
8069
|
+
this.time += delta;
|
|
8070
|
+
}
|
|
7711
8071
|
};
|
|
7712
|
-
var
|
|
7713
|
-
__publicField(
|
|
8072
|
+
var Skeleton2 = _Skeleton;
|
|
8073
|
+
__publicField(Skeleton2, "yDown", false);
|
|
8074
|
+
var Physics = /* @__PURE__ */ ((Physics2) => {
|
|
8075
|
+
Physics2[Physics2["none"] = 0] = "none";
|
|
8076
|
+
Physics2[Physics2["reset"] = 1] = "reset";
|
|
8077
|
+
Physics2[Physics2["update"] = 2] = "update";
|
|
8078
|
+
Physics2[Physics2["pose"] = 3] = "pose";
|
|
8079
|
+
return Physics2;
|
|
8080
|
+
})(Physics || {});
|
|
7714
8081
|
|
|
7715
8082
|
// spine-core/src/SkeletonData.ts
|
|
7716
8083
|
var SkeletonData = class {
|
|
@@ -7738,6 +8105,8 @@ var spine = (() => {
|
|
|
7738
8105
|
transformConstraints = new Array();
|
|
7739
8106
|
/** The skeleton's path constraints. */
|
|
7740
8107
|
pathConstraints = new Array();
|
|
8108
|
+
/** The skeleton's physics constraints. */
|
|
8109
|
+
physicsConstraints = new Array();
|
|
7741
8110
|
/** The X coordinate of the skeleton's axis aligned bounding box in the setup pose. */
|
|
7742
8111
|
x = 0;
|
|
7743
8112
|
/** The Y coordinate of the skeleton's axis aligned bounding box in the setup pose. */
|
|
@@ -7833,9 +8202,9 @@ var spine = (() => {
|
|
|
7833
8202
|
findIkConstraint(constraintName) {
|
|
7834
8203
|
if (!constraintName)
|
|
7835
8204
|
throw new Error("constraintName cannot be null.");
|
|
7836
|
-
|
|
8205
|
+
const ikConstraints = this.ikConstraints;
|
|
7837
8206
|
for (let i = 0, n = ikConstraints.length; i < n; i++) {
|
|
7838
|
-
|
|
8207
|
+
const constraint = ikConstraints[i];
|
|
7839
8208
|
if (constraint.name == constraintName)
|
|
7840
8209
|
return constraint;
|
|
7841
8210
|
}
|
|
@@ -7847,9 +8216,9 @@ var spine = (() => {
|
|
|
7847
8216
|
findTransformConstraint(constraintName) {
|
|
7848
8217
|
if (!constraintName)
|
|
7849
8218
|
throw new Error("constraintName cannot be null.");
|
|
7850
|
-
|
|
8219
|
+
const transformConstraints = this.transformConstraints;
|
|
7851
8220
|
for (let i = 0, n = transformConstraints.length; i < n; i++) {
|
|
7852
|
-
|
|
8221
|
+
const constraint = transformConstraints[i];
|
|
7853
8222
|
if (constraint.name == constraintName)
|
|
7854
8223
|
return constraint;
|
|
7855
8224
|
}
|
|
@@ -7861,9 +8230,23 @@ var spine = (() => {
|
|
|
7861
8230
|
findPathConstraint(constraintName) {
|
|
7862
8231
|
if (!constraintName)
|
|
7863
8232
|
throw new Error("constraintName cannot be null.");
|
|
7864
|
-
|
|
8233
|
+
const pathConstraints = this.pathConstraints;
|
|
7865
8234
|
for (let i = 0, n = pathConstraints.length; i < n; i++) {
|
|
7866
|
-
|
|
8235
|
+
const constraint = pathConstraints[i];
|
|
8236
|
+
if (constraint.name == constraintName)
|
|
8237
|
+
return constraint;
|
|
8238
|
+
}
|
|
8239
|
+
return null;
|
|
8240
|
+
}
|
|
8241
|
+
/** Finds a physics constraint by comparing each physics constraint's name. It is more efficient to cache the results of this method
|
|
8242
|
+
* than to call it multiple times.
|
|
8243
|
+
* @return May be null. */
|
|
8244
|
+
findPhysicsConstraint(constraintName) {
|
|
8245
|
+
if (!constraintName)
|
|
8246
|
+
throw new Error("constraintName cannot be null.");
|
|
8247
|
+
const physicsConstraints = this.physicsConstraints;
|
|
8248
|
+
for (let i = 0, n = physicsConstraints.length; i < n; i++) {
|
|
8249
|
+
const constraint = physicsConstraints[i];
|
|
7867
8250
|
if (constraint.name == constraintName)
|
|
7868
8251
|
return constraint;
|
|
7869
8252
|
}
|
|
@@ -7885,6 +8268,9 @@ var spine = (() => {
|
|
|
7885
8268
|
attachments = new Array();
|
|
7886
8269
|
bones = Array();
|
|
7887
8270
|
constraints = new Array();
|
|
8271
|
+
/** The color of the skin as it was in Spine, or a default color if nonessential data was not exported. */
|
|
8272
|
+
color = new Color(0.99607843, 0.61960787, 0.30980393, 1);
|
|
8273
|
+
// fe9e4fff
|
|
7888
8274
|
constructor(name) {
|
|
7889
8275
|
if (!name)
|
|
7890
8276
|
throw new Error("name cannot be null.");
|
|
@@ -8058,6 +8444,8 @@ var spine = (() => {
|
|
|
8058
8444
|
attachmentName = null;
|
|
8059
8445
|
/** The blend mode for drawing the slot's attachment. */
|
|
8060
8446
|
blendMode = BlendMode.Normal;
|
|
8447
|
+
/** False if the slot was hidden in Spine and nonessential data was exported. Does not affect runtime rendering. */
|
|
8448
|
+
visible = true;
|
|
8061
8449
|
constructor(index, name, boneData) {
|
|
8062
8450
|
if (index < 0)
|
|
8063
8451
|
throw new Error("index must be >= 0.");
|