Last active
May 11, 2017 19:15
-
-
Save dgbrokaw/93445a7e3436c4a4815cf224c74c8de9 to your computer and use it in GitHub Desktop.
jsPsych rAF rt demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Timeline Demo</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script> | |
<script src="jsPsych/jspsych.js"></script> | |
<script src="jsPsych/plugins/jspsych-text.js"></script> | |
<link href="jsPsych/css/jspsych.css" rel="stylesheet" type="text/css"></link> | |
<link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/black-tie/jquery-ui.min.css" rel="stylesheet" type="text/css"></link> | |
</head> | |
<body> | |
<div id="jspsych-target"></div> | |
</body> | |
<script> | |
var text_t1 = { | |
type: "text" | |
, text: "<p style='font-size:96px'>1</p><p>Press enter to see 2.</p>" | |
} | |
var text_t2 = { | |
type: "text" | |
, text: "<p style='font-size:96px'>2</p><p>Press enter to see 1. Press 0 (zero) to stop.</p>" | |
} | |
var text_trials = [text_t1, text_t2]; | |
var text_block = { | |
timeline: text_trials | |
, choices: [13, 48] | |
, loop_function: function() { | |
return jsPsych.data.getLastTrialData().values()[0].key_press !== 48; | |
} | |
} | |
jsPsych.init({ | |
timeline: [text_block] | |
, on_finish: function() { | |
jsPsych.data.displayData(); | |
} | |
}); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the text plugin, the difference between the performance time at the start of the animation callback and the performance time at the start of the keyboard listener initialization is ~0.3ms. This could be larger if a plugin requires more changes to the DOM.