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

#include <CCArmatureAnimation.h>

Inheritance diagram for ArmatureAnimation:
ProcessBase Object

Public Member Functions

 ArmatureAnimation ()
virtual ~ArmatureAnimation (void)
virtual bool init (Armature *armature)
 Init with a Armature. More...
 
local init ( local armature)
 Init with a Armature. More...
 
virtual
CC_DEPRECATED_ATTRIBUTE void 
setAnimationScale (float animationScale)
 Scale animation play speed. More...
 
local setAnimationScale ( local animationScale)
 Scale animation play speed. More...
 
virtual
CC_DEPRECATED_ATTRIBUTE float 
getAnimationScale () const
local getAnimationScale ()
virtual void setSpeedScale (float speedScale)
 Scale animation play speed. More...
 
local setSpeedScale ( local speedScale)
 Scale animation play speed. More...
 
virtual float getSpeedScale () const
virtual void setAnimationInternal (float animationInternal)
 The animation update speed. More...
 
local setAnimationInternal ( local animationInternal)
 The animation update speed. More...
 
void play (const char *animationName, int durationTo=-1, int durationTween=-1, int loop=-1, int tweenEasing=TWEEN_EASING_MAX)
 Play animation by animation name. More...
 
local play ( local animationName, local 1, local 1, local 1, local TWEEN_EASING_MAX)
 Play animation by animation name. More...
 
void playByIndex (int animationIndex, int durationTo=-1, int durationTween=-1, int loop=-1, int tweenEasing=TWEEN_EASING_MAX)
 Play animation by index, the other param is the same to play. More...
 
var playByIndex ( var animationIndex, var 1, var 1, var 1, var TWEEN_EASING_MAX)
 Play animation by index, the other param is the same to play. More...
 
local playByIndex ( local animationIndex, local 1, local 1, local 1, local TWEEN_EASING_MAX)
 Play animation by index, the other param is the same to play. More...
 
virtual void gotoAndPlay (int frameIndex)
 Go to specified frame and play current movement. More...
 
virtual void gotoAndPause (int frameIndex)
 Go to specified frame and pause current movement. More...
 
virtual void pause ()
 Pause the Process. More...
 
virtual void resume ()
 Resume the Process. More...
 
virtual void stop ()
 Stop the Process. More...
 
int getMovementCount () const
 Get movement count. More...
 
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...
 
std::string getCurrentMovementID () const
 Get current movementID. More...
 
local getCurrentMovementID ()
 Get current movementID. More...
 
void setMovementEventCallFunc (cocos2d::Object *target, SEL_MovementEventCallFunc callFunc)
 Set armature's movement event callback function To disconnect this event, just setMovementEventCallFunc(nullptr, nullptr);. More...
 
void setFrameEventCallFunc (cocos2d::Object *target, SEL_FrameEventCallFunc callFunc)
 Set armature's frame event callback function To disconnect this event, just setFrameEventCallFunc(nullptr, nullptr);. More...
 
virtual void setAnimationData (AnimationData *data)
virtual AnimationDatagetAnimationData () const
local getAnimationData ()
virtual ObjectgetUserObject ()
 Returns a user assigned Object. More...
 
virtual const ObjectgetUserObject () const
virtual void setUserObject (Object *userObject)
 Returns a user assigned Object. More...
 
- 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 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
virtual float getAnimationInternal () const
- Public Member Functions inherited from Object
 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...
 
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 ArmatureAnimationcreate (Armature *armature)
 Create with a Armature. More...
 
local create ( local armature)
 Create with a Armature. More...
 

Protected Member Functions

void updateHandler ()
 Update(float dt) will call this handler, you can handle your logic here. More...
 
void updateFrameData (float currentPercent)
 Update current key frame, and process auto stop, pause. More...
 
void frameEvent (Bone *bone, const char *frameEventName, int originFrameIndex, int currentFrameIndex)
 Emit a frame event. More...
 
bool isIgnoreFrameEvent () const
var isIgnoreFrameEvent ()
local isIgnoreFrameEvent ()
- Protected Member Functions inherited from ProcessBase
virtual void gotoFrame (int frameIndex)

Protected Attributes

AnimationData_animationData
 AnimationData save all MovementDatas this animation used. More...
 
var _animationData
 AnimationData save all MovementDatas this animation used. More...
 
local _animationData
 AnimationData save all MovementDatas this animation used. More...
 
float _speedScale
 Scale the animation speed. More...
 
MovementData_movementData
Armature_armature
 MovementData save all MovementFrameDatas this animation used. More...
 
var _armature
 MovementData save all MovementFrameDatas this animation used. More...
 
local _armature
 MovementData save all MovementFrameDatas this animation used. More...
 
std::string _movementID
 A weak reference of armature. More...
 
int _toIndex
 Current movment's name. More...
 
cocos2d::Array_tweenList
 The frame index in MovementData->m_pMovFrameDataArr, it's different from m_iFrameIndex. More...
 
var _tweenList
 The frame index in MovementData->m_pMovFrameDataArr, it's different from m_iFrameIndex. More...
 
local _tweenList
 The frame index in MovementData->m_pMovFrameDataArr, it's different from m_iFrameIndex. More...
 
bool _ignoreFrameEvent
std::queue< FrameEvent * > _frameEventQueue
var _frameEventQueue
local _frameEventQueue
cocos2d::Object_userObject
SEL_MovementEventCallFunc _movementEventCallFunc
 MovementEvent CallFunc. More...
 
var _movementEventCallFunc
 MovementEvent CallFunc. More...
 
local _movementEventCallFunc
 MovementEvent CallFunc. More...
 
SEL_FrameEventCallFunc _frameEventCallFunc
 FrameEvent CallFunc. More...
 
var _frameEventCallFunc
 FrameEvent CallFunc. More...
 
local _frameEventCallFunc
 FrameEvent CallFunc. More...
 
cocos2d::Object_movementEventTarget
cocos2d::Object_frameEventTarget
var _frameEventTarget
local _frameEventTarget
- 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...
 
unsigned int _autoReleaseCount
 count of autorelease More...
 

Friends

class Tween

Additional Inherited Members

- Public Attributes inherited from Object
unsigned int _ID
 object id, ScriptSupport need public _ID More...
 
int _luaID
 Lua reference id. More...
 

Constructor & Destructor Documentation

var ctor ( )
local ArmatureAnimation ( )
virtual ~ArmatureAnimation ( void  )
virtual

Member Function Documentation

static ArmatureAnimation* create ( Armature armature)
static

Create with a Armature.

Parameters
armatureThe Armature ArmatureAnimation will bind to
var create ( var  armature)
static

Create with a Armature.

Parameters
armatureThe Armature ArmatureAnimation will bind to
local create ( local  armature)
static

Create with a Armature.

Parameters
armatureThe Armature ArmatureAnimation will bind to
void frameEvent ( Bone bone,
const char *  frameEventName,
int  originFrameIndex,
int  currentFrameIndex 
)
protected

Emit a frame event.

virtual AnimationData*
getAnimationData
( ) const
inlinevirtual
var getAnimationData ( )
inlinevirtual
local getAnimationData ( )
inlinevirtual
virtual
CC_DEPRECATED_ATTRIBUTE float
getAnimationScale
( ) const
virtual
var getAnimationScale ( )
virtual
local getAnimationScale ( )
virtual
std::string getCurrentMovementID ( ) const

Get current movementID.

Returns
The name of current movement
var getCurrentMovementID ( )

Get current movementID.

Returns
The name of current movement
local getCurrentMovementID ( )

Get current movementID.

Returns
The name of current movement
int getMovementCount ( ) const

Get movement count.

var getMovementCount ( )

Get movement count.

local getMovementCount ( )

Get movement count.

virtual float getSpeedScale ( ) const
virtual
var getSpeedScale ( )
virtual
local getSpeedScale ( )
virtual
virtual Object* getUserObject ( )
inlinevirtual

Returns a user assigned Object.

Similar to userData, but instead of holding a void* it holds an object

Returns
A user assigned Object
virtual const Object* getUserObject ( ) const
inlinevirtual
virtual void gotoAndPause ( int  frameIndex)
virtual

Go to specified frame and pause current movement.

var gotoAndPause ( var  frameIndex)
virtual

Go to specified frame and pause current movement.

local gotoAndPause ( local  frameIndex)
virtual

Go to specified frame and pause current movement.

virtual void gotoAndPlay ( int  frameIndex)
virtual

Go to specified frame and play current movement.

You need first switch to the movement you want to play, then call this function.

example : playByIndex(0); gotoAndPlay(0); playByIndex(1); gotoAndPlay(0); gotoAndPlay(15);

var gotoAndPlay ( var  frameIndex)
virtual

Go to specified frame and play current movement.

You need first switch to the movement you want to play, then call this function.

example : playByIndex(0); gotoAndPlay(0); playByIndex(1); gotoAndPlay(0); gotoAndPlay(15);

local gotoAndPlay ( local  frameIndex)
virtual

Go to specified frame and play current movement.

You need first switch to the movement you want to play, then call this function.

example : playByIndex(0); gotoAndPlay(0); playByIndex(1); gotoAndPlay(0); gotoAndPlay(15);

virtual bool init ( Armature armature)
virtual

Init with a Armature.

Parameters
armatureThe Armature ArmatureAnimation will bind to
var init ( var  armature)
virtual

Init with a Armature.

Parameters
armatureThe Armature ArmatureAnimation will bind to
local init ( local  armature)
virtual

Init with a Armature.

Parameters
armatureThe Armature ArmatureAnimation will bind to
bool isIgnoreFrameEvent ( ) const
inlineprotected
var isIgnoreFrameEvent ( )
inlineprotected
local isIgnoreFrameEvent ( )
inlineprotected
virtual void pause ( )
virtual

Pause the Process.

Reimplemented from ProcessBase.

var pause ( )
virtual

Pause the Process.

Reimplemented from ProcessBase.

local pause ( )
virtual

Pause the Process.

Reimplemented from ProcessBase.

void play ( const char *  animationName,
int  durationTo = -1,
int  durationTween = -1,
int  loop = -1,
int  tweenEasing = TWEEN_EASING_MAX 
)

Play animation by animation name.

Parameters
animationNameThe animation name you want to play
durationToThe frames between two animation changing-over. It's meaning is changing to this animation need how many frames

-1 : use the value from MovementData get from flash design panel

Parameters
durationTweenThe frame count you want to play in the game. if _durationTween is 80, then the animation will played 80 frames in a loop

-1 : use the value from MovementData get from flash design panel

Parameters
loopWhether the animation is loop
    loop < 0 : use the value from MovementData get from flash design panel
    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 flash design panel
    -1 : fade out
    0  : line
    1  : fade in
    2  : fade in and out
var play ( var  animationName,
var  durationTo = -1,
var  durationTween = -1,
var  loop = -1,
var  tweenEasing = TWEEN_EASING_MAX 
)

Play animation by animation name.

Parameters
animationNameThe animation name you want to play
durationToThe frames between two animation changing-over. It's meaning is changing to this animation need how many frames

-1 : use the value from MovementData get from flash design panel

Parameters
durationTweenThe frame count you want to play in the game. if _durationTween is 80, then the animation will played 80 frames in a loop

-1 : use the value from MovementData get from flash design panel

Parameters
loopWhether the animation is loop
    loop < 0 : use the value from MovementData get from flash design panel
    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 flash design panel
    -1 : fade out
    0  : line
    1  : fade in
    2  : fade in and out
local play ( local  animationName,
local  durationTo = -1,
local  durationTween = -1,
local  loop = -1,
local  tweenEasing = TWEEN_EASING_MAX 
)

Play animation by animation name.

Parameters
animationNameThe animation name you want to play
durationToThe frames between two animation changing-over. It's meaning is changing to this animation need how many frames

-1 : use the value from MovementData get from flash design panel

Parameters
durationTweenThe frame count you want to play in the game. if _durationTween is 80, then the animation will played 80 frames in a loop

-1 : use the value from MovementData get from flash design panel

Parameters
loopWhether the animation is loop
    loop < 0 : use the value from MovementData get from flash design panel
    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 flash design panel
    -1 : fade out
    0  : line
    1  : fade in
    2  : fade in and out
void playByIndex ( int  animationIndex,
int  durationTo = -1,
int  durationTween = -1,
int  loop = -1,
int  tweenEasing = TWEEN_EASING_MAX 
)

Play animation by index, the other param is the same to play.

Parameters
animationIndexthe animation index you want to play
var playByIndex ( var  animationIndex,
var  durationTo = -1,
var  durationTween = -1,
var  loop = -1,
var  tweenEasing = TWEEN_EASING_MAX 
)

