本文整理汇总了C++中CCActionInterval类的典型用法代码示例。如果您正苦于以下问题:C++ CCActionInterval类的具体用法?C++ CCActionInterval怎么用?C++ CCActionInterval使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCActionInterval类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ccp
//------------------------------------------------------------------
//
// SpriteEase
//
//------------------------------------------------------------------
KDvoid SpriteEase::onEnter ( KDvoid )
{
TestEaseActions::onEnter ( );
const CCSize& s = this->getContentSize ( );
CCActionInterval* move = CCMoveBy::create(3, ccp(s.cx-130,0 ) );
CCActionInterval* move_back = move->reverse();
CCActionInterval* move_ease_in = CCEaseIn::create ( CCCA ( move ), 2.5f);
CCActionInterval* move_ease_in_back = move_ease_in->reverse();
CCActionInterval* move_ease_out = CCEaseOut::create ( CCCA ( move ), 2.5f);
CCActionInterval* move_ease_out_back = move_ease_out->reverse();
CCDelayTime *delay = CCDelayTime::create(0.25f);
CCSequence* seq1 = CCSequence::create(move, delay, move_back, CCCA(delay), KD_NULL);
CCSequence* seq2 = CCSequence::create(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), KD_NULL);
CCSequence* seq3 = CCSequence::create(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), KD_NULL);
CCAction *a2 = m_grossini->runAction(CCRepeatForever::create ( seq1 ) );
a2->setTag(1);
CCAction *a1 = m_tamara->runAction(CCRepeatForever::create ( seq2 ) );
a1->setTag(1);
CCAction *a = m_kathia->runAction(CCRepeatForever::create ( seq3 ) );
a->setTag(1);
schedule(schedule_selector(SpriteEase::testStopAction), 6.25f);
}
示例2: ccc4
//------------------------------------------------------------------
//
// LayerTest2
//
//------------------------------------------------------------------
void LayerTest2::onEnter()
{
LayerTest::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLayerColor* layer1 = CCLayerColor::create( ccc4(255, 255, 0, 80), 100, 300);
layer1->setPosition(ccp(s.width/3, s.height/2));
layer1->ignoreAnchorPointForPosition(false);
addChild(layer1, 1);
CCLayerColor* layer2 = CCLayerColor::create( ccc4(0, 0, 255, 255), 100, 300);
layer2->setPosition(ccp((s.width/3)*2, s.height/2));
layer2->ignoreAnchorPointForPosition(false);
addChild(layer2, 1);
CCActionInterval* actionTint = CCTintBy::create(2, -255, -127, 0);
CCActionInterval* actionTintBack = actionTint->reverse();
CCActionInterval* seq1 = CCSequence::create( actionTint, actionTintBack, NULL);
layer1->runAction(seq1);
CCActionInterval* actionFade = CCFadeOut::create(2.0f);
CCActionInterval* actionFadeBack = actionFade->reverse();
CCActionInterval* seq2 = CCSequence::create(actionFade, actionFadeBack, NULL);
layer2->runAction(seq2);
}
示例3: birdReadyAction
void GameScene::birdReadyAction()
{
CCSize winSize =CCDirector::sharedDirector()->getWinSize();
// 添加bird精灵
CCSprite *bird =CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("bird1.png"));
bird->setPosition(ccp(winSize.width/2-80,winSize.height/2+20));
bird->setZOrder(20);
bird->setScale(0.6);
bird->setTag(TAG_BIRD);
bird->setVisible(false);
this->addChild(bird);
// 创建动画对象
CCAnimation *birdAnimation =CCAnimation::create();
birdAnimation->setDelayPerUnit(0.2);
birdAnimation->addSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("bird1.png"));
birdAnimation->addSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("bird2.png"));
birdAnimation->addSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("bird3.png"));
// 创建动画动作
birdanimate =CCAnimate::create(birdAnimation);
CCActionInterval *action =CCMoveBy::create(0.2,ccp(0,10));
CCActionInterval *action1 =action->reverse();
CCActionInterval *sequence =CCSequence::create(action,action1,NULL);
CCSpawn *spawn =CCSpawn::create(sequence,birdanimate,NULL);
CCRepeatForever *birdrepeatForever =CCRepeatForever::create(spawn);
// 让bird精灵一直运行动画
bird->runAction(birdrepeatForever);
}
示例4: ccp
//------------------------------------------------------------------
//
// StressTest2
//
//------------------------------------------------------------------
StressTest2::StressTest2()
{
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCLayer* sublayer = CCLayer::create();
CCSprite *sp1 = CCSprite::create(s_pPathSister1);
sp1->setPosition( ccp(80, s.height/2) );
CCActionInterval* move = CCMoveBy::create(3, ccp(350,0));
CCActionInterval* move_ease_inout3 = CCEaseInOut::create((CCActionInterval*)(move->copy()->autorelease()), 2.0f);
CCActionInterval* move_ease_inout_back3 = move_ease_inout3->reverse();
CCSequence* seq3 = CCSequence::create( move_ease_inout3, move_ease_inout_back3, NULL);
sp1->runAction( CCRepeatForever::create(seq3) );
sublayer->addChild(sp1, 1);
CCParticleFire* fire = CCParticleFire::create();
fire->setTexture(CCTextureCache::sharedTextureCache()->addImage("Images/fire.png"));
fire->setPosition( ccp(80, s.height/2-50) );
CCActionInterval* copy_seq3 = (CCActionInterval*)(seq3->copy()->autorelease());
fire->runAction( CCRepeatForever::create(copy_seq3) );
sublayer->addChild(fire, 2);
schedule(schedule_selector(StressTest2::shouldNotLeak), 6.0f);
addChild(sublayer, 0, kTagSprite1);
}
示例5: getChildByTag
//------------------------------------------------------------------
//
// Effect2
//
//------------------------------------------------------------------
void Effect2::onEnter()
{
EffectAdvanceTextLayer::onEnter();
CCNode* target = getChildByTag(kTagBackground);
// To reuse a grid the grid size and the grid type must be the same.
// in this case:
// ShakyTiles is TiledGrid3D and it's size is (15,10)
// Shuffletiles is TiledGrid3D and it's size is (15,10)
// TurnOfftiles is TiledGrid3D and it's size is (15,10)
CCActionInterval* shaky = CCShakyTiles3D::actionWithRange(4, false, ccg(15,10), 5);
CCActionInterval* shuffle = CCShuffleTiles::actionWithSeed(0, ccg(15,10), 3);
CCActionInterval* turnoff = CCTurnOffTiles::actionWithSeed(0, ccg(15,10), 3);
CCActionInterval* turnon = turnoff->reverse();
// reuse 2 times:
// 1 for shuffle
// 2 for turn off
// turnon tiles will use a new grid
CCFiniteTimeAction* reuse = CCReuseGrid::actionWithTimes(2);
CCActionInterval* delay = CCDelayTime::actionWithDuration(1);
// id orbit = [OrbitCamera::actionWithDuration:5 radius:1 deltaRadius:2 angleZ:0 deltaAngleZ:180 angleX:0 deltaAngleX:-90];
// id orbit_back = [orbit reverse];
//
// [target runAction: [RepeatForever::actionWithAction: [Sequence actions: orbit, orbit_back, nil]]];
target->runAction( (CCActionInterval *)(CCSequence::actions( shaky, delay, reuse, shuffle, delay->copy()->autorelease(), turnoff, turnon, NULL) ) );
}
示例6: callfunc_selector
bool SplashScreen::init()
{
if (!CCLayer::init()) {
return false;
}
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCSprite *logo = CCSprite::create("logo.png");
logo->setOpacity(0);
logo->setPosition(VisibleRect::center());
CCSprite *splash = CCSprite::create("splash.png");
CCSize splashSize = splash->getContentSize();
splash->setOpacity(0);
splash->setPosition(VisibleRect::center());
CCActionInterval *fadeIn = CCFadeIn::create(0.5f);
CCCallFunc *loadHandler = CCCallFunc::create(this, callfunc_selector(SplashScreen::__loadAssets));
CCActionInterval *delayAct = CCDelayTime::create(1.0f);
CCActionInterval *fadeOut = CCFadeOut::create(0.5f);
CCCallFunc *startHandler = CCCallFunc::create(this, callfunc_selector(SplashScreen::__startGame));
CCSequence *splashSeq = CCSequence::create(fadeIn,loadHandler,delayAct,fadeOut,startHandler,NULL);
addChild(splash);
addChild(logo);
splash->setScaleX(winSize.width/splashSize.width);
logo->setScale(winSize.width/splashSize.width);
splash->setScaleY(winSize.height/splashSize.height);
logo->runAction(splashSeq);
splash->runAction((CCActionInterval*)fadeIn->copy());
return true;
}
示例7: onEnter
void CCTransitionRotoZoom:: onEnter()
{
CCTransitionScene::onEnter();
m_pInScene->setScale(0.001f);
m_pOutScene->setScale(1.0f);
m_pInScene->setAnchorPoint(ccp(0.5f, 0.5f));
m_pOutScene->setAnchorPoint(ccp(0.5f, 0.5f));
CCActionInterval *rotozoom = (CCActionInterval*)(CCSequence::create
(
CCSpawn::create
(
CCScaleBy::create(m_fDuration/2, 0.001f),
CCRotateBy::create(m_fDuration/2, 360 * 2),
NULL
),
CCDelayTime::create(m_fDuration/2),
NULL
));
m_pOutScene->runAction(rotozoom);
m_pInScene->runAction
(
CCSequence::create
(
rotozoom->reverse(),
CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),
NULL
)
);
}
示例8: CCActionInterval
CCActionInterval* CCActionInterval::create(float d){
CCActionInterval *pAction = new CCActionInterval();
pAction->initWithDuration(d);
// pAction->autorelease();
return pAction;
}
示例9: addChild
//------------------------------------------------------------------
//
// NodeToWorld
//
//------------------------------------------------------------------
NodeToWorld::NodeToWorld()
{
//
// This code tests that nodeToParent works OK:
// - It tests different anchor Points
// - It tests different children anchor points
CCSprite *back = CCSprite::spriteWithFile(s_back3);
addChild( back, -10);
back->setAnchorPoint( CCPointMake(0,0) );
CCSize backSize = back->getContentSize();
CCMenuItem *item = CCMenuItemImage::itemFromNormalImage(s_PlayNormal, s_PlaySelect);
CCMenu *menu = CCMenu::menuWithItems(item, NULL);
menu->alignItemsVertically();
menu->setPosition( CCPointMake(backSize.width/2, backSize.height/2));
back->addChild(menu);
CCActionInterval* rot = CCRotateBy::actionWithDuration(5, 360);
CCAction* fe = CCRepeatForever::actionWithAction( rot);
item->runAction( fe );
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(200,0));
CCActionInterval* move_back = move->reverse();
CCFiniteTimeAction* seq = CCSequence::actions( move, move_back, NULL);
CCAction* fe2 = CCRepeatForever::actionWithAction((CCActionInterval*)seq);
back->runAction(fe2);
}
示例10: ccp
void ParticleComponentTest::defaultPlay()
{
CCComRender* Particle = static_cast<CCComRender*>(m_rootNode->getChildByTag(10020)->getComponent("CCParticleSystemQuad"));
CCActionInterval* jump = CCJumpBy::create(5, ccp(-500,0), 50, 4);
CCFiniteTimeAction* action = CCSequence::create( jump, jump->reverse(), NULL);
Particle->getNode()->runAction(action);
}
示例11: CCPointMake
void SpriteEaseBack::onEnter()
{
EaseSpriteDemo::onEnter();
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCActionInterval* move = CCMoveBy::create(3, CCPointMake(s.width-130, 0));
CCActionInterval* move_back = move->reverse();
CCActionInterval* move_ease_in = CCEaseBackIn::create((CCActionInterval*)(move->copy()->autorelease()));
CCActionInterval* move_ease_in_back = move_ease_in->reverse();
CCActionInterval* move_ease_out = CCEaseBackOut::create((CCActionInterval*)(move->copy()->autorelease()));
CCActionInterval* move_ease_out_back = move_ease_out->reverse();
CCDelayTime *delay = CCDelayTime::create(0.25f);
CCFiniteTimeAction* seq1 = CCSequence::create(move, delay, move_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq2 = CCSequence::create(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), NULL);
CCFiniteTimeAction* seq3 = CCSequence::create(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), NULL);
m_grossini->runAction(CCRepeatForever::create((CCActionInterval*)seq1));
m_tamara->runAction(CCRepeatForever::create((CCActionInterval*)seq2));
m_kathia->runAction(CCRepeatForever::create((CCActionInterval*)seq3));
}
示例12: addChild
//------------------------------------------------------------------
//
// NodeToWorld
//
//------------------------------------------------------------------
NodeToWorld::NodeToWorld()
{
//
// This code tests that nodeToParent works OK:
// - It tests different anchor Points
// - It tests different children anchor points
CCSprite *back = CCSprite::create(s_back3);
addChild( back, -10);
back->setAnchorPoint( ccp(0,0) );
CCSize backSize = back->getContentSize();
CCMenuItem *item = CCMenuItemImage::create(s_PlayNormal, s_PlaySelect);
CCMenu *menu = CCMenu::create(item, NULL);
menu->alignItemsVertically();
menu->setPosition( ccp(backSize.width/2, backSize.height/2));
back->addChild(menu);
CCActionInterval* rot = CCRotateBy::create(5, 360);
CCAction* fe = CCRepeatForever::create( rot);
item->runAction( fe );
CCActionInterval* move = CCMoveBy::create(3, ccp(200,0));
CCActionInterval* move_back = move->reverse();
CCSequence* seq = CCSequence::create( move, move_back, NULL);
CCAction* fe2 = CCRepeatForever::create(seq);
back->runAction(fe2);
}
示例13: ccp
void SpriteEaseInOut::onEnter()
{
EaseSpriteDemo::onEnter();
CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130,0));
// id move_back = move->reverse();
CCActionInterval* move_ease_inout1 = CCEaseInOut::create((CCActionInterval*)(move->copy()->autorelease()), 0.65f);
CCActionInterval* move_ease_inout_back1 = move_ease_inout1->reverse();
CCActionInterval* move_ease_inout2 = CCEaseInOut::create((CCActionInterval*)(move->copy()->autorelease()), 1.35f);
CCActionInterval* move_ease_inout_back2 = move_ease_inout2->reverse();
CCActionInterval* move_ease_inout3 = CCEaseInOut::create((CCActionInterval*)(move->copy()->autorelease()), 1.0f);
CCActionInterval* move_ease_inout_back3 = move_ease_inout3->reverse();
CCDelayTime *delay = CCDelayTime::create(0.25f);
CCSequence* seq1 = CCSequence::create( move_ease_inout1, delay, move_ease_inout_back1, CCCA(delay), NULL);
CCSequence* seq2 = CCSequence::create( move_ease_inout2, CCCA(delay), move_ease_inout_back2, CCCA(delay), NULL);
CCSequence* seq3 = CCSequence::create( move_ease_inout3, CCCA(delay), move_ease_inout_back3, CCCA(delay), NULL);
m_tamara->runAction(CCRepeatForever::create(seq1));
m_kathia->runAction(CCRepeatForever::create(seq2));
m_grossini->runAction(CCRepeatForever::create(seq3));
}
示例14: addChild
//------------------------------------------------------------------
//
// ParallaxParticle
//
//------------------------------------------------------------------
void ParallaxParticle::onEnter()
{
ParticleDemo::onEnter();
m_background->getParent()->removeChild(m_background, true);
m_background = NULL;
CCParallaxNode* p = CCParallaxNode::node();
addChild(p, 5);
CCSprite *p1 = CCSprite::spriteWithFile(s_back3);
CCSprite *p2 = CCSprite::spriteWithFile(s_back3);
p->addChild( p1, 1, CGPointMake(0.5f,1), CGPointMake(0,250) );
p->addChild(p2, 2, CGPointMake(1.5f,1), CGPointMake(0,50) );
m_emitter = CCParticleFlower::node();
m_emitter->retain();
m_emitter->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_fire) );
p1->addChild(m_emitter, 10);
m_emitter->setPosition( CGPointMake(250,200) );
CCParticleSun* par = CCParticleSun::node();
p2->addChild(par, 10);
par->setTexture( CCTextureCache::sharedTextureCache()->addImage(s_fire) );
CCActionInterval* move = CCMoveBy::actionWithDuration(4, CGPointMake(300,0));
CCActionInterval* move_back = move->reverse();
CCFiniteTimeAction* seq = CCSequence::actions( move, move_back, NULL);
p->runAction(CCRepeatForever::actionWithAction((CCActionInterval*)seq));
}
示例15: CCPointMake
void SpriteEase::onEnter()
{
EaseSpriteDemo::onEnter();
CCActionInterval* move = CCMoveBy::actionWithDuration(3, CCPointMake(350,0) );
CCActionInterval* move_back = move->reverse();
CCActionInterval* move_ease_in = (CCActionInterval*)CCEaseIn::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 3.0f);
CCActionInterval* move_ease_in_back = move_ease_in->reverse();
CCActionInterval* move_ease_out = CCEaseOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()), 3.0f);
CCActionInterval* move_ease_out_back = move_ease_out->reverse();
CCFiniteTimeAction* seq1 = CCSequence::actions(move, move_back, NULL);
CCFiniteTimeAction* seq2 = CCSequence::actions(move_ease_in, move_ease_in_back, NULL);
CCFiniteTimeAction* seq3 = CCSequence::actions(move_ease_out, move_ease_out_back, NULL);
CCAction *a2 = m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1) );
a2->setTag(1);
CCAction *a1 = m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2) );
a1->setTag(1);
CCAction *a = m_kathia->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq3) );
a->setTag(1);
schedule(schedule_selector(SpriteEase::testStopAction), 6);
}