CCTransition(scene切换时会用到 产生特效 渐隐 碎片 翻页 钟摆 涡轮 渐远 左移 百叶窗。。。)

本文主要是介绍CCTransition(scene切换时会用到 产生特效 渐隐 碎片 翻页 钟摆 涡轮 渐远 左移 百叶窗。。。),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

cocos2D场景切换方式总汇

CCTransitionFade,  //渐隐效果
CCTransitionFadeTR, //碎片效果
CCTransitionJumpZoom, //跳动效果
CCTransitionMoveInL, //从左向右移动
CCTransitionPageTurn, //翻页效果
CCTransitionRadialCCW, //钟摆效果
CCTransitionRotoZoom,//涡轮效果
CCTransitionSceneOriented,//
CCTransitionShrinkGrow, //渐远效果
CCTransitionSlideInL, //左移
CCTransitionSplitCols,//上下移动
CCTransitionTurnOffTiles//
CCTransitionScene : CCScene  基类

CCRotoZoomTransition 旋转缩小切换
CCJumpZoomTransition 缩小后跳跃切换
CCSlideInLTransition 从左向右切换
CCSlideInRTransition 从右向左切换
CCSlideInTTransition 从上向下切换
CCSlideInBTransition 从下向上切换
CCShrinkGrowTransition 逐渐缩小切换
CCFlipXTransition 已x中间为轴平面式旋转切换
CCFlipYTransition 已y中间为轴平面式旋转切换
CCFlipAngularTransition 侧翻式旋转切换
CCZoomFlipXTransition 缩小后x为轴旋转切换
CCZoomFlipYTransition 缩小后y为轴旋转切换
CCZoomFlipAngularTransition 缩小侧翻式旋转切换
CCFadeTransition 逐渐变暗切换
CCCrossFadeTransition   逐渐变暗切换2
CCTurnOffTilesTransition 随机方块覆盖切换
CCSplitColsTransition 三条上下分开切换
CCSplitRowsTransition 三条左右分开切换
CCFadeTRTransition 小方块大方块式切换 左下到右上 眩!
CCFadeBLTransition 小方块大方块式切换 右上到左下 眩!
CCFadeUpTransition 百叶窗从下向上
CCFadeDownTransition 百叶窗从上向下

CCTransitionRotoZoom : CCTransitionScene 旋转进入
CCTransitionJumpZoom : CCTransitionScene 跳动进入
CCTransitionMoveInL : CCTransitionScene<CCTransitionEaseScene> 从左侧进入
CCTransitionMoveInR : CCTransitionMoveInL 从右侧进入
CCTransitionMoveInT : CCTransitionMoveInL 从顶部进入
CCTransitionMoveInB : CCTransitionMoveInL 从底部进入
CCTransitionSlideInL : CCTransitionScene<CCTransitionEaseScene> 从左侧滑入
CCTransitionSlideInR : CCTransitionSlideInL 从右侧滑入
CCTransitionSlideInB : CCTransitionSlideInL 从顶部滑入
CCTransitionSlideInT : CCTransitionSlideInL 从底部滑入
CCTransitionShrinkGrow : CCTransitionScene<CCTransitionEaseScene> 交替进入
CCTransitionFlipX : CCTransitionSceneOriented x轴翻入(左右)
CCTransitionFlipY : CCTransitionSceneOriented y轴翻入(上下)
CCTransitionFlipAngular : CCTransitionSceneOriented 左上右下轴翻入
CCTransitionZoomFlipX : CCTransitionSceneOriented x轴翻入放大缩小效果(左右)
CCTransitionZoomFlipY : CCTransitionSceneOriented y轴翻入放大缩小效果(上下)
CCTransitionZoomFlipAngular :CCTransitionSceneOriented  左上右下轴翻入放大缩小效果
CCTransitionFade : CCTransitionScene  变暗变亮进入
CCTransitionCrossFade : CCTransitionScene 渐变进入
CCTransitionTurnOffTiles : CCTransitionScene<CCTransitionEaseScene> 小方格消失进入
CCTransitionSplitCols : CCTransitionScene<CCTransitionEaseScene> 竖条切换进入
CCTransitionSplitRows : CCTransitionSplitCols 横条切换进入
CCTransitionFadeTR : CCTransitionScene<CCTransitionEaseScene> 小方格右上角显示进入
CCTransitionFadeBL : CCTransitionFadeTR 小方格左下角显示进入
CCTransitionFadeUp : CCTransitionFadeTR 横条向上显示进入
CCTransitionFadeDown : CCTransitionFadeTR 横条向下显示进入

