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

#include <CCActionTimeline.h>

Inheritance diagram for ActionTimeline:
Action Ref Clonable

Public Member Functions

 ActionTimeline ()
virtual ~ActionTimeline ()
virtual void play (std::string animationName, bool loop)
local play ( local animationName, local loop)
virtual bool init ()
var init ()
local init ()
virtual void gotoFrameAndPlay (int startIndex)
 Goto the specified frame index, and start playing from this index. More...
 
local gotoFrameAndPlay ( local startIndex)
 Goto the specified frame index, and start playing from this index. More...
 
virtual void gotoFrameAndPlay (int startIndex, bool loop)
 Goto the specified frame index, and start playing from this index. More...
 
local gotoFrameAndPlay ( local startIndex, local loop)
 Goto the specified frame index, and start playing from this index. More...
 
virtual void gotoFrameAndPlay (int startIndex, int endIndex, bool loop)
 Goto the specified frame index, and start playing from start index, end at end index. More...
 
virtual void gotoFrameAndPlay (int startIndex, int endIndex, int currentFrameIndex, bool loop)
 Goto the specified frame index, and start playing from start index, end at end index. More...
 
virtual void gotoFrameAndPause (int startIndex)
 Goto the specified frame index, and pause at this index. More...
 
virtual void pause ()
 Pause the animation. More...
 
virtual void resume ()
 Resume the animation. More...
 
var resume ()
 Resume the animation. More...
 
local resume ()
 Resume the animation. More...
 
virtual bool isPlaying () const
 Whether or not Action is playing. More...
 
var isPlaying ()
 Whether or not Action is playing. More...
 
local isPlaying ()
 Whether or not Action is playing. More...
 
virtual void setTimeSpeed (float speed)
 Set the animation speed, this will speed up or slow down the speed. More...
 
var setTimeSpeed ( var speed)
 Set the animation speed, this will speed up or slow down the speed. More...
 
local setTimeSpeed ( local speed)
 Set the animation speed, this will speed up or slow down the speed. More...
 
virtual float getTimeSpeed () const
 Get current animation speed. More...
 
virtual void setDuration (int duration)
 duration of the whole action More...
 
local setDuration ( local duration)
 duration of the whole action More...
 
virtual int getDuration () const
var getDuration ()
local getDuration ()
virtual int getStartFrame () const
 Start frame index of this action. More...
 
local getStartFrame ()
 Start frame index of this action. More...
 
virtual int getEndFrame () const
 End frame of this action. More...
 
virtual void setCurrentFrame (int frameIndex)
 Set current frame index, this will cause action plays to this frame. More...
 
local setCurrentFrame ( local frameIndex)
 Set current frame index, this will cause action plays to this frame. More...
 
virtual int getCurrentFrame () const
 Get current frame. More...
 
virtual void addTimeline (Timeline *timeline)
 add Timeline to ActionTimeline More...
 
local addTimeline ( local timeline)
 add Timeline to ActionTimeline More...
 
virtual void removeTimeline (Timeline *timeline)
virtual const cocos2d::Vector
< Timeline * > & 
getTimelines () const
local getTimelines ()
virtual void addAnimationInfo (const AnimationInfo &animationInfo)
 AnimationInfo. More...
 
local addAnimationInfo ( local animationInfo)
 AnimationInfo. More...
 
virtual void removeAnimationInfo (std::string animationName)
virtual bool IsAnimationInfoExists (const std::string &animationName)
var IsAnimationInfoExists ( var animationName)
local IsAnimationInfoExists ( local animationName)
virtual AnimationInfo getAnimationInfo (const std::string &animationName)
void setFrameEventCallFunc (std::function< void(Frame *)> listener)
 Set ActionTimeline's frame event callback function. More...
 
void clearFrameEventCallFunc ()
void setLastFrameCallFunc (std::function< void()> listener)
 Last frame callback will call when arriving last frame. More...
 
local setLastFrameCallFunc ( local listener)
 Last frame callback will call when arriving last frame. More...
 
void clearLastFrameCallFunc ()
virtual ActionTimelineclone () const override
 Inherit from Action. More...
 
local clone ()
 Inherit from Action. More...
 
virtual ActionTimelinereverse () const override
 Returns a reverse of ActionTimeline. More...
 