Play animation by index, the other param is the same to play.

Parameters
animationIndexthe animation index you want to play
local playByIndex ( local  animationIndex,
local  durationTo = -1,
local  durationTween = -1,
local  loop = -1,
local  tweenEasing = TWEEN_EASING_MAX 
)

Play animation by index, the other param is the same to play.

Parameters
animationIndexthe animation index you want to play
virtual void resume ( )
virtual

Resume the Process.

Reimplemented from ProcessBase.

var resume ( )
virtual

Resume the Process.

Reimplemented from ProcessBase.

local resume ( )
virtual

Resume the Process.

Reimplemented from ProcessBase.

virtual void setAnimationData ( AnimationData data)
inlinevirtual
var setAnimationData ( var  data)
inlinevirtual
local setAnimationData ( local  data)
inlinevirtual
virtual void setAnimationInternal ( float  animationInternal)
virtual

The animation update speed.

Reimplemented from ProcessBase.

var setAnimationInternal ( var  animationInternal)
virtual

The animation update speed.

Reimplemented from ProcessBase.

local setAnimationInternal ( local  animationInternal)
virtual

The animation update speed.

Reimplemented from ProcessBase.

virtual
CC_DEPRECATED_ATTRIBUTE void
setAnimationScale
( float  animationScale)
virtual

Scale animation play speed.

This method is deprecated, please use setSpeedScale.

Parameters
animationScaleScale value
var setAnimationScale ( var  animationScale)
virtual

Scale animation play speed.

This method is deprecated, please use setSpeedScale.

Parameters
animationScaleScale value
local setAnimationScale ( local  animationScale)
virtual

Scale animation play speed.

This method is deprecated, please use setSpeedScale.

Parameters
animationScaleScale value
void setFrameEventCallFunc ( cocos2d::Object target,
SEL_FrameEventCallFunc  callFunc 
)

Set armature's frame event callback function To disconnect this event, just setFrameEventCallFunc(nullptr, nullptr);.

var setFrameEventCallFunc ( var  target,
var  callFunc 
)

Set armature's frame event callback function To disconnect this event, just setFrameEventCallFunc(nullptr, nullptr);.

local setFrameEventCallFunc ( local  target,
local  callFunc 
)

Set armature's frame event callback function To disconnect this event, just setFrameEventCallFunc(nullptr, nullptr);.

void setMovementEventCallFunc ( cocos2d::Object target,
SEL_MovementEventCallFunc  callFunc 
)

Set armature's movement event callback function To disconnect this event, just setMovementEventCallFunc(nullptr, nullptr);.

var setMovementEventCallFunc ( var  target,
var  callFunc 
)

Set armature's movement event callback function To disconnect this event, just setMovementEventCallFunc(nullptr, nullptr);.

local setMovementEventCallFunc ( local  target,
local  callFunc 
)

Set armature's movement event callback function To disconnect this event, just setMovementEventCallFunc(nullptr, nullptr);.

virtual void setSpeedScale ( float  speedScale)
virtual

Scale animation play speed.

Parameters
animationScaleScale value
var setSpeedScale ( var  speedScale)
virtual

Scale animation play speed.

Parameters
animationScaleScale value
local setSpeedScale ( local  speedScale)
virtual

Scale animation play speed.

Parameters
animationScaleScale value
virtual void setUserObject ( Object userObject)
virtual

Returns a user assigned Object.

Similar to UserData, but instead of holding a void* it holds an object. The UserObject will be retained once in this method, and the previous UserObject (if existed) will be relese. The UserObject will be released in Node's destructure.

Parameters
userObjectA user assigned Object
var setUserObject ( var  userObject)
virtual

Returns a user assigned Object.

Similar to UserData, but instead of holding a void* it holds an object. The UserObject will be retained once in this method, and the previous UserObject (if existed) will be relese. The UserObject will be released in Node's destructure.

Parameters
userObjectA user assigned Object
local setUserObject ( local  userObject)
virtual

Returns a user assigned Object.

Similar to UserData, but instead of holding a void* it holds an object. The UserObject will be retained once in this method, and the previous UserObject (if existed) will be relese. The UserObject will be released in Node's destructure.

Parameters
userObjectA user assigned Object
virtual void stop ( )
virtual

