message timing

This commit is contained in:
Evan You 2022-01-24 00:48:12 +08:00
parent 3ac576e9f8
commit e1b0f94fb4
2 changed files with 19 additions and 12 deletions

View File

@ -109,22 +109,28 @@ function completeRow() {
}
})
allowInput = false
if (currentRow.every((tile) => tile.state === LetterState.CORRECT)) {
// yay!
allowInput = false
showMessage(
['Genius', 'Magnificent', 'Impressive', 'Splendid', 'Great', 'Phew'][
currentRowIndex
],
2000
)
setTimeout(() => {
showMessage(
['Genius', 'Magnificent', 'Impressive', 'Splendid', 'Great', 'Phew'][
currentRowIndex
],
2000
)
}, 1600)
} else if (currentRowIndex < board.length - 1) {
// go the next row
currentRowIndex++
setTimeout(() => {
allowInput = true
}, 1600)
} else {
// game over :(
allowInput = false
showMessage(answer.toUpperCase(), -1)
setTimeout(() => {
showMessage(answer.toUpperCase(), -1)
}, 1600)
}
} else {
shake()
@ -176,12 +182,12 @@ function shake() {
tile.state && 'revealed'
]"
>
<div class="front" :style="{ transitionDelay: `${index * 200}ms` }">
<div class="front" :style="{ transitionDelay: `${index * 300}ms` }">
{{ tile.letter }}
</div>
<div
:class="['back', tile.state]"
:style="{ transitionDelay: `${index * 200}ms` }"
:style="{ transitionDelay: `${index * 300}ms` }"
>
{{ tile.letter }}
</div>
@ -255,7 +261,7 @@ function shake() {
-webkit-backface-visibility: hidden;
}
.tile .front {
border: 2px solid #ccc;
border: 2px solid #d3d6da;
}
.tile .back {
transform: rotateX(180deg);

View File

@ -72,6 +72,7 @@ button {
align-items: center;
text-transform: uppercase;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0.3);
transition: all .2s 1.5s;
}
button:last-of-type {
margin: 0;