Пример #1
0
void SpriteEaseSine::onEnter()
{
    EaseSpriteDemo::onEnter();

    CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
    CCActionInterval* move_back = move->reverse();
    
    CCActionInterval* move_ease_in = CCEaseSineIn::create((CCActionInterval*)(move->copy()->autorelease()) );
    CCActionInterval* move_ease_in_back = move_ease_in->reverse();
    
    CCActionInterval* move_ease_out = CCEaseSineOut::create((CCActionInterval*)(move->copy()->autorelease()) );
    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), NULL);
    CCSequence* seq2 = CCSequence::create(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), NULL);
    CCSequence* seq3 = CCSequence::create(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), NULL);
    
    
    m_grossini->runAction( CCRepeatForever::create(seq1));
    m_tamara->runAction( CCRepeatForever::create(seq2));
    m_kathia->runAction( CCRepeatForever::create(seq3));    

}
Пример #2
0
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));
}
Пример #3
0
void SpriteEase::onEnter()
{
    EaseSpriteDemo::onEnter();
    
    CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130,0));
    CCActionInterval* move_back = move->reverse();
    
    CCActionInterval* move_ease_in = CCEaseIn::create((CCActionInterval*)(move->copy()->autorelease()), 2.5f);
    CCActionInterval* move_ease_in_back = move_ease_in->reverse();
    
    CCActionInterval* move_ease_out = CCEaseOut::create((CCActionInterval*)(move->copy()->autorelease()), 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), NULL);
    CCSequence* seq2 = CCSequence::create(move_ease_in, CCCA(delay), move_ease_in_back, CCCA(delay), NULL);
    CCSequence* seq3 = CCSequence::create(move_ease_out, CCCA(delay), move_ease_out_back, CCCA(delay), 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);
}
Пример #4
0
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));    
}
Пример #5
0
void SpriteEaseInOut::onEnter()
{
    EaseSpriteDemo::onEnter();
    
    CCSize s = CCDirector::sharedDirector()->getWinSize();

    CCActionInterval*  move = CCMoveBy::create(3, CCPointMake(s.width-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);

    CCFiniteTimeAction*  seq1 = CCSequence::create( move_ease_inout1, delay, move_ease_inout_back1, CCCA(delay), NULL);
    CCFiniteTimeAction*  seq2 = CCSequence::create( move_ease_inout2, CCCA(delay), move_ease_inout_back2, CCCA(delay), NULL);
    CCFiniteTimeAction*  seq3 = CCSequence::create( move_ease_inout3, CCCA(delay), move_ease_inout_back3, CCCA(delay), NULL);
        
    m_tamara->runAction(CCRepeatForever::create((CCActionInterval*)seq1));
    m_kathia->runAction(CCRepeatForever::create((CCActionInterval*)seq2));
    m_grossini->runAction(CCRepeatForever::create((CCActionInterval*)seq3));
}
//------------------------------------------------------------------
//
// SpriteEaseBack
//
//------------------------------------------------------------------
KDvoid SpriteEaseBack::onEnter ( KDvoid )
{
	TestEaseActions::onEnter ( );

    CCSize s = this->getContentSize ( );
    
    CCActionInterval* move = CCMoveBy::create(3, ccp(s.cx-130, 0 ) );
    CCActionInterval* move_back = move->reverse();
    
    CCActionInterval* move_ease_in = CCEaseBackIn::create ( CCCA ( move ) );
    CCActionInterval* move_ease_in_back = move_ease_in->reverse();
    
    CCActionInterval* move_ease_out = CCEaseBackOut::create ( CCCA ( move ) );
    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);
    
    m_grossini->runAction(CCRepeatForever::create ( seq1 ) );
    m_tamara->runAction(CCRepeatForever::create ( seq2 ) );
    m_kathia->runAction(CCRepeatForever::create ( seq3 ) ); 
}
//------------------------------------------------------------------
//
// SpriteEaseElasticInOut
//
//------------------------------------------------------------------
KDvoid SpriteEaseElasticInOut::onEnter ( KDvoid )
{
	TestEaseActions::onEnter ( );
	
    CCSize s = this->getContentSize ( );
    
    CCActionInterval* move = CCMoveBy::create(3, ccp(s.cx-130, 0 ) );

    CCActionInterval* move_ease_inout1 = CCEaseElasticInOut::create ( CCCA ( move ), 0.3f);
    CCActionInterval* move_ease_inout_back1 = move_ease_inout1->reverse();
    
    CCActionInterval* move_ease_inout2 = CCEaseElasticInOut::create ( CCCA ( move ), 0.45f);
    CCActionInterval* move_ease_inout_back2 = move_ease_inout2->reverse();
    
    CCActionInterval* move_ease_inout3 = CCEaseElasticInOut::create ( CCCA ( move ), 0.6f);
    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), KD_NULL);
    CCSequence* seq2 = CCSequence::create(move_ease_inout2, CCCA(delay), move_ease_inout_back2, CCCA(delay), KD_NULL);
    CCSequence* seq3 = CCSequence::create(move_ease_inout3, CCCA(delay), move_ease_inout_back3, CCCA(delay), KD_NULL);
    
    m_tamara->runAction( CCRepeatForever::create ( seq1 ) );
    m_kathia->runAction( CCRepeatForever::create ( seq2 ) );
    m_grossini->runAction( CCRepeatForever::create ( seq3 ) ); 
}
//------------------------------------------------------------------
//
// 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);

}
Пример #9
0
void SpriteEaseBackInOut::onEnter()
{
    EaseSpriteDemo::onEnter();
    
    CCActionInterval* move = CCMoveBy::create(3, ccp(VisibleRect::right().x-130, 0));
    CCActionInterval* move_back = move->reverse();
    
    CCActionInterval* move_ease = CCEaseBackInOut::create((CCActionInterval*)(move->copy()->autorelease()) );
    CCActionInterval* move_ease_back = move_ease->reverse();
    
    CCDelayTime *delay = CCDelayTime::create(0.25f);
    
    CCSequence* seq1 = CCSequence::create(move, delay, move_back, CCCA(delay), NULL);
    CCSequence* seq2 = CCSequence::create(move_ease, CCCA(delay), move_ease_back, CCCA(delay), NULL);
    
    this->positionForTwo();
    
    m_grossini->runAction( CCRepeatForever::create(seq1));
    m_tamara->runAction( CCRepeatForever::create(seq2));    
}
//------------------------------------------------------------------
//
// SpriteEaseBounceInOut
//
//------------------------------------------------------------------
KDvoid SpriteEaseBounceInOut::onEnter ( KDvoid )
{
	TestEaseActions::onEnter ( );

    CCSize s = this->getContentSize ( );

    CCActionInterval* move = CCMoveBy::create(3, ccp(s.cx-130, 0 ) );
    CCActionInterval* move_back = move->reverse();
    
    CCActionInterval* move_ease = CCEaseBounceInOut::create ( CCCA ( move ) );
    CCActionInterval* move_ease_back = move_ease->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, CCCA(delay), move_ease_back, CCCA(delay), KD_NULL);
    
    this->positionForTwo();
    
    m_grossini->runAction( CCRepeatForever::create ( seq1 ) );
    m_tamara->runAction( CCRepeatForever::create ( seq2 ) );
}
Пример #11
0
void SpriteEaseExponentialInOut::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 = CCEaseExponentialInOut::create((CCActionInterval*)(move->copy()->autorelease()) );
    CCActionInterval* move_ease_back = move_ease->reverse();    //--> reverse()
    
    CCDelayTime *delay = CCDelayTime::create(0.25f);
    
    CCFiniteTimeAction* seq1 = CCSequence::create( move, delay, move_back, CCCA(delay), NULL);
    CCFiniteTimeAction* seq2 = CCSequence::create( move_ease, delay, move_ease_back, CCCA(delay), NULL);
    
    this->positionForTwo();
    
    m_grossini->runAction( CCRepeatForever::create((CCActionInterval*)seq1));
    m_tamara->runAction( CCRepeatForever::create((CCActionInterval*)seq2));

}