我正在尝试使用jsPsych为实验添加固定十字架。我对js很新。
这就是我所拥有的:
var test_stimuli = [
{
image: "img/blau_links.png",
data: { correct_response: 37 }
},
{
image: "img/blau_rechts.png",
data: { correct_response: 37 }
},
{
image: "img/gruen_links.png",
data: { correct_response: 39 }
},
{
image: "img/gruen_rechts.png",
data: { correct_response: 39 }
}
];
var all_tests = jsPsych.randomization.repeat(test_stimuli, 50, true);
var post_test_gap = function() {
return Math.floor( Math.random() * 1500 ) + 750;
}
var test_block = {
type: "single-stim",
stimuli: all_tests.image,
choices: [37, 39],
data: all_tests.data,
timing_response: 1500,
timing_post_test: post_test_gap
};
var fixation_trial = {
type: 'single-stim',
stimuli: ['<p style='text-align:center'>+</p>'],
is_html: true,
timing_response: 500,
timing_post_trial: 0,
choices: 'none'
}
var experiment = [];
experiment.push(instructions_block);
experiment.push(trial_block);
experiment.push(posttrial_block);
experiment.push(fixation_trial);
experiment.push(test_block);
experiment.push(debrief_block);
/* start the experiment */
jsPsych.init({experiment_structure: experiment,
on_finish: function() {
jsPsych.data.displayData();
}
我现在想要的是在每次试用试验版之前添加一个固定十字。在当前形式中,它仅在所有刺激之后显示一次。任何帮助表示赞赏。
答案 0 :(得分:0)
这是一个使用jsPsych-6.0.5和“ html-keyboard-response”插件(而不是“ single-stim”)编码的有效固定块:
var fixation = {
type: 'html-keyboard-response',
stimulus: '<div style="font-size:60px">+</div>',
choices: jsPsych.NO_KEYS,
trial_duration: 800 // in ms
};
此固定块可以通过推送功能包含在您的时间轴中:
experiment.push(fixation);