mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-12 08:38:11 +00:00
commit
38bfc5ba49
16
README.md
16
README.md
@ -6,7 +6,7 @@ jsPsych is a JavaScript library for creating behavioral experiments that run in
|
||||
Code Demos
|
||||
----------
|
||||
|
||||
Demo 1 with the instructions plugin:
|
||||
[Demo 1](https://github.com/jspsych/jsPsych/tree/master/examples/demos/demo_1.html) with the instructions plugin:
|
||||
<div display="flex">
|
||||
<img src="https://user-images.githubusercontent.com/14092539/28126774-801ea42e-66f8-11e7-9b6a-c8bad0026bec.gif" align="right" width=50% />
|
||||
|
||||
@ -62,7 +62,7 @@ Demo 1 with the instructions plugin:
|
||||
</div>
|
||||
|
||||
|
||||
Demo 2 with the image-keyboard-response plugin:
|
||||
[Demo 2](https://github.com/jspsych/jsPsych/tree/master/examples/demos/demo_2.html) with the image-keyboard-response plugin:
|
||||
<div display="flex">
|
||||
<img src="https://user-images.githubusercontent.com/14092539/28125911-0504cca2-66f6-11e7-8f5b-c9686f63aaa8.gif" align="right" width=50% />
|
||||
|
||||
@ -116,7 +116,7 @@ Demo 2 with the image-keyboard-response plugin:
|
||||
</div>
|
||||
|
||||
|
||||
And for a slightly longer experiment example, demo 3 with the html-keyboard-response plugin. Also shows data after experiment ends:
|
||||
And for a slightly longer experiment example, [demo 3](https://github.com/jspsych/jsPsych/tree/master/examples/demos/demo_3.html) with the html-keyboard-response plugin. Also shows data after experiment ends:
|
||||
<div display="flex">
|
||||
<img src="https://user-images.githubusercontent.com/14092539/28126802-97b50d08-66f8-11e7-9a45-46561ab51a5f.gif" align="right" width=50% />
|
||||
|
||||
@ -149,10 +149,12 @@ var debrief = {
|
||||
.filter({stim_type: 'congruent'}).select('rt').mean());
|
||||
var incongruent_rt = Math.round(jsPsych.data.get()
|
||||
.filter({stim_type: 'incongruent'}).select('rt').mean());
|
||||
return "<p>Your average response time for congruent trials"+
|
||||
"was <strong>"+congruent_rt+"ms</strong>.</p>"+
|
||||
"<p>Your average response time for incongruent trials was"+
|
||||
"<strong>"incongruent_rt + "ms</strong>.</p>";
|
||||
return "<p style='font-size:25px'>Your average response"+
|
||||
"time for congruent trials was <strong>"+congruent_rt+
|
||||
"ms</strong>.</p>"+
|
||||
"<p style='font-size:25px'>Your average response time for"+
|
||||
"incongruent trials was <strong>"incongruent_rt +
|
||||
"ms</strong>.</p>";
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -17,21 +17,21 @@
|
||||
type: "image-keyboard-response",
|
||||
stimulus: 'img/happy_face_1.jpg',
|
||||
choices: [89, 78],
|
||||
prompt: '<p class="center-content">Is this face happy? Y or N.</p>'
|
||||
prompt: '<p>Is this face happy? Y or N.</p>'
|
||||
}
|
||||
|
||||
var trial_2 = {
|
||||
type: 'image-keyboard-response',
|
||||
stimulus: 'img/sad_face_2.jpg',
|
||||
choices: [89, 78], // Y or N
|
||||
prompt: '<p class="center-content">Is this face happy? Y or N.</p>'
|
||||
prompt: '<p>Is this face happy? Y or N.</p>'
|
||||
}
|
||||
|
||||
var trial_3 = {
|
||||
type: 'image-keyboard-response',
|
||||
stimulus: 'img/happy_face_2.jpg',
|
||||
choices: [89, 78], // Y or N
|
||||
prompt: '<p class="center-content">Is this face happy? Y or N.</p>',
|
||||
prompt: '<p>Is this face happy? Y or N.</p>',
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,13 +50,13 @@ jsPsych.plugins["audio-button-response"] = (function() {
|
||||
description: ''
|
||||
},
|
||||
margin_vertical: {
|
||||
type: jsPsych.parameterType.STRING,
|
||||
type: jsPsych.plugins.parameterType.STRING,
|
||||
default: '0px',
|
||||
no_function: false,
|
||||
description: ''
|
||||
},
|
||||
margin_horizontal: {
|
||||
type: jsPsych.parameterType.STRING,
|
||||
type: jsPsych.plugins.parameterType.STRING,
|
||||
default: '8px',
|
||||
no_function: false,
|
||||
description: ''
|
||||
@ -79,13 +79,13 @@ jsPsych.plugins["audio-button-response"] = (function() {
|
||||
plugin.trial = function(display_element, trial) {
|
||||
|
||||
// default trial parameters
|
||||
trial.button_html = trial.button_html || '<button class="jspsych-btn">%choice%</button>';
|
||||
trial.response_ends_trial = (typeof trial.response_ends_trial === 'undefined') ? true : trial.response_ends_trial;
|
||||
trial.trial_ends_after_audio = (typeof trial.trial_ends_after_audio === 'undefined') ? false : trial.trial_ends_after_audio;
|
||||
trial.trial_duration = trial.trial_duration || -1; // if -1, then wait for response forever
|
||||
trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt;
|
||||
trial.margin_vertical = trial.margin_vertical || "0px";
|
||||
trial.margin_horizontal = trial.margin_horizontal || "8px";
|
||||
// trial.button_html = trial.button_html || '<button class="jspsych-btn">%choice%</button>';
|
||||
// trial.response_ends_trial = (typeof trial.response_ends_trial === 'undefined') ? true : trial.response_ends_trial;
|
||||
// trial.trial_ends_after_audio = (typeof trial.trial_ends_after_audio === 'undefined') ? false : trial.trial_ends_after_audio;
|
||||
// trial.trial_duration = trial.trial_duration || -1; // if -1, then wait for response forever
|
||||
// trial.prompt = (typeof trial.prompt === 'undefined') ? "" : trial.prompt;
|
||||
// trial.margin_vertical = trial.margin_vertical || "0px";
|
||||
// trial.margin_horizontal = trial.margin_horizontal || "8px";
|
||||
|
||||
// setup stimulus
|
||||
var context = jsPsych.pluginAPI.audioContext();
|
||||
|
Loading…
Reference in New Issue
Block a user