Hello,
We have tried a lot of times and never quite figured out how to mix (interpolate) animations. Searching the web also never provided a good and clear tutorial on the topic, so maybe one of you has a solution for cocos2d-x c++ and not spine runtimes for c# or something similar.
The way we work with animations so far is that out animation designer works very carefully to make them seem transition nicely, but it is a long and tiring task.
This is how we’re working right now as and example:
animation->setAnimation(0, "idle", true);
// and on some event
animation->clearTracks();
animation->setAnimation(1, "from_idle_to_running", false);
// and when that finishes playing
animation->clearTracks();
animation->setAnimation(2, "running_idle", true);
Can anyone shed light on correct mixing examples for cocos2d-x c++ spine animations? Thank you.
animation->setMix(“idle”,“fromIdleToRunning”,0.06);
animation->setMix(“fromIdleToRunning”,“running_idle”,0.06);
animation->setAnimation(0,“idle”,true);
animation->setAnimation(0,“fromIdleToRunning”,false);
animation->addAnimation(0,“running_idle”,true);
2 Likes
Thank you! Nowhere where i looked had it explained that the animations have to be played in the same track to be mixed!
No problem… feel free to ask anything 
@b12345
One more question.
In the above example. If one animation is playing and then in the middle of that animation i setAnimation another one with mixing. Is the end of animation_1 still being played by the end of mixing or is it “killed”?
Also, what happens if both the 1st and 2nd animations are looping?
once you mix 2 animations they stay mixed through out that skeletonAnimation
suppose
init(){
animation->setMix(“idle”,“fromIdleToRunning”,0.06);
animation->setMix(“fromIdleToRunning”,“running_idle”,0.06);
}
idle(){
animation->setAnimation(0,“idle”,true);
}
idleToRun(){
animation->setAnimation(0,“fromIdleToRunning”,false);
animation->addAnimation(0,“running_idle”,true);
}
so whenever you call idleToRun() the animations are already mixed. Given that idle was the current animation.
Note: mixing starts at current state of the animation
You also want
animation->setMix(“running_idle”,“idle”,0.06);
//
If one animation is playing and then in the middle of that animation i setAnimation another one with mixing.
/// 0.06 sec is mixed/interpolated
Animation_1 is killed.
if both are looped … 2nd animation takes over … 1st is killed
Thank you. Made a lot of things simpler 