| cocos2d-x 3.0 |
)- 类列表 - 类索引 - 类继承关系 - 类成员
全部) 类) 命名空间) 文件) 函数) 变量) 类型定义) 枚举) 枚举值) 属性) 友元) 宏定义) 组) 页)
Public 成员函数 | 静态 Public 成员函数 | Public 属性 | Protected 属性 | 所有成员列表
ActionTween类 参考 Actions
#include
类 ActionTween 继承关系图:
| ## Public 成员函数 | |
| void | startWithTarget (Node target) override |
| 方法在action开始前调用, 操作会设置执行Action的目标对象为target. 更多… | |
| void | update (float dt) override |
| 每一帧都会调用这个方法,参数time是一个在0和1之间的值 更多… | |
| ActionTween | reverse () const override |
| 返回执行与本Action对象相反操作的新Action对象 更多… | |
| ActionTween | clone () const override |
| 返回action的克隆对象 更多… | |
Public 成员函数 继承自 ActionInterval | |
| float | getElapsed (void) |
| 从动作开始执行过去了多少秒 。 更多… | |
| void | setAmplitudeRate (float amp) |
| float | getAmplitudeRate (void) |
| virtual bool | isDone (void) const override |
| 当action完成时返回true 更多… | |
| virtual void | step (float dt) override |
| 这个方法每一帧都会被调用, 参数dt为两帧之间的时间间隔(单位秒). 除非你知道正在做什么否则不要重载这个方法. 更多… | |
Public 成员函数 继承自 FiniteTimeAction | |
| float | getDuration () const |
| 返回action的持续时间(单位:秒) 更多… | |
| void | setDuration (float duration) |
| 设置action的持续时间(单位:秒) 更多… | |
Public 成员函数 继承自 Action | |
| virtual std::string | description () const |
| NA NA 更多… | |
| virtual void | stop () |
| 方法在action完成之后调用,它将执行Action的target对象设置为nil. 更多… | |
| Node | getTarget () const |
| void | setTarget (Node target) |
| 这个方法更改action的target属性. 更多… | |
| Node | getOriginalTarget () const |
| void | setOriginalTarget (Node originalTarget) |
| 设置action的原始目标对象target, 当target为nil时setOriginalTarget设置的对象会运行这个action 除非你要像ActionManager类那样做一些很复杂的操作,否则不要调用这个方法 本方法只是对originalTarget的弱引用(assigned),没有进行retain操作。 更多… | |
| int | getTag () const |
| void | setTag (int tag) |
Public 成员函数 继承自 Ref | |
| void | retain () |
| 保留所有权. 更多… | |
| void | release () |
| 立即释放所有权. 更多… | |
| Ref | autorelease () |
| 自动释放所有权在不久的将来. 更多… | |
| unsigned int | getReferenceCount () const |
| 返回Ref对象当前的引用计数. 更多… | |
| virtual | ~Ref () |
| NA NA 更多… | |
Public 成员函数 继承自 Clonable | |
| virtual | ~Clonable () |
| NA NA 更多… | |
| CC_DEPRECATED_ATTRIBUTE Ref * | copy () const |
| 返回Ref对象的一份拷贝. 更多… | |
| ## 静态 Public 成员函数 | |
| static ActionTween * | create (float duration, const std::string &key, float from, float to) |
| 用持续时间(duration), 属性名称(key), from 和 to 参数创建并初始化动作(指ActionTween). 更多… | |
| ## Public 属性 | |
| CC_CONSTRUCTOR_ACCESS | pad0: bool initWithDuration(float duration |
| CC_CONSTRUCTOR_ACCESS const std::string & | key |
| CC_CONSTRUCTOR_ACCESS const std::string float | from |
| CC_CONSTRUCTOR_ACCESS const std::string float float | to |
| ## Protected 属性 | |
| std::string | _key |
| float | _from |
| float | _to |
| float | _delta |
Protected 属性 继承自 ActionInterval | |
| float | _elapsed |
| bool | _firstTick |
Protected 属性 继承自 FiniteTimeAction | |
| float | _duration |
| 以秒单位的持续时间 更多… | |
Protected 属性 继承自 Action | |
| Node | _originalTarget |
| Node | _target |
| action动作的执行目标target. 更多… | |
| int | _tag |
| action的tag属性. 更多… | |
Protected 属性 继承自 Ref | |
| unsigned int | _referenceCount |
| 引用计数 更多… | |
| ## 额外继承的成员函数 | |
静态 Public 属性 继承自 Action | |
| static const int | INVALID_TAG = -1 |
| 所有Action对象的缺省tag值 更多… | |
Protected 成员函数 继承自 ActionInterval | |
| bool | initWithDuration (float d) |
| 初始化动作 更多… | |
Protected 成员函数 继承自 FiniteTimeAction | |
| FiniteTimeAction () | |
| virtual | ~FiniteTimeAction () |
Protected 成员函数 继承自 Action | |
| Action () | |
| virtual | ~Action () |
Protected 成员函数 继承自 Ref | |
| Ref () | |
| 构造函数 更多… | |
详细描述
ActionTween 是一个可以让你更新的某个对象(Object)属性的动作. 例如, 如果你想要让某个目标对象(target)的宽度属性(width)在2秒内从200变成300, 代码可以这样写:
auto modifyWidth = ActionTween::create(2, "width", 200, 300);
target->runAction(modifyWidth);
再一个例子: ScaleTo 动作(一个改变对象大小的动作)可以通过 ActionTween 重写. 注: 原注释中 ActionTween 为 PropertyAction, 但 PropertyAction 在整个cocos2d-x中仅在此处注释中 出现了一次, 个人翻译为ActionTween.
// scaleA 和 scaleB 是等价的动作实现
// 以下两行注释为相应动作的构造参数说明, 不翻译.
auto scaleA = ScaleTo::create(2, 3); // (duration, to)
auto scaleB = ActionTween::create(2, "scale", 1, 3); // (duration, key, from, to)
- 自从
- v0.99.2
成员函数说明
| overridevirtual |
返回action的克隆对象
实现了 ActionInterval.
| static |
用持续时间(duration), 属性名称(key), from 和 to 参数创建并初始化动作(指ActionTween).
| overridevirtual |
返回执行与本Action对象相反操作的新Action对象
实现了 ActionInterval.
| overridevirtual |
方法在action开始前调用, 操作会设置执行Action的目标对象为target.
重载 ActionInterval .
| overridevirtual |
每一帧都会调用这个方法,参数time是一个在0和1之间的值
time的含义举例:
- 0 表示action刚刚开始
- 0.5 表示action执行到正中间
- 1 表示action已经执行完毕
重载 Action .
类成员变量说明
| CC_CONSTRUCTOR_ACCESS pad0 |
| protected |
| protected |
| protected |
| protected |
| CC_CONSTRUCTOR_ACCESS const std::string float from |
| CC_CONSTRUCTOR_ACCESS const std::string& key |
| CC_CONSTRUCTOR_ACCESS const std::string float float to |
该类的文档由以下文件生成:
- /Users/zeroyang/Documents/github/cocos2d-x/cocos/2d/CCActionTween.h
- cocos2d
- ActionTween
- 生成于 2014年 五月 29日 星期四 09:41:44 , 为 cocos2d-x使用
1.8.6
Public 成员函数 继承自 