quick lua 使用spine骨骼动画
看下下面两个文件
<spine/SkeletonRenderer.h>
<spine/SkeletonAnimation.h>
1.lua中创建方法:
sp.SkeletonAnimation:create(‘xxx.json’,'xxx.atlas', 1)
实际上绑定过来的create 是createwithfile,可以参考 lua_cocos2dx_spine_manual.cpp
static void extendCCSkeletonAnimation(lua_State* L)
{
lua_pushstring(L, "sp.SkeletonAnimation");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-))
{
tolua_function(L, "create", lua_cocos2dx_CCSkeletonAnimation_createWithFile);
tolua_function(L, "registerSpineEventHandler", tolua_Cocos2d_CCSkeletonAnimation_registerSpineEventHandler00);
tolua_function(L, "unregisterSpineEventHandler", tolua_Cocos2d_CCSkeletonAnimation_unregisterSpineEventHandler00);
tolua_function(L, "setBlendFunc", tolua_spine_SkeletoneAnimation_setBlendFunc);
tolua_function(L, "addAnimation", lua_cocos2dx_spine_SkeletonAnimation_addAnimation);
tolua_function(L, "setAnimation", lua_cocos2dx_spine_SkeletonAnimation_setAnimation);
tolua_function(L, "replaceImage", lua_cocos2dx_spine_SkeletonAnimation_replaceImage);
tolua_function(L, "getCustomBounds", lua_cocos2dx_spine_SkeletonAnimation_getCustomBounds);
}
lua_pop(L, ); /*Because sp.SkeletonAnimation:create creat a LuaSkeletonAnimation object,so we need use LuaSkeletonAnimation typename for g_luaType*/
std::string typeName = typeid(LuaSkeletonAnimation).name();
g_luaType[typeName] = "sp.SkeletonAnimation";
g_typeCast["SkeletonAnimation"] = "sp.SkeletonAnimation";
}
2.registerSpineEventHandler注册事件
SP_ANIMATION_START = 0
SP_ANIMATION_END = 1
SP_ANIMATION_COMPLETE = 2
SP_ANIMATION_EVENT = 3
3.setDebugBonesEnabled(true) spine在调试模式,可以看到骨头的长度,骨点的位置
4.setDebugSlotsEnabled(true);设置查看每个骨头绑定的图片的大小,会用矩形框显示出来
5.setMix 让两个动作之间更加;流畅。单向的,所以我们要相互设置。最后一个是过渡时间
self.aniNode2:setMix("move","idle",0.2)
self.aniNode2:setMix("idle","move",0.2)
6.setTimeScale(0.1)
默认是1.0 ,然后咱们可以设置动画播放的速度。比如人物的行走,美工做的时候,可以统一按照一个速度走。然后在程序里设置不同的速度。
7.换装(需要去学习)
(1)全部换装SetSkin
(2)局部换装
quick 3.3 "异步"加载Spine方案:http://blog.csdn.net/chenhaobright/article/details/44619633
quick lua 使用spine骨骼动画的更多相关文章
- 使用spine骨骼动画制作的libgdx游戏
(官网:www.libgdx.cn) Super Spineboy是一个使用Spine和libgdx开发的跨平台游戏(Windows,Mac,Linux),Spine是一个2D游戏动画工具.Super ...
- spine骨骼动画组件使用详解
1. spine骨骼动画工具 骨骼动画: 把动画打散, 通过工具,调骨骼的运动等来形成动画spine是一个非常流行的2D骨骼动画制作工具spine 动画美术人员导出3个文件: (1) .png文 ...
- 记录 Spine骨骼动画导入unity 步骤[unity3d 4.6.6版本 2d动画]
1:准备好unity使用Spine所需要的运行库,可到如下地址 https://github.com/EsotericSoftware/spine-runtimes/tree/master/spine ...
- 如何给spine骨骼动画挂载粒子特效
目的是要把粒子挂载到骨骼动画的某个一个部件上,其实最主要是找对位置. 预览效果,左手红火,右手蓝火,很炫吧:) //init bool HelloWorld::init() { /////////// ...
- 在libGDX中使用Spine骨骼动画
首先,github是个宝库,实践流的读者可以直接看例子进行学习 1.这是Spine官方给出的例子 https://github.com/EsotericSoftware/spine-superspin ...
- cocos2d-js 骨骼动画 3.10
近期使用了cocos动画中的骨骼动画,这里记录使用的两种方式(3.10版): 一.cocos自带的动画编辑器导出的动画 ccs.armatureDataManager.addArmatureFileI ...
- 解决Spine骨骼混合动画错乱问题
Spine是一个很好的制作2D骨骼动画的软件,其中提供的混合(mix)动画功能可以很柔和过度两个不同的动画,但在混合时期,稍有不善,非常容易出现各种错乱.在Spine2D骨骼动画群上,有人提出全K帧. ...
- HTML5骨骼动画Demo | 使用min2d、createjs、pixi播放spine动画
Spine做骨骼动画是比较流行的,使用起来可能相对复杂,但功能毕竟强大,所以市场占有率较大. 在unity.cocos2d.starling中使用spine已经很成熟了,而HTML5这一块可能刚刚起步 ...
- 集成骨骼动画Spine的几点经验
最近开始用cantk做些复杂的游戏,其中一个游戏的DragonBones骨骼动画的JSON文件就达600K,导出之后显示各种不正常,可能是太复杂了,有些方面达到了DragonBones的极限.拿到官方 ...
随机推荐
- iOS Reachability的基本用法
#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @pr ...
- Java基础之读文件——使用通道读二进制数据(ReadPrimes)
控制台程序,本例读取Java基础之写文件部分(PrimesToFile)写入的primes.bin. import java.nio.file.*; import java.nio.*; import ...
- object_id的用法
OBJECT_ID: 返回数据库对象标识号. 语法 OBJECT_ID ( 'object' ) 参数 'object' 要使用的对象.object 的数据类型为 char 或 nchar.如果 ob ...
- Leetcode: Remove Elements
Given an array and a value, remove all instances of that value in place and return the new length. T ...
- 一个新人对于JavaScript简单应用的理解
JavaScript 1.输出:document.write("hello,world"); document.write的意思就是给我再此页面中显示出什么什么小括号里面的内 ...
- 【Origin】晨起忆梦
昨夜有梦又还乡, 忆起少年儿郎样: 田畔有花不忍折, 岁岁年年观花放. -作于二零一五年八月四日
- AngularJS 全局scope与Isolate scope通信
在项目开发时,全局scope 和 directive本地scope使用范围不够清晰,全局scope与directive本地scope通信掌握的不够透彻,这里对全局scope 和 directive本地 ...
- bean在容器上的生命周期
初始化两种方法: 1,使用init-method属性指定那个方法在bean依赖关系设置好后自动执行. 2,实现initializingBean接口 实现 ...
- VPN服务器的配置与应用
实验场景 通过将Linux配置VPN服务器允许远程计算机能够访问内网. 我的目的: 现在需要开发第三方接口,而第三方接口有服务器IP地址鉴权配置,这样在本地开发出来的程序每次都要发布到服务器上测试 ...
- Windows 服务入门指南
有很多时候,我们需要创建Windows Service. 这篇文章可以算是一个入门指南吧,希望对初学者有帮助. 要创建Windows Service, 首先选择Windows服务项目,如下图: 这里我 ...
http://cn.cocos2d-x.org/article/index?type=cocos2d-x&url=/doc/cocos-docs-master/manual/framework/native/v3/spine/zh.md