From 865bbee8e39acee57893e5c4000ce7c16c92f9a4 Mon Sep 17 00:00:00 2001 From: Florrie Date: Thu, 17 Jan 2019 12:19:45 -0400 Subject: Do things really quickly in time trial mode --- main.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/main.js b/main.js index 62eb5b0..97fc007 100644 --- a/main.js +++ b/main.js @@ -198,7 +198,7 @@ requestAnimationFrame(sampleAudioStream); // display choices ---------------------------------------------------------www -function displayChoices(characters, confirmCharacterCb) { +function displayChoices(characters, instant = false) { return new Promise(async resolve => { const container = document.getElementById('choice-container'); while (container.firstChild) { @@ -228,7 +228,9 @@ function displayChoices(characters, confirmCharacterCb) { container.children[0].focus(); for (const el of container.children) { el.classList.add('visible'); - await delay(800 / container.children.length); + if (!instant) { + await delay(800 / container.children.length); + } } }); } @@ -394,10 +396,15 @@ async function mainLol() { msg = pickRandom(correctCharacter.messages); } - await doSpeech(correctCharacter, msg); - await delay(500); + if (mode === 'time-trial') { + doSpeech(correctCharacter, msg); + await delay(100); + } else { + await doSpeech(correctCharacter, msg); + await delay(500); + } - const choice = await displayChoices(allCharacters); + const choice = await displayChoices(allCharacters, mode === 'time-trial'); const container = document.getElementById('choice-container'); for (let i = 0; i < allCharacters.length; i++) { -- cgit 1.3.0-6-gf8a5