使用方法:
CCScene *scene = [CCScene node];   
[scene addChild:[GameLayer node]];   
[[CCDirector sharedDirector] replaceScene:[CCTransitionSplitRowstransitionWithDuration:1.2f scene:scene]];   

场景切换的两种方式
直接调用场景
[CCDirector sharedDirector]replaceScene:[GameLayer scene]];
2、从init函数开始执行
CCScene *scene = [CCScene node];   
[scene addChild:[GameLayer node]];   
[[CCDirector sharedDirector] replaceScene:[CCTransitionSplitRowstransitionWithDuration:1.2f scene:scene]];   


缩放的形式切换场景的方法
[[CCDirector sharedDirector] replaceScene:[CCShrinkGrowTransition transitionWithDuration:1.2f scene:sc]]; 


(1)CCTransitionFade

描述:场景在指定的时间内淡入淡出到一个指定的颜色。

(2)CCTransitionFadeTR

描述:从屏幕的左下角向上卷起瓦片(tiles),从而显示场景。它还有3个变化:

CCTransitionFadeBL:从屏幕的右上角到左下角淡出场景的瓦片。

CCTransitionFadeUp:从屏幕的底部到顶部淡出场景的瓦片。

CCTransitionFadeDown:从屏幕的顶部到底部淡出场景的瓦片。

(3)CCTransitionJumpZoom

描述:现有场景跳动着变小,新场景跳动着变大。

(4)CCTransitionMoveInL

描述:旧的场景会移出,而新场景会从屏幕左侧移入。它还有3个变化:

CCTransitionMoveInB:新场景从屏幕的底部移入。

CCTransitionMoveInT:新场景从屏幕的上方移入。

CCTransitionMoveInR:新场景从屏幕的右侧移入。

(5)CCTransitionSceneOriented

描述:将整个场景翻转过来。该效果还有6个变化:

CCTransitionFlipX:场景横向翻转。

CCTransitionFlipY:场景纵向翻转。

CCTransitionFlipAngular:场景一半按横向,一半按纵向翻转。

CCTransitionZoomFlipAngular:场景一半按横向,一半按纵向翻转,同时有一定缩放。

CCTransitionZoomFlipX:场景纵向翻转,同时有一定缩放。

CCTransitionZoomFlipY:场景横向翻转,同时有一定缩放。

(6)CCTransitionPageTurn

描述:翻动书页的过渡效果。

(7)CCTransitionRotoZoom

描述:当前场景旋转变小,新场景旋转变大。

(8)CCTransitionShrinkGrow

描述:当前场景缩小,新场景在其之上变大。

(9)CCTransitionSlideInL

描述:新场景从左边滑入。该效果还有另外3个变化:

CCTransitionSlideInR:新场景从右边滑入。

CCTransitionSlideInB:新场景从底部滑入。

CCTransitionSlideInT:新场景从顶部滑入。

(10)CCTransitionSplitCols

描述:将当前场景切成竖条,上下移动显示新场景。该效果还有一个变化是CCTransition SplitRows,将当前场景切成横条,左右移动显示新场景。

(11)CCTransitionTurnOffTiles

描述:将当前场景分成方块,用分成方块的新场景随机地替换当前场景分出的方块。

(12)CCTransitionProgressRadialCCW

描述:新场景沿着径向逆时针显示。该效果还有一个变化是CCTransitionProgress RadialCW,让新的场景沿着径向顺时针显示。

(13)CCTransitionProgressHorizontal

描述:新场景沿着横向逐渐显示。该效果还有一个变化是CCTransitionProgressVertical,让新场景沿着纵向逐渐显示。该效果是Cocos2D v2.0新增场景过渡效果。

(14)CCTransitionProgressInOut

描述:新场景由内到外逐渐显示。该效果还有一个变化是CCTransitionProgressOutIn,让新场景由外到内逐渐显示。该效果是Cocos2D v2.0新增场景过渡效果。





