Commit 75e92b5f authored by 范雪寒's avatar 范雪寒

feat: 超过5个题的时候右侧星星缩放

parent 4749dfda
No preview for this file type
......@@ -99,7 +99,7 @@ cc.Class({
},
getDefaultData() {
const dataJson = '{"groupArr":[{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"bdpq"},{"type":"text","isRight":"0","text":"ooo"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]}]}';
const dataJson = '{"groupArr":[{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"bdpq"},{"type":"text","isRight":"0","text":"ooo"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]}]}';
const data1 = JSON.parse(dataJson);
return data1;
},
......@@ -258,11 +258,17 @@ cc.Class({
let baseX = this.canvas.width / 2 - 80 * this._mapScaleMin;
let baseY = this.canvas.height / 2 - 80 * this._mapScaleMin;
let disH = 80 * this._mapScaleMin;
let disScale = 1;
if (gArr.length > 5) {
disH = (400 / gArr.length) * this._mapScaleMin;
disScale = 5 / gArr.length;
}
for (let i = 0; i < gArr.length; i++) {
const starBg = getSprNode('star_bg');
this.canvas.addChild(starBg, 2);
starBg.x = baseX;
starBg.y = baseY - i * disH;
starBg.scale = disScale;
const starTop = getSprNode('star');
starBg.addChild(starTop);
......@@ -626,7 +632,8 @@ cc.Class({
const starBig = bigStarBg.starBig;
const star = bigStarBg.star;
star.active = true;
star.scaleX = 0.7;
star.scaleX = 0.7 / bigStarBg.scale;
star.scaleY = 1 / bigStarBg.scale;
star.angle = 90;
const canvas = cc.find('Canvas');
const startPos = exchangeNodePos(star.parent, canvas, cc.v2(0, -canvas.height / 2));
......@@ -638,10 +645,10 @@ cc.Class({
const time = 1;
cc.tween(star)
.to(0.3, { y: middlePos.y + 80 }, { easing: 'quadOut' })
.to(0.1, { y: middlePos.y + 40, scaleX: 1.2, scaleY: 0.8 }, { easing: 'quadOut' })
.to(0.1, { y: middlePos.y, scaleX: 1, scaleY: 1 }, { easing: 'quadOut' })
.to(0.1, { y: middlePos.y + 40, scaleX: 1.2 / bigStarBg.scale, scaleY: 0.8 / bigStarBg.scale }, { easing: 'quadOut' })
.to(0.1, { y: middlePos.y, scaleX: 1 / bigStarBg.scale, scaleY: 1 / bigStarBg.scale }, { easing: 'quadOut' })
.delay(0.1)
.to(0.8, { angle: -720 })
.to(0.8, { angle: -720, scale: 1 })
.start();
cc.tween(star)
......
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