update readme

This commit is contained in:
Josh de Leeuw 2017-07-12 23:02:44 -04:00
parent dd46c7e017
commit 5551a996b0

View File

@ -7,9 +7,8 @@ Examples
These examples are intended to illustrate what jsPsych code and experiments look like. There is a larger set of example code in the [examples folder](/examples). These examples are intended to illustrate what jsPsych code and experiments look like. There is a larger set of example code in the [examples folder](/examples).
#### #1: Displaying instructions [(code)](https://github.com/jspsych/jsPsych/tree/master/examples/demos/demo_1.html) #### #1: [Displaying instructions](https://github.com/jspsych/jsPsych/tree/master/examples/demos/demo_1.html)
<div display="flex">
<div>
<img src="https://user-images.githubusercontent.com/14092539/28126774-801ea42e-66f8-11e7-9b6a-c8bad0026bec.gif" align="right" width=50% /> <img src="https://user-images.githubusercontent.com/14092539/28126774-801ea42e-66f8-11e7-9b6a-c8bad0026bec.gif" align="right" width=50% />
<div markdown="1" style="width: 50%;"> <div markdown="1" style="width: 50%;">
<sub> <sub>
@ -32,11 +31,9 @@ var trial = {
type: 'instructions', type: 'instructions',
pages: [ pages: [
'Welcome to the experiment. Click next to begin.', 'Welcome to the experiment. Click next to begin.',
'<div>In this experiment, you will view a ' + '<div>In this experiment, you will view a ' +
'series of images and answer questions.<br>' + 'series of images and answer questions.<br>' +
'Answer with the keys "y" or "n".', 'Answer with the keys "y" or "n".',
'Here is an example:<br><br> ' + 'Here is an example:<br><br> ' +
'<img src="img/age/of2.jpg"></img><br><br>' + '<img src="img/age/of2.jpg"></img><br><br>' +
'Is this person OLD or YOUNG?' 'Is this person OLD or YOUNG?'
@ -64,7 +61,7 @@ jsPsych.init({
</div> </div>
#### #2: Displaying images and recording a response [(code)](https://github.com/jspsych/jsPsych/tree/master/examples/demos/demo_2.html) #### #2: [Displaying images and recording a response](https://github.com/jspsych/jsPsych/tree/master/examples/demos/demo_2.html)
<div display="flex"> <div display="flex">
<img src="https://user-images.githubusercontent.com/14092539/28125911-0504cca2-66f6-11e7-8f5b-c9686f63aaa8.gif" align="right" width=50% /> <img src="https://user-images.githubusercontent.com/14092539/28125911-0504cca2-66f6-11e7-8f5b-c9686f63aaa8.gif" align="right" width=50% />
@ -117,8 +114,7 @@ jsPsych.init({
</div> </div>
</div> </div>
#### #3: [A flanker task](https://github.com/jspsych/jsPsych/tree/master/examples/demos/demo_3.html) showing a few advanced features of the library
#### #3: A flanker task showing a few advanced features of the library [(code)](https://github.com/jspsych/jsPsych/tree/master/examples/demos/demo_3.html)
<div display="flex"> <div display="flex">
<img src="https://user-images.githubusercontent.com/14092539/28126802-97b50d08-66f8-11e7-9a45-46561ab51a5f.gif" align="right" width=50% /> <img src="https://user-images.githubusercontent.com/14092539/28126802-97b50d08-66f8-11e7-9a45-46561ab51a5f.gif" align="right" width=50% />
@ -130,7 +126,8 @@ var test_stimuli = [
{ stimulus: "<<<<<", data: {stim_type: 'congruent'} }, { stimulus: "<<<<<", data: {stim_type: 'congruent'} },
{ stimulus: ">>>>>", data: {stim_type: 'congruent'} }, { stimulus: ">>>>>", data: {stim_type: 'congruent'} },
{ stimulus: "<<><<", data: {stim_type: 'incongruent'} }, { stimulus: "<<><<", data: {stim_type: 'incongruent'} },
{ stimulus: ">><>>", data: { stim_type: 'incongruent'} } ]; { stimulus: ">><>>", data: {stim_type: 'incongruent'} }
];
var test = { var test = {
timeline: [{ timeline: [{
@ -139,7 +136,8 @@ var test = {
stimulus: jsPsych.timelineVariable('stimulus'), stimulus: jsPsych.timelineVariable('stimulus'),
data: jsPsych.timelineVariable('data'), data: jsPsych.timelineVariable('data'),
post_trial_gap: 1500, post_trial_gap: 1500,
response_ends_trial: true }], response_ends_trial: true
}],
timeline_variables: test_stimuli, timeline_variables: test_stimuli,
sample: {type: 'fixed-repetitions', size: 2} sample: {type: 'fixed-repetitions', size: 2}
}; };
@ -160,11 +158,8 @@ var debrief = {
} }
}; };
var timeline = [];
timeline.push(test);
timeline.push(debrief);
jsPsych.init({ jsPsych.init({
timeline: timeline, timeline: [test, debrief],
}); });
``` ```
</sub> </sub>