I hope this is not due to my low developer skills!
If I try to give a value to a parameter of an object of jspsych-psychophysics using a function it doesn't work.
height: function() {return 1000;},
Instead this works with the object of "basic" jspsych
post_trial_gap: function(){return 1000;},
Here the example (remember to add the plugin for html-keyboard-response)
Thx!
var rect_object = {
obj_type: 'rect', // means a rectangle
startX: 200, // location in the canvas
startY: 150,
width: 300, // of the rectangle
height: function() {return 1000;},
line_color: '#ffffff',
fill_color: '#ffffff',
show_start_time: 0 // from the trial start (ms)
}
var circle_object = {
obj_type: 'circle',
startX: 500, // location in the canvas
startY: 300,
radius: 100,
line_color: 'red', // You can use the HTML color name instead of the HEX color.
fill_color: 'red',
show_start_time: 1000 // from the trial start (ms)
}
var first = {
obj_type: 'instruction',
type: 'html-keyboard-response',
stimulus: '<p>Welcome to exp1_visivo</p>',
post_trial_gap: function(){return 1000;},
};
var trial = {
type: 'psychophysics',
stimuli: [rect_object, circle_object],
choices: ['y', 'n'], // The participant can respond to the stimuli using the 'y' or 'n' key.
canvas_width: 1000,
canvas_height: 800,
background_color: '#008000', // The HEX color means green.
}
jsPsych.init({
timeline: [first,trial],
on_finish: function(){jsPsych.data.displayData();}
});
I hope this is not due to my low developer skills! If I try to give a value to a parameter of an object of jspsych-psychophysics using a function it doesn't work.
height: function() {return 1000;},
Instead this works with the object of "basic" jspsych
post_trial_gap: function(){return 1000;},
Here the example (remember to add the plugin for html-keyboard-response)
Thx!