local reverse ()
 Returns a reverse of ActionTimeline. More...
 
virtual void step (float delta) override
 called every frame with it's delta time, dt in seconds. DON'T override unless you know what you are doing. More...
 
virtual void startWithTarget (cocos2d::Node *target) override
 called before the action start. It will also set the target. More...
 
var startWithTarget ( var target)
 called before the action start. It will also set the target. More...
 
local startWithTarget ( local target)
 called before the action start. It will also set the target. More...
 
virtual bool isDone () const override
 return true if the action has finished More...
 
var isDone ()
 return true if the action has finished More...
 
- Public Member Functions inherited from Action
virtual std::string description () const
virtual void stop ()
 called after the action has finished. More...
 
var stop ()
 called after the action has finished. More...
 
local stop ()
 called after the action has finished. More...
 
virtual void update (float time)
 called once per frame. More...
 
var update ( var time)
 called once per frame. More...
 
local update ( local time)
 called once per frame. More...
 
NodegetTarget () const
var getTarget ()
local getTarget ()
void setTarget (Node *target)
 The action will modify the target properties. More...
 
var setTarget ( var target)
 The action will modify the target properties. More...
 
local setTarget ( local target)
 The action will modify the target properties. More...
 
NodegetOriginalTarget () const
var getOriginalTarget ()
local getOriginalTarget ()
void setOriginalTarget (Node *originalTarget)
 Set the original target, since target can be nil. More...
 
var setOriginalTarget ( var originalTarget)
 Set the original target, since target can be nil. More...
 
local setOriginalTarget ( local originalTarget)
 Set the original target, since target can be nil. More...
 
int getTag () const
var getTag ()
local getTag ()
void setTag (int tag)
var setTag ( var tag)
local setTag ( local tag)
virtual ~Action ()
var ~Action ()
local ~Action ()
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
- Public Member Functions inherited from Clonable
virtual ~Clonable ()
Refcopy () const
 returns a copy of the Ref. More...
 
var copy ()
 returns a copy of the Ref. More...
 
local copy ()
 returns a copy of the Ref. More...
 

Static Public Member Functions

static ActionTimelinecreate ()
local create ()

Protected Member Functions

virtual void gotoFrame (int frameIndex)
local gotoFrame ( local frameIndex)
virtual void stepToFrame (int frameIndex)
local stepToFrame ( local frameIndex)
virtual void emitFrameEvent (Frame *frame)
 emit frame event, call it when enter a frame More...
 
var emitFrameEvent ( var frame)
 emit frame event, call it when enter a frame More...
 
local emitFrameEvent ( local frame)
 emit frame event, call it when enter a frame More...
 
- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 
 Ref ()
 Constructor. More...
 

Protected Attributes

std::map< int, cocos2d::Vector
< Timeline * > > 
_timelineMap
cocos2d::Vector< Timeline * > _timelineList
int _duration
double _time
float _timeSpeed
float _frameInternal
bool _playing
int _currentFrame
int _startFrame
int _endFrame
bool _loop
std::function< void(Frame *)> _frameEventListener
var _frameEventListener
local _frameEventListener
std::function< void()> _lastFrameListener
std::map< std::string,
AnimationInfo
_animationInfos
- Protected Attributes inherited from Action
Node_originalTarget
Node_target
 The "target". More...
 
int _tag
 The action tag. More...
 
- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references More...
 
var _referenceCount
 count of references More...
 
local _referenceCount
 count of references More...
 

Friends

class Frame

Additional Inherited Members

- Public Attributes inherited from Action
CC_CONSTRUCTOR_ACCESS __pad0__: Action()
- Static Public Attributes inherited from Action
static const int INVALID_TAG = -1
 Default tag used for all the actions. More...
 
var INVALID_TAG = -1
 Default tag used for all the actions. More...
 
local INVALID_TAG = -1
 Default tag used for all the actions. More...
 

Constructor & Destructor Documentation

var ActionTimeline ( )
local ActionTimeline ( )
virtual ~ActionTimeline ( )
virtual
var ~ActionTimeline ( )
virtual
local ~ActionTimeline ( )
virtual

Member Function Documentation

