# How do I scale a Spine animation at runtime?

The spine docummentation shows how to scale the skeleton when loading. Is it a must to reload the skeleton to scale the animation while playing it?

• Do you mean scale it as part of the animation data, or procedurally when rendering it in your game? – Anko Oct 4 '14 at 11:02
• I need to do is procedurally, since my character moves in a virtual z axis in my 2d game and I need to make it smaller or bigger. – freesoul Oct 4 '14 at 11:17
• Which runtime are you using? – Kelly Thomas Oct 4 '14 at 12:58
• I'm using SFML library – freesoul Oct 4 '14 at 13:45
• SFML doesn't have built-in support for skeletal animation, is it possible you're using this project? – bcrist Oct 5 '14 at 11:21

This is done by manipulating the bone directly, as in this documentation: http://esotericsoftware.com/spine-using-runtimes#Manipulating-bones

The key here is that you have to perform the operation after calling AnimationState_update/apply but before calling Skeleton_updateWorldTransform:

Skeleton_update(spine->_Skeleton, dt);
AnimationState_update(spine->_AnimationState, dt);
AnimationState_apply(spine->_AnimationState, spine->_Skeleton);

// Now that the animation has applied any changes, provide our own manipulations:
spine->_Skeleton->x = transform->position.x;
spine->_Skeleton->y = transform->position.y;
spine->_Skeleton->root->scaleX = 0.5f;
spine->_Skeleton->root->scaleY = 0.5f;

spine->_Skeleton->root->rotation = 45.0f;

Skeleton_updateWorldTransform(spine->_Skeleton);