cocos2d-x  2.2.3-gd2.113-rev1ec524e
Loading...
Searching...
No Matches
CCActionTween Class Reference

CCActionTween. More...

#include <CCActionTween.h>

Inheritance diagram for CCActionTween:
[legend]
Collaboration diagram for CCActionTween:
[legend]

Public Member Functions

bool initWithDuration (float aDuration, const char *key, float from, float to)
 initializes the action with the property name (key), and the from and to parameters. More...
 
void startWithTarget (CCNode *pTarget)
 called before the action start. It will also set the target. More...
 
void update (float dt)
 called once per frame. More...
 
CCActionIntervalreverse ()
 returns a reversed action More...
 
- Public Member Functions inherited from CCActionInterval
float getElapsed (void)
 how many seconds had elapsed since the actions started to run. More...
 
bool initWithDuration (float d)
 initializes the action More...
 
virtual bool isDone (void)
 returns true if the action has finished More...
 
virtual CCObjectcopyWithZone (CCZone *pZone)
 NA NA. More...
 
virtual void step (float dt)
 called every frame with it's delta time. DON'T override unless you know what you are doing. More...
 
virtual void startWithTarget (CCNode *pTarget)
 called before the action start. It will also set the target. More...
 
virtual CCActionIntervalreverse (void)
 returns a reversed action More...
 
void setAmplitudeRate (float amp)
 
float getAmplitudeRate (void)
 
- Public Member Functions inherited from CCFiniteTimeAction
 CCFiniteTimeAction ()
 ctor More...
 
virtual ~CCFiniteTimeAction ()
 NA NA. More...
 
float getDuration (void)
 get duration in seconds of the action More...
 
void setDuration (float duration)
 set duration in seconds of the action More...
 
virtual CCFiniteTimeActionreverse (void)
 returns a reversed action More...
 
- Public Member Functions inherited from CCAction
 CCAction (void)
 ctor More...
 
virtual ~CCAction (void)
 NA NA. More...
 
const char * description ()
 NA NA. More...
 
virtual CCObjectcopyWithZone (CCZone *pZone)
 NA NA. More...
 
virtual bool isDone (void)
 return true if the action has finished More...
 
virtual void startWithTarget (CCNode *pTarget)
 called before the action start. It will also set the target. More...
 
virtual void stop (void)
 called after the action has finished. More...
 
virtual void step (float dt)
 called every frame with it's delta time. DON'T override unless you know what you are doing. More...
 
virtual void update (float time)
 called once per frame. More...
 
CCNodegetTarget (void)
 
void setTarget (CCNode *pTarget)
 The action will modify the target properties. More...
 
CCNodegetOriginalTarget (void)
 
void setOriginalTarget (CCNode *pOriginalTarget)
 Set the original target, since target can be nil. More...
 
int getTag (void)
 
void setTag (int nTag)
 
void setSpeedMod (float mod)
 
- Public Member Functions inherited from CCObject
 CCObject (void)
 
virtual ~CCObject (void)
 NA. More...
 
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)
 
virtual void update (float dt)
 
 CCObject (const CCObject &)
 
CCObjectoperator= (const CCObject &)
 
virtual void encodeWithCoder (DS_Dictionary *)
 
virtual bool canEncode ()
 
CCObjectType getObjType () const
 
void setObjType (CCObjectType)
 
virtual CCObjectcopyWithZone (CCZone *pZone)
 

Static Public Member Functions

static CCActionTweencreate (float aDuration, const char *key, float from, float to)
 creates an initializes the action with the property name (key), and the from and to parameters. More...
 
- Static Public Member Functions inherited from CCActionInterval
static CCActionIntervalcreate (float d)
 creates the action More...
 
- Static Public Member Functions inherited from CCAction
static CCActioncreate ()
 Create an action. More...
 
- Static Public Member Functions inherited from CCObject
static CCObjectcreateWithCoder (DS_Dictionary *)
 

Public Attributes

std::string m_strKey
 
float m_fFrom
 
float m_fTo
 
float m_fDelta
 
- Public Attributes inherited from CCObject
unsigned int m_uID
 
int m_nLuaID
 

Additional Inherited Members

- Protected Attributes inherited from CCActionInterval
float m_elapsed
 
bool m_bFirstTick
 
- Protected Attributes inherited from CCFiniteTimeAction
float m_fDuration
 duration in seconds More...
 
- Protected Attributes inherited from CCAction
CCNodem_pOriginalTarget
 
CCNodem_pTarget
 The "target". More...
 
int m_nTag
 The action tag. More...
 
float m_fSpeedMod
 
- Protected Attributes inherited from CCObject
unsigned int m_uReference
 
unsigned int m_uAutoReleaseCount
 
int m_nTag
 
int m_eObjType
 
unsigned int m_uObjectIdxInArray
 

Detailed Description

CCActionTween.

CCActionTween is an action that lets you update any property of an object. For example, if you want to modify the "width" property of a target from 200 to 300 in 2 seconds, then:

id modifyWidth = [CCActionTween actionWithDuration:2 key:"width" from:200 to:300]; [target runAction:modifyWidth]; Another example: CCScaleTo action could be rewritten using CCPropertyAction: scaleA and scaleB are equivalents id scaleA = [CCScaleTo actionWithDuration:2 scale:3]; id scaleB = [CCActionTween actionWithDuration:2 key:@"scale" from:1 to:3];

Since
v0.99.2

Member Function Documentation

◆ create()

static CCActionTween * create ( float  aDuration,
const char *  key,
float  from,
float  to 
)
static

creates an initializes the action with the property name (key), and the from and to parameters.

◆ initWithDuration()

bool initWithDuration ( float  aDuration,
const char *  key,
float  from,
float  to 
)

initializes the action with the property name (key), and the from and to parameters.

◆ reverse()

CCActionInterval * reverse ( )
virtual

returns a reversed action

Reimplemented from CCActionInterval.

◆ startWithTarget()

void startWithTarget ( CCNode pTarget)
virtual

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

Reimplemented from CCActionInterval.

◆ update()

void update ( float  time)
virtual

called once per frame.

time a value between 0 and 1

For example:

  • 0 means that the action just started
  • 0.5 means that the action is in the middle
  • 1 means that the action is over

Reimplemented from CCAction.

Member Data Documentation

◆ m_fDelta

float m_fDelta

◆ m_fFrom

float m_fFrom

◆ m_fTo

float m_fTo

◆ m_strKey

std::string m_strKey

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