本文来自http://blog.csdn.net/runaying ,引用必须注明出处!

cocos2d-X 节点(CCActionFrame.h)API

温馨提醒:为了大家能更好学习,强烈推荐大家看看本人的这篇博客 Cocos2d-X权威指南笔记

ActionFrameActionTintFrameActionFadeFrameActionRotationFrameActionScaleFrameActionMoveFrame分别实现 补间动画、颜色、淡入淡出、旋转、缩放、移动 action

///cocos2d-x-3.0alpha0/extensions/CocoStudio/Action

//ActionFrame、ActionTintFrame、ActionFadeFrame、ActionRotationFrame、ActionScaleFrame、ActionMoveFrame 分别实现 补间动画、颜色、淡入淡出、旋转、缩放、移动 的 action #ifndef __ActionFRAME_H__ #define __ActionFRAME_H__ #include "cocos2d.h" #include "ExtensionMacros.h" NS_CC_EXT_BEGIN enum FrameType { kKeyframeMove = 0, kKeyframeScale, kKeyframeRotate, kKeyframeTint, kKeyframeFade, kKeyframeMax }; class ActionFrame:public Object { public: /** * Default constructor //构造函数 */ ActionFrame(); /** * Default destructor //析构函数 */ virtual ~ActionFrame(); /** * Changes action 帧的索引 * * @param index action 帧的索引 */ void setFrameIndex(int index); /** * Gets action 帧的索引 * * @return action 帧的索引 */ int getFrameIndex(); /** * Changes action 帧的类型 * * @param fTime action 帧的类型 */ void setFrameTime(float fTime); /** * Gets action 帧的类型 * * @return fTime action 帧的类型 */ float getFrameTime(); /** * Changes action 帧的类型 * * @param frameType action 帧的类型 */ void setFrameType(int frameType); /** * Gets the type of action frame * * @return the type of action frame */ int getFrameType(); /** * Changes the easing type. //减缓 * * @param easingType the easing type. //减缓 */ void setEasingType(int easingType); /** * Gets the easing type. //减缓 * * @return the easing type. //减缓 */ int getEasingType(); /** * Gets ActionFrame 的 CCAction . * * @parame fDuration ActionFrame 的持续时间 * * @return CCAction */ virtual Action* getAction(float fDuration); protected: int _frameType; int _easingType; int _frameIndex; float _fTime; }; class ActionMoveFrame:public ActionFrame { public: /** * Default constructor //构造函数 */ ActionMoveFrame(); /** * Default destructor //析构函数 */ virtual ~ActionMoveFrame(); /** * Changes 移动 action 位置. * * @param 移动 action 位置. */ void setPosition(Point pos); /** * Gets 移动 action 位置. * * @return 移动 action 位置. */ Point getPosition(); /** * Gets ActionFrame 的 CCAction . * * @parame fDuration ActionFrame 的持续时间 * * @return CCAction */ virtual Action* getAction(float fDuration); protected: Point _position; }; class ActionScaleFrame:public ActionFrame { public: /** * Default constructor //构造函数 */ ActionScaleFrame(); /** * Default destructor //析构函数 */ virtual ~ActionScaleFrame(); /** * Changes the scale action scaleX. //比例 * * @param the scale action scaleX. //比例 */ void setScaleX(float scaleX); /** * Gets the scale action scaleX. //比例 * * @return the scale action scaleX. //比例 */ float getScaleX(); /** * Changes the scale action scaleY. //比例 * * @param rotation the scale action scaleY. //比例 */ void setScaleY(float scaleY); /** * Gets the scale action scaleY. //比例 * * @return the the scale action scaleY. //比例 */ float getScaleY(); /** * Gets ActionFrame 的 CCAction . * * @parame fDuration ActionFrame 的持续时间 * * @return CCAction */ virtual Action* getAction(float fDuration); protected: float _scaleX; float _scaleY; }; class ActionRotationFrame:public ActionFrame { public: /** * Default constructor //构造函数 */ ActionRotationFrame(); /** * Default destructor //析构函数 */ virtual ~ActionRotationFrame(); /** * Changes 旋转 action 的旋转. * * @param rotation 旋转 action 的旋转. */ void setRotation(float rotation); /** * Gets 旋转 action 的旋转. * * @return 旋转 action 的旋转. */ float getRotation(); /** * Gets ActionFrame 的 CCAction . * * @parame fDuration ActionFrame 的持续时间 * * @return CCAction */ virtual Action* getAction(float fDuration); protected: float _rotation; }; class ActionFadeFrame:public ActionFrame { public: /** * Default constructor //构造函数 */ ActionFadeFrame(); /** * Default destructor //析构函数 */ virtual ~ActionFadeFrame(); /** * Changes 淡入淡出的 action 不透明度. * * @param opacity 淡入淡出的 action 不透明度 */ void setOpacity(int opacity); /** * Gets 淡入淡出的 action 不透明度. //淡入淡出的 action 不透明度 * * @return 淡入淡出的 action 不透明度. */ int getOpacity(); /** * Gets ActionFrame 的 CCAction . * * @parame fDuration ActionFrame 的持续时间 * * @return CCAction */ virtual Action* getAction(float fDuration); protected: float _opacity; }; class ActionTintFrame:public ActionFrame { public: /** * Default constructor //构造函数 */ ActionTintFrame(); /** * Default destructor //析构函数 */ virtual ~ActionTintFrame(); /** * Changes the tint(色调) action color. * * @param ccolor the tint(色调) action color */ void setColor(Color3B ccolor); /** * Gets the tint(色调) action color. * * @return the tint(色调) action color. */ Color3B getColor(); /** * Gets ActionFrame 的 CCAction . * * @parame fDuration ActionFrame 的持续时间 * * @return CCAction */ virtual Action* getAction(float fDuration); protected: Color3B _color; }; NS_CC_EXT_END #endif


Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