To blend from one animation to the next, the runtime needs to apply animation A, then mix the pose from animation B on top of the pose from A. If A is no longer being applied and you only tell B to play, then when B is applied, the pose from A is overwritten.
You don't need to let A end before setting the second. Instead, for spine-cocos2d, you can do setAnimationForTrack
then addAnimationForTrack
.
If you really want to wait for animation A to finish, then do:
spTrackEntry* trackEntry = [skeletonAnimation setAnimationForTrack:0 name:A2 loop:NO];
trackEntry->endTime = 99999;
The endTime
is set to the animation duration (in seconds) by default. When the animation reaches the end time, it is removed from the track (or loops if it is looping). This is why by the time you play B, A is no longer being applied and you get no mixing. Setting A's endTime
to something high means A is still applied until you call setAnimationForTrack
to play B, so then you get crossfading.