cocos2d-x  2.2.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CCTween Class Reference

#include <CCTween.h>

Inheritance diagram for CCTween:
CCProcessBase CCObject CCCopying

Public Member Functions

 CCTween (void)
virtual ~CCTween (void)
virtual bool init (CCBone *bone)
 Init with a CCBone. More...
 
virtual void play (CCMovementBoneData *movementBoneData, int durationTo, int durationTween, int loop, int tweenEasing)
 Start the Process. More...
 
virtual void gotoAndPlay (int frameIndex)
virtual void gotoAndPause (int frameIndex)
void setAnimation (CCArmatureAnimation *animation)
CCArmatureAnimationgetAnimation () const
- Public Member Functions inherited from CCProcessBase
 CCProcessBase (void)
 ~CCProcessBase (void)
virtual void play (int durationTo, int durationTween, int loop, int tweenEasing)
 Play animation by animation name. More...
 
virtual void pause ()
 Pause the Process. More...
 
virtual void resume ()
 Resume the Process. More...
 
virtual void stop ()
 Stop the Process. More...
 
virtual void update (float dt)
 You should never call this function, unless you know what you do Update the Process, include current process, current frame and son on. More...
 
virtual int getCurrentFrameIndex ()
- Public Member Functions inherited from CCObject
 CCObject (void)
virtual ~CCObject (void)
void release (void)
void retain (void)
CCObjectautorelease (void)
CCObjectcopy (void)
bool isSingleReference (void) const
unsigned int retainCount (void) const
virtual bool isEqual (const CCObject *pObject)
virtual void acceptVisitor (CCDataVisitor &visitor)
- Public Member Functions inherited from CCCopying
virtual CCObjectcopyWithZone (CCZone *pZone)

Static Public Member Functions

static CCTweencreate (CCBone *bone)
 @ More...
 

Public Attributes

virtual CCMovementBoneData
*getMovementBoneData(void)\n\n
public CCFrameData
m_pTweenData
 getMovementBoneData More...
 
CCFrameDatam_pFrom
 The computational tween frame data, //! A weak reference to the CCBone's tweenData. More...
 
CCFrameDatam_pTo
 From frame data, used for calculate between value. More...
 
CCFrameDatam_pBetween
 To frame data, used for calculate between value. More...
 
CCBonem_pBone
 Between frame data, used for calculate current CCFrameData(m_pNode) value. More...
 
CCTweenType m_eFrameTweenEasing
 A weak reference to the CCBone. More...
 
int m_iBetweenDuration
 Dedermine which tween effect current frame use. More...
 
int m_iTotalDuration
 Current key frame will last m_iBetweenDuration frames. More...
 
int m_iFromIndex
int m_iToIndex
 The current frame index in FrameList of CCMovementBoneData, it's different from m_iFrameIndex. More...
 
CCArmatureAnimationm_pAnimation
 The next frame index in FrameList of CCMovementBoneData, it's different from m_iFrameIndex. More...
 
bool m_bPassLastFrame
- Public Attributes inherited from CCProcessBase
virtual float getProcessScale (void)\n\n public
 getProcessScale More...
 
virtual bool getIsPause (void)\n\n public
 getIsPause More...
 
virtual bool getIsComplete (void)\n\n public
 getIsComplete More...
 
virtual bool getIsPlaying (void)\n\n public
 getIsPlaying More...
 
virtual float getCurrentPercent (void)\n\n public
 getCurrentPercent More...
 
virtual int getRawDuration (void)\n\n public
 getRawDuration More...
 
virtual AnimationType getLoopType (void)\n\n public
 getLoopType More...
 
virtual CCTweenType getTweenEasing (void)\n\n public
 getTweenEasing More...
 
- Public Attributes inherited from CCObject
unsigned int m_uID
int m_nLuaID

Protected Member Functions

virtual void updateHandler ()
 Update(float dt) will call this handler, you can handle your logic here. More...
 
virtual float updateFrameData (float currentPercent)
 Calculate which frame arrived, and if current frame have event, then call the event listener. More...
 
virtual void setBetween (CCFrameData *from, CCFrameData *to, bool limit=true)
 Calculate the between value of _from and _to, and give it to between frame data. More...
 
virtual CCFrameDatatweenNodeTo (float percent, CCFrameData *node=NULL)
 According to the percent to calculate current CCFrameData with tween effect. More...
 
virtual void tweenColorTo (float percent, CCFrameData *node)
 According to the percent to calculate current color with tween effect. More...
 
virtual void arriveKeyFrame (CCFrameData *keyFrameData)
 Update display index and process the key frame event when arrived a key frame. More...
 
- Protected Member Functions inherited from CCProcessBase
virtual void gotoFrame (int frameIndex)

Protected Attributes

