CCTransitionScene派生自CCScene,换句话说,场景特效本身也是一个场景。讲到这里,聪明的读者也许已经想到了,场景特效的实现方式与复合动作类似:复合动作是一类特殊的动作,它们包
CCTransitionScene派生自CCScene,换句话说,场景特效本身也是一个场景。讲到这里,聪明的读者也许已经想到了,场
景特效的实现方式与复合动作类似:复合动作是一类特殊的动作,它们包含其他动作,执行复合动作时,被包含的动作也
会按照一定的方式执行;而场景特效是一类特殊的场景,它们包含了另一个场景,在运行场景特效时,被包含的原场景会
以添加了特效的方式显示出来。因此,特效场景的使用方法与复合动作也类似。首先创建一个场景,称作原场景,然后把
原场景当做参数来创建一个特效场景,使用时只需要把特效场景传入CCDirector的replaceScene方法即可,相关代码如
下:
CCDirector::sharedDirector()->replaceScene(CCTransitionFlipY::create(5, pscene));
还有一些其他的场景效果类,他们都派生于CCTransitionScene:
/** @brief A CCTransition that supports orientation like.
* Possible orientation: LeftOver, RightOver, UpOver, DownOver
*/
class CC_DLL CCTransitionSceneOriented : public CCTransitionScene
{
protected:
tOrientation m_eOrientation;
public:
/**
* @js ctor
*/
CCTransitionSceneOriented();
/**
* @js NA
* @lua NA
*/
virtual ~CCTransitionSceneOriented();
/** creates a base transition with duration and incoming scene */
static CCTransitionSceneOriented * create(float t,CCScene* scene, tOrientation orientation);
/** initializes a transition with duration and incoming scene */
virtual bool initWithDuration(float t,CCScene* scene,tOrientation orientation);
};
/** @brief CCTransitionRotoZoom:
Rotate and zoom out the outgoing scene, and then rotate and zoom in the incoming
*/
class CC_DLL CCTransitionRotoZoom : public CCTransitionScene
{
public:
/**
* @js ctor
*/
CCTransitionRotoZoom();
/**
* @js NA
* @lua NA
*/
virtual ~CCTransitionRotoZoom();
/**
* @js NA
* @lua NA
*/
virtual void onEnter();
static CCTransitionRotoZoom* create(float t, CCScene* scene);
};
/** @brief CCTransitionJumpZoom:
Zoom out and jump the outgoing scene, and then jump and zoom in the incoming
*/
class CC_DLL CCTransitionJumpZoom : public CCTransitionScene
{
public:
/**
* @js ctor
*/
CCTransitionJumpZoom();
/**
* @js NA
* @lua NA
*/
virtual ~CCTransitionJumpZoom();
/**
* @js NA
* @lua NA
*/
virtual void onEnter();
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:
/**
* @js ctor
*/
CCTransitionMoveInL();
/**
* @js NA
* @lua NA
*/
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);
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionMoveInR();
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionMoveInT();
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionMoveInB();
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionSlideInL();
/**
* @js NA
* @lua NA
*/
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);
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionSlideInR();
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionSlideInB();
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionSlideInT();
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionShrinkGrow();
/**
* @js NA
* @lua NA
*/
virtual ~CCTransitionShrinkGrow();
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionFlipX();
/**
* @js NA
* @lua NA
*/
virtual ~CCTransitionFlipX();
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionFlipY();
/**
* @js NA
* @lua NA
*/
virtual ~CCTransitionFlipY();
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionFlipAngular();
/**
* @js NA
* @lua NA
*/
virtual ~CCTransitionFlipAngular();
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionZoomFlipX();
/**
* @js NA
* @lua NA
*/
virtual ~CCTransitionZoomFlipX();
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionZoomFlipY();
/**
* @js NA
* @lua NA
*/
virtual ~CCTransitionZoomFlipY();
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionZoomFlipAngular();
/**
* @js NA
* @lua NA
*/
virtual ~CCTransitionZoomFlipAngular();
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionFade();
/**
* @js NA
* @lua NA
*/
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);
/**
* @js NA
* @lua NA
*/
virtual void onEnter();
/**
* @js NA
* @lua NA
*/
virtual void onExit();
};
class CCRenderTexture;
/**
@brief CCTransitionCrossFade:
Cross fades two scenes using the CCRenderTexture object.
*/
class CC_DLL CCTransitionCrossFade : public CCTransitionScene
{
public :
/**
* @js ctor
*/
CCTransitionCrossFade();
/**
* @js NA
* @lua NA
*/
virtual ~CCTransitionCrossFade();
virtual void draw();
/**
* @js NA
* @lua NA
*/
virtual void onEnter();
/**
* @js NA
* @lua NA
*/
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 :
/**
* @js ctor
*/
CCTransitionTurnOffTiles();
/**
* @js NA
* @lua NA
*/
virtual ~CCTransitionTurnOffTiles();
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionSplitCols();
/**
* @js NA
* @lua NA
*/
virtual ~CCTransitionSplitCols();
virtual CCActionInterval* action(void);
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionSplitRows();
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionFadeTR();
/**
* @js NA
* @lua NA
*/
virtual ~CCTransitionFadeTR();
virtual CCActionInterval* actionWithSize(const CCSize& size);
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionFadeBL();
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionFadeUp();
/**
* @js NA
* @lua NA
*/
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:
/**
* @js ctor
*/
CCTransitionFadeDown();
/**
* @js NA
* @lua NA
*/
virtual ~CCTransitionFadeDown();
virtual CCActionInterval* actionWithSize(const CCSize& size);
public:
static CCTransitionFadeDown* create(float t, CCScene* scene);
};