mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
tweak example code indentation
This commit is contained in:
parent
14bcb4d621
commit
2c6307efce
@ -46,7 +46,7 @@ Note: the canvas stimulus is *not* included in the trial data because it is a fu
|
|||||||
var circle_1 = {
|
var circle_1 = {
|
||||||
type: 'canvas-button-response',
|
type: 'canvas-button-response',
|
||||||
stimulus: function(c) {
|
stimulus: function(c) {
|
||||||
filledCirc(c, 100, 'blue');
|
filledCirc(c, 100, 'blue');
|
||||||
},
|
},
|
||||||
canvas_size: [300, 300],
|
canvas_size: [300, 300],
|
||||||
choices: ['Red', 'Green', 'Blue'],
|
choices: ['Red', 'Green', 'Blue'],
|
||||||
@ -57,13 +57,13 @@ Note: the canvas stimulus is *not* included in the trial data because it is a fu
|
|||||||
var circle_2 = {
|
var circle_2 = {
|
||||||
type: 'canvas-button-response',
|
type: 'canvas-button-response',
|
||||||
stimulus: function(c) {
|
stimulus: function(c) {
|
||||||
filledCirc(c, 150, 'green');
|
filledCirc(c, 150, 'green');
|
||||||
},
|
},
|
||||||
canvas_size: [300, 300],
|
canvas_size: [300, 300],
|
||||||
choices: ['Larger', 'Smaller'],
|
choices: ['Larger', 'Smaller'],
|
||||||
stimulus_duration: 1000,
|
stimulus_duration: 1000,
|
||||||
prompt: '<p>Is this circle larger or smaller than the last one?</p>'+
|
prompt: '<p>Is this circle larger or smaller than the last one?</p>'+
|
||||||
'<p>Stimulus will be hidden after 1 second.</p>',
|
'<p>Stimulus will be hidden after 1 second.</p>',
|
||||||
data: {color: 'green', radius: 150}
|
data: {color: 'green', radius: 150}
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
@ -81,21 +81,21 @@ Note: the canvas stimulus is *not* included in the trial data because it is a fu
|
|||||||
var lines = {
|
var lines = {
|
||||||
type: 'canvas-button-response',
|
type: 'canvas-button-response',
|
||||||
stimulus: function(c) {
|
stimulus: function(c) {
|
||||||
var ctx = c.getContext("2d");
|
var ctx = c.getContext("2d");
|
||||||
// first line
|
// first line
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(200, 10);
|
ctx.moveTo(200, 10);
|
||||||
ctx.lineTo(200, 250);
|
ctx.lineTo(200, 250);
|
||||||
ctx.lineWidth = 10;
|
ctx.lineWidth = 10;
|
||||||
ctx.strokeStyle = 'MediumBlue';
|
ctx.strokeStyle = 'MediumBlue';
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
// second line
|
// second line
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(20, 100);
|
ctx.moveTo(20, 100);
|
||||||
ctx.lineTo(100, 250);
|
ctx.lineTo(100, 250);
|
||||||
ctx.lineWidth = 10;
|
ctx.lineWidth = 10;
|
||||||
ctx.strokeStyle = 'MediumPurple';
|
ctx.strokeStyle = 'MediumPurple';
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
},
|
},
|
||||||
canvas_size: [300, 300],
|
canvas_size: [300, 300],
|
||||||
choices: ['Blue line', 'Purple line'],
|
choices: ['Blue line', 'Purple line'],
|
||||||
@ -124,26 +124,29 @@ Note: the canvas stimulus is *not* included in the trial data because it is a fu
|
|||||||
}
|
}
|
||||||
|
|
||||||
var circle_procedure = {
|
var circle_procedure = {
|
||||||
timeline: [{
|
timeline: [
|
||||||
type: 'canvas-button-response',
|
{
|
||||||
stimulus: function(c) {
|
type: 'canvas-button-response',
|
||||||
filledCirc(c, jsPsych.timelineVariable('radius'), jsPsych.timelineVariable('color'));
|
stimulus: function(c) {
|
||||||
},
|
filledCirc(c, jsPsych.timelineVariable('radius'), jsPsych.timelineVariable('color'));
|
||||||
canvas_size: [300, 300],
|
},
|
||||||
choices: ['Red', 'Green', 'Blue'],
|
canvas_size: [300, 300],
|
||||||
prompt: '<p>What color is the circle?</p>',
|
choices: ['Red', 'Green', 'Blue'],
|
||||||
data: {
|
prompt: '<p>What color is the circle?</p>',
|
||||||
radius: jsPsych.timelineVariable('radius'),
|
data: {
|
||||||
color: jsPsych.timelineVariable('color'),
|
radius: jsPsych.timelineVariable('radius'),
|
||||||
correct_response: jsPsych.timelineVariable('correct_response')},
|
color: jsPsych.timelineVariable('color'),
|
||||||
on_finish: function(data){
|
correct_response: jsPsych.timelineVariable('correct_response')
|
||||||
data.correct = jsPsych.pluginAPI.compareKeys(data.response, data.correct_response);
|
},
|
||||||
}
|
on_finish: function(data){
|
||||||
}],
|
data.correct = jsPsych.pluginAPI.compareKeys(data.response, data.correct_response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
timeline_variables: [
|
timeline_variables: [
|
||||||
{radius: 80, color: 'red', correct_response: 0},
|
{radius: 80, color: 'red', correct_response: 0},
|
||||||
{radius: 100, color: 'green', correct_response: 1},
|
{radius: 100, color: 'green', correct_response: 1},
|
||||||
{radius: 50, color: 'blue', correct_response: 2}
|
{radius: 50, color: 'blue', correct_response: 2}
|
||||||
],
|
],
|
||||||
randomize_order: true
|
randomize_order: true
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user