Commit cb466971 authored by LMZ's avatar LMZ

feat: showStar

parent 7e74769f
...@@ -117,76 +117,66 @@ cc.Class({ ...@@ -117,76 +117,66 @@ cc.Class({
} }
}, },
showBigStar() { currentStarIdx: null,
if (!this.bigStarArr || this.bigStarArr.length <= 0) { showStar() {
// this.checkGameEnd(); if (!this.currentStarIdx) {
return; this.currentStarIdx = 0;
} }
const bigStarBg = this.bigStarArr[this.curGroupIndex];
const starBase = cc.find(`Canvas/layout/starBase_${this.currentStarIdx}`);
const starBig = bigStarBg.starBig; if (!starBase) {
starBig.scale = 1; return;
const star = bigStarBg.star; }
star.active = true; const star = starBase.getChildByName('Star');
star.scaleX = 0.7 / bigStarBg.scale; const starBig = star.getChildByName('StarBig');
star.scaleY = 1 / bigStarBg.scale; starBig.scale = 1;
star.angle = 90; star.active = true;
const canvas = cc.find("Canvas"); star.scaleX = 0.7 / starBase.scale;
const startPos = exchangeNodePos( star.scaleY = 1 / starBase.scale;
star.parent, star.angle = 90;
canvas, const canvas = cc.find('Canvas');
cc.v2(0, -canvas.height / 2) const startPos = this.exchangeNodePos(star.parent, canvas, cc.v2(0, -canvas.height / 2));
); const middlePos = this.exchangeNodePos(star.parent, canvas, cc.v2(0, -canvas.height / 4));
const middlePos = exchangeNodePos( star.x = startPos.x;
star.parent, star.y = startPos.y - starBig.height;
canvas,
cc.v2(0, -canvas.height / 4) console.log('middlePos = ' + JSON.stringify(middlePos));
); const time = 1;
star.x = startPos.x; cc.tween(star)
star.y = startPos.y - starBig.height; .to(0.3, { y: middlePos.y + 80 }, { easing: 'quadOut' })
.to(0.1, { y: middlePos.y + 40, scaleX: 1.2 / starBase.scale, scaleY: 0.8 / starBase.scale }, { easing: 'quadOut' })
console.log("middlePos = " + JSON.stringify(middlePos)); .to(0.1, { y: middlePos.y, scaleX: 1 / starBase.scale, scaleY: 1 / starBase.scale }, { easing: 'quadOut' })
const time = 1; .delay(0.1)
cc.tween(star) .to(0.8, { angle: -720, scale: 1 })
.to(0.3, { y: middlePos.y + 80 }, { easing: "quadOut" }) .start();
.to(
0.1, cc.tween(star)
{ .delay(0.6)
y: middlePos.y + 40, .to(0.8, { x: 0 }, { easing: 'quadIn' })
scaleX: 1.2 / bigStarBg.scale, .start();
scaleY: 0.8 / bigStarBg.scale, cc.tween(star)
}, .delay(0.6)
{ easing: "quadOut" } .to(0.8, { y: 0 }, { easing: 'quadOut' })
) .start();
.to(
0.1, cc.tween(starBig)
{ .delay(0.6)
y: middlePos.y, .to(0.8, { scale: 0 }, { easing: 'quadOut' })
scaleX: 1 / bigStarBg.scale, .call(() => {
scaleY: 1 / bigStarBg.scale, // this.checkGameEnd();
}, })
{ easing: "quadOut" } .start();
)
.delay(0.1) this.currentStarIdx++;
.to(0.8, { angle: -720, scale: 1 })
.start();
cc.tween(star).delay(0.6).to(0.8, { x: 0 }, { easing: "quadIn" }).start();
cc.tween(star).delay(0.6).to(0.8, { y: 0 }, { easing: "quadOut" }).start();
cc.tween(starBig)
.delay(0.6)
.to(0.8, { scale: 0 }, { easing: "quadOut" })
.call(() => {
// this.checkGameEnd();
// playAudio(this.starCountClip);
})
.start();
// playAudio(this.bigStarClip);
}, },
exchangeNodePos(targetNode, baseNode, basePos) {
return targetNode.convertToNodeSpaceAR(baseNode.convertToWorldSpaceAR(cc.v2(basePos.x, basePos.y)));
},
between(a, b, c) { between(a, b, c) {
return [a, b, c].sort()[1]; return [a, b, c].sort()[1];
}, },
......
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