• Runtimes
  • [cocos2dx] a noob question on animation mix

  • संपादित
Related Discussions
...

hello guys, I have a noob question on mixing animation,
I have three animations A,B,C. I want them go in loop A->B->C->A(loop)
I have them setMix(A,B) ,setMix(B,C), setMix(C,A)
then when C animation completed:

	switch (type) {
	case ANIMATION_COMPLETE:
            if(strcmp(animationName,"C")==0){
                skeletonNode->clearTrack();
                skeletonNode->setAnimation(0, "A", false);
                skeletonNode->addAnimation(0, "B", false,2.0f);
                skeletonNode->addAnimation(0, "C", false,2.0f);
            }
		break;
...
	}

I clear the track and set the animation sequence again,
but doing so, I will lose the mixing from C to A,
how should I do it properly if I want to keep the C to A mixing?

using:
-official cocos2dx 2.2
-latest spine runtime
-xcode ios simulator

many thanks!

Clearing the track means setAnimation has nothing to mix from. If you wait until C is complete, it is too late to mix C -> A, mixing happens between C.endTime - mixTime and C.endTime. Try this: add A,B,C, then whenever B ends you add A,B,C to the track.

7 महीने बाद में

Hi, I have a similar question.
I have four animations A, B, C, D. I want them run like A(3s)->B(5s)->C->D(loop).
I want D will loop like that It pause in 3s then runs again but I don't know how to make it runs like that. If I use:

skeletonAnim->setPosition(ccp(240, 10));
    skeletonAnim->setAnimation(0, "A", true);
    skeletonAnim->addAnimation(0, "B", true, 3);
    skeletonAnim->addAnimation(0, "C", false, 5);
    skeletonAnim->addAnimation(0, "D", true);

It just runs like "A"(loop for 3s) then runs "B"(loop for 5s) then runs "C" and wait for 5s then loop "D" without 3s delay between a loop.

Any help would be appreciated :clap: