Adjust relax soft bodies (draggable trio)

This commit is contained in:
Daddy32
2025-12-13 20:49:22 +01:00
parent 45a7a6cef4
commit 8dfb370d10

View File

@@ -75,8 +75,9 @@
}; };
const softRadius = Math.max(18, w * 0.025); const softRadius = Math.max(18, w * 0.025);
const softA = makeSoft(w * 0.35, h * 0.4, 3, 3, softRadius, "#38bdf8"); const softA = makeSoft(w * 0.32, h * 0.38, 3, 3, softRadius, "#38bdf8");
const softB = makeSoft(w * 0.65, h * 0.55, 3, 3, softRadius, "#f472b6"); const softB = makeSoft(w * 0.65, h * 0.55, 3, 3, softRadius, "#f472b6");
const softC = makeSoft(w * 0.5, h * 0.32, 3, 3, softRadius, "#fbbf24");
return [ return [
Bodies.rectangle( Bodies.rectangle(
@@ -114,20 +115,12 @@
render: { fillStyle: "#7c3aed", strokeStyle: "#7c3aed" }, render: { fillStyle: "#7c3aed", strokeStyle: "#7c3aed" },
}, },
), ),
Bodies.circle(w * 0.35, h * 0.35, bumperRadius, {
isStatic: true,
restitution: 1.05,
render: { fillStyle: "#fbbf24", strokeStyle: "#fbbf24" },
}),
Bodies.circle(w * 0.65, h * 0.55, bumperRadius * 0.9, {
isStatic: true,
restitution: 1.05,
render: { fillStyle: "#22c55e", strokeStyle: "#22c55e" },
}),
...softA.bodies, ...softA.bodies,
...softA.constraints, ...softA.constraints,
...softB.bodies, ...softB.bodies,
...softB.constraints, ...softB.constraints,
...softC.bodies,
...softC.constraints,
]; ];
}, },
}); });