#ifndef __CCTRANSITION_H__

#define __CCTRANSITION_H__


#include "CCScene.h"

#include "ccTypes.h"


NS_CC_BEGIN


/**

 * @addtogroup transition

 * @{

 */


//static creation function macro

//c/c++ don't support object creation of using class name

//so, all classes need creation method.


class CCActionInterval;

class CCNode;


/** @brief CCTransitionEaseScene can ease the actions of the scene protocol.

@since v0.8.2

*/

class CC_DLL CCTransitionEaseScene// : public CCObject

{

public:

    /** returns the Ease action that will be performed on a linear action.

    @since v0.8.2

    */

    virtual CCActionInterval * easeActionWithAction(CCActionInterval * action) = 0;

};


/** Orientation Type used by some transitions

*/

typedef enum {

    /// An horizontal(水平的) orientation(方向) where the Left is nearer

kCCTransitionOrientationLeftOver = 0,

/// An horizontal orientation where the Right is nearer

kCCTransitionOrientationRightOver = 1,

/// A vertical(垂直的) orientation where the Up is nearer

kCCTransitionOrientationUpOver = 0,

/// A vertical orientation where the Bottom is nearer

kCCTransitionOrientationDownOver = 1,

    

// Deprecated

    //kOrientationLeftOver = kCCTransitionOrientationLeftOver,

    //kOrientationRightOver = kCCTransitionOrientationRightOver,

    //kOrientationUpOver = kCCTransitionOrientationUpOver,

    //kOrientationDownOver = kCCTransitionOrientationDownOver,

} tOrientation;


/** @brief Base class for CCTransition scenes

*/

class CC_DLLCCTransitionScene : public CCScene

{


protected:

    CCScene    * m_pInScene;

    CCScene    * m_pOutScene;

    float    m_fDuration;

    bool    m_bIsInSceneOnTop;

    bool    m_bIsSendCleanupToScene;


public:


    CCTransitionScene();

    virtual ~CCTransitionScene();

    virtual void draw();

    virtual void onEnter();

    virtual void onExit();

    virtual void cleanup();


    static CCTransitionScene *create(float t, CCScene *scene);

{

    CCTransitionScene * pScene = new CCTransitionScene();

    if(pScene && pScene->initWithDuration(t,scene))

    {

        pScene->autorelease();

        return pScene;

    }

    CC_SAFE_DELETE(pScene);

    return NULL;

}


    virtual boolinitWithDuration(float t,CCScene* scene);

{

    CCAssert( scene != NULL, "Argument scene must be non-nil");


    if (CCScene::init())

    {

        m_fDuration = t;


        // retain

        m_pInScene = scene;

        m_pInScene->retain();

        m_pOutScene = CCDirector::sharedDirector()->getRunningScene();

        if (m_pOutScene == NULL)

        {

            m_pOutScene = CCScene::create();

            m_pOutScene->init();

        }

        m_pOutScene->retain();


        CCAssert( m_pInScene != m_pOutScene, "Incoming scene must be different from the outgoing scene" );

        

        sceneOrder();


        return true;

    }

    else

    {

        return false;

    }

}



    /** called after the transition finishes */

    voidfinish(void);

{

    // clean up     

     m_pInScene->setVisible(true);

     m_pInScene->setPosition(ccp(0,0));

     m_pInScene->setScale(1.0f);

     m_pInScene->setRotation(0.0f);

     m_pInScene->getCamera()->restore();

 

     m_pOutScene->setVisible(false);

     m_pOutScene->setPosition(ccp(0,0));

     m_pOutScene->setScale(1.0f);

     m_pOutScene->setRotation(0.0f);

     m_pOutScene->getCamera()->restore();


    //[self schedule:@selector(setNewScene:) interval:0];

    this->schedule(schedule_selector(CCTransitionScene::setNewScene), 0);


}


    /** used by some transitions to hide the outer scene */

    voidhideOutShowIn(void);

{

    m_pInScene->setVisible(true);

    m_pOutScene->setVisible(false);

}


protected:

    virtual voidsceneOrder();

{

    m_bIsInSceneOnTop = true;

}


private:

    voidsetNewScene(float dt);

{    

    CC_UNUSED_PARAM(dt);


    this->unschedule(schedule_selector(CCTransitionScene::setNewScene));

    

    // Before replacing, save the "send cleanup to scene"

    CCDirector *director = CCDirector::sharedDirector();

    m_bIsSendCleanupToScene = director->isSendCleanupToScene();

    

    director->replaceScene(m_pInScene);

    

    // issue #267

    m_pOutScene->setVisible(true);

}


};


/** @brief A CCTransition that supports orientation(方向) like.

* Possible orientation: LeftOver, RightOver, UpOver, DownOver

*/

class CC_DLLCCTransitionSceneOriented : public CCTransitionScene

{

protected:

    tOrientation m_eOrientation; //Possible orientation: LeftOver, RightOver, UpOver, DownOver


public:

    CCTransitionSceneOriented();

    virtual ~CCTransitionSceneOriented();


    /** creates a base transition with duration and incoming scene */

    static CCTransitionSceneOriented * create(float t,CCScene* scene, tOrientation orientation);

{

    CCTransitionSceneOriented * pScene = new CCTransitionSceneOriented();

    pScene->initWithDuration(t,scene,orientation);

    pScene->autorelease();

    return pScene;

}


    /** initializes a transition with duration and incoming scene */

    virtual bool initWithDuration(float t,CCScene* scene,tOrientation orientation);

{

    if ( CCTransitionScene::initWithDuration(t, scene) )

    {

        m_eOrientation = orientation;

    }

    return true;

}


};


/** @brief CCTransitionRotoZoom:

Rotate and zoom out the outgoing scene, and then rotate and zoom in the incoming 

*/

class CC_DLL CCTransitionRotoZoom : public CCTransitionScene

{

public:

    CCTransitionRotoZoom();

    virtual ~CCTransitionRotoZoom();

    virtual voidonEnter();

{

    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

        )

    );

}

    static CCTransitionRotoZoom*create(float t, CCScene* scene);

{                                                               

    CCTransitionRotoZoom* pScene = new CCTransitionRotoZoom();                                

    if(pScene && pScene->initWithDuration(t, scene))            

    {                                                           

        pScene->autorelease();                                  

        return pScene;                                          

    }                                                           

    CC_SAFE_DELETE(pScene);                                     

    return NULL;                                                

}


};


/** @brief CCTransitionJumpZoom:

Zoom out and jump the outgoing scene, and then jump and zoom in the incoming 

*/

class CC_DLL CCTransitionJumpZoom : public CCTransitionScene

{

public:

    CCTransitionJumpZoom();

    virtual ~CCTransitionJumpZoom();

    virtual voidonEnter();

{

    CCTransitionScene::onEnter();

    CCSize s = CCDirector::sharedDirector()->getWinSize();


    m_pInScene->setScale(0.5f);

    m_pInScene->setPosition(ccp(s.width, 0));

    m_pInScene->setAnchorPoint(ccp(0.5f, 0.5f));

    m_pOutScene->setAnchorPoint(ccp(0.5f, 0.5f));


    CCActionInterval *jump = CCJumpBy::create(m_fDuration/4, ccp(-s.width,0), s.width/4, 2);

    CCActionInterval *scaleIn = CCScaleTo::create(m_fDuration/4, 1.0f);

    CCActionInterval *scaleOut = CCScaleTo::create(m_fDuration/4, 0.5f);


    CCActionInterval *jumpZoomOut = (CCActionInterval*)(CCSequence::create(scaleOut, jump, NULL));

    CCActionInterval *jumpZoomIn = (CCActionInterval*)(CCSequence::create(jump, scaleIn, NULL));


    CCActionInterval *delay = CCDelayTime::create(m_fDuration/2);


    m_pOutScene->runAction(jumpZoomOut);

    m_pInScene->runAction

    (

        CCSequence::create

        (

            delay,

            jumpZoomIn,

            CCCallFunc::create(this, callfunc_selector(CCTransitionScene::finish)),

            NULL

        )

    );

}




    static CCTransitionJumpZoom* create(float t, CCScene* scene);

};


/** @brief CCTransitionMoveInL:

Move in from to the left the incoming scene.

*/

class CC_DLL CCTransitionMoveInL : public CCTransitionScene, public CCTransitionEaseScene

{

public:

    CCTransitionMoveInL();

