当前位置:网站首页>Cocoscreator plays spine animation
Cocoscreator plays spine animation
2022-06-26 06:58:00 【RemoteDev】
1. establish 2D Air Engineering

2. The project opens the default scene , Canvas has been added to the default scene

3. Add an empty node to the canvas

4. Named node is NodeSke
5. Add bone animation (Spine) Component to empty node

After successful addition , Click on NodeSke node , You can see that... Has been added to the property inspector sp.Skeleton node
6. take Spine Drag the animation folder to assets Catalog

an Spine Animation catalog girl You can see the relevant animation files

7. take Spine Animation json Drag files to Skeleton Data in
Select the specified skin


After selecting skin , The animation canvas appears at the hollow node of the scene

8. Adjust the animation position
Animation position adjustment OK
Save the scene just made as main

9. Select the camera , And switch Layer by UI_2D, You can see that the camera has rendered the canvas in the scene

10. Click preview to view the effect in the browser

11. Select the empty node NodeSke, Then select the animation to play by default in the attribute inspector on the right

Now? , In the browser, you can see Spine The animation has been played automatically

12. Control animation playback through scripts , stop it , And switch animation skin
a. Add script file

b. by NodeSke Node to add a custom script
c. Double click the script to open VSCODE And in girl.ts Add methods to play animation and stop animation

d. Nodes are associated with variables
Drag nodes into variables
e. Add animation control buttons

f. Add variable associations for buttons

g. Add click event associations for buttons


coded Spine Animation play , stop it , Skin change function
// Play animation
playAnimation(){
this.SkeObj.setAnimation(0,"dance",true);
}
// Stop Animation
stopAnimation(){
let SpEnt:sp.spine.TrackEntry = this.SkeObj.setAnimation(0,"dance",true);
SpEnt.animationStart = SpEnt.animationEnd;
}
// Skin peeler
changeSkin() {
const skins =['girl', 'boy', 'girl-blue-cape', 'girl-spring-dress'].map(x=> `full-skins/${x}`);
this.skinId = (this.skinId + 1) % skins.length;
this.SkeObj!.setSkin(skins[this.skinId]);
}
demonstration :
边栏推荐
- 同步通信和异步通信的区别以及优缺点
- I caught a 10-year-old Alibaba test developer in the company. After chatting with him, I realized everything
- Shell编程-用户信息管理
- JS download pictures
- Rust中的过程宏
- [path planning] robot path planning based on improved artificial potential field with matlab code
- 同花顺究竟如何开户,网上开户是否安全么?
- LabVIEW Arduino TCP/IP远程智能家居系统(项目篇—5)
- Numpy learning challenge level 5 - create array
- [image fusion] multimodal medical image fusion based on coupled feature learning with matlab code
猜你喜欢

Professional course - Code question record

One chip realizes functions such as spray 𞓜 ws2812 drive | key touch | LED display | voice broadcast chip and simplifies the design of humidifier products

遇到女司机业余开滴滴,日入500!

Closure problem C Lua

Invalid problem of self defined map used by Gaode map

LabVIEW Arduino tcp/ip remote smart home system (project part-5)

When vs code uses prettier to format JS, there is a space between the name of the function definition and the parentheses, and ESLIt does not allow this space

【yolov4】基于yolov4深度学习网络目标检测MATLAB仿真

Temperature alarm

直播预告丨消防安全讲师培训“云课堂”即将开讲!
随机推荐
Invalid problem of self defined map used by Gaode map
My SQL (II)
How to transfer database data to check box
Solution of garbled code in sparkshell deletion key of SecureCRT
Phantom star VR equipment product details II: dark battlefield
Operation mode and investment planning report of China's financial warehousing industry during the "14th five year plan" period 2022-2027
[image enhancement] image defogging based on artificial multiple exposure fusion amef with matlab code
[004] [stm32] MDK project configuration and commissioning
Global and Chinese silicon carbide monocrystal furnace market survey and future production and marketing demand analysis report 2022-2027
Analysis report on market demand and investment competitiveness of China's cyclohexanone industry (2022 Edition)
高德地图使用自定义地图无效问题
一芯实现喷雾|WS2812驱动|按键触摸|LED显示|语音播报芯片等功能,简化加湿器产品设计
Massive log collection tool flume
How to open an account in flush? Is it safe to open an account online?
MySQL (III)
On a classical problem
海量日志采集工具——Flume
Web technology sharing | webrtc recording video stream
同花顺究竟如何开户,网上开户是否安全么?
Closure problem C Lua