Stop the Process.

Reimplemented from ProcessBase.

var stop ( )
virtual

Stop the Process.

Reimplemented from ProcessBase.

local stop ( )
virtual

Stop the Process.

Reimplemented from ProcessBase.

void update ( float  dt)
virtual

You should never call this function, unless you know what you do Update the Process, include current process, current frame and son on.

Parameters
Theduration since last update

Reimplemented from ProcessBase.

var update ( var  dt)
virtual

You should never call this function, unless you know what you do Update the Process, include current process, current frame and son on.

Parameters
Theduration since last update

Reimplemented from ProcessBase.

local update ( local  dt)
virtual

You should never call this function, unless you know what you do Update the Process, include current process, current frame and son on.

Parameters
Theduration since last update

Reimplemented from ProcessBase.

void updateFrameData ( float  currentPercent)
protected

Update current key frame, and process auto stop, pause.

void updateHandler ( )
protectedvirtual

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

Reimplemented from ProcessBase.

Friends And Related Function Documentation

friend class Tween
friend

Member Data Documentation

AnimationData* _animationData
protected

AnimationData save all MovementDatas this animation used.

var _animationData
protected

AnimationData save all MovementDatas this animation used.

local _animationData
protected

AnimationData save all MovementDatas this animation used.

Armature* _armature
protected

MovementData save all MovementFrameDatas this animation used.

var _armature
protected

MovementData save all MovementFrameDatas this animation used.

local _armature
protected

MovementData save all MovementFrameDatas this animation used.

SEL_FrameEventCallFunc
_frameEventCallFunc
protected

FrameEvent CallFunc.

Parameters
Bone*,aBone
constchar*, the name of this frame event
int,originframe index
int,currentframe index, animation may be delayed
var _frameEventCallFunc
protected

FrameEvent CallFunc.

Parameters
Bone*,aBone
constchar*, the name of this frame event
int,originframe index
int,currentframe index, animation may be delayed
local _frameEventCallFunc
protected

FrameEvent CallFunc.

Parameters
Bone*,aBone
constchar*, the name of this frame event
int,originframe index
int,currentframe index, animation may be delayed
std::queue<FrameEvent*>
_frameEventQueue
protected
var _frameEventQueue
protected
local _frameEventQueue
protected
cocos2d::Object* _frameEventTarget
protected
var _frameEventTarget
protected
local _frameEventTarget
protected
bool _ignoreFrameEvent
protected
var _ignoreFrameEvent
protected
local _ignoreFrameEvent
protected
MovementData* _movementData
protected
var _movementData
protected
local _movementData
protected
SEL_MovementEventCallFunc
_movementEventCallFunc
protected

MovementEvent CallFunc.

Parameters
Armature*a Armature
MovementEventType,EventType, like START, COMPLETE.
constchar*, Movement ID, also called Movement Name
var _movementEventCallFunc
protected

MovementEvent CallFunc.

Parameters
Armature*a Armature
MovementEventType,EventType, like START, COMPLETE.
constchar*, Movement ID, also called Movement Name
local _movementEventCallFunc
protected

MovementEvent CallFunc.

Parameters
Armature*a Armature
MovementEventType,EventType, like START, COMPLETE.
constchar*, Movement ID, also called Movement Name
cocos2d::Object*
_movementEventTarget
protected
var _movementEventTarget
protected
local _movementEventTarget
protected
std::string _movementID
protected

A weak reference of armature.

var _movementID
protected

A weak reference of armature.

local _movementID
protected

A weak reference of armature.

float _speedScale
protected

Scale the animation speed.

var _speedScale
protected

Scale the animation speed.

local _speedScale
protected

Scale the animation speed.

int _toIndex
protected

Current movment's name.

var _toIndex
protected

Current movment's name.

local _toIndex
protected

Current movment's name.

cocos2d::Array* _tweenList
protected

The frame index in MovementData->m_pMovFrameDataArr, it's different from m_iFrameIndex.

var _tweenList
protected

The frame index in MovementData->m_pMovFrameDataArr, it's different from m_iFrameIndex.

local _tweenList
protected

The frame index in MovementData->m_pMovFrameDataArr, it's different from m_iFrameIndex.

cocos2d::Object* _userObject
protected
var _userObject
protected
local _userObject
protected

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