    virtual ~CCTransitionMoveInL();

    /** initializes the scenes */

    virtual void initScenes(void);

    /** returns the action that will be performed */

    virtual CCActionInterval* action(void);


    virtual CCActionInterval* easeActionWithAction(CCActionInterval * action);


    virtual void onEnter();


    static CCTransitionMoveInL* create(float t, CCScene* scene);

};


/** @brief CCTransitionMoveInR:

Move in from to the right the incoming scene.

*/

class CC_DLL CCTransitionMoveInR : public CCTransitionMoveInL

{

public:

    CCTransitionMoveInR();

    virtual ~CCTransitionMoveInR();

    virtual void initScenes();


    static CCTransitionMoveInR* create(float t, CCScene* scene);

};


/** @brief CCTransitionMoveInT:

Move in from to the top the incoming scene.

*/

class CC_DLL CCTransitionMoveInT : public CCTransitionMoveInL 

{

public:

    CCTransitionMoveInT();

    virtual ~CCTransitionMoveInT();

    virtual void initScenes();


    static CCTransitionMoveInT* create(float t, CCScene* scene);

};


/** @brief CCTransitionMoveInB:

Move in from to the bottom the incoming scene.

*/

class CC_DLL CCTransitionMoveInB : public CCTransitionMoveInL

{

public:

    CCTransitionMoveInB();

    virtual ~CCTransitionMoveInB();

    virtual void initScenes();


    static CCTransitionMoveInB* create(float t, CCScene* scene);

};


/** @brief CCTransitionSlideInL:

Slide in the incoming scene from the left border.

*/

class CC_DLL CCTransitionSlideInL : public CCTransitionScene, public CCTransitionEaseScene

{

public:

    CCTransitionSlideInL();

    virtual ~CCTransitionSlideInL();


    /** initializes the scenes */

    virtual void initScenes(void);

    /** returns the action that will be performed by the incoming and outgoing scene */

    virtual CCActionInterval* action(void);


    virtual void onEnter();

    

    virtual CCActionInterval* easeActionWithAction(CCActionInterval * action);


    static CCTransitionSlideInL* create(float t, CCScene* scene);

protected:

    virtual void sceneOrder();

};


/** @brief CCTransitionSlideInR:

Slide in the incoming scene from the right border.

*/

class CC_DLL CCTransitionSlideInR : public CCTransitionSlideInL 

{

public:

    CCTransitionSlideInR();

    virtual ~CCTransitionSlideInR();


    /** initializes the scenes */

    virtual void initScenes(void);

    /** returns the action that will be performed by the incoming and outgoing scene */

    virtual CCActionInterval* action(void);


    static CCTransitionSlideInR* create(float t, CCScene* scene);

protected:

    virtual void sceneOrder();

};


/** @brief CCTransitionSlideInB:

Slide in the incoming scene from the bottom border.

*/

class CC_DLL CCTransitionSlideInB : public CCTransitionSlideInL

{

public:

    CCTransitionSlideInB();

    virtual ~CCTransitionSlideInB();


    /** initializes the scenes */

    virtual void initScenes(void);

    /** returns the action that will be performed by the incoming and outgoing scene */

    virtual CCActionInterval* action(void);


    static CCTransitionSlideInB* create(float t, CCScene* scene);

protected: 

    virtual void sceneOrder();

};


/** @brief CCTransitionSlideInT:

Slide in the incoming scene from the top border.

*/

class CC_DLL CCTransitionSlideInT : public CCTransitionSlideInL

{

public:

    CCTransitionSlideInT();

    virtual ~CCTransitionSlideInT();


    /** initializes the scenes */

    virtual void initScenes(void);

    /** returns the action that will be performed by the incoming and outgoing scene */

    virtual CCActionInterval* action(void);


    static CCTransitionSlideInT* create(float t, CCScene* scene);

protected:

    virtual void sceneOrder();

};


/**

@brief Shrink the outgoing scene while grow the incoming scene

*/

class CC_DLL CCTransitionShrinkGrow : public CCTransitionScene , public CCTransitionEaseScene

{

public:

    CCTransitionShrinkGrow();

    virtual ~CCTransitionShrinkGrow();


    virtual void onEnter();

    virtual CCActionInterval* easeActionWithAction(CCActionInterval * action);


