CCSize size=CCDirector::sharedDirector()->getWinSize(); CCSprite* spr1=CCSprite::create("s_2.png"); spr1->setPosition(ccp(size.width*0.2,size.height*0.2)); this->addChild(spr1); CCPointArray *arr=CCPointArray::create(10); arr->addControlPoint(ccp(size.width*0.2,size.height*0.2)); arr->addControlPoint(ccp(size.width*0.2,size.height*0.8)); arr->addControlPoint(ccp(size.width*0.8,size.height*0.8)); arr->addControlPoint(ccp(size.width*0.8,size.height*0.2)); arr->addControlPoint(ccp(size.width*0.2,size.height*0.2)); //最后一个参数是张力,如果大于1向内弯曲,如果小于1向内弯曲 CCActionInterval* action1=CCCardinalSplineTo::create(5.0f,arr,0.01); CCActionInterval* action2=CCScaleBy::create(5.0,2.0); CCActionInterval* action21=action2->reverse(); CCActionInterval* action3=CCSequence::create(action1,action2,NULL); CCActionInterval* action31=CCSequence::create(action1,CCDelayTime::create(2),action2,NULL); CCActionInterval* action4=CCSpawn::create(action1,action2,NULL); CCActionInterval* action5=CCRepeat::create(CCSequence::create(action2,action21,NULL),5); spr1->runAction(action5);