auto sp= Sprite::create();
sp->setPosition(500, 500);
this->addChild(sp);
auto hand = Animation::create();
for(int i = 1; i <= 8; i++)
{
std::string fileName = StringUtils::format("hand/hand-00%d.png", i);
hand->addSpriteFrameWithFile(fileName.c_str());
}
hand->setDelayPerUnit(0.15f);//设置播放的时间间隔
hand->setLoops(-1);//设置循环次数 -1永久循环
auto action = Animate::create(hand);
sp->runAction(action);
sp->setPosition(500, 500);
this->addChild(sp);
auto hand = Animation::create();
for(int i = 1; i <= 8; i++)
{
std::string fileName = StringUtils::format("hand/hand-00%d.png", i);
hand->addSpriteFrameWithFile(fileName.c_str());
}
hand->setDelayPerUnit(0.15f);//设置播放的时间间隔
hand->setLoops(-1);//设置循环次数 -1永久循环
auto action = Animate::create(hand);
sp->runAction(action);