    static CCTransitionShrinkGrow* create(float t, CCScene* scene);

};


/** @brief CCTransitionFlipX:

Flips the screen horizontally.

The front face is the outgoing scene and the back face is the incoming scene.

*/

class CC_DLL CCTransitionFlipX : public CCTransitionSceneOriented

{

public:

    CCTransitionFlipX();

    virtual ~CCTransitionFlipX();


    virtual void onEnter();


    static CCTransitionFlipX* create(float t, CCScene* s, tOrientation o);

    static CCTransitionFlipX* create(float t, CCScene* s);

};


/** @brief CCTransitionFlipY:

Flips the screen vertically.

The front face is the outgoing scene and the back face is the incoming scene.

*/

class CC_DLL CCTransitionFlipY : public CCTransitionSceneOriented

{

public:

    CCTransitionFlipY();

    virtual ~CCTransitionFlipY();


    virtual void onEnter();


    static CCTransitionFlipY* create(float t, CCScene* s, tOrientation o);

    static CCTransitionFlipY* create(float t, CCScene* s);

};


/** @brief CCTransitionFlipAngular:

Flips the screen half horizontally and half vertically.

The front face is the outgoing scene and the back face is the incoming scene.

*/

class CC_DLL CCTransitionFlipAngular : public CCTransitionSceneOriented

{

public:

    CCTransitionFlipAngular();

    virtual ~CCTransitionFlipAngular();


    virtual void onEnter();

    

    static CCTransitionFlipAngular* create(float t, CCScene* s, tOrientation o);

    static CCTransitionFlipAngular* create(float t, CCScene* s);

};


/** @brief CCTransitionZoomFlipX:

Flips the screen horizontally doing a zoom out/in

The front face is the outgoing scene and the back face is the incoming scene.

*/

class CC_DLL CCTransitionZoomFlipX : public CCTransitionSceneOriented

{

public:

    CCTransitionZoomFlipX();

    virtual ~CCTransitionZoomFlipX();


    virtual void onEnter();


    static CCTransitionZoomFlipX* create(float t, CCScene* s, tOrientation o);

    static CCTransitionZoomFlipX* create(float t, CCScene* s);

};


/** @brief CCTransitionZoomFlipY:

Flips the screen vertically doing a little zooming out/in

The front face is the outgoing scene and the back face is the incoming scene.

*/

class CC_DLL CCTransitionZoomFlipY : public CCTransitionSceneOriented

{

public:

    CCTransitionZoomFlipY();

    virtual ~CCTransitionZoomFlipY();


    virtual void onEnter();


    static CCTransitionZoomFlipY* create(float t, CCScene* s, tOrientation o);

    static CCTransitionZoomFlipY* create(float t, CCScene* s);

};


/** @brief CCTransitionZoomFlipAngular:

Flips the screen half horizontally and half vertically doing a little zooming out/in.

The front face is the outgoing scene and the back face is the incoming scene.

*/

class CC_DLL CCTransitionZoomFlipAngular : public CCTransitionSceneOriented

{

public:

    CCTransitionZoomFlipAngular();

    virtual ~CCTransitionZoomFlipAngular();


    virtual void onEnter();


    static CCTransitionZoomFlipAngular* create(float t, CCScene* s, tOrientation o);

    static CCTransitionZoomFlipAngular* create(float t, CCScene* s);

};


/** @brief CCTransitionFade:

Fade out the outgoing scene and then fade in the incoming scene.'''

*/

class CC_DLL CCTransitionFade : public CCTransitionScene

{

protected:

    ccColor4B    m_tColor;


public:


    CCTransitionFade();

    virtual ~CCTransitionFade();

    

    /** creates the transition with a duration and with an RGB color

    * Example: FadeTransition::create(2, scene, ccc3(255,0,0); // red color

    */

    static CCTransitionFade* create(float duration,CCScene* scene, const ccColor3B& color);

    static CCTransitionFade* create(float duration,CCScene* scene);


    /** initializes the transition with a duration and with an RGB color */

    virtual bool initWithDuration(float t, CCScene*scene ,const ccColor3B& color);


    virtual bool initWithDuration(float t,CCScene* scene); 

    virtual void onEnter();

    virtual void onExit();

};


