2046 auto s = Director::getInstance()->getWinSize();
2047 auto cache = SpriteFrameCache::getInstance();
2048 cache->addSpriteFramesWithFile(
"animations/grossini.plist");
2049 cache->addSpriteFramesWithFile(
"animations/grossini_gray.plist",
"animations/grossini_gray.png");
2051 for(
int i=0;i<3;i++)
2056 auto sprite = Sprite::createWithSpriteFrameName(
"grossini_dance_01.png");
2057 sprite->setPosition(Vec2( s.width/4*(i+1), s.height/2));
2059 auto point = Sprite::create(
"Images/r1.png");
2060 point->setScale( 0.25f );
2061 point->setPosition( sprite->getPosition() );
2067 sprite->setAnchorPoint( Vec2::ANCHOR_BOTTOM_LEFT );
2070 sprite->setAnchorPoint( Vec2::ANCHOR_MIDDLE );
2073 sprite->setAnchorPoint( Vec2::ANCHOR_TOP_RIGHT );
2077 point->setPosition( sprite->getPosition() );
2079 Vector<SpriteFrame*> animFrames(14);
2080 char str[100] = {0};
2081 for(
int i = 0; i < 14; i++)
2083 sprintf(str,
"grossini_dance_%02d.png",(i+1));
2084 auto frame = cache->getSpriteFrameByName(str);
2085 animFrames.pushBack(frame);
2088 auto animation = Animation::createWithSpriteFrames(animFrames, 0.3f);
2089 sprite->runAction(RepeatForever::create( Animate::create(animation) ) );
2090 sprite->runAction(RepeatForever::create(RotateBy::create(10, 360) ) );
2092 addChild(sprite, 0);
virtual void onEnter() override