Commit a0fc698a authored by 智慧's avatar 智慧

feat:将骨骼动画 改成根据json 去选择播放

parent 548a555c
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
"array": [ "array": [
0, 0,
0, 0,
350.9567948836438, 353.3789596848534,
0, 0,
0, 0,
0, 0,
......
...@@ -82,8 +82,8 @@ cc.Class({ ...@@ -82,8 +82,8 @@ cc.Class({
}, },
getDefaultData() { getDefaultData() {
const dataJson = '{"pic_url":"http://staging-teach.cdn.ireadabc.com/ed94332a503c31e0908bd4c6923a2665.png","pic_url_2":"http://staging-teach.cdn.ireadabc.com/5fb60317ade0195d35ad8034d5370a7f.png","text":"This is a test label.","audio_url":"http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3"}' const dataJson = '{"animationName":"WarmUp"}'
const data = JSON.parse(dataJson); const data = JSON.parse(dataJson);
return data; return data;
}, },
...@@ -163,14 +163,14 @@ cc.Class({ ...@@ -163,14 +163,14 @@ cc.Class({
initBtn() { initBtn() {
const bg = cc.find('Canvas/bg'); const bg = cc.find('Canvas/bg');
bg.addComponent(cc.Button); bg.addComponent(cc.Button);
//节点中添加了button组件 则可以添加click事件监听 //节点中添加了button组件 则可以添加click事件监听das
bg.on('click', async () => { bg.on('click', async () => {
await this.showDragon(); await this.showDragon();
}) })
}, },
async showDragon() { async showDragon() {
const nodeName = 'Canvas/' + 'Greetings'; const nodeName = 'Canvas/' + this.data.animationName;
const animationNode = cc.find(nodeName); const animationNode = cc.find(nodeName);
animationNode.scale = this._mapScaleMin; animationNode.scale = this._mapScaleMin;
await asyncTweenTo(animationNode, 0.5, { x: 0 }); await asyncTweenTo(animationNode, 0.5, { x: 0 });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment