Cocos2d-x 学习笔记(11.8) DelayTime ReverseTime TargetedAction ActionFloat Blink TintTo TintBy ResizeTo ResizeBy
2024-09-01 10:38:01
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 * ( - t); // from + t * delta if (_callback)
{
// report back value to caller
_callback(value);
}
5. TintTo TintBy
create方法传入rgb三个值,To和By是在startWithTarget和update有相对和绝对的区别。
6. ResizeTo ResizeBy
create传入Size,To和By是在startWithTarget和update有相对和绝对的区别。
7. 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 / ? true : false); //本次进度到了一半就可见,没到一半就隐藏,实现了闪烁效果
}
最新文章
- [转]MyBatis传入多个参数的问题 - mingyue1818
- 细解ListView之自定义适配器
- 【openGL】画正弦函数图像
- Windows下 使用CodeBlocks配置OpenGL开发环境
- AngularJs初步学习笔记(part1)
- 关于SWT的线程问题
- orace owi介绍
- 使用javascript判断浏览器类型
- Android studio教程:[5]活动的生命周期
- discuz默认模板文件结构详解-模板文件夹介绍
- 2年Java开发工作经验面试总结
- Java求素数时出现错误
- Docker进阶之七:管理应用程序数据
- 2017-2018-2 20155309南皓芯 Exp4 恶意代码分析
- 小程序中添加客服按钮contact-button
- 大数据入门到精通16--hive 的条件语句和聚合函数
- nutz学习笔记(1)
- 【python】查找函数定义
- SQL特殊字符转义
- 利用Fiddler编写Jmeter接口测试
热门文章
- 编译gaia
- xml文档的解析并通过工具类实现java实体类的映射:XML工具-XmlUtil
- 深入浅出Mysql索引的那些事儿
- query 与 params 使用
- github认证登陆
- java.nio.ByteBuffer中的flip()、rewind()、compact()等方法的使用和区别
- java架构之路-(mysql底层原理)Mysql事务隔离与MVCC
- Ubuntu+docker+gitlab安装和使用
- c++中不需要显示指出struct
- Spring Cloud 全链路追踪实现