|
|
|
@ -1523,6 +1523,32 @@ function switchSide(){ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function warmup(){ |
|
|
|
|
var startWarmup |
|
|
|
|
var textExample = "iterative explorations" // hard to text in desktop browser as AFrame has its own shortcuts, e.g f for fullscreen |
|
|
|
|
var jxrExample = "jxr qs a-sphere sa color blue" |
|
|
|
|
var jxrJavascriptExample = "addNewNote( Math.random() + ' is a random number.' )" |
|
|
|
|
// the virtual keyboard doesn't currently have symbols and some of them have a different meaning, e.g < or > |
|
|
|
|
setFeedbackHUD( "starting the game in 1s, end with DONE" ) |
|
|
|
|
setHUD("") |
|
|
|
|
setTimeout( _ => { |
|
|
|
|
setFeedbackHUD( textExample ) |
|
|
|
|
startWarmup = Date.now() |
|
|
|
|
}, 1000) |
|
|
|
|
var checkingWarmupContent = setInterval( _ => { |
|
|
|
|
warmupCheckTime = Date.now() |
|
|
|
|
currentTextHUD = document.querySelector("#typinghud").getAttribute("value") |
|
|
|
|
var trimmed = currentTextHUD.slice(0,-4) |
|
|
|
|
var elapsedTime = warmupCheckTime-startWarmup |
|
|
|
|
if ( currentTextHUD.slice(-4) == "DONE" || elapsedTime > 100000 ){ |
|
|
|
|
console.log ( trimmed, textExample, trimmed == textExample, elapsedTime ) |
|
|
|
|
if ( trimmed == textExample) setFeedbackHUD( "You win in "+elapsedTime/1000+"s. Start again and do better." ) |
|
|
|
|
if ( trimmed != textExample) setFeedbackHUD( "You lose, different text:"+trimmed ) |
|
|
|
|
if ( elapsedTime > 10000 ) setFeedbackHUD( "Too slow") |
|
|
|
|
clearInterval( checkingWarmupContent ) |
|
|
|
|
} |
|
|
|
|
}, 100) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// could change model opacity based on hand position, fading out when within a (very small here) safe space |
|
|
|
|
</script> |
|
|
|
|