648 auto animation = Animation::create();
649 for(
int i=1;i<15;i++)
651 char szName[100] = {0};
652 sprintf(szName,
"Images/grossini_dance_%02d.png", i);
653 animation->addSpriteFrameWithFile(szName);
656 animation->setDelayPerUnit(2.8f / 14.0f);
657 animation->setRestoreOriginalFrame(
true);
659 auto action = Animate::create(animation);
660 _grossini->runAction(Sequence::create(action, action->reverse(),
nullptr));
666 auto cache = AnimationCache::getInstance();
667 cache->addAnimationsWithFile(
"animations/animations-2.plist");
668 auto animation2 = cache->getAnimation(
"dance_1");
670 auto action2 = Animate::create(animation2);
671 _tamara->runAction(Sequence::create(action2, action2->reverse(),
nullptr));
673 _frameDisplayedListener = EventListenerCustom::create(AnimationFrameDisplayedNotification, [](EventCustom * event){
674 auto userData =
static_cast<AnimationFrame::DisplayedEventInfo*
>(
event->getUserData());
676 log(
"target %p with data %s", userData->target, Value(userData->userInfo).getDescription().c_str());
685 auto animation3 = animation2->clone();
686 animation3->setLoops(4);
689 auto action3 = Animate::create(animation3);
cocos2d::EventListenerCustom * _frameDisplayedListener
void centerSprites(unsigned int numberOfSprites)
cocos2d::Sprite * _grossini
virtual void onEnter() override
cocos2d::Sprite * _tamara
cocos2d::Sprite * _kathia