@esotericsoftware/spine-canvas 4.2.33 → 4.2.35
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.
|
@@ -8687,8 +8687,8 @@ var spine = (() => {
|
|
|
8687
8687
|
data.strength = input.readFloat();
|
|
8688
8688
|
data.damping = input.readFloat();
|
|
8689
8689
|
data.massInverse = input.readFloat();
|
|
8690
|
-
data.wind = input.readFloat();
|
|
8691
|
-
data.gravity = input.readFloat();
|
|
8690
|
+
data.wind = input.readFloat() * scale;
|
|
8691
|
+
data.gravity = input.readFloat() * scale;
|
|
8692
8692
|
data.mix = input.readFloat();
|
|
8693
8693
|
flags = input.readByte();
|
|
8694
8694
|
if ((flags & 1) != 0)
|
|
@@ -9389,10 +9389,10 @@ var spine = (() => {
|
|
|
9389
9389
|
timelines.push(readTimeline1(input, new PhysicsConstraintMassTimeline(frameCount, bezierCount, index), 1));
|
|
9390
9390
|
break;
|
|
9391
9391
|
case PHYSICS_WIND:
|
|
9392
|
-
timelines.push(readTimeline1(input, new PhysicsConstraintWindTimeline(frameCount, bezierCount, index),
|
|
9392
|
+
timelines.push(readTimeline1(input, new PhysicsConstraintWindTimeline(frameCount, bezierCount, index), scale));
|
|
9393
9393
|
break;
|
|
9394
9394
|
case PHYSICS_GRAVITY:
|
|
9395
|
-
timelines.push(readTimeline1(input, new PhysicsConstraintGravityTimeline(frameCount, bezierCount, index),
|
|
9395
|
+
timelines.push(readTimeline1(input, new PhysicsConstraintGravityTimeline(frameCount, bezierCount, index), scale));
|
|
9396
9396
|
break;
|
|
9397
9397
|
case PHYSICS_MIX:
|
|
9398
9398
|
timelines.push(readTimeline1(input, new PhysicsConstraintMixTimeline(frameCount, bezierCount, index), 1));
|
|
@@ -10572,6 +10572,40 @@ var spine = (() => {
|
|
|
10572
10572
|
skeletonData.pathConstraints.push(data);
|
|
10573
10573
|
}
|
|
10574
10574
|
}
|
|
10575
|
+
if (root.physics) {
|
|
10576
|
+
for (let i = 0; i < root.physics.length; i++) {
|
|
10577
|
+
const constraintMap = root.physics[i];
|
|
10578
|
+
const data = new PhysicsConstraintData(constraintMap.name);
|
|
10579
|
+
data.order = getValue(constraintMap, "order", 0);
|
|
10580
|
+
data.skinRequired = getValue(constraintMap, "skin", false);
|
|
10581
|
+
const boneName = constraintMap.bone;
|
|
10582
|
+
const bone = skeletonData.findBone(boneName);
|
|
10583
|
+
if (bone == null)
|
|
10584
|
+
throw new Error("Physics bone not found: " + boneName);
|
|
10585
|
+
data.bone = bone;
|
|
10586
|
+
data.x = getValue(constraintMap, "x", 0);
|
|
10587
|
+
data.y = getValue(constraintMap, "y", 0);
|
|
10588
|
+
data.rotate = getValue(constraintMap, "rotate", 0);
|
|
10589
|
+
data.scaleX = getValue(constraintMap, "scaleX", 0);
|
|
10590
|
+
data.shearX = getValue(constraintMap, "shearX", 0);
|
|
10591
|
+
data.step = 1 / getValue(constraintMap, "fps", 60);
|
|
10592
|
+
data.inertia = getValue(constraintMap, "inertia", 1);
|
|
10593
|
+
data.strength = getValue(constraintMap, "strength", 100);
|
|
10594
|
+
data.damping = getValue(constraintMap, "damping", 1);
|
|
10595
|
+
data.massInverse = 1 / getValue(constraintMap, "mass", 1);
|
|
10596
|
+
data.wind = getValue(constraintMap, "wind", 0) * scale;
|
|
10597
|
+
data.gravity = getValue(constraintMap, "gravity", 0) * scale;
|
|
10598
|
+
data.mix = getValue(constraintMap, "mix", 1);
|
|
10599
|
+
data.inertiaGlobal = getValue(constraintMap, "inertiaGlobal", false);
|
|
10600
|
+
data.strengthGlobal = getValue(constraintMap, "strengthGlobal", false);
|
|
10601
|
+
data.dampingGlobal = getValue(constraintMap, "dampingGlobal", false);
|
|
10602
|
+
data.massGlobal = getValue(constraintMap, "massGlobal", false);
|
|
10603
|
+
data.windGlobal = getValue(constraintMap, "windGlobal", false);
|
|
10604
|
+
data.gravityGlobal = getValue(constraintMap, "gravityGlobal", false);
|
|
10605
|
+
data.mixGlobal = getValue(constraintMap, "mixGlobal", false);
|
|
10606
|
+
skeletonData.physicsConstraints.push(data);
|
|
10607
|
+
}
|
|
10608
|
+
}
|
|
10575
10609
|
if (root.skins) {
|
|
10576
10610
|
for (let i = 0; i < root.skins.length; i++) {
|
|
10577
10611
|
let skinMap = root.skins[i];
|
|
@@ -10612,6 +10646,15 @@ var spine = (() => {
|
|
|
10612
10646
|
skin.constraints.push(constraint);
|
|
10613
10647
|
}
|
|
10614
10648
|
}
|
|
10649
|
+
if (skinMap.physics) {
|
|
10650
|
+
for (let ii = 0; ii < skinMap.physics.length; ii++) {
|
|
10651
|
+
let constraintName = skinMap.physics[ii];
|
|
10652
|
+
let constraint = skeletonData.findPhysicsConstraint(constraintName);
|
|
10653
|
+
if (!constraint)
|
|
10654
|
+
throw new Error(`Couldn't find physics constraint ${constraintName} for skin ${skinMap.name}.`);
|
|
10655
|
+
skin.constraints.push(constraint);
|
|
10656
|
+
}
|
|
10657
|
+
}
|
|
10615
10658
|
for (let slotName in skinMap.attachments) {
|
|
10616
10659
|
let slot = skeletonData.findSlot(slotName);
|
|
10617
10660
|
if (!slot)
|
|
@@ -11143,6 +11186,53 @@ var spine = (() => {
|
|
|
11143
11186
|
}
|
|
11144
11187
|
}
|
|
11145
11188
|
}
|
|
11189
|
+
if (map.physics) {
|
|
11190
|
+
for (let constraintName in map.physics) {
|
|
11191
|
+
let constraintMap = map.physics[constraintName];
|
|
11192
|
+
let constraintIndex = -1;
|
|
11193
|
+
if (constraintName.length > 0) {
|
|
11194
|
+
let constraint = skeletonData.findPhysicsConstraint(constraintName);
|
|
11195
|
+
if (!constraint)
|
|
11196
|
+
throw new Error("Physics constraint not found: " + constraintName);
|
|
11197
|
+
constraintIndex = skeletonData.physicsConstraints.indexOf(constraint);
|
|
11198
|
+
}
|
|
11199
|
+
for (let timelineName in constraintMap) {
|
|
11200
|
+
let timelineMap = constraintMap[timelineName];
|
|
11201
|
+
let keyMap = timelineMap[0];
|
|
11202
|
+
if (!keyMap)
|
|
11203
|
+
continue;
|
|
11204
|
+
let frames = timelineMap.length;
|
|
11205
|
+
if (timelineName == "reset") {
|
|
11206
|
+
const timeline2 = new PhysicsConstraintResetTimeline(timelineMap.size, constraintIndex);
|
|
11207
|
+
for (let frame = 0; keyMap != null; keyMap = timelineMap[frame + 1], frame++)
|
|
11208
|
+
timeline2.setFrame(frame, getValue(keyMap, "time", 0));
|
|
11209
|
+
timelines.push(timeline2);
|
|
11210
|
+
continue;
|
|
11211
|
+
}
|
|
11212
|
+
let timeline;
|
|
11213
|
+
let timelineScale = 1;
|
|
11214
|
+
if (timelineName == "inertia")
|
|
11215
|
+
timeline = new PhysicsConstraintInertiaTimeline(frames, frames, constraintIndex);
|
|
11216
|
+
else if (timelineName == "strength")
|
|
11217
|
+
timeline = new PhysicsConstraintStrengthTimeline(frames, frames, constraintIndex);
|
|
11218
|
+
else if (timelineName == "damping")
|
|
11219
|
+
timeline = new PhysicsConstraintDampingTimeline(frames, frames, constraintIndex);
|
|
11220
|
+
else if (timelineName == "mass")
|
|
11221
|
+
timeline = new PhysicsConstraintMassTimeline(frames, frames, constraintIndex);
|
|
11222
|
+
else if (timelineName == "wind") {
|
|
11223
|
+
timeline = new PhysicsConstraintWindTimeline(frames, frames, constraintIndex);
|
|
11224
|
+
timelineScale = scale;
|
|
11225
|
+
} else if (timelineName == "gravity") {
|
|
11226
|
+
timeline = new PhysicsConstraintGravityTimeline(frames, frames, constraintIndex);
|
|
11227
|
+
timelineScale = scale;
|
|
11228
|
+
} else if (timelineName == "mix")
|
|
11229
|
+
timeline = new PhysicsConstraintMixTimeline(frames, frames, constraintIndex);
|
|
11230
|
+
else
|
|
11231
|
+
continue;
|
|
11232
|
+
timelines.push(readTimeline12(timelineMap, timeline, 0, timelineScale));
|
|
11233
|
+
}
|
|
11234
|
+
}
|
|
11235
|
+
}
|
|
11146
11236
|
if (map.attachments) {
|
|
11147
11237
|
for (let attachmentsName in map.attachments) {
|
|
11148
11238
|
let attachmentsMap = map.attachments[attachmentsName];
|