- Edited
[LibGDX] Scaling skeleton
Hi guys,
I've just started playing around with the Spine runtime in LibGDX. I would have liked to change the scale of my skeleton with a simple tween animatio but i can't find a method that supports this. I can only set the scale when creating the skeleton. The scaling method provided in the documentation did not affect the result in any way.
BoneData root = skeletonData.findBone("root");
root.scaleX = 2;
root.scaleY = 2;
Is it possible to change the skeleton scale at a given moment at runtime?
Changing the root will work. If you key the root scale in an animation you apply, you need to set the root scale in code after you apply the animation (or don't key scale).
You can do
In your render method.
if (scaling && skeleton.getRootBone().getScaleX() < 2) {
skeleton.getRootBone().setScaleX(skeleton.getRootBone().getScaleX() + 1f * Gdx.graphics.getDeltaTime());
skeleton.getRootBone().setScaleY(skeleton.getRootBone().getScaleY() + 1f * Gdx.graphics.getDeltaTime());
}
If you want it to scale over time smoothly. I've just set up a key to toggle a boolean scaling
true or false
Thanks guys, scaling the getRootBone() worked perfectly.