1. DelayTime
通过create方法create(float d)设置时长,update方法没有任何操作。可以用于动作之间的延迟。
2. ReverseTime
create方法create(FiniteTimeAction *action)设置绑定的action。upadte方法中执行_other->update(1 - time),进度为正常倒放的进度,实现倒放的效果。
3. TargetedAction
通过create(Node* target, FiniteTimeAction* action)方法将action与node绑定。在runAction时,实际上是对绑定的node执行绑定的action。
4. ActionFloat
从from到to按进度取的值作为value,传给回调函数。
create(float duration, float from, float to, ActionFloatCallback callback)把参数赋给变量。
startWithTarget中,_delta是to-from。
update方法:
- float value = _to - _delta * (1 - t); // from + t * delta
- if (_callback)
- {
- // report back value to caller
- _callback(value);
- }
5. Blink
闪烁。create(float duration, int blinks)设置间隔和闪烁次数。
startWithTarget,获取可见性:
- _originalState = target->isVisible();
update:
- if (_target && ! isDone())
- {
- float slice = 1.0f / _times; // 一次闪烁的占比
- float m = fmodf(time, slice); //本次闪烁完成进度
- _target->setVisible(m > slice / 2 ? true : false); //本次进度到了一半就可见,没到一半就隐藏,实现了闪烁效果
- }
原文链接:http://www.cnblogs.com/deepcho/p/cocos2dx-delaytime-reversetime-targetedaction-actionfloat-blink.html