diff options
author | Florrie <towerofnix@gmail.com> | 2019-01-17 12:19:45 -0400 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2019-01-17 12:19:45 -0400 |
commit | 865bbee8e39acee57893e5c4000ce7c16c92f9a4 (patch) | |
tree | 0f5a465bdd4bbcc68269b3d0055566468b4ee71a | |
parent | 39bb19de91169cc22a3ce9c4f273e614e9c601f6 (diff) |
Do things really quickly in time trial mode
-rw-r--r-- | main.js | 17 |
1 files 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++) { |