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

View File

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