Commit 5a133171 authored by 范雪寒's avatar 范雪寒

feat: 选项的出现速度加快

parent 93afe146
...@@ -169,16 +169,10 @@ cc.Class({ ...@@ -169,16 +169,10 @@ cc.Class({
arr.forEach(async (option, idx) => { arr.forEach(async (option, idx) => {
const optionNode = await this.createOption(option); const optionNode = await this.createOption(option);
optionNode.name = `option_${idx}`; optionNode.name = `option_${idx}`;
optionNode.x = canvasWidth + idx * maxOptionWidth; optionNode.x = (maxOptionWidth) * (idx + 0.5) - canvasWidth / 2 - box.x;
optionNode.y = canvasHeight / 2 - box.y - 300; optionNode.y = canvasHeight / 2 - box.y - 300;
optionNode.scale = Math.min(1, (maxOptionWidth - 10) / optionNode.width, maxOptionHeight / optionNode.height); optionNode.scale = Math.min(1, (maxOptionWidth - 10) / optionNode.width, maxOptionHeight / optionNode.height);
optionNode.parent = box; optionNode.parent = box;
const targetX = (maxOptionWidth) * (idx + 0.5) - canvasWidth / 2 - box.x;
const time = (optionNode.x - targetX) / 1000;
cc.tween(optionNode)
.to(time, { x: targetX }, cc.easing.quadIn)
.start();
}); });
}, },
...@@ -246,18 +240,17 @@ cc.Class({ ...@@ -246,18 +240,17 @@ cc.Class({
return optionNode; return optionNode;
}); });
// optionData.audio_url
}, },
optionJump(node) { optionJump(node, time = 0.1) {
if (node.baseScale) { if (node.baseScale) {
return; return;
} }
node.baseScale = node.scaleX; node.baseScale = node.scaleX;
cc.tween(node) cc.tween(node)
.to(0.1, { scaleX: node.baseScale * 1.1, scaleY: node.baseScale * 1.1 }) .to(time, { scaleX: node.baseScale * 1.1, scaleY: node.baseScale * 1.1 })
.to(0.1, { scaleX: node.baseScale * 1, scaleY: node.baseScale * 1 }) .to(time, { scaleX: node.baseScale * 1, scaleY: node.baseScale * 1 })
.call(() => { .call(() => {
node.baseScale = null; node.baseScale = null;
}) })
...@@ -267,7 +260,7 @@ cc.Class({ ...@@ -267,7 +260,7 @@ cc.Class({
initListener() { initListener() {
const btnSubmit = cc.find('Canvas/bg/btnSubmit'); const btnSubmit = cc.find('Canvas/bg/btnSubmit');
btnSubmit.on('click', () => { btnSubmit.on('click', () => {
this.optionJump(btnSubmit); this.optionJump(btnSubmit, 0.05);
this.playEffect('submit'); this.playEffect('submit');
const box = cc.find('Canvas/bg/box'); const box = cc.find('Canvas/bg/box');
if (box.children.every(child => child.optionData.selected == child.optionData.is_right)) { if (box.children.every(child => child.optionData.selected == child.optionData.is_right)) {
...@@ -284,7 +277,7 @@ cc.Class({ ...@@ -284,7 +277,7 @@ cc.Class({
const btnNext = cc.find('Canvas/bg/btnNext'); const btnNext = cc.find('Canvas/bg/btnNext');
btnNext.on('click', () => { btnNext.on('click', () => {
this.optionJump(btnNext); this.optionJump(btnNext, 0.05);
}); });
}, },
...@@ -348,10 +341,6 @@ cc.Class({ ...@@ -348,10 +341,6 @@ cc.Class({
.start(); .start();
}, },
coolCatSpeakStart(cb) {
cb();
},
submitBtnMoveOut() { submitBtnMoveOut() {
const submitBtn = cc.find('Canvas/bg/btnSubmit'); const submitBtn = cc.find('Canvas/bg/btnSubmit');
cc.tween(submitBtn) cc.tween(submitBtn)
...@@ -364,6 +353,11 @@ cc.Class({ ...@@ -364,6 +353,11 @@ cc.Class({
btnNext.active = true; btnNext.active = true;
}, },
coolCatSpeakStart(cb) {
cb();
},
......
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