virtual void addAnimationInfo ( const AnimationInfo animationInfo)
virtual
var addAnimationInfo ( var  animationInfo)
virtual
local addAnimationInfo ( local  animationInfo)
virtual
virtual void addTimeline ( Timeline timeline)
virtual
var addTimeline ( var  timeline)
virtual
local addTimeline ( local  timeline)
virtual
void clearFrameEventCallFunc ( )
var clearFrameEventCallFunc ( )
local clearFrameEventCallFunc ( )
void clearLastFrameCallFunc ( )
var clearLastFrameCallFunc ( )
local clearLastFrameCallFunc ( )
virtual ActionTimeline* clone ( ) const
overridevirtual

Inherit from Action.

Returns a clone of ActionTimeline

Reimplemented from Action.

var clone ( )
overridevirtual

Inherit from Action.

Returns a clone of ActionTimeline

Reimplemented from Action.

local clone ( )
overridevirtual

Inherit from Action.

Returns a clone of ActionTimeline

Reimplemented from Action.

static ActionTimeline* create ( )
static
var create ( )
static
local create ( )
static
virtual void emitFrameEvent ( Frame frame)
protectedvirtual

emit frame event, call it when enter a frame

var emitFrameEvent ( var  frame)
protectedvirtual

emit frame event, call it when enter a frame

local emitFrameEvent ( local  frame)
protectedvirtual

emit frame event, call it when enter a frame

virtual AnimationInfo
getAnimationInfo
( const std::string &  animationName)
virtual
var getAnimationInfo ( var  animationName)
virtual
local getAnimationInfo ( local  animationName)
virtual
virtual int getCurrentFrame ( ) const
inlinevirtual

Get current frame.

var getCurrentFrame ( )
inlinevirtual

Get current frame.

local getCurrentFrame ( )
inlinevirtual

Get current frame.

virtual int getDuration ( ) const
inlinevirtual
var getDuration ( )
inlinevirtual
local getDuration ( )
inlinevirtual
virtual int getEndFrame ( ) const
inlinevirtual

End frame of this action.

When action play to this frame, if action is not loop, then it will stop, or it will play from start frame again.

var getEndFrame ( )
inlinevirtual

End frame of this action.

When action play to this frame, if action is not loop, then it will stop, or it will play from start frame again.

local getEndFrame ( )
inlinevirtual

End frame of this action.

When action play to this frame, if action is not loop, then it will stop, or it will play from start frame again.

virtual int getStartFrame ( ) const
inlinevirtual

Start frame index of this action.

var getStartFrame ( )
inlinevirtual

Start frame index of this action.

local getStartFrame ( )
inlinevirtual

Start frame index of this action.

virtual const cocos2d::Vector
<Timeline*>& getTimelines
( ) const
inlinevirtual
var getTimelines ( )
inlinevirtual
local getTimelines ( )
inlinevirtual
virtual float getTimeSpeed ( ) const
inlinevirtual

Get current animation speed.

var getTimeSpeed ( )
inlinevirtual

Get current animation speed.

local getTimeSpeed ( )
inlinevirtual

Get current animation speed.

virtual void gotoFrame ( int  frameIndex)
protectedvirtual
var gotoFrame ( var  frameIndex)
protectedvirtual
local gotoFrame ( local  frameIndex)
protectedvirtual
virtual void gotoFrameAndPause ( int  startIndex)
virtual

Goto the specified frame index, and pause at this index.

Parameters
startIndexThe animation will pause at this index.
var gotoFrameAndPause ( var  startIndex)
virtual

Goto the specified frame index, and pause at this index.

Parameters
startIndexThe animation will pause at this index.
local gotoFrameAndPause ( local  startIndex)
virtual

Goto the specified frame index, and pause at this index.

Parameters
startIndexThe animation will pause at this index.
virtual void gotoFrameAndPlay ( int  startIndex)
virtual

Goto the specified frame index, and start playing from this index.

Parameters
startIndexThe animation will play from this index.
var gotoFrameAndPlay ( var  startIndex)
virtual

Goto the specified frame index, and start playing from this index.

Parameters
startIndexThe animation will play from this index.
local gotoFrameAndPlay ( local  startIndex)
virtual

Goto the specified frame index, and start playing from this index.

Parameters
startIndexThe animation will play from this index.
virtual void gotoFrameAndPlay ( int  startIndex,
bool  loop 
)
virtual

Goto the specified frame index, and start playing from this index.

Parameters
startIndexThe animation will play from this index.
loopWhether or not the animation need loop.
var gotoFrameAndPlay ( var  startIndex,
var  loop 
)
virtual

Goto the specified frame index, and start playing from this index.

Parameters
startIndexThe animation will play from this index.
loopWhether or not the animation need loop.
local gotoFrameAndPlay ( local  startIndex,
local  loop 
)
virtual

Goto the specified frame index, and start playing from this index.

Parameters
startIndexThe animation will play from this index.
loopWhether or not the animation need loop.
virtual void gotoFrameAndPlay ( int  startIndex,
int  endIndex,
bool  loop 
)
virtual

Goto the specified frame index, and start playing from start index, end at end index.

Parameters
startIndexThe animation will play from this index.
endIndexThe animation will end at this index.
loopWhether or not the animation need loop.
var gotoFrameAndPlay ( var  startIndex,
var  endIndex,
var  loop 
)
virtual

Goto the specified frame index, and start playing from start index, end at end index.

Parameters
startIndexThe animation will play from this index.
endIndexThe animation will end at this index.
loopWhether or not the animation need loop.
local gotoFrameAndPlay ( local  startIndex,
local  endIndex,
local  loop 
)
virtual

Goto the specified frame index, and start playing from start index, end at end index.

Parameters
startIndexThe animation will play from this index.
endIndexThe animation will end at this index.
loopWhether or not the animation need loop.
virtual void gotoFrameAndPlay ( int  startIndex,
int  endIndex,
int  currentFrameIndex,
bool  loop 
)
virtual

Goto the specified frame index, and start playing from start index, end at end index.

Parameters
startIndexThe animation will play from this index.
endIndexThe animation will end at this index.
currentFrameIndexset current frame index.
loopWhether or not the animation need loop.
var gotoFrameAndPlay ( var  startIndex,
var  endIndex,
var  currentFrameIndex,
var  loop 
)
virtual

Goto the specified frame index, and start playing from start index, end at end index.

Parameters
startIndexThe animation will play from this index.
endIndexThe animation will end at this index.
currentFrameIndexset current frame index.
loopWhether or not the animation need loop.
local gotoFrameAndPlay ( local  startIndex,
local  endIndex,
local  currentFrameIndex,
local  loop 
)
virtual

Goto the specified frame index, and start playing from start index, end at end index.

Parameters
startIndexThe animation will play from this index.
endIndexThe animation will end at this index.
currentFrameIndexset current frame index.
loopWhether or not the animation need loop.
virtual bool init ( )
virtual
var init ( )
virtual
local init ( )
virtual
virtual bool IsAnimationInfoExists ( const std::string &  animationName)
virtual
var IsAnimationInfoExists ( var  animationName)
virtual
local IsAnimationInfoExists ( local  animationName)
virtual
virtual bool isDone ( ) const
inlineoverridevirtual

return true if the action has finished

Reimplemented from Action.

var isDone ( )
inlineoverridevirtual

return true if the action has finished

Reimplemented from Action.

local isDone ( )
inlineoverridevirtual

return true if the action has finished

Reimplemented from Action.

virtual bool isPlaying ( ) const
virtual

Whether or not Action is playing.

var isPlaying ( )
virtual

Whether or not Action is playing.

local isPlaying ( )
virtual

Whether or not Action is playing.

virtual void pause ( )
virtual

Pause the animation.

var pause ( )
virtual

Pause the animation.

local pause ( )
virtual

Pause the animation.

virtual void play ( std::string  animationName,
bool  loop 
)
virtual
var play ( var  animationName,
var  loop 
)
virtual
local play ( local  animationName,
local  loop 
)
virtual
virtual void removeAnimationInfo ( std::string  animationName)
virtual
var removeAnimationInfo ( var  animationName)
virtual
local removeAnimationInfo ( local  animationName)
virtual
virtual void removeTimeline ( Timeline timeline)
virtual
var removeTimeline ( var  timeline)
virtual
local removeTimeline ( local  timeline)
virtual
virtual void resume ( )
virtual

Resume the animation.

var resume ( )
virtual

Resume the animation.

local resume ( )
virtual

Resume the animation.

virtual ActionTimeline* reverse ( void  ) const
inlineoverridevirtual

Returns a reverse of ActionTimeline.

Not implement yet.

Reimplemented from Action.

var reverse (   )
inlineoverridevirtual

Returns a reverse of ActionTimeline.

Not implement yet.

Reimplemented from Action.

local reverse (   )
inlineoverridevirtual

Returns a reverse of ActionTimeline.

Not implement yet.

Reimplemented from Action.

virtual void setCurrentFrame ( int  frameIndex)
virtual

Set current frame index, this will cause action plays to this frame.

var setCurrentFrame ( var  frameIndex)
virtual

Set current frame index, this will cause action plays to this frame.

local setCurrentFrame ( local  frameIndex)
virtual

Set current frame index, this will cause action plays to this frame.

virtual void setDuration ( int  duration)
inlinevirtual

duration of the whole action

var setDuration ( var  duration)
inlinevirtual

duration of the whole action

local setDuration ( local  duration)
inlinevirtual

duration of the whole action

void setFrameEventCallFunc ( std::function< void(Frame *)>  listener)

Set ActionTimeline's frame event callback function.

var setFrameEventCallFunc ( var  listener)

Set ActionTimeline's frame event callback function.

local setFrameEventCallFunc ( local  listener)

Set ActionTimeline's frame event callback function.

void setLastFrameCallFunc ( std::function< void()>  listener)

Last frame callback will call when arriving last frame.

var setLastFrameCallFunc ( var  listener)

Last frame callback will call when arriving last frame.

local setLastFrameCallFunc ( local  listener)

Last frame callback will call when arriving last frame.

virtual void setTimeSpeed ( float  speed)
inlinevirtual

Set the animation speed, this will speed up or slow down the speed.

var setTimeSpeed ( var  speed)
inlinevirtual

Set the animation speed, this will speed up or slow down the speed.

local setTimeSpeed ( local  speed)
inlinevirtual

Set the animation speed, this will speed up or slow down the speed.

virtual void startWithTarget ( cocos2d::Node target)
overridevirtual

called before the action start. It will also set the target.

Reimplemented from Action.

var startWithTarget ( var  target)
overridevirtual

called before the action start. It will also set the target.

Reimplemented from Action.

local startWithTarget ( local  target)
overridevirtual

called before the action start. It will also set the target.

Reimplemented from Action.

virtual void step ( float  dt)
overridevirtual

called every frame with it's delta time, dt in seconds. DON'T override unless you know what you are doing.

Reimplemented from Action.

var step ( var  dt)
overridevirtual

called every frame with it's delta time, dt in seconds. DON'T override unless you know what you are doing.

Reimplemented from Action.

local step ( local  dt)
overridevirtual

called every frame with it's delta time, dt in seconds. DON'T override unless you know what you are doing.

Reimplemented from Action.

virtual void stepToFrame ( int  frameIndex)
protectedvirtual
var stepToFrame ( var  frameIndex)
protectedvirtual
local stepToFrame ( local  frameIndex)
protectedvirtual

Friends And Related Function Documentation

friend class Frame
friend
var Frame
friend
local Frame
friend

Member Data Documentation

std::map<std::string,
AnimationInfo> _animationInfos
protected
var _animationInfos
protected
local _animationInfos
protected
int _currentFrame
protected
var _currentFrame
protected
local _currentFrame
protected
int _duration
protected
var _duration
protected
local _duration
protected
int _endFrame
protected
var _endFrame
protected
local _endFrame
protected
std::function<void(Frame*)>
_frameEventListener
protected
var _frameEventListener
protected
local _frameEventListener
protected
float _frameInternal
protected
var _frameInternal
protected
local _frameInternal
protected
std::function<void()>
_lastFrameListener
protected
var _lastFrameListener
protected
local _lastFrameListener
protected
bool _loop
protected
var _loop
protected
local _loop
protected
bool _playing
protected
var _playing
protected
local _playing
protected
int _startFrame
protected
var _startFrame
protected
local _startFrame
protected
double _time
protected
var _time
protected
local _time
protected
cocos2d::Vector<Timeline*>
_timelineList
protected
var _timelineList
protected
local _timelineList
protected
std::map<int, cocos2d::Vector
<Timeline*> > _timelineMap
protected
float _timeSpeed
protected
var _timeSpeed
protected
local _timeSpeed
protected

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