Reconstruction plugin - starting_value parameter not working #722
-
Hi there, I have a problem with getting an image rotation to be at the correct starting value. No matter what value I set the starting value the code runs the same. Currently the paddle image used will only rotate counter clockwise as opposed to both directions. See code below. Cheers. var timeline = [];
function generateRotationStyle (rotation) {
return "transform: rotate(" + rotation + "deg);"
}
var stim_function = function(param) {
console.log(param)
var rotation = 0 + param * 360;
var style = generateRotationStyle(rotation)
var html =
'<br><br><br><br><br><br><br><br><br><img src="White_48px.png" width="150" height="16" opacity="0.5" style="' +
style +
'"></div></div><br><br><br><br><p>Press H to rotate line clockwise. Press G to rotate anticlockwise.</p>' +
"<p>When when you have matched rotation, click Continue.</p>";
return html;
};
timeline.push({
type: 'fullscreen',
fullscreen_mode: true
});
var instructions = {
type: "html-keyboard-response",
stimulus: "<br><br><p>In this experiment, an image like this one will appear in the center " +
"of the screen.</p> <img src='img/stimuli/gabor-gaussian-10.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png'></img><p>The image will remian" +
" on screen for a short length of time. Immediately after a paddle will appear.</p>" +
"<p>Your task is to orientate the paddle to match the orientation of the lines.</p>" +
"<p>Press any key to begin.</p>"
};
timeline.push(instructions);
/* practice trial */
var test_stimuli = [
{ stimulus: "img/stimuli/gabor-gaussian-10.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"},
{ stimulus: "img/stimuli/gabor-gaussian-20.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"},
{ stimulus: "img/stimuli/gabor-gaussian-30.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"},
{ stimulus: "img/stimuli/gabor-gaussian-40.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"},
{ stimulus: "img/stimuli/gabor-gaussian-50.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"},
{ stimulus: "img/stimuli/gabor-gaussian-60.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"},
{ stimulus: "img/stimuli/gabor-gaussian-70.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"},
{ stimulus: "img/stimuli/gabor-gaussian-80.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"},
{ stimulus: "img/stimuli/gabor-gaussian-90.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"},
{ stimulus: "img/stimuli/gabor-gaussian-100.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"},
{ stimulus: "img/stimuli/gabor-gaussian-110.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"},
{ stimulus: "img/stimuli/gabor-gaussian-120.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"},
{ stimulus: "img/stimuli/gabor-gaussian-130.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"},
{ stimulus: "img/stimuli/gabor-gaussian-140.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"},
{ stimulus: "img/stimuli/gabor-gaussian-150.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"},
{ stimulus: "img/stimuli/gabor-gaussian-160.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"},
{ stimulus: "img/stimuli/gabor-gaussian-170.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"},
{ stimulus: "img/stimuli/gabor-gaussian-180.00-96-30.00-0.03-0.00-128-128-128-160-160-160-96-96-96.png"}
];
var mask = {
type: 'image-keyboard-response',
stimulus: "img/mask_patch1.png",
choices: jsPsych.NO_KEYS,
trial_duration: 1000,
maintain_aspect_ration: true,
stimulus_height: 150
}
var fixation = {
type: 'html-keyboard-response',
stimulus: '<div style="font-size:60px;">+</div>',
choices: jsPsych.NO_KEYS,
trial_duration: 1000,
}
var test = {
type: "image-keyboard-response",
stimulus: jsPsych.timelineVariable('stimulus'),
choices: jsPsych.NO_KEYS,
trial_duration: 500,
maintain_aspect_ration: true,
stimulus_height: 150
}
var capture = {
type: "reconstruction",
stim_function: stim_function,
starting_value: 40,
step_size: 0.025
}
var test_procedure = {
timeline: [fixation, test, mask, capture],
timeline_variables: test_stimuli,
randomize_order: true,
repetitions: 5
}
timeline.push(test_procedure);
/*create test screen
var test = {
type: "reconstruction",
stim_function: stim_function,
starting_value: 45,
step_size: 0.025
}; */
//start experiment
jsPsych.init({
timeline: timeline,
on_finish: function() {
jsPsych.data.displayData();
}
}); |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
From the documentation:
Set the starting value to between that range, and multiple it by a number inside your stim function to get the values you desire. |
Beta Was this translation helpful? Give feedback.
-
Fixed. Cheers. |
Beta Was this translation helpful? Give feedback.
From the documentation:
Set the starting value to between that range, and multiple it by a number inside your stim function to get the values you desire.