CCMovementBoneDatam_pMovementBoneData
 A weak reference to the current CCMovementBoneData. The data is in the data pool. More...
 
- Protected Attributes inherited from CCProcessBase
float m_fProcessScale
 Scale the process speed. More...
 
bool m_bIsPause
 Set and get whether the aniamtion is pause. More...
 
bool m_bIsComplete
 Set and get whether the aniamtion is complete. More...
 
bool m_bIsPlaying
 Set and get whether the aniamtion is playing. More...
 
float m_fCurrentPercent
 Current percent this process arrived. More...
 
int m_iRawDuration
 The raw duration. More...
 
AnimationType m_eLoopType
 The animation whether or not loop. More...
 
CCTweenType m_eTweenEasing
 The tween easing effect. More...
 
int m_iDurationTween
 The durantion frame count will run. More...
 
float m_fCurrentFrame
 Current frame this process arrived, this frame is tween frame. More...
 
int m_iCurFrameIndex
 Frame index it the time line. More...
 
int m_iNextFrameIndex
 Next frame this process need run to. More...
 
bool m_bIsLoopBack
float m_fAnimationInternal
 The animation update speed. More...
 
- Protected Attributes inherited from CCObject
unsigned int m_uReference
unsigned int m_uAutoReleaseCount

Constructor & Destructor Documentation

CCTween ( void  )
virtual ~CCTween ( void  )
virtual

Member Function Documentation

virtual void arriveKeyFrame ( CCFrameData keyFrameData)
protectedvirtual

Update display index and process the key frame event when arrived a key frame.

static CCTween* create ( CCBone bone)
static

@

CCArmatureAnimation* getAnimation ( ) const
inline
virtual void gotoAndPause ( int  frameIndex)
virtual
virtual void gotoAndPlay ( int  frameIndex)
virtual
virtual bool init ( CCBone bone)
virtual

Init with a CCBone.

Parameters
bonethe CCBone CCTween will bind to
virtual void play ( CCMovementBoneData movementBoneData,
int  durationTo,
int  durationTween,
int  loop,
int  tweenEasing 
)
virtual

Start the Process.

Parameters
movementBoneDatathe CCMovementBoneData include all CCFrameData
durationTothe number of frames changing to this animation needs.
durationTweenthe number of frames this animation actual last.
loopwhether the animation is loop
    loop < 0 : use the value from CCMovementData get from Action Editor
    loop = 0 : this animation is not loop
    loop > 0 : this animation is loop
tweenEasingtween easing is used for calculate easing effect
    TWEEN_EASING_MAX : use the value from CCMovementData get from Action Editor
    -1 : fade out
    0  : line
    1  : fade in
    2  : fade in and out
void setAnimation ( CCArmatureAnimation animation)
inline
virtual void setBetween ( CCFrameData from,
CCFrameData to,
bool  limit = true 
)
protectedvirtual

Calculate the between value of _from and _to, and give it to between frame data.

virtual void tweenColorTo ( float  percent,
CCFrameData node 
)
protectedvirtual

According to the percent to calculate current color with tween effect.

virtual CCFrameData* tweenNodeTo ( float  percent,
CCFrameData node = NULL 
)
protectedvirtual

According to the percent to calculate current CCFrameData with tween effect.

virtual float updateFrameData ( float  currentPercent)
protectedvirtual

Calculate which frame arrived, and if current frame have event, then call the event listener.

virtual void updateHandler ( )
protectedvirtual

Update(float dt) will call this handler, you can handle your logic here.

Reimplemented from CCProcessBase.

Member Data Documentation

bool m_bPassLastFrame
CCTweenType m_eFrameTweenEasing

A weak reference to the CCBone.

int m_iBetweenDuration

Dedermine which tween effect current frame use.

int m_iFromIndex
int m_iToIndex

The current frame index in FrameList of CCMovementBoneData, it's different from m_iFrameIndex.

int m_iTotalDuration

Current key frame will last m_iBetweenDuration frames.

CCArmatureAnimation* m_pAnimation

The next frame index in FrameList of CCMovementBoneData, it's different from m_iFrameIndex.

CCFrameData* m_pBetween

To frame data, used for calculate between value.

CCBone* m_pBone

Between frame data, used for calculate current CCFrameData(m_pNode) value.

CCFrameData* m_pFrom

The computational tween frame data, //! A weak reference to the CCBone's tweenData.

CCMovementBoneData*
m_pMovementBoneData
protected

A weak reference to the current CCMovementBoneData. The data is in the data pool.

CCFrameData* m_pTo

From frame data, used for calculate between value.

virtual CCMovementBoneData*
getMovementBoneData (void)\n
\n public CCFrameData*
m_pTweenData

getMovementBoneData

setMovementBoneData


The documentation for this class was generated from the following file: