cocos2d-x  3.0rc1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Tween Class Reference

#include <CCTween.h>

Inheritance diagram for Tween:
ProcessBase Ref

Public Member Functions

 Tween (void)
virtual ~Tween (void)
virtual bool init (Bone *bone)
 Init with a Bone. More...
 
virtual void play (MovementBoneData *movementBoneData, int durationTo, int durationTween, int loop, int tweenEasing)
 Start the Process. More...
 
void setAnimation (ArmatureAnimation *animation)
ArmatureAnimationgetAnimation () const
virtual void gotoAndPlay (int frameIndex)
virtual void gotoAndPause (int frameIndex)
virtual void setMovementBoneData (MovementBoneData *data)
virtual const MovementBoneDatagetMovementBoneData () const
- Public Member Functions inherited from ProcessBase
 ProcessBase (void)
virtual ~ProcessBase (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 ()
virtual void setProcessScale (float processScale)
virtual float getProcessScale () const
virtual void setIsPause (bool pause)
virtual bool isPause () const
virtual void setIsComplete (bool complete)
virtual bool isComplete () const
virtual void setIsPlaying (bool playing)
virtual bool isPlaying () const
virtual float getCurrentPercent () const
virtual int getRawDuration () const
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Release the ownership immediately. More...
 
local release ()
 Release the ownership immediately. More...
 
Refautorelease ()
 Release the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()

Static Public Member Functions

static Tweencreate (Bone *bone)
 @ More...
 

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 (FrameData *from, FrameData *to, bool limit=true)
 Calculate the between value of _from and _to, and give it to between frame data. More...
 
virtual FrameDatatweenNodeTo (float percent, FrameData *node=nullptr)
 According to the percent to calculate current FrameData with tween effect. More...
 
virtual void tweenColorTo (float percent, FrameData *node)
 According to the percent to calculate current color with tween effect. More...
 
virtual void arriveKeyFrame (FrameData *keyFrameData)
 Update display index and process the key frame event when arrived a key frame. More...
 
- Protected Member Functions inherited from ProcessBase
virtual void gotoFrame (int frameIndex)
- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 
 Ref ()
 Constructor. More...
 

Protected Attributes

MovementBoneData_movementBoneData
 A weak reference to the current MovementBoneData. The data is in the data pool. More...
 
FrameData_tweenData
FrameData_from
 The computational tween frame data, //! A weak reference to the Bone's tweenData. More...
 
FrameData_to
 From frame data, used for calculate between value. More...
 
FrameData_between
 To frame data, used for calculate between value. More...
 
Bone_bone
 Between frame data, used for calculate current FrameData(m_pNode) value. More...
 
TweenType _frameTweenEasing
 A weak reference to the Bone. More...
 
int _betweenDuration
 Dedermine which tween effect current frame use. More...
 
int _totalDuration
 Current key frame will last _betweenDuration frames. More...
 
int _fromIndex
int _toIndex
 The current frame index in FrameList of MovementBoneData, it's different from m_iFrameIndex. More...
 
ArmatureAnimation_animation
 The next frame index in FrameList of MovementBoneData, it's different from m_iFrameIndex. More...
 
bool _passLastFrame
- Protected Attributes inherited from ProcessBase
float _processScale
 Scale the process speed. More...
 
bool _isPause
 Set and get whether the aniamtion is pause. More...
 
bool _isComplete
 Set and get whether the aniamtion is complete. More...
 
bool _isPlaying
 Set and get whether the aniamtion is playing. More...
 
float _currentPercent
 Current percent this process arrived. More...
 
int _rawDuration
 The raw duration. More...
 
AnimationType _loopType
 The animation whether or not loop. More...
 
cocos2d::tweenfunc::TweenType _tweenEasing
 The tween easing effect. More...
 
float _animationInternal
 The animation update speed. More...
 
int _durationTween
 The durantion frame count will run. More...
 
float _currentFrame
 Current frame this process arrived, this frame is tween frame. More...
 
int _curFrameIndex
 Frame index it the time line. More...
 
int _nextFrameIndex
 Next frame this process need run to. More...
 
bool _isLoopBack
- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references More...
 

Constructor & Destructor Documentation

Tween ( void  )
virtual ~Tween ( void  )
virtual

Member Function Documentation

virtual void arriveKeyFrame ( FrameData keyFrameData)
protectedvirtual

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

static Tween* create ( Bone bone)
static

@

ArmatureAnimation* getAnimation ( ) const
inline
virtual const MovementBoneData*
getMovementBoneData
( ) const
inlinevirtual
virtual void gotoAndPause ( int  frameIndex)
virtual
virtual void gotoAndPlay ( int  frameIndex)
virtual
virtual bool init ( Bone bone)
virtual

Init with a Bone.

Parameters
bonethe Bone Tween will bind to
virtual void play ( MovementBoneData movementBoneData,
int  durationTo,
int  durationTween,
int  loop,
int  tweenEasing 
)
virtual

Start the Process.

Parameters
movementBoneDatathe MovementBoneData include all FrameData
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 MovementData 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 MovementData get from Action Editor
    -1 : fade out
    0  : line
    1  : fade in
    2  : fade in and out
void setAnimation ( ArmatureAnimation animation)
inline
virtual void setBetween ( FrameData from,
FrameData to,
bool  limit = true 
)
protectedvirtual

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

virtual void setMovementBoneData ( MovementBoneData data)
inlinevirtual
virtual void tweenColorTo ( float  percent,
FrameData node 
)
protectedvirtual

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

virtual FrameData* tweenNodeTo ( float  percent,
FrameData node = nullptr 
)
protectedvirtual

According to the percent to calculate current FrameData 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 ProcessBase.

Member Data Documentation

ArmatureAnimation* _animation
protected

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

FrameData* _between
protected

To frame data, used for calculate between value.

int _betweenDuration
protected

Dedermine which tween effect current frame use.

Bone* _bone
protected

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

TweenType _frameTweenEasing
protected

A weak reference to the Bone.

FrameData* _from
protected

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

int _fromIndex
protected
MovementBoneData* _movementBoneData
protected

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

bool _passLastFrame
protected
FrameData* _to
protected

From frame data, used for calculate between value.

int _toIndex
protected

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

int _totalDuration
protected

Current key frame will last _betweenDuration frames.

FrameData* _tweenData
protected

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