class CCRenderTexture;

/**

@brief CCTransitionCrossFade:

Cross fades two scenes using the CCRenderTexture object.

*/

class CC_DLL CCTransitionCrossFade : public CCTransitionScene

{

public :

    CCTransitionCrossFade();

    virtual ~CCTransitionCrossFade();


    virtual void draw();

    virtual void onEnter();

    virtual void onExit();


public:

    static CCTransitionCrossFade* create(float t, CCScene* scene);

};


/** @brief CCTransitionTurnOffTiles:

Turn off the tiles of the outgoing scene in random order

*/

class CC_DLL CCTransitionTurnOffTiles : public CCTransitionScene ,public CCTransitionEaseScene

{

public :

    CCTransitionTurnOffTiles();

    virtual ~CCTransitionTurnOffTiles();


    virtual void onEnter();

    virtual CCActionInterval * easeActionWithAction(CCActionInterval * action);


public:

    static CCTransitionTurnOffTiles* create(float t, CCScene* scene);

protected:

    virtual void sceneOrder();

};


/** @brief CCTransitionSplitCols:

The odd columns goes upwards while the even columns goes downwards.

*/

class CC_DLL CCTransitionSplitCols : public CCTransitionScene , public CCTransitionEaseScene

{

public:

    CCTransitionSplitCols();

    virtual ~CCTransitionSplitCols();


    virtual CCActionInterval* action(void);

    virtual void onEnter();

    virtual CCActionInterval * easeActionWithAction(CCActionInterval * action);


public:


    static CCTransitionSplitCols* create(float t, CCScene* scene);

};


/** @brief CCTransitionSplitRows:

The odd rows goes to the left while the even rows goes to the right.

*/

class CC_DLL CCTransitionSplitRows : public CCTransitionSplitCols

{

public:

    CCTransitionSplitRows();

    virtual ~CCTransitionSplitRows();


    virtual CCActionInterval* action(void);


public:


    static CCTransitionSplitRows* create(float t, CCScene* scene);

};


/** @brief CCTransitionFadeTR:

Fade the tiles of the outgoing scene from the left-bottom corner the to top-right corner.

*/

class CC_DLL CCTransitionFadeTR : public CCTransitionScene , public CCTransitionEaseScene

{

public:

    CCTransitionFadeTR();

    virtual ~CCTransitionFadeTR();

    virtual CCActionInterval* actionWithSize(const CCSize& size);

    virtual void onEnter();

    virtual CCActionInterval* easeActionWithAction(CCActionInterval * action);


public:


    static CCTransitionFadeTR* create(float t, CCScene* scene);

protected:

    virtual void sceneOrder();

};


/** @brief CCTransitionFadeBL:

Fade the tiles of the outgoing scene from the top-right corner to the bottom-left corner.

*/

class CC_DLL CCTransitionFadeBL : public CCTransitionFadeTR

{

public:

    CCTransitionFadeBL();

    virtual ~CCTransitionFadeBL();

    virtual CCActionInterval* actionWithSize(const CCSize& size);


public:


    static CCTransitionFadeBL* create(float t, CCScene* scene);

};


/** @brief CCTransitionFadeUp:

* Fade the tiles of the outgoing scene from the bottom to the top.

*/

class CC_DLL CCTransitionFadeUp : public CCTransitionFadeTR

{

public:

    CCTransitionFadeUp();

    virtual ~CCTransitionFadeUp();

    virtual CCActionInterval* actionWithSize(const CCSize& size);


public:


    static CCTransitionFadeUp* create(float t, CCScene* scene);

};


/** @brief CCTransitionFadeDown:

* Fade the tiles of the outgoing scene from the top to the bottom.

*/

class CC_DLL CCTransitionFadeDown : public CCTransitionFadeTR

{

public:

    CCTransitionFadeDown();

    virtual ~CCTransitionFadeDown();

    virtual CCActionInterval* actionWithSize(const CCSize& size);


public:


    static CCTransitionFadeDown* create(float t, CCScene* scene);

};


// end of transition group

/// @}


NS_CC_END


#endif // __CCTRANSITION_H__


这篇关于CCTransition(scene切换时会用到 产生特效 渐隐 碎片 翻页 钟摆 涡轮 渐远 左移 百叶窗。。。)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/661605

相关文章

IDEA如何切换数据库版本mysql5或mysql8

《IDEA如何切换数据库版本mysql5或mysql8》本文介绍了如何将IntelliJIDEA从MySQL5切换到MySQL8的详细步骤,包括下载MySQL8、安装、配置、停止旧服务、启动新服务以及... 目录问题描述解决方案第一步第二步第三步第四步第五步总结问题描述最近想开发一个新应用,想使用mysq

基于Python实现PDF动画翻页效果的阅读器

《基于Python实现PDF动画翻页效果的阅读器》在这篇博客中,我们将深入分析一个基于wxPython实现的PDF阅读器程序,该程序支持加载PDF文件并显示页面内容,同时支持页面切换动画效果,文中有详... 目录全部代码代码结构初始化 UI 界面加载 PDF 文件显示 PDF 页面页面切换动画运行效果总结主

React实现原生APP切换效果

《React实现原生APP切换效果》最近需要使用Hybrid的方式开发一个APP,交互和原生APP相似并且需要IM通信,本文给大家介绍了使用React实现原生APP切换效果,文中通过代码示例讲解的非常... 目录背景需求概览技术栈实现步骤根据 react-router-dom 文档配置好路由添加过渡动画使用

Spring Boot实现多数据源连接和切换的解决方案

《SpringBoot实现多数据源连接和切换的解决方案》文章介绍了在SpringBoot中实现多数据源连接和切换的几种方案,并详细描述了一个使用AbstractRoutingDataSource的实... 目录前言一、多数据源配置与切换方案二、实现步骤总结前言在 Spring Boot 中实现多数据源连接

康拓展开(hash算法中会用到)

康拓展开是一个全排列到一个自然数的双射(也就是某个全排列与某个自然数一一对应) 公式: X=a[n]*(n-1)!+a[n-1]*(n-2)!+...+a[i]*(i-1)!+...+a[1]*0! 其中,a[i]为整数,并且0<=a[i]<i,1<=i<=n。(a[i]在不同应用中的含义不同); 典型应用: 计算当前排列在所有由小到大全排列中的顺序,也就是说求当前排列是第

MCU7.keil中build产生的hex文件解读

1.hex文件大致解读 闲来无事,查看了MCU6.用keil新建项目的hex文件 用FlexHex打开 给我的第一印象是:经过软件的解释之后,发现这些数据排列地十分整齐 :02000F0080FE71:03000000020003F8:0C000300787FE4F6D8FD75810702000F3D:00000001FF 把解释后的数据当作十六进制来观察 1.每一行数据

MyBatis 切换不同的类型数据库方案

下属案例例当前结合SpringBoot 配置进行讲解。 背景: 实现一个工程里面在部署阶段支持切换不同类型数据库支持。 方案一 数据源配置 关键代码(是什么数据库,该怎么配就怎么配) spring:datasource:name: test# 使用druid数据源type: com.alibaba.druid.pool.DruidDataSource# @需要修改 数据库连接及驱动u

解决Office Word不能切换中文输入

我们在使用WORD的时可能会经常碰到WORD中无法输入中文的情况。因为,虽然我们安装了搜狗输入法,但是到我们在WORD中使用搜狗的输入法的切换中英文的按键的时候会发现根本没有效果,无法将输入法切换成中文的。下面我就介绍一下如何在WORD中把搜狗输入法切换到中文。

『功能项目』战士的平A特效【35】

我们打开上一篇34武器的切换实例的项目, 本章要做的事情是在战士的每次按A键时在指定位置生成一个平A特效 首先将之前下载的技能拖拽至场景中 完全解压缩后重命名为AEffect 拖拽至预制体文件夹 进入主角动画的战士动画层级 双击第一次攻击 选择Animation 创建事件 创建的动画事件帧放在攻击动画挥剑指定处 命名为PerpetualAtt

第49课 Scratch入门篇:骇客任务背景特效

骇客任务背景特效 故事背景:   骇客帝国特色背景在黑色中慢慢滚动着! 程序原理:  1 、 角色的设计技巧  2 、克隆体的应用及特效的使用 开始编程   1、使用 黑色的背景: ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/7d74c872f06b4d9fbc88aecee634b074.png#pic_center)   2