cocos2d-x  3.0Beta0
 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 Object

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 Object
 Object ()
 Constructor. More...
 
 Object ()
 Constructor. More...
 
virtual ~Object ()
void release ()
 Release the ownership immediately. More...
 
void retain ()
 Retains the ownership. More...
 
Objectautorelease ()
 Release the ownership sometime soon automatically. More...
 
bool isSingleReference () const
 Returns a boolean value that indicates whether there is only one reference to the object. More...
 
unsigned int retainCount () const
 Returns the object's current reference count. More...
 
local retainCount ()
 Returns the object's current reference count. More...
 
virtual bool isEqual (const Object *object)
 Returns a boolean value that indicates whether this object and a given object are equal. More...
 
virtual void acceptVisitor (DataVisitor &visitor)

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 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...
 
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 Object
unsigned int _reference
 count of references More...
 
var _reference
 count of references More...
 
local _reference
 count of references More...
 
unsigned int _autoReleaseCount
 count of autorelease More...
 
var _autoReleaseCount
 count of autorelease More...
 
local _autoReleaseCount
 count of autorelease More...
 

Additional Inherited Members

- Public Attributes inherited from Object
unsigned int _ID
 object id, ScriptSupport need public _ID More...
 
int _luaID
 Lua reference id. More...
 
var _luaID
 Lua reference id. More...
 
local _luaID
 Lua reference id. 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: