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

feat: 选项的出现速度加快

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