Add mobile vibration when card shakes
This commit is contained in:
parent
8efe87fadf
commit
ea39f02459
10
app.js
10
app.js
@ -533,6 +533,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
function triggerShake(card) {
|
||||
triggerShake(card);
|
||||
if (navigator.vibrate) navigator.vibrate([90, 40, 90]);
|
||||
}
|
||||
|
||||
function openStats() {
|
||||
game.active = false;
|
||||
clearInterval(dementor.interval);
|
||||
@ -865,10 +870,7 @@
|
||||
// guard in case question changed
|
||||
const currentId = `${Math.min(game.currentFact.n1, game.currentFact.n2)}x${Math.max(game.currentFact.n1, game.currentFact.n2)}`;
|
||||
if (currentId !== factId) return;
|
||||
if (card) {
|
||||
card.classList.add('apply-shake');
|
||||
setTimeout(() => card.classList.remove('apply-shake'), 500);
|
||||
}
|
||||
triggerShake(card);
|
||||
feedback.style.color = '#ffb0b0';
|
||||
feedback.innerText = `Answer is ${game.currentFact.ans}.${penalty ? ` (-${penalty} XP)` : ''} Press CAST to continue.`;
|
||||
addToTroubleList(game.currentFact.n1, game.currentFact.n2);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user