完善冲突动画

This commit is contained in:
2025-05-27 15:30:14 +08:00
parent b6126cebad
commit 606c5a78fd
2 changed files with 20 additions and 19 deletions

View File

@@ -66,11 +66,14 @@ export class Block extends Laya.Script {
this.owner.graphics.clear() this.owner.graphics.clear()
this.owner.graphics.drawRect(0, 0, blockSize, blockSize, color) this.owner.graphics.drawRect(0, 0, blockSize, blockSize, color)
if (animated) { if (animated) {
Laya.Tween.to(this.owner, {alpha:alpha}, 500, Laya.Ease.elasticOut, Laya.Handler.create(this, () => { this.owner.alpha = 0
Laya.Tween.to(this.owner, {alpha:alpha}, 100, Laya.Ease.linearIn)
Laya.Tween.to(this.owner, {alpha:0}, 150, Laya.Ease.linearIn, null, 100)
Laya.Tween.to(this.owner, {alpha:alpha}, 100, Laya.Ease.linearIn, Laya.Handler.create(this, () => {
this.owner.graphics.clear() this.owner.graphics.clear()
this.owner.graphics.drawRect(0, 0, blockSize, blockSize, completedColor) this.owner.graphics.drawRect(0, 0, blockSize, blockSize, completedColor)
this.owner.alpha = completedAlpha this.owner.alpha = completedAlpha
})) }), 250)
} }
else { else {
this.owner.alpha = alpha this.owner.alpha = alpha
@@ -79,20 +82,18 @@ export class Block extends Laya.Script {
public setFadeAnimation(): void { public setFadeAnimation(): void {
var color = this.label_show.color var color = this.label_show.color
var flag = true Laya.timer.once(200, this, ()=>{
Laya.timer.loop(200, this, ()=>{ this.label_show.color = "#ff0000"
flag = !flag Laya.timer.once(100, this, ()=>{
if (flag) {
this.label_show.color = color this.label_show.color = color
} Laya.timer.once(200, this, ()=>{
else { this.label_show.color = "#ff0000"
this.label_show.color = "#ff0000" Laya.timer.once(100, this, ()=>{
} this.label_show.color = color
})
})
})
}) })
Laya.Tween.to(this.label_show, {color:"#ff0000"}, 1000, Laya.Ease.strongIn, Laya.Handler.create(this, () => {
this.label_show.color = color
Laya.timer.clearAll(this)
}))
} }
public setTipsBgColor(visible: boolean, noteNumber: number=0, color: string="", alpha: number=1): void { public setTipsBgColor(visible: boolean, noteNumber: number=0, color: string="", alpha: number=1): void {

View File

@@ -265,11 +265,11 @@ export class Stage extends Laya.Script {
else { else {
var sames = this.findSameNumberBlocks(block)//相同数字的格子 var sames = this.findSameNumberBlocks(block)//相同数字的格子
for (var i=0; i<sames.length; i++) { for (var i=0; i<sames.length; i++) {
sames[i].setBlockColor(config.BLOCK_COLOR.BLUE, 0.6) sames[i].setBlockColor(config.BLOCK_COLOR.BLUE, 0.4)
} }
var sames = this.findSameNoteBlocks(block)//相同数字的铅笔格子 var sames = this.findSameNoteBlocks(block)//相同数字的铅笔格子
for (var i=0; i<sames.length; i++) { for (var i=0; i<sames.length; i++) {
sames[i].setTipsBgColor(true, block.getData().get_show(), config.BLOCK_COLOR.BLUE, 0.6) sames[i].setTipsBgColor(true, block.getData().get_show(), config.BLOCK_COLOR.BLUE, 0.4)
} }
//正确 //正确
if (block.getData().get_checked()) { if (block.getData().get_checked()) {
@@ -280,8 +280,8 @@ export class Stage extends Laya.Script {
for (var i=0; i<relateds.length; i++) {//相关且数字相同 for (var i=0; i<relateds.length; i++) {//相关且数字相同
if (relateds[i].getData().get_show() == block.getData().get_show()) {//播放变红动效 if (relateds[i].getData().get_show() == block.getData().get_show()) {//播放变红动效
if (relateds[i].getData().get_index() != block.getData().get_index()) { if (relateds[i].getData().get_index() != block.getData().get_index()) {
relateds[i].setBlockColor(config.BLOCK_COLOR.WHITE) // relateds[i].setBlockColor(config.BLOCK_COLOR.WHITE)
relateds[i].setBlockColor(config.BLOCK_COLOR.RED, 0.6, true, config.BLOCK_COLOR.GREY, 1) relateds[i].setBlockColor(config.BLOCK_COLOR.RED, 0.4, true, config.BLOCK_COLOR.GREY, 1)
} }
} }
} }
@@ -290,7 +290,7 @@ export class Stage extends Laya.Script {
for (var i=0; i<relateds.length; i++) {//相关且数字相同 for (var i=0; i<relateds.length; i++) {//相关且数字相同
if (relateds[i].getData().get_show() == block.getData().get_show()) {//直接变红 if (relateds[i].getData().get_show() == block.getData().get_show()) {//直接变红
if (relateds[i].getData().get_index() != block.getData().get_index()) { if (relateds[i].getData().get_index() != block.getData().get_index()) {
relateds[i].setBlockColor(config.BLOCK_COLOR.RED, 0.6) relateds[i].setBlockColor(config.BLOCK_COLOR.RED, 0.4)
} }
} }
} }